From 1982d26295beb43a050ec9a4c8eb4dcec157b3ed Mon Sep 17 00:00:00 2001 From: Martchus Date: Thu, 1 Aug 2019 19:08:58 +0200 Subject: [PATCH] Remove code duplication in SyncthingApplet --- plasmoid/lib/syncthingapplet.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/plasmoid/lib/syncthingapplet.cpp b/plasmoid/lib/syncthingapplet.cpp index b67d9fd..ea11113 100644 --- a/plasmoid/lib/syncthingapplet.cpp +++ b/plasmoid/lib/syncthingapplet.cpp @@ -343,12 +343,14 @@ void SyncthingApplet::showNotificationsDialog() void SyncthingApplet::dismissNotifications() { m_connection.considerAllNotificationsRead(); - if (!m_notifications.empty()) { - m_notifications.clear(); - emit notificationsAvailableChanged(false); - // update status as well because having or not having notifications is relevant for status text/icon - updateStatusIconAndTooltip(); + if (m_notifications.empty()) { + return; } + m_notifications.clear(); + emit notificationsAvailableChanged(false); + + // update status as well because having or not having notifications is relevant for status text/icon + updateStatusIconAndTooltip(); } void SyncthingApplet::showInternalErrorsDialog() @@ -428,13 +430,8 @@ void SyncthingApplet::handleConnectionStatusChanged(Data::SyncthingStatus previo return; } - // update whether passive setPassive(static_cast(newStatus) < passiveStates().size() && passiveStates().at(static_cast(newStatus)).isChecked()); - - // update status icon and tooltip text - m_statusInfo.updateConnectionStatus(m_connection); - m_statusInfo.updateConnectedDevices(m_connection); - emit connectionStatusChanged(); + updateStatusIconAndTooltip(); } void SyncthingApplet::handleDevicesChanged()