mirror of
https://github.com/Ximi1970/systray-x.git
synced 2026-02-27 16:40:42 +01:00
Activate notify icon
This commit is contained in:
@@ -37,6 +37,7 @@ Preferences::Preferences( QObject *parent ) : QObject( parent )
|
||||
m_default_icon_type = PREF_DEFAULT_ICON_DEFAULT;
|
||||
m_default_icon_mime = "image/png";
|
||||
m_default_icon_data = QByteArray();
|
||||
m_hide_default_icon = true;
|
||||
|
||||
m_icon_type = PREF_BLANK_ICON;
|
||||
m_icon_mime = "image/png";
|
||||
@@ -218,6 +219,32 @@ void Preferences::setDefaultIconData( const QByteArray& icon_data )
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the hide default icon state.
|
||||
*/
|
||||
bool Preferences::getHideDefaultIcon() const
|
||||
{
|
||||
return m_hide_default_icon;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the hide default icon state.
|
||||
*/
|
||||
void Preferences::setHideDefaultIcon( bool hide )
|
||||
{
|
||||
if( m_hide_default_icon != hide)
|
||||
{
|
||||
m_hide_default_icon = hide;
|
||||
|
||||
/*
|
||||
* Tell the world the new preference
|
||||
*/
|
||||
emit signalHideDefaultIconChange();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get the icon type.
|
||||
*/
|
||||
|
||||
@@ -184,6 +184,20 @@ class Preferences : public QObject
|
||||
*/
|
||||
void setDefaultIconData( const QByteArray& icon_data );
|
||||
|
||||
/**
|
||||
* @brief getHideDefaultIcon. Get the hide default icon state.
|
||||
*
|
||||
* @return The state.
|
||||
*/
|
||||
bool getHideDefaultIcon() const;
|
||||
|
||||
/**
|
||||
* @brief setHideDefaultIcon. Set the hide default icon state.
|
||||
*
|
||||
* @param The state.
|
||||
*/
|
||||
void setHideDefaultIcon( bool hide );
|
||||
|
||||
/**
|
||||
* @brief getIconType. Get the icon type.
|
||||
*
|
||||
@@ -385,6 +399,11 @@ class Preferences : public QObject
|
||||
*/
|
||||
void signalDefaultIconDataChange();
|
||||
|
||||
/**
|
||||
* @brief signalHideDefaultIconChange. Signal a hide default icon change.
|
||||
*/
|
||||
void signalHideDefaultIconChange();
|
||||
|
||||
/**
|
||||
* @brief signalIconTypeChange. Signal a icon type change.
|
||||
*/
|
||||
@@ -472,6 +491,11 @@ class Preferences : public QObject
|
||||
*/
|
||||
QByteArray m_default_icon_data;
|
||||
|
||||
/**
|
||||
* @brief m_hide_default_icon. Hide default icon state.
|
||||
*/
|
||||
bool m_hide_default_icon;
|
||||
|
||||
/**
|
||||
* @brief m_icon_type. Selected icon type.
|
||||
*/
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>525</width>
|
||||
<height>600</height>
|
||||
<width>500</width>
|
||||
<height>540</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -17,160 +17,96 @@
|
||||
<iconset resource="SysTray-X.qrc">
|
||||
<normaloff>:/files/icons/SysTray-X.png</normaloff>:/files/icons/SysTray-X.png</iconset>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_15">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Default icon</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="defaultIconRadioButton">
|
||||
<property name="text">
|
||||
<string>Default Thunderbird</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">defaultIconTypeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="hideDefaultIconRadioButton">
|
||||
<property name="text">
|
||||
<string>Hide icon</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">defaultIconTypeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="customDefaultIconRadioButton">
|
||||
<property name="text">
|
||||
<string>Custom icon</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">defaultIconTypeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="defaultImageLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="chooseCustomDefaultIconButton">
|
||||
<property name="text">
|
||||
<string>Choose</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="2">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Windows</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Minimize</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<widget class="QGroupBox" name="groupBox_5">
|
||||
<property name="title">
|
||||
<string>Icon</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="defaultIconRadioButton">
|
||||
<property name="text">
|
||||
<string>Default Thunderbird</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">defaultIconTypeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="lookThroughDefaultIconRadioButton">
|
||||
<property name="text">
|
||||
<string>Lookthrough icon</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">defaultIconTypeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="defaultMinimizeRadioButton">
|
||||
<widget class="QRadioButton" name="customDefaultIconRadioButton">
|
||||
<property name="text">
|
||||
<string>Default minimize</string>
|
||||
<string>Custom icon</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">defaultIconTypeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="defaultImageLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="chooseCustomDefaultIconButton">
|
||||
<property name="text">
|
||||
<string>Choose</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">minimizeTypeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="minimizeMethod1RadioButton">
|
||||
<property name="text">
|
||||
<string>Minimize to tray, method 1</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">minimizeTypeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="minimizeMethod2RadioButton">
|
||||
<property name="text">
|
||||
<string>Minimize to tray, method 2</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">minimizeTypeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="startMinimizedCheckBox">
|
||||
<property name="text">
|
||||
<string>Start application minimized</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="minimizeOnCloseCheckBox">
|
||||
<property name="text">
|
||||
<string>Minimize on close</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="hideDefaultIconCheckBox">
|
||||
<property name="text">
|
||||
<string>Hide icon (KDE)</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" rowspan="2">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="iconTypeGroupBox">
|
||||
<property name="title">
|
||||
<string>Mail notification icon</string>
|
||||
@@ -307,7 +243,107 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" rowspan="2">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>113</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string>Windows</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_11">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_10">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>Minimize</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QRadioButton" name="defaultMinimizeRadioButton">
|
||||
<property name="text">
|
||||
<string>Default minimize</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">minimizeTypeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="minimizeMethod1RadioButton">
|
||||
<property name="text">
|
||||
<string>Minimize to tray, method 1</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">minimizeTypeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="minimizeMethod2RadioButton">
|
||||
<property name="text">
|
||||
<string>Minimize to tray, method 2</string>
|
||||
</property>
|
||||
<attribute name="buttonGroup">
|
||||
<string notr="true">minimizeTypeGroup</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="startMinimizedCheckBox">
|
||||
<property name="text">
|
||||
<string>Start application minimized</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="minimizeOnCloseCheckBox">
|
||||
<property name="text">
|
||||
<string>Minimize on close</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_3">
|
||||
<property name="title">
|
||||
<string>Number properties</string>
|
||||
@@ -411,20 +447,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>113</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -439,7 +462,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="1" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="debugWindowCheckBox">
|
||||
@@ -484,9 +507,9 @@
|
||||
</connection>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="countTypeGroup"/>
|
||||
<buttongroup name="minimizeTypeGroup"/>
|
||||
<buttongroup name="defaultIconTypeGroup"/>
|
||||
<buttongroup name="iconTypeGroup"/>
|
||||
<buttongroup name="minimizeTypeGroup"/>
|
||||
<buttongroup name="countTypeGroup"/>
|
||||
<buttongroup name="defaultIconTypeGroup"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
||||
@@ -75,7 +75,7 @@ PreferencesDialog::PreferencesDialog( SysTrayXLink *link, Preferences *pref, QWi
|
||||
* 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->lookThroughDefaultIconRadioButton, Preferences::PREF_DEFAULT_ICON_HIDE );
|
||||
m_ui->defaultIconTypeGroup->setId( m_ui->customDefaultIconRadioButton, Preferences::PREF_DEFAULT_ICON_CUSTOM );
|
||||
|
||||
/*
|
||||
@@ -230,6 +230,16 @@ void PreferencesDialog::setDefaultIcon()
|
||||
m_ui->defaultImageLabel->setPixmap( pixmap.scaledToHeight( m_ui->chooseCustomButton->size().height() ) );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the hide default icon
|
||||
*/
|
||||
void PreferencesDialog::setHideDefaultIcon( bool hide )
|
||||
{
|
||||
m_ui->hideDefaultIconCheckBox->setChecked( hide );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the enable number state
|
||||
*/
|
||||
@@ -287,6 +297,7 @@ void PreferencesDialog::slotAccept()
|
||||
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->setHideDefaultIcon( m_ui->hideDefaultIconCheckBox->isChecked() );
|
||||
|
||||
m_pref->setIconType( static_cast< Preferences::IconType >( m_ui->iconTypeGroup->checkedId() ) );
|
||||
m_pref->setIconMime( m_tmp_icon_mime );
|
||||
@@ -477,6 +488,15 @@ void PreferencesDialog::slotDefaultIconDataChange()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the hide default icon change signal
|
||||
*/
|
||||
void PreferencesDialog::slotHideDefaultIconChange()
|
||||
{
|
||||
setHideDefaultIcon( m_pref->getHideDefaultIcon() );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the enable number state change
|
||||
*/
|
||||
|
||||
@@ -109,6 +109,13 @@ class PreferencesDialog : public QDialog
|
||||
*/
|
||||
void setDefaultIcon();
|
||||
|
||||
/**
|
||||
* @brief setHideDefaultIcon. Set the hide default icon.
|
||||
*
|
||||
* @param hide The state.
|
||||
*/
|
||||
void setHideDefaultIcon( bool hide );
|
||||
|
||||
/**
|
||||
* @brief setShowNumber. Set the show number state.
|
||||
*
|
||||
@@ -183,6 +190,11 @@ class PreferencesDialog : public QDialog
|
||||
*/
|
||||
void slotDefaultIconTypeChange();
|
||||
|
||||
/**
|
||||
* @brief slotHideDefaultIconChange. Slot for handling hide default icon change signals.
|
||||
*/
|
||||
void slotHideDefaultIconChange();
|
||||
|
||||
/**
|
||||
* @brief slotIconDataChange. Slot for handling icon data change signals.
|
||||
*/
|
||||
|
||||
@@ -71,7 +71,7 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
|
||||
* Setup tray icon
|
||||
*/
|
||||
createMenu();
|
||||
showTrayIcon();
|
||||
// showTrayIcon();
|
||||
showTrayIconKDE();
|
||||
|
||||
/*
|
||||
@@ -108,6 +108,7 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
|
||||
|
||||
connect( m_preferences, &Preferences::signalDefaultIconTypeChange, m_pref_dialog, &PreferencesDialog::slotDefaultIconTypeChange );
|
||||
connect( m_preferences, &Preferences::signalDefaultIconDataChange, m_pref_dialog, &PreferencesDialog::slotDefaultIconDataChange );
|
||||
connect( m_preferences, &Preferences::signalHideDefaultIconChange, m_pref_dialog, &PreferencesDialog::slotHideDefaultIconChange );
|
||||
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 );
|
||||
@@ -121,6 +122,7 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
|
||||
|
||||
connect( m_preferences, &Preferences::signalDefaultIconTypeChange, m_link, &SysTrayXLink::slotDefaultIconTypeChange );
|
||||
connect( m_preferences, &Preferences::signalDefaultIconDataChange, m_link, &SysTrayXLink::slotDefaultIconDataChange );
|
||||
connect( m_preferences, &Preferences::signalHideDefaultIconChange, m_link, &SysTrayXLink::slotHideDefaultIconChange );
|
||||
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 );
|
||||
@@ -323,6 +325,7 @@ void SysTrayX::showTrayIconKDE()
|
||||
|
||||
connect( m_preferences, &Preferences::signalDefaultIconTypeChange, m_tray_icon2, &SysTrayXStatusNotifier::slotDefaultIconTypeChange );
|
||||
connect( m_preferences, &Preferences::signalDefaultIconDataChange, m_tray_icon2, &SysTrayXStatusNotifier::slotDefaultIconDataChange );
|
||||
connect( m_preferences, &Preferences::signalHideDefaultIconChange, m_tray_icon2, &SysTrayXStatusNotifier::slotHideDefaultIconChange );
|
||||
connect( m_preferences, &Preferences::signalIconTypeChange, m_tray_icon2, &SysTrayXStatusNotifier::slotIconTypeChange );
|
||||
connect( m_preferences, &Preferences::signalIconDataChange, m_tray_icon2, &SysTrayXStatusNotifier::slotIconDataChange );
|
||||
connect( m_preferences, &Preferences::signalShowNumberChange, m_tray_icon2, &SysTrayXStatusNotifier::slotShowNumberChange );
|
||||
@@ -348,6 +351,7 @@ void SysTrayX::hideTrayIconKDE()
|
||||
|
||||
disconnect( m_preferences, &Preferences::signalDefaultIconTypeChange, m_tray_icon2, &SysTrayXStatusNotifier::slotDefaultIconTypeChange );
|
||||
disconnect( m_preferences, &Preferences::signalDefaultIconDataChange, m_tray_icon2, &SysTrayXStatusNotifier::slotDefaultIconDataChange );
|
||||
disconnect( m_preferences, &Preferences::signalHideDefaultIconChange, m_tray_icon2, &SysTrayXStatusNotifier::slotHideDefaultIconChange );
|
||||
disconnect( m_preferences, &Preferences::signalIconTypeChange, m_tray_icon2, &SysTrayXStatusNotifier::slotIconTypeChange );
|
||||
disconnect( m_preferences, &Preferences::signalIconDataChange, m_tray_icon2, &SysTrayXStatusNotifier::slotIconDataChange );
|
||||
disconnect( m_preferences, &Preferences::signalShowNumberChange, m_tray_icon2, &SysTrayXStatusNotifier::slotShowNumberChange );
|
||||
|
||||
@@ -279,7 +279,6 @@ void SysTrayXIcon::renderIcon()
|
||||
case Preferences::PREF_DEFAULT_ICON_HIDE:
|
||||
{
|
||||
pixmap = QPixmap();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -477,6 +477,16 @@ void SysTrayXLink::DecodePreferences( const QJsonObject& pref )
|
||||
m_pref->setDefaultIconData( QByteArray::fromBase64( icon_base64.toUtf8() ) );
|
||||
}
|
||||
|
||||
if( pref.contains( "hideDefaultIcon" ) && pref[ "hideDefaultIcon" ].isString() )
|
||||
{
|
||||
bool hide_default_icon = pref[ "hideDefaultIcon" ].toString() == "true";
|
||||
|
||||
/*
|
||||
* Store the new start minimized state
|
||||
*/
|
||||
m_pref->setHideDefaultIcon( hide_default_icon );
|
||||
}
|
||||
|
||||
if( pref.contains( "iconType" ) && pref[ "iconType" ].isString() )
|
||||
{
|
||||
Preferences::IconType icon_type = static_cast< Preferences::IconType >( pref[ "iconType" ].toString().toInt() );
|
||||
@@ -604,6 +614,7 @@ void SysTrayXLink::EncodePreferences( const Preferences& pref )
|
||||
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("hideDefaultIcon", QJsonValue::fromVariant( QString( pref.getHideDefaultIcon() ? "true" : "false" ) ) );
|
||||
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() ) ) );
|
||||
@@ -715,6 +726,18 @@ void SysTrayXLink::slotDefaultIconDataChange()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the hide default icon change signal
|
||||
*/
|
||||
void SysTrayXLink::slotHideDefaultIconChange()
|
||||
{
|
||||
if( m_pref->getAppPrefChanged() )
|
||||
{
|
||||
sendPreferences();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the icon type change signal
|
||||
*/
|
||||
|
||||
@@ -220,6 +220,11 @@ class SysTrayXLink : public QObject
|
||||
*/
|
||||
void slotDefaultIconDataChange();
|
||||
|
||||
/**
|
||||
* @brief slotHideDefaultIconChange. Slot for handling hide default icon change signals.
|
||||
*/
|
||||
void slotHideDefaultIconChange();
|
||||
|
||||
/**
|
||||
* @brief slotIconTypeChange. Slot for handling icon type change signals.
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
* Qt includes
|
||||
*/
|
||||
#include <QIcon>
|
||||
#include <QTimer>
|
||||
#include <QPixmap>
|
||||
#include <QPainter>
|
||||
|
||||
@@ -44,8 +45,10 @@ SysTrayXStatusNotifier::SysTrayXStatusNotifier( SysTrayXLink* link, Preferences*
|
||||
setIconByPixmap( QIcon( QPixmap( ":/files/icons/Thunderbird.png") ) );
|
||||
setTitle("SysTray-X");
|
||||
|
||||
// setStatus(KStatusNotifierItem::ItemStatus::Passive);
|
||||
setStatus(KStatusNotifierItem::ItemStatus::Active);
|
||||
setStatus( KStatusNotifierItem::ItemStatus::Passive );
|
||||
m_hide_default_icon = true;
|
||||
|
||||
// setStatus(KStatusNotifierItem::ItemStatus::Active);
|
||||
// setStatus(KStatusNotifierItem::ItemStatus::NeedsAttention);
|
||||
|
||||
connect( this, &KStatusNotifierItem::activateRequested, this, &SysTrayXStatusNotifier::slotActivateRequested );
|
||||
@@ -108,6 +111,21 @@ void SysTrayXStatusNotifier::setDefaultIconData( const QByteArray& icon_data
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the hide default icon
|
||||
*/
|
||||
void SysTrayXStatusNotifier::setHideDefaultIcon( bool hide )
|
||||
{
|
||||
if( m_hide_default_icon != hide )
|
||||
{
|
||||
/*
|
||||
* Store the new value
|
||||
*/
|
||||
m_hide_default_icon = hide;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Set the icon type
|
||||
*/
|
||||
@@ -294,7 +312,6 @@ void SysTrayXStatusNotifier::renderIcon()
|
||||
case Preferences::PREF_DEFAULT_ICON_HIDE:
|
||||
{
|
||||
pixmap = QPixmap();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -334,6 +351,27 @@ void SysTrayXStatusNotifier::renderIcon()
|
||||
* Set the tray icon
|
||||
*/
|
||||
setIconByPixmap( QIcon( pixmap ) );
|
||||
|
||||
/*
|
||||
* Hide the icon?
|
||||
*/
|
||||
if( m_hide_default_icon && m_unread_mail == 0 )
|
||||
{
|
||||
setStatus( KStatusNotifierItem::ItemStatus::Passive );
|
||||
}
|
||||
else
|
||||
{
|
||||
QTimer::singleShot(500, this, &SysTrayXStatusNotifier::showIcon);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SysTrayXStatusNotifier::showIcon()
|
||||
{
|
||||
if( !m_hide_default_icon || m_unread_mail > 0 )
|
||||
{
|
||||
setStatus( KStatusNotifierItem::ItemStatus::Active );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -365,6 +403,15 @@ void SysTrayXStatusNotifier::slotDefaultIconDataChange()
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the hide default icon change signal
|
||||
*/
|
||||
void SysTrayXStatusNotifier::slotHideDefaultIconChange()
|
||||
{
|
||||
setHideDefaultIcon( m_pref->getHideDefaultIcon() );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Handle the icon type change signal
|
||||
*/
|
||||
|
||||
@@ -54,6 +54,13 @@ class SysTrayXStatusNotifier : public KStatusNotifierItem
|
||||
*/
|
||||
void setDefaultIconData( const QByteArray& icon_data );
|
||||
|
||||
/**
|
||||
* @brief setHideDefaultIcon. Set hide default icon.
|
||||
*
|
||||
* @param hide The state
|
||||
*/
|
||||
void setHideDefaultIcon( bool hide );
|
||||
|
||||
/**
|
||||
* @brief setIconType. Set the sytem tray icon type.
|
||||
*
|
||||
@@ -110,6 +117,11 @@ class SysTrayXStatusNotifier : public KStatusNotifierItem
|
||||
*/
|
||||
void renderIcon();
|
||||
|
||||
/**
|
||||
* @brief showIcon. Show the icon.
|
||||
*/
|
||||
void showIcon();
|
||||
|
||||
signals:
|
||||
|
||||
/**
|
||||
@@ -136,6 +148,11 @@ class SysTrayXStatusNotifier : public KStatusNotifierItem
|
||||
*/
|
||||
void slotDefaultIconDataChange();
|
||||
|
||||
/**
|
||||
* @brief slotHideDefaultIconChange. Slot for handling hide default icon change signals.
|
||||
*/
|
||||
void slotHideDefaultIconChange();
|
||||
|
||||
/**
|
||||
* @brief slotIconTypeChange. Slot for handling icon type change signals.
|
||||
*/
|
||||
@@ -205,6 +222,11 @@ class SysTrayXStatusNotifier : public KStatusNotifierItem
|
||||
*/
|
||||
QByteArray m_default_icon_data;
|
||||
|
||||
/**
|
||||
* @brief m_hide_default_icon. Storage for the hide default icon state.
|
||||
*/
|
||||
bool m_hide_default_icon;
|
||||
|
||||
/**
|
||||
* @brief m_icon_type. Storage for the icon type.
|
||||
*/
|
||||
|
||||
@@ -146,6 +146,7 @@ SysTrayX.Messaging = {
|
||||
"defaultIconType",
|
||||
"defaultIconMime",
|
||||
"defaultIcon",
|
||||
"hideDefaultIcon",
|
||||
"iconType",
|
||||
"iconMime",
|
||||
"icon",
|
||||
@@ -165,6 +166,7 @@ SysTrayX.Messaging = {
|
||||
const defaultIconType = result.defaultIconType || "0";
|
||||
const defaultIconMime = result.defaultIconMime || "image/png";
|
||||
const defaultIcon = result.defaultIcon || [];
|
||||
const hideDefaultIcon = result.hideDefaultIcon || "true";
|
||||
const iconType = result.iconType || "0";
|
||||
const iconMime = result.iconMime || "image/png";
|
||||
const icon = result.icon || [];
|
||||
@@ -183,6 +185,7 @@ SysTrayX.Messaging = {
|
||||
defaultIconType: defaultIconType,
|
||||
defaultIconMime: defaultIconMime,
|
||||
defaultIcon: defaultIcon,
|
||||
hideDefaultIcon: hideDefaultIcon,
|
||||
iconType: iconType,
|
||||
iconMime: iconMime,
|
||||
icon: icon,
|
||||
@@ -279,6 +282,13 @@ SysTrayX.Link = {
|
||||
});
|
||||
}
|
||||
|
||||
const hideDefaultIcon = response["preferences"].hideDefaultIcon;
|
||||
if (hideDefaultIcon) {
|
||||
browser.storage.sync.set({
|
||||
hideDefaultIcon: hideDefaultIcon,
|
||||
});
|
||||
}
|
||||
|
||||
const iconMime = response["preferences"].iconMime;
|
||||
if (iconMime) {
|
||||
browser.storage.sync.set({
|
||||
|
||||
@@ -61,6 +61,7 @@ body {
|
||||
}
|
||||
|
||||
#minimizeselect {
|
||||
width: 20em;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
margin: 10px 10px 10px 10px;
|
||||
@@ -98,6 +99,7 @@ ul,
|
||||
|
||||
/* Remove margins and padding from the parent ul */
|
||||
#accountsTree {
|
||||
width: 20em;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
margin: 0;
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
<form>
|
||||
<h3>Windows</h3>
|
||||
<table id="minimizeselect">
|
||||
<caption>
|
||||
Minimize
|
||||
</caption>
|
||||
<tr id="minimizedefault">
|
||||
<td>
|
||||
<input type="radio" name="minimizeType" value="0" />
|
||||
@@ -83,7 +86,8 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<input type="radio" name="defaultIconType" value="1" /> Hide icon
|
||||
<input type="radio" name="defaultIconType" value="1" />
|
||||
Lookthrough icon
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -120,6 +124,9 @@
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<input type="checkbox" name="hideDefaultIcon" value="" /> Hide default
|
||||
icon (KDE)<br />
|
||||
|
||||
<table id="iconselect">
|
||||
<caption>
|
||||
Unread mail icon
|
||||
|
||||
@@ -109,6 +109,16 @@ SysTrayX.SaveOptions = {
|
||||
defaultIcon: defaultIconBase64,
|
||||
});
|
||||
|
||||
//
|
||||
// Save hide default icon state
|
||||
//
|
||||
let hideDefaultIcon = document.querySelector(
|
||||
'input[name="hideDefaultIcon"]'
|
||||
).checked;
|
||||
browser.storage.sync.set({
|
||||
hideDefaultIcon: `${hideDefaultIcon}`,
|
||||
});
|
||||
|
||||
//
|
||||
// Save icon preferences
|
||||
//
|
||||
@@ -234,6 +244,15 @@ SysTrayX.RestoreOptions = {
|
||||
SysTrayX.RestoreOptions.onDefaultIconError
|
||||
);
|
||||
|
||||
//
|
||||
// Restore hide default icon
|
||||
//
|
||||
const getHideDefaultIcon = browser.storage.sync.get("hideDefaultIcon");
|
||||
getHideDefaultIcon.then(
|
||||
SysTrayX.RestoreOptions.setHideDefaultIcon,
|
||||
SysTrayX.RestoreOptions.onHideDefaultIconError
|
||||
);
|
||||
|
||||
//
|
||||
// Restore icon type
|
||||
//
|
||||
@@ -452,6 +471,20 @@ SysTrayX.RestoreOptions = {
|
||||
console.log(`Default icon Error: ${error}`);
|
||||
},
|
||||
|
||||
//
|
||||
// Restore hide default icon callbacks
|
||||
//
|
||||
setHideDefaultIcon: function (result) {
|
||||
const hideDefaultIcon = result.hideDefaultIcon || "true";
|
||||
|
||||
const checkbox = document.querySelector(`input[name="hideDefaultIcon"]`);
|
||||
checkbox.checked = hideDefaultIcon === "true";
|
||||
},
|
||||
|
||||
onHideDefaultIconError: function (error) {
|
||||
console.log(`hideDefaultIcon Error: ${error}`);
|
||||
},
|
||||
|
||||
//
|
||||
// Restore icon
|
||||
//
|
||||
@@ -677,6 +710,11 @@ SysTrayX.StorageChanged = {
|
||||
defaultIconType: changes[item].newValue,
|
||||
});
|
||||
}
|
||||
if (item === "hideDefaultIcon") {
|
||||
SysTrayX.RestoreOptions.setHideDefaultIcon({
|
||||
hideDefaultIcon: changes[item].newValue,
|
||||
});
|
||||
}
|
||||
if (item === "showNumber") {
|
||||
SysTrayX.RestoreOptions.setShowNumber({
|
||||
showNumber: changes[item].newValue,
|
||||
|
||||
Reference in New Issue
Block a user