UI: Restart on profile drive's reattach

This commit is contained in:
Nodir Temirkhodjaev 2024-01-07 18:33:23 +03:00
parent 906dd7ec8d
commit 4a1a8ca574
3 changed files with 21 additions and 6 deletions

View File

@ -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<WindowManager>()->restart();
return;
}
updateDriverConf();
if ((m_driveMask & driveMask) != 0) {
updateDriverConf();
}
}
bool ConfAppManager::addOrUpdateApp(const App &app)

View File

@ -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;

View File

@ -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()