Optionally start minimized to tray
authorBas Pape <baspape@gmail.com>
Wed, 20 Jun 2012 22:19:33 +0000 (00:19 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Wed, 6 Mar 2013 18:44:07 +0000 (19:44 +0100)
Restores mimized to tray if it was closed as such and adds an option to
force starting mimized to tray (if a tray is available). Fixed #1133

src/common/main.cpp
src/qtui/mainwin.cpp

index c0ffabf..198e76b 100644 (file)
@@ -98,6 +98,7 @@ int main(int argc, char **argv)
     cliParser->addOption("qss <file.qss>", 0, "Load a custom application stylesheet");
     cliParser->addSwitch("debugbufferswitches", 0, "Enables debugging for bufferswitches");
     cliParser->addSwitch("debugmodel", 0, "Enables debugging for models");
     cliParser->addOption("qss <file.qss>", 0, "Load a custom application stylesheet");
     cliParser->addSwitch("debugbufferswitches", 0, "Enables debugging for bufferswitches");
     cliParser->addSwitch("debugmodel", 0, "Enables debugging for models");
+    cliParser->addSwitch("hidewindow", 0, "Start the client minimized to the system tray");
 #endif
 #ifndef BUILD_QTUI
     // put core-only arguments here
 #endif
 #ifndef BUILD_QTUI
     // put core-only arguments here
index bf7cda3..fc53283 100644 (file)
@@ -306,7 +306,9 @@ void MainWin::restoreStateFromSettings(UiSettings &s)
     move(_normalPos);
 #endif
 
     move(_normalPos);
 #endif
 
-    if (s.value("MainWinHidden").toBool() && QtUi::haveSystemTray())
+    if ((Quassel::isOptionSet("hidewindow")
+            || s.value("MainWinHidden").toBool())
+            && _systemTray->isSystemTrayAvailable())
         QtUi::hideMainWidget();
     else if (s.value("MainWinMinimized").toBool())
         showMinimized();
         QtUi::hideMainWidget();
     else if (s.value("MainWinMinimized").toBool())
         showMinimized();