diff --git a/app/SysTray-X/preferences.cpp b/app/SysTray-X/preferences.cpp
index a13d2a6..4db821c 100644
--- a/app/SysTray-X/preferences.cpp
+++ b/app/SysTray-X/preferences.cpp
@@ -34,6 +34,10 @@ Preferences::Preferences( QObject *parent ) : QObject( parent )
*/
m_app_pref_changed = false;
+ m_default_icon_type = PREF_DEFAULT_ICON_DEFAULT;
+ m_default_icon_mime = "image/png";
+ m_default_icon_data = QByteArray();
+
m_icon_type = PREF_BLANK_ICON;
m_icon_mime = "image/png";
m_icon_data = QByteArray();
@@ -142,6 +146,77 @@ void Preferences::setBrowserBuildID( const QString buildID )
}
+/*
+ * Get the default icon type.
+ */
+Preferences::DefaultIconType Preferences::getDefaultIconType() const
+{
+ return m_default_icon_type;
+}
+
+
+/*
+ * Set the default icon type.
+ */
+void Preferences::setDefaultIconType( DefaultIconType icon_type )
+{
+ if( m_default_icon_type != icon_type)
+ {
+ m_default_icon_type = icon_type;
+
+ /*
+ * Tell the world the new preference
+ */
+ emit signalDefaultIconTypeChange();
+ }
+}
+
+
+/*
+ * Get the default icon mime.
+ */
+const QString& Preferences::getDefaultIconMime() const
+{
+ return m_icon_mime;
+}
+
+
+/*
+ * Set the default icon mime.
+ */
+void Preferences::setDefaultIconMime( const QString& icon_mime )
+{
+ m_default_icon_mime = icon_mime;
+}
+
+
+/*
+ * Get the default icon data.
+ */
+const QByteArray& Preferences::getDefaultIconData() const
+{
+ return m_default_icon_data;
+}
+
+
+/*
+ * Set the icon data.
+ */
+void Preferences::setDefaultIconData( const QByteArray& icon_data )
+{
+
+ if( m_default_icon_data != icon_data )
+ {
+ m_default_icon_data = icon_data;
+
+ /*
+ * Tell the world the new preference
+ */
+ emit signalDefaultIconDataChange();
+ }
+}
+
+
/*
* Get the icon type.
*/
diff --git a/app/SysTray-X/preferences.h b/app/SysTray-X/preferences.h
index b794161..a6d357f 100644
--- a/app/SysTray-X/preferences.h
+++ b/app/SysTray-X/preferences.h
@@ -30,6 +30,12 @@ class Preferences : public QObject
PREF_MINIMIZE_METHOD_2
};
+ enum DefaultIconType {
+ PREF_DEFAULT_ICON_DEFAULT = 0,
+ PREF_DEFAULT_ICON_HIDE,
+ PREF_DEFAULT_ICON_CUSTOM
+ };
+
/*
* Icon types
*/
@@ -135,6 +141,48 @@ class Preferences : public QObject
*/
void setBrowserBuildID( const QString buildID );
+ /**
+ * @brief getDefaultIconType. Get the default icon type.
+ *
+ * @return The icon type.
+ */
+ DefaultIconType getDefaultIconType() const;
+
+ /**
+ * @brief setDefaultIconType. Set the default icon type.
+ *
+ * @param The icon type.
+ */
+ void setDefaultIconType( DefaultIconType icon_type );
+
+ /**
+ * @brief getDefaultIconMime. Get the default icon mime.
+ *
+ * @return The icon mime.
+ */
+ const QString& getDefaultIconMime() const;
+
+ /**
+ * @brief setDefaultIconMime. Set the default icon mime.
+ *
+ * @param The icon mime.
+ */
+ void setDefaultIconMime( const QString& icon_mime );
+
+ /**
+ * @brief getDefaultIconData. Get the default icon data.
+ *
+ * @return The icon data.
+ */
+ const QByteArray& getDefaultIconData() const;
+
+ /**
+ * @brief setDefaultIconData. Set the default icon data.
+ *
+ * @param The icon data.
+ */
+ void setDefaultIconData( const QByteArray& icon_data );
+
/**
* @brief getIconType. Get the icon type.
*
@@ -312,6 +360,16 @@ class Preferences : public QObject
*/
void signalConsole( QString message );
+ /**
+ * @brief signalDefaultIconTypeChange. Signal a default icon type change.
+ */
+ void signalDefaultIconTypeChange();
+
+ /**
+ * @brief signalDefaultIconDataChange. Signal a default icon data change.
+ */
+ void signalDefaultIconDataChange();
+
/**
* @brief signalIconTypeChange. Signal a icon type change.
*/
@@ -379,6 +437,21 @@ class Preferences : public QObject
QString m_browser_version;
QString m_browser_buildID;
+ /**
+ * @brief m_default_icon_type. Selected icon type.
+ */
+ DefaultIconType m_default_icon_type;
+
+ /**
+ * @brief m_default_icon_mime. Selected icon mime.
+ */
+ QString m_default_icon_mime;
+
+ /**
+ * @brief m_default_icon_data. Binary data icon image.
+ */
+ QByteArray m_default_icon_data;
+
/**
* @brief m_icon_type. Selected icon type.
*/
diff --git a/app/SysTray-X/preferences.ui b/app/SysTray-X/preferences.ui
index 5b2905b..3aecfea 100644
--- a/app/SysTray-X/preferences.ui
+++ b/app/SysTray-X/preferences.ui
@@ -6,8 +6,8 @@
0
0
- 484
- 416
+ 495
+ 505
@@ -18,218 +18,74 @@
:/files/icons/SysTray-X.png:/files/icons/SysTray-X.png
- -
-
-
-
-
-
-
-
-
- Mail notification icon
-
-
+
-
+
+
+ Default icon
+
+
+
-
+
+
-
+
+
+ Default Thunderbird
+
+
+ true
+
+
+ defaultIconTypeGroup
+
+
+
+ -
+
+
+ Hide icon
+
+
+ defaultIconTypeGroup
+
+
+
+ -
+
-
-
-
-
-
-
- QLayout::SetFixedSize
-
-
-
-
-
- Blank icon
-
-
- true
-
-
- iconTypeGroup
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- QLayout::SetFixedSize
-
-
-
-
-
- New mail icon
-
-
- iconTypeGroup
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
-
-
- -
-
-
- QLayout::SetMaximumSize
-
-
-
-
-
- Custom icon
-
-
- iconTypeGroup
-
-
-
- -
-
-
-
-
-
-
- -
-
-
- Choose
-
-
- false
-
-
-
-
-
-
+
+
+ Custom icon
+
+
+ defaultIconTypeGroup
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ Choose
+
+
+ false
+
+
-
-
- -
-
-
- Number properties
-
-
-
-
-
-
-
-
-
- Display unread message count
-
-
- true
-
-
-
- -
-
-
-
-
-
- Text color
-
-
-
- -
-
-
- Qt::NoFocus
-
-
-
-
-
-
-
-
- -
-
-
- Count type
-
-
-
-
-
-
-
-
-
- Unread
-
-
- true
-
-
- countTypeGroup
-
-
-
- -
-
-
- New
-
-
- countTypeGroup
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 0
-
-
-
-
-
+
+
+
+
+
- -
+
-
Windows
@@ -312,7 +168,197 @@
- -
+
-
+
+
+ Mail notification icon
+
+
+
-
+
+
-
+
+
+ QLayout::SetFixedSize
+
+
-
+
+
+ Blank icon
+
+
+ true
+
+
+ iconTypeGroup
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ QLayout::SetFixedSize
+
+
-
+
+
+ New mail icon
+
+
+ iconTypeGroup
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+
+
+ -
+
+
+ QLayout::SetMaximumSize
+
+
-
+
+
+ Custom icon
+
+
+ iconTypeGroup
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ Choose
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+ -
+
+
+ Number properties
+
+
+
-
+
+
-
+
+
+ Display unread message count
+
+
+ true
+
+
+
+ -
+
+
-
+
+
+ Text color
+
+
+
+ -
+
+
+ Qt::NoFocus
+
+
+
+
+
+
+
+
+ -
+
+
+ Count type
+
+
+
-
+
+
-
+
+
+ Unread
+
+
+ true
+
+
+ countTypeGroup
+
+
+
+ -
+
+
+ New
+
+
+ countTypeGroup
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -
Qt::Vertical
@@ -320,12 +366,32 @@
20
- 95
+ 113
- -
+
-
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 6
+
+
+
+
+ -
+
+
+ Display debug window
+
+
+
+ -
Qt::Horizontal
@@ -335,13 +401,6 @@
- -
-
-
- Display debug window
-
-
-
@@ -366,8 +425,9 @@
+
-
+
diff --git a/app/SysTray-X/preferencesdialog.cpp b/app/SysTray-X/preferencesdialog.cpp
index c1eaa57..be78db9 100644
--- a/app/SysTray-X/preferencesdialog.cpp
+++ b/app/SysTray-X/preferencesdialog.cpp
@@ -62,17 +62,31 @@ PreferencesDialog::PreferencesDialog( SysTrayXLink *link, Preferences *pref, QWi
*/
m_ui->countTypeGroupBox->setVisible(false);
// m_ui->unreadRadioButton->setVisible(false);
- // m_ui->newRadioButton->setVisible(false);
+// m_ui->newRadioButton->setVisible(false);
/*
- * Set defaults
+ * Set icon type defaults
*/
m_tmp_icon_data = QByteArray();
m_tmp_icon_mime = QString();
+ /*
+ * Set default icon type button Ids
+ */
+ m_ui->defaultIconTypeGroup->setId( m_ui->defaultIconRadioButton, Preferences::PREF_DEFAULT_ICON_DEFAULT );
+ m_ui->defaultIconTypeGroup->setId( m_ui->hideDefaultIconRadioButton, Preferences::PREF_DEFAULT_ICON_HIDE );
+ m_ui->defaultIconTypeGroup->setId( m_ui->customDefaultIconRadioButton, Preferences::PREF_DEFAULT_ICON_CUSTOM );
+
+ /*
+ * Set icon type defaults
+ */
+ m_tmp_default_icon_data = QByteArray();
+ m_tmp_default_icon_mime = QString();
+
/*
* Signals and slots
*/
+ connect( m_ui->chooseCustomDefaultIconButton, &QPushButton::clicked, this, &PreferencesDialog::slotDefaultFileSelect );
connect( m_ui->chooseCustomButton, &QPushButton::clicked, this, &PreferencesDialog::slotFileSelect );
connect( m_ui->buttonBox, &QDialogButtonBox::accepted, this, &PreferencesDialog::slotAccept );
connect( m_ui->buttonBox, &QDialogButtonBox::rejected, this, &PreferencesDialog::slotReject );
@@ -129,6 +143,16 @@ void PreferencesDialog::setIconType( Preferences::IconType icon_type )
( m_ui->iconTypeGroup->button( icon_type ) )->setChecked( true );
}
+
+/*
+ * Set the default icon type
+ */
+void PreferencesDialog::setDefaultIconType( Preferences::DefaultIconType icon_type )
+{
+ ( m_ui->defaultIconTypeGroup->button( icon_type ) )->setChecked( true );
+}
+
+
/*
* Set the icon
*/
@@ -165,6 +189,41 @@ void PreferencesDialog::setIcon()
}
+/*
+ * Set the default icon
+ */
+void PreferencesDialog::setDefaultIcon( const QString& icon_mime, const QByteArray& icon )
+{
+ /*
+ * Store the new icon
+ */
+ m_tmp_default_icon_mime = icon_mime;
+ m_tmp_default_icon_data = icon;
+
+ /*
+ * Display the new icon
+ */
+ setDefaultIcon();
+}
+
+
+/*
+ * Set the default icon
+ */
+void PreferencesDialog::setDefaultIcon()
+{
+ /*
+ * Convert data to pixmap
+ */
+ QPixmap pixmap;
+ pixmap.loadFromData( m_tmp_default_icon_data );
+
+ /*
+ * Display the icon
+ */
+ m_ui->defaultImageLabel->setPixmap( pixmap.scaledToHeight( m_ui->chooseCustomButton->size().height() ) );
+}
+
/*
* Set the enable number state
*/
@@ -210,6 +269,10 @@ void PreferencesDialog::slotAccept()
/*
* Get all the selected values and store them in the preferences
*/
+ m_pref->setDefaultIconType( static_cast< Preferences::DefaultIconType >( m_ui->defaultIconTypeGroup->checkedId() ) );
+ m_pref->setDefaultIconMime( m_tmp_default_icon_mime );
+ m_pref->setDefaultIconData( m_tmp_default_icon_data );
+
m_pref->setIconType( static_cast< Preferences::IconType >( m_ui->iconTypeGroup->checkedId() ) );
m_pref->setIconMime( m_tmp_icon_mime );
m_pref->setIconData( m_tmp_icon_data );
@@ -274,9 +337,33 @@ void PreferencesDialog::slotFileSelect()
}
}
+/*
+ * Handle the default choose button
+ */
+void PreferencesDialog::slotDefaultFileSelect()
+{
+ QFileDialog file_dialog( this, tr( "Open Image" ), "", tr( "Image Files (*.png *.jpg *.bmp)" ) );
+
+ if( file_dialog.exec() )
+ {
+ QFile file( file_dialog.selectedFiles()[ 0 ] );
+ file.open( QIODevice::ReadOnly );
+ m_tmp_default_icon_data = file.readAll();
+ file.close();
+
+ QMimeType type = QMimeDatabase().mimeTypeForData( m_tmp_default_icon_data );
+ m_tmp_default_icon_mime = type.name();
+
+ /*
+ * Display the default icon
+ */
+ setDefaultIcon();
+ }
+}
+
/*
- * Handle the choose button
+ * Handle the colro select button
*/
void PreferencesDialog::slotColorSelect()
{
@@ -335,6 +422,15 @@ void PreferencesDialog::slotIconTypeChange()
}
+/*
+ * Handle the default icon type change signal
+ */
+void PreferencesDialog::slotDefaultIconTypeChange()
+{
+ setDefaultIconType( m_pref->getDefaultIconType() );
+}
+
+
/*
* Handle the icon data change signal
*/
@@ -350,6 +446,21 @@ void PreferencesDialog::slotIconDataChange()
}
+/*
+ * Handle the default icon data change signal
+ */
+void PreferencesDialog::slotDefaultIconDataChange()
+{
+ m_tmp_default_icon_mime = m_pref->getDefaultIconMime();
+ m_tmp_default_icon_data = m_pref->getDefaultIconData();
+
+ /*
+ * Display the icon
+ */
+ setDefaultIcon();
+}
+
+
/*
* Handle the enable number state change
*/
diff --git a/app/SysTray-X/preferencesdialog.h b/app/SysTray-X/preferencesdialog.h
index 3259dd1..fe7331c 100644
--- a/app/SysTray-X/preferencesdialog.h
+++ b/app/SysTray-X/preferencesdialog.h
@@ -76,6 +76,13 @@ class PreferencesDialog : public QDialog
*/
void setIconType( Preferences::IconType icon_type );
+ /**
+ * @brief setDefaultIconType. Set the default icon type.
+ *
+ * @param icon_type The icon type.
+ */
+ void setDefaultIconType( Preferences::DefaultIconType icon_type );
+
/**
* @brief setIcon. Set the icon.
*
@@ -89,6 +96,19 @@ class PreferencesDialog : public QDialog
*/
void setIcon();
+ /**
+ * @brief setDefaultIcon. Set the default icon.
+ *
+ * @param icon The icon mime.
+ * @param icon The icon data.
+ */
+ void setDefaultIcon( const QString& icon_mime, const QByteArray& icon );
+
+ /**
+ * @brief setDefaultIcon. Set the default icon.
+ */
+ void setDefaultIcon();
+
/**
* @brief setShowNumber. Set the show number state.
*
@@ -151,11 +171,21 @@ class PreferencesDialog : public QDialog
*/
void slotIconTypeChange();
+ /**
+ * @brief slotDefaultIconTypeChange. Slot for handling default icon type change signals.
+ */
+ void slotDefaultIconTypeChange();
+
/**
* @brief slotIconDataChange. Slot for handling icon data change signals.
*/
void slotIconDataChange();
+ /**
+ * @brief slotDefaultIconDataChange. Slot for handling default icon data change signals.
+ */
+ void slotDefaultIconDataChange();
+
/**
* @brief slotShowNumberChange. Slot for handling show number state change.
*/
@@ -188,6 +218,11 @@ class PreferencesDialog : public QDialog
*/
void slotFileSelect();
+ /**
+ * @brief slotDefaultFileSelect. Handle the choose default custom button click.
+ */
+ void slotDefaultFileSelect();
+
/**
* @brief slotColorSelect. Handle the choose color button click.
*/
@@ -220,6 +255,16 @@ class PreferencesDialog : public QDialog
*/
QByteArray m_tmp_icon_data;
+ /**
+ * @brief m_tmp_default_icon_mime. Temporary storage for default icon mime.
+ */
+ QString m_tmp_default_icon_mime;
+
+ /**
+ * @brief m_tmp_default_icon_data. Temporary storage for default icon data.
+ */
+ QByteArray m_tmp_default_icon_data;
+
/**
* @brief m_number_color. Temporary storage for the number color.
*/
diff --git a/app/SysTray-X/systrayx.cpp b/app/SysTray-X/systrayx.cpp
index 60d3464..7f4bc30 100644
--- a/app/SysTray-X/systrayx.cpp
+++ b/app/SysTray-X/systrayx.cpp
@@ -38,6 +38,8 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
*/
m_win_ctrl = new WindowCtrl( m_preferences );
+#ifdef QT_NO_DEBUG
+
if( !m_win_ctrl->thunderbirdStart() )
{
/*
@@ -46,6 +48,8 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
exit(0);
}
+#endif
+
/*
* Setup the link
*/
@@ -88,6 +92,8 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
/*
* Connect preferences signals
*/
+ connect( m_preferences, &Preferences::signalDefaultIconTypeChange, m_tray_icon, &SysTrayXIcon::slotDefaultIconTypeChange );
+ connect( m_preferences, &Preferences::signalDefaultIconDataChange, m_tray_icon, &SysTrayXIcon::slotDefaultIconDataChange );
connect( m_preferences, &Preferences::signalIconTypeChange, m_tray_icon, &SysTrayXIcon::slotIconTypeChange );
connect( m_preferences, &Preferences::signalIconDataChange, m_tray_icon, &SysTrayXIcon::slotIconDataChange );
connect( m_preferences, &Preferences::signalShowNumberChange, m_tray_icon, &SysTrayXIcon::slotShowNumberChange );
@@ -96,6 +102,8 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
connect( m_preferences, &Preferences::signalMinimizeTypeChange, m_win_ctrl, &WindowCtrl::slotMinimizeTypeChange );
connect( m_preferences, &Preferences::signalStartMinimizedChange, m_win_ctrl, &WindowCtrl::slotStartMinimizedChange );
+ connect( m_preferences, &Preferences::signalDefaultIconTypeChange, m_pref_dialog, &PreferencesDialog::slotDefaultIconTypeChange );
+ connect( m_preferences, &Preferences::signalDefaultIconDataChange, m_pref_dialog, &PreferencesDialog::slotDefaultIconDataChange );
connect( m_preferences, &Preferences::signalIconTypeChange, m_pref_dialog, &PreferencesDialog::slotIconTypeChange );
connect( m_preferences, &Preferences::signalIconDataChange, m_pref_dialog, &PreferencesDialog::slotIconDataChange );
connect( m_preferences, &Preferences::signalShowNumberChange, m_pref_dialog, &PreferencesDialog::slotShowNumberChange );
@@ -106,6 +114,8 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
connect( m_preferences, &Preferences::signalMinimizeOnCloseChange, m_pref_dialog, &PreferencesDialog::slotMinimizeOnCloseChange );
connect( m_preferences, &Preferences::signalDebugChange, m_pref_dialog, &PreferencesDialog::slotDebugChange );
+ connect( m_preferences, &Preferences::signalDefaultIconTypeChange, m_link, &SysTrayXLink::slotDefaultIconTypeChange );
+ connect( m_preferences, &Preferences::signalDefaultIconDataChange, m_link, &SysTrayXLink::slotDefaultIconDataChange );
connect( m_preferences, &Preferences::signalIconTypeChange, m_link, &SysTrayXLink::slotIconTypeChange );
connect( m_preferences, &Preferences::signalIconDataChange, m_link, &SysTrayXLink::slotIconDataChange );
connect( m_preferences, &Preferences::signalShowNumberChange, m_link, &SysTrayXLink::slotShowNumberChange );
@@ -208,6 +218,13 @@ void SysTrayX::createTrayIcon()
m_tray_icon = new SysTrayXIcon( m_link, m_preferences );
m_tray_icon->setContextMenu( m_tray_icon_menu );
+ /*
+ * Set default icon
+ */
+ m_tray_icon->setDefaultIconMime( m_preferences->getDefaultIconMime() );
+ m_tray_icon->setDefaultIconData( m_preferences->getDefaultIconData() );
+ m_tray_icon->setDefaultIconType( m_preferences->getDefaultIconType() );
+
/*
* Set icon
*/
diff --git a/app/SysTray-X/systrayxicon.cpp b/app/SysTray-X/systrayxicon.cpp
index 79c7f94..e2748d5 100644
--- a/app/SysTray-X/systrayxicon.cpp
+++ b/app/SysTray-X/systrayxicon.cpp
@@ -37,6 +37,61 @@ SysTrayXIcon::SysTrayXIcon( SysTrayXLink* link, Preferences* pref, QObject* pare
}
+/*
+ * Set the default icon type
+ */
+void SysTrayXIcon::setDefaultIconType( Preferences::DefaultIconType icon_type )
+{
+ if( m_default_icon_type != icon_type )
+ {
+ /*
+ * Store the new value
+ */
+ m_default_icon_type = icon_type;
+
+ /*
+ * Render and set a new icon in the tray
+ */
+ renderIcon();
+ }
+}
+
+
+/*
+ * Set the default icon mime
+ */
+void SysTrayXIcon::setDefaultIconMime( const QString& icon_mime )
+{
+ if( m_default_icon_mime != icon_mime )
+ {
+ /*
+ * Store the new value
+ */
+ m_default_icon_mime = icon_mime;
+ }
+}
+
+
+/*
+ * Set the default icon data
+ */
+void SysTrayXIcon::setDefaultIconData( const QByteArray& icon_data )
+{
+ if( m_default_icon_data != icon_data )
+ {
+ /*
+ * Store the new value
+ */
+ m_default_icon_data = icon_data;
+
+ /*
+ * Render and set a new icon in the tray
+ */
+ renderIcon();
+ }
+}
+
+
/*
* Set the icon type
*/
@@ -73,7 +128,7 @@ void SysTrayXIcon::setIconMime( const QString& icon_mime )
/*
- * Set the icon type
+ * Set the icon data
*/
void SysTrayXIcon::setIconData( const QByteArray& icon_data )
{
@@ -228,6 +283,25 @@ void SysTrayXIcon::slotSetUnreadMail( int unread_mail )
}
+/*
+ * Handle the default icon type change signal
+ */
+void SysTrayXIcon::slotDefaultIconTypeChange()
+{
+ setDefaultIconType( m_pref->getDefaultIconType() );
+}
+
+
+/*
+ * Handle the default icon data change signal
+ */
+void SysTrayXIcon::slotDefaultIconDataChange()
+{
+ setDefaultIconMime( m_pref->getDefaultIconMime() );
+ setDefaultIconData( m_pref->getDefaultIconData() );
+}
+
+
/*
* Handle the icon type change signal
*/
diff --git a/app/SysTray-X/systrayxicon.h b/app/SysTray-X/systrayxicon.h
index 877ef79..e195b94 100644
--- a/app/SysTray-X/systrayxicon.h
+++ b/app/SysTray-X/systrayxicon.h
@@ -33,6 +33,27 @@ class SysTrayXIcon : public QSystemTrayIcon
*/
SysTrayXIcon( SysTrayXLink* link, Preferences* pref, QObject* parent = nullptr );
+ /**
+ * @brief setDefaultIconType. Set the sytem tray default icon type.
+ *
+ * @param icon_type The icon type
+ */
+ void setDefaultIconType( Preferences::DefaultIconType icon_type );
+
+ /**
+ * @brief setDefaultIconMime. Set the sytem tray icon mime.
+ *
+ * @param icon_mime The icon mime
+ */
+ void setDefaultIconMime( const QString& icon_mime );
+
+ /**
+ * @brief setDefaultIconData. Set the custom icon data.
+ *
+ * @param icon_data The icon data.
+ */
+ void setDefaultIconData( const QByteArray& icon_data );
+
/**
* @brief setIconType. Set the sytem tray icon type.
*
@@ -98,6 +119,16 @@ class SysTrayXIcon : public QSystemTrayIcon
*/
void slotSetUnreadMail( int unread_mail );
+ /**
+ * @brief slotDefaultIconTypeChange. Slot for handling default icon type change signals.
+ */
+ void slotDefaultIconTypeChange();
+
+ /**
+ * @brief slotDefaultIconDataChange. Slot for handling default icon data change signals.
+ */
+ void slotDefaultIconDataChange();
+
/**
* @brief slotIconTypeChange. Slot for handling icon type change signals.
*/
@@ -139,6 +170,21 @@ class SysTrayXIcon : public QSystemTrayIcon
*/
Preferences* m_pref;
+ /**
+ * @brief m_default_icon_type. Storage for the default icon type.
+ */
+ Preferences::DefaultIconType m_default_icon_type;
+
+ /**
+ * @brief m_default_icon_mime. Storage for the default icon mime.
+ */
+ QString m_default_icon_mime;
+
+ /**
+ * @brief m_default_icon_data. Storage for the default icon.
+ */
+ QByteArray m_default_icon_data;
+
/**
* @brief m_icon_type. Storage for the icon type.
*/
diff --git a/app/SysTray-X/systrayxlink.cpp b/app/SysTray-X/systrayxlink.cpp
index 6698705..9a268b6 100644
--- a/app/SysTray-X/systrayxlink.cpp
+++ b/app/SysTray-X/systrayxlink.cpp
@@ -447,6 +447,36 @@ void SysTrayXLink::DecodePreferences( const QJsonObject& pref )
/*
* Check the received object
*/
+ if( pref.contains( "defaultIconType" ) && pref[ "defaultIconType" ].isString() )
+ {
+ Preferences::DefaultIconType icon_type = static_cast< Preferences::DefaultIconType >( pref[ "defaultIconType" ].toString().toInt() );
+
+ /*
+ * Store the new default icon type
+ */
+ m_pref->setDefaultIconType( icon_type );
+ }
+
+ if( pref.contains( "defaultIconMime" ) && pref[ "defaultIconMime" ].isString() )
+ {
+ QString icon_mime = pref[ "defaultIconMime" ].toString();
+
+ /*
+ * Store the new icon mime
+ */
+ m_pref->setDefaultIconMime( icon_mime );
+ }
+
+ if( pref.contains( "defaultIcon" ) && pref[ "defaultIcon" ].isString() )
+ {
+ QString icon_base64 = pref[ "defaultIcon" ].toString();
+
+ /*
+ * Store the new default icon data
+ */
+ m_pref->setDefaultIconData( QByteArray::fromBase64( icon_base64.toUtf8() ) );
+ }
+
if( pref.contains( "iconType" ) && pref[ "iconType" ].isString() )
{
Preferences::IconType icon_type = static_cast< Preferences::IconType >( pref[ "iconType" ].toString().toInt() );
@@ -476,7 +506,6 @@ void SysTrayXLink::DecodePreferences( const QJsonObject& pref )
*/
m_pref->setIconData( QByteArray::fromBase64( icon_base64.toUtf8() ) );
}
-
if( pref.contains( "showNumber" ) && pref[ "showNumber" ].isString() )
{
bool show_number = pref[ "showNumber" ].toString() == "true";
@@ -502,7 +531,7 @@ void SysTrayXLink::DecodePreferences( const QJsonObject& pref )
Preferences::CountType count_type = static_cast< Preferences::CountType >( pref[ "countType" ].toString().toInt() );
/*
- * Store the new icon type
+ * Store the new count type
*/
m_pref->setCountType( count_type );
}
@@ -512,7 +541,7 @@ void SysTrayXLink::DecodePreferences( const QJsonObject& pref )
Preferences::MinimizeType minimize_type = static_cast< Preferences::MinimizeType >( pref[ "minimizeType" ].toString().toInt() );
/*
- * Store the new icon type
+ * Store the new minimize type
*/
m_pref->setMinimizeType( minimize_type );
}
@@ -562,6 +591,9 @@ void SysTrayXLink::EncodePreferences( const Preferences& pref )
prefObject.insert("minimizeType", QJsonValue::fromVariant( QString::number( pref.getMinimizeType() ) ) );
prefObject.insert("startMinimized", QJsonValue::fromVariant( QString( pref.getStartMinimized() ? "true" : "false" ) ) );
prefObject.insert("minimizeOnClose", QJsonValue::fromVariant( QString( pref.getMinimizeOnClose() ? "true" : "false" ) ) );
+ prefObject.insert("defaultIconType", QJsonValue::fromVariant( QString::number( pref.getDefaultIconType() ) ) );
+ prefObject.insert("defaultIconMime", QJsonValue::fromVariant( pref.getDefaultIconMime() ) );
+ prefObject.insert("defaultIcon", QJsonValue::fromVariant( QString( pref.getDefaultIconData().toBase64() ) ) );
prefObject.insert("iconType", QJsonValue::fromVariant( QString::number( pref.getIconType() ) ) );
prefObject.insert("iconMime", QJsonValue::fromVariant( pref.getIconMime() ) );
prefObject.insert("icon", QJsonValue::fromVariant( QString( pref.getIconData().toBase64() ) ) );
@@ -647,6 +679,31 @@ void SysTrayXLink::slotMinimizeOnCloseChange()
}
}
+
+/*
+ * Handle the default icon type change signal
+ */
+void SysTrayXLink::slotDefaultIconTypeChange()
+{
+ if( m_pref->getAppPrefChanged() )
+ {
+ sendPreferences();
+ }
+}
+
+
+/*
+ * Handle the default icon data change signal
+ */
+void SysTrayXLink::slotDefaultIconDataChange()
+{
+ if( m_pref->getAppPrefChanged() )
+ {
+ sendPreferences();
+ }
+}
+
+
/*
* Handle the icon type change signal
*/
diff --git a/app/SysTray-X/systrayxlink.h b/app/SysTray-X/systrayxlink.h
index 4331716..f96e78b 100644
--- a/app/SysTray-X/systrayxlink.h
+++ b/app/SysTray-X/systrayxlink.h
@@ -210,6 +210,16 @@ class SysTrayXLink : public QObject
*/
void slotMinimizeOnCloseChange();
+ /**
+ * @brief slotDefaultIconTypeChange. Slot for handling default icon type change signals.
+ */
+ void slotDefaultIconTypeChange();
+
+ /**
+ * @brief slotDefaultIconDataChange. Slot for handling default icon data change signals.
+ */
+ void slotDefaultIconDataChange();
+
/**
* @brief slotIconTypeChange. Slot for handling icon type change signals.
*/