fix - 'Launch at startup feature' doesn't work after uncheck/check in the Configuration window
(cherry picked from commit 2d3b02b462300a3de24f2d4115086b5ae7c7bd46)
This commit is contained in:
@@ -318,31 +318,29 @@ bool ConfigHandler::startupLaunchValue()
|
||||
|
||||
bool ConfigHandler::verifyLaunchFile()
|
||||
{
|
||||
bool res = false;
|
||||
|
||||
#if defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
|
||||
QString path = QStandardPaths::locate(QStandardPaths::GenericConfigLocation,
|
||||
"autostart/",
|
||||
QStandardPaths::LocateDirectory) +
|
||||
"Flameshot.desktop";
|
||||
res = QFile(path).exists();
|
||||
bool res = QFile(path).exists();
|
||||
#elif defined(Q_OS_WIN)
|
||||
QSettings bootUpSettings(
|
||||
"HKEY_CURRENT_USER\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",
|
||||
QSettings::NativeFormat);
|
||||
res = bootUpSettings.value("Flameshot").toString() ==
|
||||
QDir::toNativeSeparators(QCoreApplication::applicationFilePath());
|
||||
bool res =
|
||||
bootUpSettings.value("Flameshot").toString() ==
|
||||
QDir::toNativeSeparators(QCoreApplication::applicationFilePath());
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
void ConfigHandler::setStartupLaunch(const bool start)
|
||||
{
|
||||
|
||||
m_settings.setValue(QStringLiteral("startupLaunch"), start);
|
||||
if (start == m_settings.value(QStringLiteral("startupLaunch")).toBool()) {
|
||||
return;
|
||||
}
|
||||
m_settings.setValue(QStringLiteral("startupLaunch"), start);
|
||||
#if defined(Q_OS_MACOS)
|
||||
/* TODO - there should be more correct way via API, but didn't find it
|
||||
without extra dependencies, there should be something like that:
|
||||
|
||||
Reference in New Issue
Block a user