Merge branch 'KDE/4.11' into KDE/4.12

GIT_SILENT
wilder-work
Sergio Martins 12 years ago
commit 44ff4d29be
  1. 8
      kmkernel.cpp
  2. 6
      kmkernel.h
  3. 20
      kmsystemtray.cpp
  4. 14
      kmsystemtray.h

@ -458,11 +458,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->setShowUnread(enabled);
GlobalSettings::self()->writeConfig();
mSystemTray->setSystrayIconNotificationsEnabled( enabled );
}
QStringList KMKernel::accounts()
@ -2019,7 +2017,7 @@ void KMKernel::toggleSystemTray()
// Set mode of systemtray. If mode has changed, tray will handle this.
if ( mSystemTray ) {
mSystemTray->setMode( GlobalSettings::self()->systemTrayPolicy() );
mSystemTray->setShowUnread( GlobalSettings::self()->systemTrayShowUnread() );
mSystemTray->setShowUnreadCount( GlobalSettings::self()->systemTrayShowUnread() );
}
}

@ -118,7 +118,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

@ -62,7 +62,8 @@ KMSystemTray::KMSystemTray(QObject *parent)
mDesktopOfMainWin( 0 ),
mMode( GlobalSettings::EnumSystemTrayPolicy::ShowOnUnread ),
mCount( 0 ),
mShowUnreadMail( true ),
mShowUnreadMailCount( true ),
mIconNotificationsEnabled( true ),
mNewMessagesPopup( 0 ),
mSendQueued( 0 )
{
@ -142,11 +143,11 @@ KMSystemTray::~KMSystemTray()
{
}
void KMSystemTray::setShowUnread(bool showUnread)
void KMSystemTray::setShowUnreadCount(bool showUnreadCount)
{
if (mShowUnreadMail == showUnread)
if (mShowUnreadMailCount == showUnreadCount)
return;
mShowUnreadMail = showUnread;
mShowUnreadMailCount = showUnreadCount;
updateSystemTray();
}
@ -182,11 +183,11 @@ int KMSystemTray::mode() const
*/
void KMSystemTray::updateCount()
{
if (mCount == 0) {
if (mCount == 0 || !mIconNotificationsEnabled) {
setIconByName( QLatin1String("kmail") );
return;
}
if (mShowUnreadMail) {
if (mShowUnreadMailCount) {
const int overlaySize = KIconLoader::SizeSmallMedium;
const QString countString = QString::number( mCount );
@ -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

@ -41,7 +41,15 @@ public:
/** destructor */
~KMSystemTray();
void setShowUnread(bool showUnread);
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;
@ -73,7 +81,9 @@ private:
int mMode;
int mCount;
bool mShowUnreadMail;
bool mShowUnreadMailCount;
bool mIconNotificationsEnabled;
QMenu *mNewMessagesPopup;
QAction *mSendQueued;
};

Loading…
Cancel
Save