Merge lp:~mzanetti/unity-scopes-shell/activate-appid-2 into lp:unity-scopes-shell

Proposed by Michael Zanetti
Status: Merged
Approved by: Michal Hruby
Approved revision: 50
Merged at revision: 68
Proposed branch: lp:~mzanetti/unity-scopes-shell/activate-appid-2
Merge into: lp:unity-scopes-shell
Diff against target: 46 lines (+11/-16)
1 file modified
src/Unity/scope.cpp (+11/-16)
To merge this branch: bzr merge lp:~mzanetti/unity-scopes-shell/activate-appid-2
Reviewer Review Type Date Requested Status
Michal Hruby (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+205443@code.launchpad.net

Commit message

Activate applications by the appId instead of the path to the desktop file to align it with how the rest of unity8 works.

Description of the change

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

N/A

 * 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 :
review: Approve (continuous-integration)
Revision history for this message
Michal Hruby (mhr3) wrote :

New scopes are already doing this, and support for old scopes will hopefully go away soon, so unless you terribly needed this yesterday, I think we can forget about it.

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

> New scopes are already doing this, and support for old scopes will hopefully
> go away soon, so unless you terribly needed this yesterday, I think we can
> forget about it.

We do need this in case the right-edge lands before the new scopes.

Revision history for this message
Michal Hruby (mhr3) wrote :

Fine with me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Unity/scope.cpp'
2--- src/Unity/scope.cpp 2013-12-11 15:58:54 +0000
3+++ src/Unity/scope.cpp 2014-02-07 19:16:42 +0000
4@@ -32,6 +32,8 @@
5 #include <QDebug>
6 #include <QtGui/QDesktopServices>
7 #include <QQmlEngine>
8+#include <QFileInfo>
9+#include <QDir>
10
11 #include <UnityCore/Variant.h>
12 #include <UnityCore/GLibWrapper.h>
13@@ -287,25 +289,18 @@
14 return;
15 }
16 if (url.scheme() == "application") {
17- // get the full path to the desktop file
18 QString path(url.path().isEmpty() ? url.authority() : url.path());
19- if (path.startsWith("/")) {
20- Q_EMIT activateApplication(path);
21- } else {
22- // TODO: use the new desktop file finder/parser when it's ready
23- gchar* full_path = nullptr;
24- GKeyFile* key_file = g_key_file_new();
25- QString apps_path = "applications/" + path;
26- if (g_key_file_load_from_data_dirs(key_file, apps_path.toLocal8Bit().constData(), &full_path,
27- G_KEY_FILE_NONE, nullptr)) {
28- path = full_path;
29- Q_EMIT activateApplication(path);
30- } else {
31- qWarning() << "Unable to activate " << path;
32+ if (path.startsWith('/')) {
33+ Q_FOREACH(const QString &dir, QStandardPaths::standardLocations(QStandardPaths::ApplicationsLocation)) {
34+ if (path.startsWith(dir)) {
35+ path.remove(dir);
36+ path.replace('/', '-');
37+ break;
38+ }
39 }
40- g_key_file_free(key_file);
41- g_free(full_path);
42 }
43+
44+ Q_EMIT activateApplication(QFileInfo(path).completeBaseName());
45 return;
46 }
47

Subscribers

People subscribed via source and target branches

to all changes: