diff --git a/src/gui/application.cpp b/src/gui/application.cpp index 81ce3ee53107b..f962f9b14dde8 100644 --- a/src/gui/application.cpp +++ b/src/gui/application.cpp @@ -639,15 +639,7 @@ void Application::slotownCloudWizardDone(int res) _checkConnectionTimer.start(); slotCheckConnection(); - bool shouldSetAutoStart = true; - -#ifdef Q_OS_MAC - // Don't auto start when not being 'installed' - shouldSetAutoStart = shouldSetAutoStart - && QCoreApplication::applicationDirPath().startsWith("/Applications/"); -#endif - - Utility::setLaunchOnStartup(_theme->appName(), _theme->appNameGUI(), shouldSetAutoStart); + Utility::setLaunchOnStartup(_theme->appName(), _theme->appNameGUI(), true); Systray::instance()->showWindow(); } diff --git a/src/gui/generalsettings.cpp b/src/gui/generalsettings.cpp index 114aab7cd9dd8..0b32d9db47b69 100644 --- a/src/gui/generalsettings.cpp +++ b/src/gui/generalsettings.cpp @@ -155,16 +155,14 @@ GeneralSettings::GeneralSettings(QWidget *parent) _ui->showInExplorerNavigationPaneCheckBox->setText(txt); #endif - if(Utility::hasSystemLaunchOnStartup(Theme::instance()->appName())) { - _ui->autostartCheckBox->setChecked(true); - _ui->autostartCheckBox->setDisabled(true); + if(const auto hasSystemAutoStart = Utility::hasSystemLaunchOnStartup(Theme::instance()->appName())) { + _ui->autostartCheckBox->setChecked(hasSystemAutoStart); + _ui->autostartCheckBox->setDisabled(hasSystemAutoStart); _ui->autostartCheckBox->setToolTip(tr("You cannot disable autostart because system-wide autostart is enabled.")); } else { - const bool hasAutoStart = Utility::hasLaunchOnStartup(Theme::instance()->appName()); - // make sure the binary location is correctly set - slotToggleLaunchOnStartup(hasAutoStart); - _ui->autostartCheckBox->setChecked(hasAutoStart); + const auto hasAutoStart = Utility::hasLaunchOnStartup(Theme::instance()->appName()); connect(_ui->autostartCheckBox, &QAbstractButton::toggled, this, &GeneralSettings::slotToggleLaunchOnStartup); + _ui->autostartCheckBox->setChecked(hasAutoStart); } // setup about section @@ -456,7 +454,7 @@ void GeneralSettings::saveMiscSettings() void GeneralSettings::slotToggleLaunchOnStartup(bool enable) { - Theme *theme = Theme::instance(); + const auto theme = Theme::instance(); Utility::setLaunchOnStartup(theme->appName(), theme->appNameGUI(), enable); }