diff --git a/src/core/Config.cpp b/src/core/Config.cpp index 442c45808..c03e720ce 100644 --- a/src/core/Config.cpp +++ b/src/core/Config.cpp @@ -98,9 +98,7 @@ static const QHash configStrings = { {Config::GUI_HidePreviewPanel, {QS("GUI/HidePreviewPanel"), Roaming, false}}, {Config::GUI_AlwaysOnTop, {QS("GUI/GUI_AlwaysOnTop"), Local, false}}, {Config::GUI_ToolButtonStyle, {QS("GUI/ToolButtonStyle"), Roaming, Qt::ToolButtonIconOnly}}, -#ifdef KEEPASSXC_DIST_FLATPAK {Config::GUI_LaunchAtStartup, {QS("GUI/LaunchAtStartup"), Roaming, false}}, -#endif {Config::GUI_ShowTrayIcon, {QS("GUI/ShowTrayIcon"), Roaming, false}}, {Config::GUI_TrayIconAppearance, {QS("GUI/TrayIconAppearance"), Roaming, {}}}, {Config::GUI_MinimizeToTray, {QS("GUI/MinimizeToTray"), Roaming, false}}, diff --git a/src/core/Config.h b/src/core/Config.h index df8bb209e..db3187caa 100644 --- a/src/core/Config.h +++ b/src/core/Config.h @@ -79,9 +79,7 @@ public: GUI_HidePreviewPanel, GUI_AlwaysOnTop, GUI_ToolButtonStyle, -#ifdef KEEPASSXC_DIST_FLATPAK GUI_LaunchAtStartup, -#endif GUI_ShowTrayIcon, GUI_TrayIconAppearance, GUI_MinimizeToTray, diff --git a/src/gui/osutils/nixutils/NixUtils.cpp b/src/gui/osutils/nixutils/NixUtils.cpp index a5c18d8d8..0aa7e0972 100644 --- a/src/gui/osutils/nixutils/NixUtils.cpp +++ b/src/gui/osutils/nixutils/NixUtils.cpp @@ -18,19 +18,17 @@ #include "NixUtils.h" #include "config-keepassx.h" +#include "core/Config.h" #include #include #include #include #include +#include #include #include #include -#ifdef KEEPASSXC_DIST_FLATPAK -#include "core/Config.h" -#include -#endif #ifdef WITH_XC_X11 #include @@ -129,9 +127,8 @@ QString NixUtils::getAutostartDesktopFilename(bool createDirs) const bool NixUtils::isLaunchAtStartupEnabled() const { -#if !defined(KEEPASSXC_DIST_FLATPAK) +#ifndef KEEPASSXC_DIST_FLATPAK return QFile::exists(getAutostartDesktopFilename()); - ; #else return config()->get(Config::GUI_LaunchAtStartup).toBool(); #endif @@ -139,7 +136,7 @@ bool NixUtils::isLaunchAtStartupEnabled() const void NixUtils::setLaunchAtStartup(bool enable) { -#if !defined(KEEPASSXC_DIST_FLATPAK) +#ifndef KEEPASSXC_DIST_FLATPAK if (enable) { QFile desktopFile(getAutostartDesktopFilename(true)); if (!desktopFile.open(QIODevice::WriteOnly)) { @@ -201,7 +198,7 @@ void NixUtils::setLaunchAtStartup(bool enable) SLOT(launchAtStartupRequested(uint, QVariantMap))); if (!res) { - qDebug() << "Could not connect to org.freedesktop.portal.Request::Response signal"; + qDebug() << "DBus Error: could not connect to org.freedesktop.portal.Request"; } #endif } @@ -209,14 +206,11 @@ void NixUtils::setLaunchAtStartup(bool enable) void NixUtils::launchAtStartupRequested(uint response, const QVariantMap& results) { if (response > 0) { - qDebug() << "The interaction was cancelled"; + qDebug() << "DBus Error: the request to autostart was cancelled."; return; } - bool isLauchedAtStartup = results["autostart"].value(); - qDebug() << "The autostart value is set to:" << isLauchedAtStartup; -#if defined(KEEPASSXC_DIST_FLATPAK) - config()->set(Config::GUI_LaunchAtStartup, isLauchedAtStartup); -#endif + + config()->set(Config::GUI_LaunchAtStartup, results["autostart"].value()); } bool NixUtils::isCapslockEnabled()