Commit ea04b62a authored by Luigi Baldoni's avatar Luigi Baldoni Committed by Laurent Montel
Browse files

Fix Bug 420520 - tray icon always shown

BUG: 420520

(thanks @Jari Kuittinen)
parent 9f2bee26
Pipeline #47370 passed with stage
in 15 minutes and 41 seconds
......@@ -274,9 +274,7 @@ void Part::initializeTrayIcon()
TrayIcon::setInstance(trayIcon);
m_actionManager->setTrayIcon(trayIcon);
if (isTrayIconEnabled()) {
trayIcon->setStatus(KStatusNotifierItem::Active);
}
trayIcon->setEnabled(isTrayIconEnabled());
connect(m_mainWidget.data(), &MainWidget::signalUnreadCountChanged, trayIcon, &TrayIcon::slotSetUnread);
connect(m_mainWidget.data(), &MainWidget::signalArticlesSelected,
......
......@@ -26,6 +26,16 @@ void TrayIcon::setInstance(TrayIcon *trayIcon)
m_instance = trayIcon;
}
bool TrayIcon::isEnabled() const
{
return mEnabled;
}
void TrayIcon::setEnabled(bool enabled)
{
mEnabled = enabled;
}
TrayIcon::TrayIcon(QObject *parent)
: KStatusNotifierItem(parent)
{
......@@ -40,7 +50,7 @@ TrayIcon::~TrayIcon()
void TrayIcon::slotSetUnread(int unread)
{
if (m_unread != unread) {
if (mEnabled && m_unread != unread) {
m_unread = unread;
setToolTip(QStringLiteral("akregator"), i18n("Akregator"), unread == 0 ? i18n("There are no unread articles") : i18np("1 unread article", "%1 unread articles", unread));
......
......@@ -20,6 +20,9 @@ public:
static TrayIcon *getInstance();
static void setInstance(TrayIcon *trayIcon);
bool isEnabled() const;
void setEnabled(bool enabled);
explicit TrayIcon(QObject *parent = nullptr);
~TrayIcon();
......@@ -30,6 +33,7 @@ public Q_SLOTS:
private:
static TrayIcon *m_instance;
int m_unread = 0;
bool mEnabled = false;
};
} // namespace Akregator
......
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