Merge lp:~mzanetti/unity8/support-short-appid-in-gsettings into lp:unity8

Proposed by Michael Zanetti
Status: Merged
Approved by: Gerry Boland
Approved revision: 753
Merged at revision: 897
Proposed branch: lp:~mzanetti/unity8/support-short-appid-in-gsettings
Merge into: lp:unity8
Diff against target: 110 lines (+29/-15)
1 file modified
plugins/Unity/Launcher/backend/launcherbackend.cpp (+29/-15)
To merge this branch: bzr merge lp:~mzanetti/unity8/support-short-appid-in-gsettings
Reviewer Review Type Date Requested Status
Gerry Boland (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Michał Sawicz Needs Information
Review via email: mp+209071@code.launchpad.net

Commit message

support appid:// entries in gsettings schema and make findDesktopFile work with short-appid

Description of the change

This is now able to load appid:// entries from gsettings and can find .desktop files for short-appids, however, unity still fails to launch applications by short-appid. So this doesn't fully work until the ApplicationManager is patched to support that.

 * Are there any related MPs required for this MP to build/function as expected? Please list.

https://code.launchpad.net/~gerboland/unity-mir/shortAppIds-0.1.9/+merge/219377

 * Did you perform an exploratory manual test run of your code change and any related functionality?

Yes.

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?

N/A

 * If you changed the UI, has there been a design review?

N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:747
http://jenkins.qa.ubuntu.com/job/unity8-ci/2506/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3960
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3545
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1376
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1027
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1031
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1031/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1027
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3457
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3995
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/3995/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3547
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3547/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5880
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4834

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2506/rebuild

review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:748
http://jenkins.qa.ubuntu.com/job/unity8-ci/2510/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3967
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3552
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1380
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1031
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1035
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1035/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1031
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3462
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4002
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4002/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3554
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3554/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5888
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4844

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2510/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Checklist, please, and is there work ongoing on the ApplicationManager for the corresponding fix?

review: Needs Information
Revision history for this message
Michael Zanetti (mzanetti) wrote :

> Checklist, please, and is there work ongoing on the ApplicationManager for the
> corresponding fix?

Checklist added. I'm not aware of any activities related this in the AppManager yet.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gerry Boland (gerboland) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Unity/Launcher/backend/launcherbackend.cpp'
2--- plugins/Unity/Launcher/backend/launcherbackend.cpp 2014-04-29 15:38:32 +0000
3+++ plugins/Unity/Launcher/backend/launcherbackend.cpp 2014-05-13 11:25:10 +0000
4@@ -31,7 +31,6 @@
5 class LauncherBackendItem
6 {
7 public:
8- QString desktopFile;
9 QString displayName;
10 QString icon;
11 int count;
12@@ -107,11 +106,6 @@
13
14 QString LauncherBackend::desktopFile(const QString &appId) const
15 {
16- LauncherBackendItem *item = m_itemCache.value(appId, nullptr);
17- if (item) {
18- return item->desktopFile;
19- }
20-
21 return findDesktopFile(appId);
22 }
23
24@@ -264,7 +258,7 @@
25 Q_FOREACH(const QString &entry, gSettings.get("favorites").toStringList()) {
26 if (entry.startsWith("application://")) {
27 QString appId = entry;
28- // Transform "application://foobar.desktop" to "foobar"
29+ // Transform "application://foobar.desktop" to "application://foobar"
30 appId.remove("application://");
31 if (appId.endsWith(".desktop")) {
32 appId.chop(8);
33@@ -279,6 +273,26 @@
34 }
35 }
36 }
37+ if (entry.startsWith("appid://")) {
38+ QString appId = entry;
39+ appId.remove("appid://");
40+ // Strip hook name and current-user-version in case its there
41+
42+ if (appId.split('/').count() != 3) {
43+ qWarning() << "ignoring entry " + appId + ". Not a valid appId.";
44+ continue;
45+ }
46+ appId = appId.split('/').first() + "_" + appId.split('/').at(1);
47+ QString df = findDesktopFile(appId);
48+
49+ if (!df.isEmpty()) {
50+ m_storedApps << appId;
51+
52+ if (!m_itemCache.contains(appId)) {
53+ m_itemCache.insert(appId, parseDesktopFile(df));
54+ }
55+ }
56+ }
57 }
58 } else {
59 for (const QVariant &app: apps) {
60@@ -315,10 +329,13 @@
61 helper = helper.replace(dashPos, 1, '/');
62 }
63
64- Q_FOREACH(const QString &searchDir, searchDirs) {
65- QFileInfo fileInfo(QDir(searchDir), helper + ".desktop");
66- if (fileInfo.exists()) {
67- return fileInfo.absoluteFilePath();
68+ Q_FOREACH(const QString &searchDirName, searchDirs) {
69+ QDir searchDir(searchDirName);
70+ Q_FOREACH(const QString &desktopFile, searchDir.entryList(QStringList() << "*.desktop")) {
71+ if (desktopFile.startsWith(helper)) {
72+ QFileInfo fileInfo(searchDir, desktopFile);
73+ return fileInfo.absoluteFilePath();
74+ }
75 }
76 }
77
78@@ -333,7 +350,6 @@
79 QSettings settings(desktopFile, QSettings::IniFormat);
80
81 LauncherBackendItem* item = new LauncherBackendItem();
82- item->desktopFile = desktopFile;
83 item->displayName = settings.value("Desktop Entry/Name").toString();
84
85 QString iconString = settings.value("Desktop Entry/Icon").toString();
86@@ -367,7 +383,7 @@
87 qWarning() << "Unable to parse desktop file for" << appId << "path" << df;
88 }
89 } else {
90- qDebug() << "Unable to find desktop file for:" << appId;
91+ qWarning() << "Unable to find desktop file for:" << appId;
92 }
93 }
94
95@@ -391,7 +407,6 @@
96
97 item = new LauncherBackendItem();
98
99- item->desktopFile = details.value("desktopFile").toString();
100 item->displayName = details.value("name").toString();
101 item->icon = details.value("icon").toString();
102 item->count = details.value("count").toInt();
103@@ -408,7 +423,6 @@
104 details.insert("id", appId);
105 details.insert("name", item->displayName);
106 details.insert("icon", item->icon);
107- details.insert("desktopFile", item->desktopFile);
108 details.insert("count", item->count);
109 details.insert("countVisible", item->countVisible);
110 return details;

Subscribers

People subscribed via source and target branches