From 270e19a155c426431d437fb699b919ce30823d20 Mon Sep 17 00:00:00 2001 From: Grigory Ustinov Date: Fri, 22 Feb 2019 19:09:16 +0300 Subject: [PATCH] Fixup working with startupLaunch value This commit fixes problem, when you want to import or export information about startup. --- src/utils/confighandler.cpp | 16 ++++++++++++++++ src/utils/confighandler.h | 1 + 2 files changed, 17 insertions(+) diff --git a/src/utils/confighandler.cpp b/src/utils/confighandler.cpp index 46a34f74..ef859a7e 100644 --- a/src/utils/confighandler.cpp +++ b/src/utils/confighandler.cpp @@ -242,6 +242,21 @@ void ConfigHandler::setKeepOpenAppLauncher(const bool keepOpen) { bool ConfigHandler::startupLaunchValue() { bool res = false; + + if (m_settings.contains(QStringLiteral("startupLaunch"))) { + res = m_settings.value(QStringLiteral("startupLaunch")).toBool(); + } + + if (res != verifyLaunchFile()) { + setStartupLaunch(res); + } + + return res; +} + +bool ConfigHandler::verifyLaunchFile() { + bool res = false; + #if defined(Q_OS_LINUX) || defined(Q_OS_UNIX) QString path = QDir::homePath() + "/.config/autostart/Flameshot.desktop"; res = QFile(path).exists(); @@ -281,6 +296,7 @@ void ConfigHandler::setStartupLaunch(const bool start) { bootUpSettings.remove("Flameshot"); } #endif + m_settings.setValue(QStringLiteral("startupLaunch"), start); } int ConfigHandler::contrastOpacityValue() { diff --git a/src/utils/confighandler.h b/src/utils/confighandler.h index 00b6cfa9..040aa0bf 100644 --- a/src/utils/confighandler.h +++ b/src/utils/confighandler.h @@ -61,6 +61,7 @@ class ConfigHandler { bool keepOpenAppLauncherValue(); void setKeepOpenAppLauncher(const bool); + bool verifyLaunchFile(); bool startupLaunchValue(); void setStartupLaunch(const bool);