Allow selecting the core account to connect to from CLI 503/head
authorJanne Koschinski <janne@kuschku.de>
Fri, 26 Jul 2019 12:19:48 +0000 (14:19 +0200)
committerJanne Koschinski <janne@kuschku.de>
Fri, 26 Jul 2019 12:19:48 +0000 (14:19 +0200)
- adds new --account option
- if an account id is specified, connects to that account instead of
  asking or using any other defaults

src/common/quassel.cpp
src/qtui/mainwin.cpp

index 09d8037..0c6b863 100644 (file)
@@ -336,6 +336,7 @@ void Quassel::setupCliParser()
             {"icontheme", tr("Override the system icon theme ('breeze' is recommended)."), tr("theme")},
             {"qss", tr("Load a custom application stylesheet."), tr("file.qss")},
             {"hidewindow", tr("Start the client minimized to the system tray.")},
+            {"account", tr("Account id to connect to on startup."), tr("account"), "0"},
         };
     }
 
index 2b43a7e..5b0118a 100644 (file)
@@ -1195,7 +1195,8 @@ void MainWin::saveMainToolBarStatus(bool enabled)
 
 void MainWin::doAutoConnect()
 {
-    if (!Client::coreConnection()->connectToCore()) {
+    int accountId = Quassel::optionValue("account").toInt();
+    if (!Client::coreConnection()->connectToCore(accountId)) {
         // No autoconnect selected (or no accounts)
         showCoreConnectionDlg();
     }