summarylogtreecommitdiffstats
path: root/0001-fix-minimizing-on-copy-if-running-under-KDE-Plasma.patch
blob: 8fcb02df1adc8bbcfedac727185b76dc7ccae243 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 1af49828a7964b69c003e64e375bddb0580baaa0 Mon Sep 17 00:00:00 2001
From: magum <magum@home>
Date: Mon, 8 Jun 2020 12:45:15 +0300
Subject: [PATCH] fix minimizing on copy if running under KDE Plasma

it is workaround old Qt bug https://bugreports.qt.io/browse/QTBUG-25727

Fixes: https://github.com/keepassxreboot/keepassxc/issues/2793
---
 src/gui/DatabaseWidget.cpp | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp
index 990cf4e3..887466bc 100644
--- a/src/gui/DatabaseWidget.cpp
+++ b/src/gui/DatabaseWidget.cpp
@@ -61,6 +61,7 @@
 #include "gui/group/GroupView.h"
 #include "keeshare/KeeShare.h"
 #include "touchid/TouchID.h"
+#include "MainWindow.h"
 
 #ifdef WITH_XC_NETWORKING
 #include "gui/IconDownloaderDialog.h"
@@ -667,12 +668,22 @@ void DatabaseWidget::showTotpKeyQrCode()
     }
 }
 
+MainWindow* getMainWindow();
+
 void DatabaseWidget::setClipboardTextAndMinimize(const QString& text)
 {
     clipboard()->setText(text);
     if (config()->get("HideWindowOnCopy").toBool()) {
         if (config()->get("MinimizeOnCopy").toBool()) {
-            window()->showMinimized();
+            if (config()->get("GUI/MinimizeToTray").toBool())
+            {
+                getMainWindow()->hideWindow();
+
+            } else {
+                window()->setWindowState(window()->windowState() | Qt::WindowMinimized);
+                QApplication::processEvents();
+                window()->setWindowState(window()->windowState() & ~Qt::WindowMinimized);
+            }
         } else if (config()->get("DropToBackgroundOnCopy").toBool()) {
             window()->lower();
         }
-- 
2.27.0