Update icon when new notifications shown

This commit is contained in:
Martchus 2016-12-03 01:00:04 +01:00
parent 7093f735ed
commit d3bde05ccd
5 changed files with 17 additions and 13 deletions

View File

@ -9,7 +9,7 @@ set(META_APP_DESCRIPTION "Tray application for Syncthing")
set(META_APP_CATEGORIES "System;Utility;Network;FileTransfer")
set(META_VERSION_MAJOR 0)
set(META_VERSION_MINOR 1)
set(META_VERSION_PATCH 0)
set(META_VERSION_PATCH 1)
set(META_VERSION_EXACT_SONAME ON)
project(${META_PROJECT_NAME})

View File

@ -304,15 +304,6 @@ void SyncthingConnection::shutdown()
QObject::connect(postData(QStringLiteral("system/shutdown"), QUrlQuery()), &QNetworkReply::finished, this, &SyncthingConnection::readShutdown);
}
/*!
* \brief Considers all notifications as read; hence might trigger a status update.
*/
void SyncthingConnection::considerAllNotificationsRead()
{
m_unreadNotifications = false;
setStatus(status());
}
/*!
* \brief Prepares a request for the specified \a path and \a query.
*/

View File

@ -300,6 +300,14 @@ inline bool SyncthingConnection::hasUnreadNotifications() const
return m_unreadNotifications;
}
/*!
* \brief Considers all notifications as read; hence might trigger a status update.
*/
inline void SyncthingConnection::considerAllNotificationsRead()
{
m_unreadNotifications = false;
}
/*!
* \brief Returns the interval for polling traffic status (which currently can not be received via event API) in milliseconds.
* \remarks Default value is 2000 milliseconds.

View File

@ -24,13 +24,15 @@ public:
TrayIcon(QObject *parent = nullptr);
TrayMenu &trayMenu();
private slots:
void handleActivated(QSystemTrayIcon::ActivationReason reason);
void handleMessageClicked();
public slots:
void showInternalError(const QString &errorMsg);
void showSyncthingNotification(ChronoUtilities::DateTime when, const QString &message);
void updateStatusIconAndText(Data::SyncthingStatus status);
private slots:
void handleActivated(QSystemTrayIcon::ActivationReason reason);
void handleMessageClicked();
private:
QPixmap renderSvgImage(const QString &path);

View File

@ -243,6 +243,9 @@ void TrayWidget::showNotifications()
showDialog(dlg);
m_connection.considerAllNotificationsRead();
m_ui->notificationsPushButton->setHidden(true);
if(m_menu && m_menu->icon()) {
m_menu->icon()->updateStatusIconAndText(m_connection.status());
}
}
void TrayWidget::restartSyncthing()