mirror of
https://github.com/tnodir/fort
synced 2024-11-15 05:18:07 +00:00
UI: Create/remove an "inst.tmp" by Service early
This commit is contained in:
parent
df7757c2ea
commit
df812cb097
@ -267,6 +267,8 @@ void FortManager::install(const char *arg)
|
||||
case 's': { // "service"
|
||||
StartupUtil::setAutoRunMode(StartupUtil::StartupAllUsers);
|
||||
StartupUtil::setServiceInstalled(true);
|
||||
|
||||
OsUtil::endRestartClients();
|
||||
} break;
|
||||
case 'e': { // "explorer"
|
||||
StartupUtil::setExplorerIntegrated(true);
|
||||
|
@ -83,7 +83,7 @@ void AutoUpdateManager::setupRestart()
|
||||
{
|
||||
if (IoC<FortSettings>()->isService()) {
|
||||
connect(IoC<ServiceManager>(), &ServiceManager::stopRestartingRequested, this,
|
||||
&AutoUpdateManager::restartClients);
|
||||
&AutoUpdateManager::onRestartClientsRequested);
|
||||
} else {
|
||||
if (!OsUtil::registerAppRestart()) {
|
||||
qCWarning(LC) << "Restart registration error";
|
||||
@ -146,6 +146,15 @@ void AutoUpdateManager::setupByTaskInfo(TaskInfoUpdateChecker *taskInfo)
|
||||
setIsDownloaded(downloaded);
|
||||
}
|
||||
|
||||
void AutoUpdateManager::onRestartClientsRequested(bool restarting)
|
||||
{
|
||||
if (restarting) {
|
||||
OsUtil::beginRestartClients();
|
||||
}
|
||||
|
||||
emit restartClients(restarting);
|
||||
}
|
||||
|
||||
void AutoUpdateManager::clearUpdateDir()
|
||||
{
|
||||
if (isDownloaded())
|
||||
|
@ -74,6 +74,8 @@ protected slots:
|
||||
private:
|
||||
void setupByTaskInfo(TaskInfoUpdateChecker *taskInfo);
|
||||
|
||||
void onRestartClientsRequested(bool restarting);
|
||||
|
||||
void clearUpdateDir();
|
||||
|
||||
bool saveInstaller(const QByteArray &fileData);
|
||||
|
@ -180,6 +180,16 @@ bool OsUtil::registerAppRestart()
|
||||
RegisterApplicationRestart(L"--restarted", RESTART_NO_CRASH | RESTART_NO_REBOOT));
|
||||
}
|
||||
|
||||
void OsUtil::beginRestartClients()
|
||||
{
|
||||
FileUtil::writeFileData(FileUtil::appBinLocation() + "/inst.tmp", {});
|
||||
}
|
||||
|
||||
void OsUtil::endRestartClients()
|
||||
{
|
||||
FileUtil::removeFile(FileUtil::appBinLocation() + "/inst.tmp");
|
||||
}
|
||||
|
||||
void OsUtil::restartClient()
|
||||
{
|
||||
const QFileInfo fi(QCoreApplication::applicationFilePath());
|
||||
|
@ -44,7 +44,10 @@ public:
|
||||
|
||||
static bool registerAppRestart();
|
||||
|
||||
static void beginRestartClients();
|
||||
static void endRestartClients();
|
||||
static void restartClient();
|
||||
|
||||
static void restart();
|
||||
static void quit(const QString &reason);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user