Merge lp:~nikwen/ubuntu-terminal-app/exit-handling into lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot

Proposed by Niklas Wenzel
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 88
Merged at revision: 87
Proposed branch: lp:~nikwen/ubuntu-terminal-app/exit-handling
Merge into: lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot
Diff against target: 87 lines (+23/-5)
3 files modified
po/com.ubuntu.terminal.pot (+3/-4)
src/app/qml/TabsModel.qml (+15/-1)
src/app/qml/TerminalComponent.qml (+5/-0)
To merge this branch: bzr merge lp:~nikwen/ubuntu-terminal-app/exit-handling
Reviewer Review Type Date Requested Status
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
Ubuntu Phone Apps Jenkins Bot continuous-integration Approve
Review via email: mp+261770@code.launchpad.net

Commit message

Add the ability to close tabs using the "exit" command.
Automatically close the application when the last tab was closed using the "exit" command.

Description of the change

Add the ability to close tabs using the "exit" command.
Automatically close the application when the last tab was closed using the "exit" command.

As discussed in LP: #1372915.

To post a comment you must log in.
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
87. By Niklas Wenzel

Refactoring

Revision history for this message
Niklas Wenzel (nikwen) wrote :

I did some refactoring which will be helpful for the fix for LP: #1401994.

88. By Niklas Wenzel

Remove unnecessary connect

Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ubuntu Phone Apps Jenkins Bot (ubuntu-phone-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

This is excellent! Thanks so much for the contribution Niklas!

review: Approve
Revision history for this message
Niklas Wenzel (nikwen) wrote :

You're welcome and thanks for merging!

Revision history for this message
Niklas Wenzel (nikwen) wrote :

*approving. Sorry.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'po/com.ubuntu.terminal.pot'
2--- po/com.ubuntu.terminal.pot 2015-06-02 19:51:45 +0000
3+++ po/com.ubuntu.terminal.pot 2015-06-11 21:34:06 +0000
4@@ -8,8 +8,7 @@
5 msgstr ""
6 "Project-Id-Version: \n"
7 "Report-Msgid-Bugs-To: \n"
8-
9-"POT-Creation-Date: 2015-04-02 14:49+0200\n"
10+"POT-Creation-Date: 2015-06-11 23:33+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
14@@ -43,7 +42,7 @@
15 msgstr ""
16
17 #: ../src/app/qml/AuthenticationDialog.qml:50
18-msgid "Ok"
19+msgid "OK"
20 msgstr ""
21
22 #: ../src/app/qml/AuthenticationDialog.qml:62
23@@ -54,7 +53,7 @@
24 msgid "Authentication failed"
25 msgstr ""
26
27-#: ../src/app/qml/KeyboardBar.qml:163
28+#: ../src/app/qml/KeyboardBar.qml:174
29 msgid "Change Keyboard"
30 msgstr ""
31
32
33=== modified file 'src/app/qml/TabsModel.qml'
34--- src/app/qml/TabsModel.qml 2014-11-17 21:12:53 +0000
35+++ src/app/qml/TabsModel.qml 2015-06-11 21:34:06 +0000
36@@ -36,10 +36,24 @@
37 selectedIndex = index;
38 }
39
40+ function removeTabWithSession(session) {
41+ for (var i = 0; i < count; i++) {
42+ if (session === get(i).terminal.session) {
43+ removeTab(i);
44+ return;
45+ }
46+ }
47+ }
48+
49 function removeTab(index) {
50- if (tabsModel.count <= 1)
51+ if (count === 0 || index >= count)
52 return;
53+
54 get(index).terminal.destroy();
55+
56+ if (count === 1) // The last tab was closed, probably by running the "exit" command (otherwise this is prevented by the UI)
57+ Qt.quit();
58+
59 remove(index);
60
61 // Decrease the selected index to keep the state consistent.
62
63=== modified file 'src/app/qml/TerminalComponent.qml'
64--- src/app/qml/TerminalComponent.qml 2015-03-23 11:12:46 +0000
65+++ src/app/qml/TerminalComponent.qml 2015-06-11 21:34:06 +0000
66@@ -4,6 +4,7 @@
67
68 Component {
69 id: terminalComponent
70+
71 QMLTermWidget {
72 id: terminal
73 width: parent.width
74@@ -13,9 +14,13 @@
75 font.family: settings.fontStyle
76 font.pointSize: settings.fontSize
77
78+ signal sessionFinished(var session);
79+
80 session: QMLTermSession {
81 id: terminalSession
82 initialWorkingDirectory: workdir
83+
84+ onFinished: tabsModel.removeTabWithSession(terminalSession);
85 }
86
87 QMLTermScrollbar {

Subscribers

People subscribed via source and target branches