diff --git a/src/core/systemfactory.cpp b/src/core/systemfactory.cpp index b98a9c6ff..6afffba3e 100644 --- a/src/core/systemfactory.cpp +++ b/src/core/systemfactory.cpp @@ -55,6 +55,7 @@ SystemFactory::AutoStartStatus SystemFactory::getAutoStartStatus() { #endif } +#if defined(Q_OS_LINUX) QString SystemFactory::getAutostartDesktopFileLocation() { QString xdg_config_path(qgetenv("XDG_CONFIG_HOME")); QString desktop_file_location; @@ -77,6 +78,7 @@ QString SystemFactory::getAutostartDesktopFileLocation() { // No location found, return empty string. return desktop_file_location; } +#endif // TODO: Finish implementation of SystemFactory auto-start methods. bool SystemFactory::setAutoStartStatus(const AutoStartStatus &new_status) { diff --git a/src/core/systemfactory.h b/src/core/systemfactory.h index ec145164a..13329d71c 100644 --- a/src/core/systemfactory.h +++ b/src/core/systemfactory.h @@ -21,9 +21,11 @@ class SystemFactory { // new status failed. static bool setAutoStartStatus(const SystemFactory::AutoStartStatus &new_status); +#if defined(Q_OS_LINUX) // Returns standard location where auto-start .desktop files // should be placed. static QString getAutostartDesktopFileLocation(); +#endif }; #endif // SYSTEMFACTORY_H diff --git a/src/gui/systemtrayicon.cpp b/src/gui/systemtrayicon.cpp index 2b2e1b053..114ba59d5 100644 --- a/src/gui/systemtrayicon.cpp +++ b/src/gui/systemtrayicon.cpp @@ -66,10 +66,19 @@ void SystemTrayIcon::deleteInstance() { qDebug("Disabling tray icon and raising main application window."); static_cast((*s_trayIcon).parent())->display(); delete s_trayIcon.data(); + + // Make sure that application quits when last window is closed. + qApp->setQuitOnLastWindowClosed(true); } } void SystemTrayIcon::showPrivate() { + // Make sure that application does not exit some window (for example + // the settings window) gets closed. Behavior for main window + // is handled explicitly by FormMain::closeEvent() method. + qApp->setQuitOnLastWindowClosed(false); + + // Display the tray icon. QSystemTrayIcon::show(); qDebug("Tray icon displayed."); } @@ -78,7 +87,7 @@ void SystemTrayIcon::show() { #if defined(Q_OS_WIN) // Show immediately. qDebug("Showing tray icon immediately."); - show_private(); + showPrivate(); #else // Delay avoids race conditions and tray icon is properly displayed. qDebug("Showing tray icon with 1000 ms delay.");