From 4a1a8ca5744cc9d30cb19330eff576b68c74ce65 Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Sun, 7 Jan 2024 18:33:23 +0300 Subject: [PATCH] UI: Restart on profile drive's reattach --- src/ui/conf/confappmanager.cpp | 17 +++++++++++++++-- src/ui/conf/confappmanager.h | 3 +++ src/ui/fortmanager.cpp | 7 +++---- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/ui/conf/confappmanager.cpp b/src/ui/conf/confappmanager.cpp index 4e4f6ef4..d2a85011 100644 --- a/src/ui/conf/confappmanager.cpp +++ b/src/ui/conf/confappmanager.cpp @@ -145,6 +145,8 @@ void ConfAppManager::setUp() purgeAppsOnStart(); setupAppEndTimer(); + + setupDbDriveMask(); } void ConfAppManager::purgeAppsOnStart() @@ -180,6 +182,13 @@ void ConfAppManager::updateAppEndTimer() } } +void ConfAppManager::setupDbDriveMask() +{ + const QString filePath = sqliteDb()->filePath(); + + m_dbDriveMask = FileUtil::driveMaskByPath(filePath); +} + void ConfAppManager::emitAppAlerted() { m_appAlertedTimer.startTrigger(); @@ -497,10 +506,14 @@ bool ConfAppManager::updateDriverConf(bool onlyFlags) void ConfAppManager::updateDriverConfByDriveMask(quint32 driveMask) { - if ((m_driveMask & driveMask) == 0) + if ((m_dbDriveMask & driveMask) != 0) { + IoC()->restart(); return; + } - updateDriverConf(); + if ((m_driveMask & driveMask) != 0) { + updateDriverConf(); + } } bool ConfAppManager::addOrUpdateApp(const App &app) diff --git a/src/ui/conf/confappmanager.h b/src/ui/conf/confappmanager.h index 5cdcfcfa..ce481423 100644 --- a/src/ui/conf/confappmanager.h +++ b/src/ui/conf/confappmanager.h @@ -61,6 +61,8 @@ protected: virtual void setupAppEndTimer(); void updateAppEndTimer(); + void setupDbDriveMask(); + private: bool deleteApp(qint64 appId, bool &isWildcard); @@ -86,6 +88,7 @@ private: bool checkEndTransaction(bool ok); private: + quint32 m_dbDriveMask = 0; quint32 m_driveMask = 0; ConfManager *m_confManager = nullptr; diff --git a/src/ui/fortmanager.cpp b/src/ui/fortmanager.cpp index c83a3eb4..64a18967 100644 --- a/src/ui/fortmanager.cpp +++ b/src/ui/fortmanager.cpp @@ -323,10 +323,9 @@ void FortManager::checkInstallDriver() const bool canInstallDriver = (settings->canInstallDriver() || settings->isPortable()) && settings->isMaster() && settings->isUserAdmin(); - if (!canInstallDriver) - return; - - installDriver(); + if (canInstallDriver) { + installDriver(); + } } void FortManager::setupEnvManager()