Commit 0f4b369c authored by Laurent Montel's avatar Laurent Montel 😁

Fix Bug 401444 - Add an option to not show an unread count on the Task Manager icon

FIXED-IN: 5.11.0
BUG: 401444
parent 229c9dbc
......@@ -879,6 +879,12 @@ AppearancePageGeneralTab::AppearancePageGeneralTab(QWidget *parent)
connect(mSystemTrayCheck, &QCheckBox::stateChanged,
this, &ConfigModuleTab::slotEmitChanged);
// "Enable system tray applet" check box
mShowNumberInTaskBar = new QCheckBox(i18n("Show unread email in Taskbar"), this);
systrayBoxlayout->addWidget(mShowNumberInTaskBar);
connect(mShowNumberInTaskBar, &QCheckBox::stateChanged,
this, &ConfigModuleTab::slotEmitChanged);
topLayout->addStretch(100); // spacer
}
......@@ -890,6 +896,7 @@ void AppearancePage::ReaderTab::doResetToDefaultsOther()
void AppearancePage::ReaderTab::doLoadOther()
{
loadWidget(mSystemTrayCheck, KMailSettings::self()->systemTrayEnabledItem());
loadWidget(mShowNumberInTaskBar, KMailSettings::self()->showUnreadInTaskbarItem());
loadWidget(mCloseAfterReplyOrForwardCheck, MessageViewer::MessageViewerSettings::self()->closeAfterReplyOrForwardItem());
mViewerSettings->readConfig();
mGravatarConfigWidget->doLoadFromGlobalSettings();
......@@ -898,6 +905,7 @@ void AppearancePage::ReaderTab::doLoadOther()
void AppearancePage::ReaderTab::save()
{
saveCheckBox(mSystemTrayCheck, KMailSettings::self()->systemTrayEnabledItem());
saveCheckBox(mShowNumberInTaskBar, KMailSettings::self()->showUnreadInTaskbarItem());
KMailSettings::self()->save();
saveCheckBox(mCloseAfterReplyOrForwardCheck, MessageViewer::MessageViewerSettings::self()->closeAfterReplyOrForwardItem());
mViewerSettings->writeConfig();
......
......@@ -172,6 +172,7 @@ private: // data
MessageViewer::ConfigureWidget *mViewerSettings = nullptr;
Gravatar::GravatarConfigWidget *mGravatarConfigWidget = nullptr;
QCheckBox *mSystemTrayCheck = nullptr;
QCheckBox *mShowNumberInTaskBar = nullptr;
};
class TagListWidgetItem : public QListWidgetItem
......
......@@ -1187,6 +1187,7 @@ void KMKernel::slotSyncConfig()
Gravatar::GravatarSettings::self()->load();
KMailSettings::self()->load();
KMKernel::config()->reparseConfiguration();
mUnityServiceManager->updateCount();
}
void KMKernel::saveConfig()
......
......@@ -84,6 +84,10 @@
<label>Enable system tray icon</label>
<default>false</default>
</entry>
<entry name="ShowUnreadInTaskbar" type="Bool">
<label>Show Unread Email in TaskBar</label>
<default>true</default>
</entry>
<entry name="ExternalEditor" type="String" key="external-editor">
<label>Specify e&amp;ditor:</label>
<default>kwrite %f</default>
......
......@@ -148,12 +148,13 @@ void UnityServiceManager::updateCount()
if (mSystemTray) {
mSystemTray->updateCount(mCount);
}
if (mUnityServiceAvailable) {
const QString launcherId = qApp->desktopFileName() + QLatin1String(".desktop");
const int unreadEmail = KMailSettings::self()->showUnreadInTaskbar() ? mCount : 0;
const QVariantMap properties{
{QStringLiteral("count-visible"), mCount > 0},
{QStringLiteral("count"), mCount}
{QStringLiteral("count-visible"), unreadEmail > 0},
{QStringLiteral("count"), unreadEmail}
};
QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/org/kmail2/UnityLauncher"),
......
......@@ -42,11 +42,11 @@ public:
void initListOfCollection();
bool excludeFolder(const Akonadi::Collection &collection) const;
bool ignoreNewMailInFolder(const Akonadi::Collection &collection);
void updateCount();
private:
Q_DISABLE_COPY(UnityServiceManager)
void unreadMail(const QAbstractItemModel *model, const QModelIndex &parentIndex = {});
void slotCollectionStatisticsChanged(Akonadi::Collection::Id id, const Akonadi::CollectionStatistics &);
void updateCount();
void initUnity();
bool hasUnreadMail() const;
QDBusServiceWatcher *mUnityServiceWatcher = nullptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment