summaryrefslogtreecommitdiff
blob: e9e33a91dcdae29b047008c4b8b798932c551a52 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
From 4655fb0affb4753eade7d6c92bb699e9d7dd3fb5 Mon Sep 17 00:00:00 2001
From: Eike Hein <hein@kde.org>
Date: Mon, 5 Nov 2012 23:06:26 +0100
Subject: [PATCH] Add an option for keeping the window open after the last
 session closes.

BUG:308850
---
 app/config/behaviorsettings.ui | 107 ++++++++++++++++++++++++-----------------
 app/config/yakuake.kcfg        |   5 ++
 app/mainwindow.cpp             |   2 +-
 3 files changed, 68 insertions(+), 46 deletions(-)

diff --git a/app/config/behaviorsettings.ui b/app/config/behaviorsettings.ui
index 2fce1c7..3759f7b 100644
--- a/app/config/behaviorsettings.ui
+++ b/app/config/behaviorsettings.ui
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>364</width>
-    <height>308</height>
+    <width>356</width>
+    <height>289</height>
    </rect>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
@@ -20,31 +20,49 @@
       <string comment="@title:group Group box label">General</string>
      </property>
      <layout class="QGridLayout" name="gridLayout">
-      <item row="0" column="0" colspan="2">
-       <widget class="QCheckBox" name="kcfg_OpenAfterStart">
+      <item row="6" column="0" colspan="2">
+       <widget class="QCheckBox" name="kcfg_FocusFollowsMouse">
         <property name="text">
-         <string comment="@option:check">Open window after program start</string>
+         <string comment="@option:check">Focus terminals when the mouse pointer is moved over them</string>
         </property>
        </widget>
       </item>
-      <item row="1" column="0" colspan="2">
-       <widget class="QCheckBox" name="kcfg_PollMouse">
+      <item row="4" column="1">
+       <widget class="QCheckBox" name="kcfg_ToggleToFocus">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
         <property name="whatsThis">
-         <string comment="@info:whatsthis">If this option is enabled, the window will automatically open when the mouse pointer is moved to the same edge of the screen that it would open on when using the shortcut.</string>
+         <string comment="@info:whatsthis">If this option is enabled, the shortcut normally used to open and retract the window will give it focus, rather than close it, if it has previously lost focus. Unless the window is set to show on all virtual desktops, this may cause the window manager to switch to the virtual desktop it currently resides on.</string>
         </property>
         <property name="text">
-         <string comment="@option:check">Open window when the mouse pointer touches the screen edge</string>
+         <string comment="@option:check">Use Open/Retract action to focus window</string>
         </property>
        </widget>
       </item>
-      <item row="2" column="0" colspan="2">
-       <widget class="QCheckBox" name="kcfg_KeepOpen">
+      <item row="3" column="1">
+       <widget class="QCheckBox" name="kcfg_KeepAbove">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
         <property name="text">
-         <string comment="@option:check">Keep window open when it loses focus</string>
+         <string comment="@option:check">Keep window above other windows</string>
         </property>
        </widget>
       </item>
-      <item row="3" column="0">
+      <item row="4" column="0">
        <spacer>
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
@@ -60,23 +78,31 @@
         </property>
        </spacer>
       </item>
-      <item row="3" column="1">
-       <widget class="QCheckBox" name="kcfg_KeepAbove">
-        <property name="enabled">
-         <bool>false</bool>
+      <item row="0" column="0" colspan="2">
+       <widget class="QCheckBox" name="kcfg_OpenAfterStart">
+        <property name="text">
+         <string comment="@option:check">Open window after program start</string>
         </property>
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
+       </widget>
+      </item>
+      <item row="1" column="0" colspan="2">
+       <widget class="QCheckBox" name="kcfg_PollMouse">
+        <property name="whatsThis">
+         <string comment="@info:whatsthis">If this option is enabled, the window will automatically open when the mouse pointer is moved to the same edge of the screen that it would open on when using the shortcut.</string>
         </property>
         <property name="text">
-         <string comment="@option:check">Keep window above other windows</string>
+         <string comment="@option:check">Open window when the mouse pointer touches the screen edge</string>
         </property>
        </widget>
       </item>
-      <item row="4" column="0">
+      <item row="2" column="0" colspan="2">
+       <widget class="QCheckBox" name="kcfg_KeepOpen">
+        <property name="text">
+         <string comment="@option:check">Keep window open when it loses focus</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="0">
        <spacer>
         <property name="orientation">
          <enum>Qt::Horizontal</enum>
@@ -92,29 +118,10 @@
         </property>
        </spacer>
       </item>
-      <item row="4" column="1">
-       <widget class="QCheckBox" name="kcfg_ToggleToFocus">
-        <property name="enabled">
-         <bool>false</bool>
-        </property>
-        <property name="sizePolicy">
-         <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
-          <horstretch>0</horstretch>
-          <verstretch>0</verstretch>
-         </sizepolicy>
-        </property>
-        <property name="whatsThis">
-         <string comment="@info:whatsthis">If this option is enabled, the shortcut normally used to open and retract the window will give it focus, rather than close it, if it has previously lost focus. Unless the window is set to show on all virtual desktops, this may cause the window manager to switch to the virtual desktop it currently resides on.</string>
-        </property>
-        <property name="text">
-         <string comment="@option:check">Use Open/Retract action to focus window</string>
-        </property>
-       </widget>
-      </item>
       <item row="5" column="0" colspan="2">
-       <widget class="QCheckBox" name="kcfg_FocusFollowsMouse">
+       <widget class="QCheckBox" name="kcfg_KeepOpenAfterLastSessionCloses">
         <property name="text">
-         <string comment="@option:check">Focus terminals when the mouse pointer is moved over them</string>
+         <string extracomment="@option:check">Keep window open after the last session is closed</string>
         </property>
        </widget>
       </item>
@@ -152,6 +159,16 @@
    </item>
   </layout>
  </widget>
+ <tabstops>
+  <tabstop>kcfg_OpenAfterStart</tabstop>
+  <tabstop>kcfg_PollMouse</tabstop>
+  <tabstop>kcfg_KeepOpen</tabstop>
+  <tabstop>kcfg_KeepAbove</tabstop>
+  <tabstop>kcfg_ToggleToFocus</tabstop>
+  <tabstop>kcg_KeepOpenAfterLastSessionCloses</tabstop>
+  <tabstop>kcfg_FocusFollowsMouse</tabstop>
+  <tabstop>kcfg_ConfirmQuit</tabstop>
+ </tabstops>
  <resources/>
  <connections>
   <connection>
diff --git a/app/config/yakuake.kcfg b/app/config/yakuake.kcfg
index e70418b..a71e9b3 100644
--- a/app/config/yakuake.kcfg
+++ b/app/config/yakuake.kcfg
@@ -41,6 +41,11 @@
       <whatsthis context="@info:whatsthis">Whether to keep the application window open when it loses focus.</whatsthis>
       <default>true</default>
     </entry>
+    <entry name="KeepOpenAfterLastSessionCloses" type="Bool">
+      <label context="@label">Keep window open after last session closes</label>
+      <whatsthis context="@info:whatsthis">Whether to keep the application window open after the last session is closed.</whatsthis>
+      <default>false</default>
+    </entry>
     <entry name="ToggleToFocus" type="Bool">
       <label context="@label">Use open/retract shortcut to focus window</label>
       <whatsthis context="@info:whatsthis">Whether the open/retract keyboard shortcut can be used to focus the application window when it is already open.</whatsthis>
diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp
index 3f51911..22b374d 100644
--- a/app/mainwindow.cpp
+++ b/app/mainwindow.cpp
@@ -538,7 +538,7 @@ void MainWindow::handleTerminalSilence(Terminal* terminal)
 
 void MainWindow::handleLastTabClosed()
 {
-    if (isVisible())
+    if (isVisible() && !Settings::keepOpenAfterLastSessionCloses())
         toggleWindowState();
 }
 
-- 
1.8.1.5