Improve my last commit re disabling systray icon changes via dbus.

Disabling unread count wasn't enough, the icon still changed when
new mail arrived.
wilder-work
Sergio Martins 12 years ago
parent 5856e428ba
commit f954915795
  1. 6
      kmkernel.cpp
  2. 6
      kmkernel.h
  3. 10
      kmsystemtray.cpp
  4. 10
      kmsystemtray.h

@ -537,11 +537,9 @@ void KMKernel::checkMail () //might create a new reader but won't show!!
}
}
void KMKernel::setSystrayUnreadCountEnabled(bool enabled)
void KMKernel::setSystrayIconNotificationsEnabled( bool enabled )
{
GlobalSettings::self()->systemTrayShowUnreadItem()->setValue(enabled);
mSystemTray->setShowUnreadCount(enabled);
GlobalSettings::self()->writeConfig();
mSystemTray->setSystrayIconNotificationsEnabled( enabled );
}
QStringList KMKernel::accounts()

@ -120,7 +120,11 @@ public Q_SLOTS:
Q_SCRIPTABLE void checkMail();
Q_SCRIPTABLE void openReader() { openReader( false ); }
Q_SCRIPTABLE void setSystrayUnreadCountEnabled(bool enabled);
/**
* Enables/disables systray icon changing when mail arrives.
* With this disabled the systray icon will always be the same.
*/
Q_SCRIPTABLE void setSystrayIconNotificationsEnabled( bool enabled );
/**
* Pauses all background jobs and does not

@ -63,6 +63,7 @@ KMSystemTray::KMSystemTray(QObject *parent)
mMode( GlobalSettings::EnumSystemTrayPolicy::ShowOnUnread ),
mCount( 0 ),
mShowUnreadMailCount( true ),
mIconNotificationsEnabled( true ),
mNewMessagesPopup( 0 ),
mSendQueued( 0 )
{
@ -182,7 +183,7 @@ int KMSystemTray::mode() const
*/
void KMSystemTray::updateCount()
{
if (mCount == 0) {
if (mCount == 0 || !mIconNotificationsEnabled) {
setIconByName( "kmail" );
return;
}
@ -229,6 +230,13 @@ void KMSystemTray::updateCount()
}
}
void KMSystemTray::setSystrayIconNotificationsEnabled( bool enabled )
{
if ( enabled != mIconNotificationsEnabled ) {
mIconNotificationsEnabled = enabled;
updateSystemTray();
}
}
/**
* On left mouse click, switch focus to the first KMMainWidget. On right

@ -48,6 +48,14 @@ public:
~KMSystemTray();
void setShowUnreadCount(bool showUnreadCount);
/**
* Use this method to disable any systray icon changing.
* By default this is enabled and you'll see the "new e-mail" icon whenever there's
* new e-mail.
*/
void setSystrayIconNotificationsEnabled(bool enable);
void setMode(int mode);
int mode() const;
@ -81,6 +89,8 @@ private:
int mCount;
bool mShowUnreadMailCount;
bool mIconNotificationsEnabled;
QMenu *mNewMessagesPopup;
QAction *mSendQueued;
};

Loading…
Cancel
Save