Merge lp:~verzegnassi-stefano/ubuntu-terminal-app/layouts-q-argument into lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot

Proposed by Stefano Verzegnassi
Status: Merged
Approved by: Nicholas Skaggs
Approved revision: 158
Merged at revision: 162
Proposed branch: lp:~verzegnassi-stefano/ubuntu-terminal-app/layouts-q-argument
Merge into: lp:~ubuntu-terminal-dev/ubuntu-terminal-app/reboot
Diff against target: 45 lines (+21/-2)
1 file modified
src/app/main.cpp (+21/-2)
To merge this branch: bzr merge lp:~verzegnassi-stefano/ubuntu-terminal-app/layouts-q-argument
Reviewer Review Type Date Requested Status
Evan McIntire Approve
Jenkins Bot continuous-integration Approve
Review via email: mp+283786@code.launchpad.net

Commit message

Fixed layouts not found when terminal-app is launched with '-q' argument

Description of the change

Fixed layouts not found when terminal-app is launched with '-q' argument

To post a comment you must log in.
Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrea Bernabei (faenil) wrote :

small comment

157. By Stefano Verzegnassi

added debug output as per MP review

Revision history for this message
Stefano Verzegnassi (verzegnassi-stefano) wrote :

Done!

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Andrea Bernabei (faenil) wrote :

another comment :)

158. By Stefano Verzegnassi

Added output in case the default layouts folder doesn't exist, or no default layout has been found

Revision history for this message
Andrea Bernabei (faenil) wrote :

lgtm! thanks :)

Revision history for this message
Jenkins Bot (ubuntu-core-apps-jenkins-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Evan McIntire (mcintire-evan) wrote :

Works well, code all looks good to me - Thanks for the change!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/main.cpp'
2--- src/app/main.cpp 2015-03-23 17:46:34 +0000
3+++ src/app/main.cpp 2016-01-25 12:37:28 +0000
4@@ -40,7 +40,7 @@
5 QDir layoutDir(path);
6 layoutDir.setNameFilters(QStringList("*.json"));
7
8- QStringList jsonFiles = layoutDir.entryList();
9+ QStringList jsonFiles = layoutDir.entryList();
10
11 QStringList result;
12 foreach (QString s, jsonFiles) {
13@@ -174,12 +174,31 @@
14 qDebug() << "Trying to load QML from:" << path + "/qml/ubuntu-terminal-app.qml";
15 if (fi.exists()) {
16 qmlfile = path + "/qml/ubuntu-terminal-app.qml";
17- keyboardLayouts << getProfileFromDir(path + "/qml/KeyboardRows/Layouts/");
18 break;
19 }
20 }
21 }
22
23+ // Look for default layouts
24+ QDir keybLayoutDir = QFileInfo(qmlfile).dir();
25+ const QString &layoutsDir("KeyboardRows/Layouts");
26+
27+ if (keybLayoutDir.cd(layoutsDir)) {
28+ QString keybLayoutPath = keybLayoutDir.canonicalPath() + "/";
29+ qDebug() << "Retrieving default keyboard profiles from folder: " << keybLayoutPath;
30+
31+ QStringList kLayouts = getProfileFromDir(keybLayoutPath);
32+
33+ if (kLayouts.isEmpty()) {
34+ qDebug() << "No default keyboard profile found.";
35+ } else {
36+ keyboardLayouts << kLayouts;
37+ }
38+ } else {
39+ qDebug() << "Not able to locate default keyboard profiles folder:" << keybLayoutDir.canonicalPath() + "/" + layoutsDir;
40+ }
41+
42+ // Look for user-defined layouts
43 QStringList configLocations = QStandardPaths::standardLocations(QStandardPaths::ConfigLocation);
44 foreach (const QString &path, configLocations) {
45 QString fullPath = path + "/com.ubuntu.terminal/Layouts/";

Subscribers

People subscribed via source and target branches