From 90bd5a8c4c03a872dfc1f505e2db130e90168cf1 Mon Sep 17 00:00:00 2001
From: Edric Milaret <edric.ladent-milaret@savoirfairelinux.com>
Date: Mon, 8 Jun 2015 10:07:59 -0400
Subject: [PATCH] autostart: add start minimized to commandline options

Refs #74811

Change-Id: Ia1c6929c2b46dc9815692e9dfe8be7350064fc90
---
 main.cpp  | 13 ++++++++++++-
 utils.cpp |  1 +
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/main.cpp b/main.cpp
index 861bcd5..35f390c 100644
--- a/main.cpp
+++ b/main.cpp
@@ -50,7 +50,18 @@ main(int argc, char *argv[])
     }
 
     MainWindow w;
-    w.show();
+
+    auto startMinimized = false;
+
+    for (auto string : QCoreApplication::arguments()) {
+        if (string == "-m" || string == "--minimized")
+            startMinimized = true;
+    }
+
+    if (not startMinimized)
+        w.show();
+    else
+        w.showMinimized();
 
     QObject::connect(&a, &QApplication::aboutToQuit, [&a]() {
         delete CallModel::instance();
diff --git a/utils.cpp b/utils.cpp
index 645fe0f..7e80f3b 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -46,6 +46,7 @@ Utils::CreateLink(LPCWSTR lpszPathObj, LPCWSTR lpszPathLink) {
     {
         IPersistFile* ppf;
         psl->SetPath(lpszPathObj);
+        psl->SetArguments(TEXT("--minimized"));
 
         hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);
         if (SUCCEEDED(hres))
-- 
GitLab