diff --git a/src/core/feedsmodel.cpp b/src/core/feedsmodel.cpp index 723fab65d..64f7ea746 100755 --- a/src/core/feedsmodel.cpp +++ b/src/core/feedsmodel.cpp @@ -456,10 +456,7 @@ void FeedsModel::reloadChangedItem(RootItem *item) { } void FeedsModel::notifyWithCounts() { - if (SystemTrayIcon::isSystemTrayActivated()) { - // TODO: Udělat přes signál, jádro by nemělo inkludovat GUI prvky. - qApp->trayIcon()->setNumber(countOfUnreadMessages(), hasAnyFeedNewMessages()); - } + emit messageCountsChanged(countOfUnreadMessages(), hasAnyFeedNewMessages()); } void FeedsModel::onItemDataChanged(const QList &items) { diff --git a/src/core/feedsmodel.h b/src/core/feedsmodel.h index 9b129c693..be88cf120 100755 --- a/src/core/feedsmodel.h +++ b/src/core/feedsmodel.h @@ -155,7 +155,7 @@ class FeedsModel : public QAbstractItemModel { signals: // Emitted if counts of messages are changed. - void messageCountsChanged(int unread_messages, int total_messages, bool any_feed_has_unread_messages); + void messageCountsChanged(int unread_messages, bool any_feed_has_unread_messages); // Emitted if any item requested that any view should expand it. void itemExpandRequested(QList items, bool expand); diff --git a/src/miscellaneous/application.cpp b/src/miscellaneous/application.cpp index 983309999..518fe075d 100755 --- a/src/miscellaneous/application.cpp +++ b/src/miscellaneous/application.cpp @@ -275,6 +275,7 @@ SystemTrayIcon *Application::trayIcon() { if (m_trayIcon == nullptr) { m_trayIcon = new SystemTrayIcon(APP_ICON_PATH, APP_ICON_PLAIN_PATH, m_mainForm); connect(m_trayIcon, &SystemTrayIcon::shown, m_feedReader->feedsModel(), &FeedsModel::notifyWithCounts); + connect(m_feedReader->feedsModel(), &FeedsModel::messageCountsChanged, m_trayIcon, &SystemTrayIcon::setNumber); } return m_trayIcon;