diff --git a/src/ui/conf/confappmanager.cpp b/src/ui/conf/confappmanager.cpp index 2c298c26..5dfa49a2 100644 --- a/src/ui/conf/confappmanager.cpp +++ b/src/ui/conf/confappmanager.cpp @@ -188,6 +188,21 @@ void ConfAppManager::updateAppEndTimer() } } +void ConfAppManager::onAddOrUpdateApp(const App &app, bool onlyUpdate) +{ + if (!app.endTime.isNull()) { + updateAppEndTimer(); + } + + if (onlyUpdate) { + emitAppUpdated(); + } else { + emitAppsChanged(); + } + + updateDriverUpdateAppConf(app); +} + void ConfAppManager::emitAppAlerted() { m_appAlertedTimer.startTrigger(); @@ -255,24 +270,14 @@ bool ConfAppManager::addOrUpdateApp(const App &app, bool onlyUpdate) if (ok) { // Alert - const char *alertSql = app.alerted && !onlyUpdate ? sqlInsertAppAlert : sqlDeleteAppAlert; + const char *alertSql = (app.alerted && !onlyUpdate) ? sqlInsertAppAlert : sqlDeleteAppAlert; sqliteDb()->executeEx(alertSql, { appIdVar }); } commitTransaction(ok); if (ok) { - if (!app.endTime.isNull()) { - updateAppEndTimer(); - } - - if (onlyUpdate) { - emitAppUpdated(); - } else { - emitAppsChanged(); - } - - updateDriverUpdateAppConf(app); + onAddOrUpdateApp(app, onlyUpdate); } return ok; diff --git a/src/ui/conf/confappmanager.h b/src/ui/conf/confappmanager.h index 97e31669..9ba01706 100644 --- a/src/ui/conf/confappmanager.h +++ b/src/ui/conf/confappmanager.h @@ -63,6 +63,8 @@ protected: void updateAppEndTimer(); private: + void onAddOrUpdateApp(const App &app, bool onlyUpdate); + bool deleteApp(qint64 appId, bool &isWildcard); bool updateAppBlocked(qint64 appId, bool blocked, bool killProcess, bool &isWildcard);