Merge lp:~gerboland/unity-mir/fix-click into lp:unity-mir

Proposed by Gerry Boland
Status: Merged
Approved by: Michał Sawicz
Approved revision: 60
Merged at revision: 59
Proposed branch: lp:~gerboland/unity-mir/fix-click
Merge into: lp:unity-mir
Diff against target: 90 lines (+20/-9)
3 files modified
src/modules/Unity/ApplicationManager/application_manager.cpp (+12/-4)
src/modules/Unity/ApplicationManager/desktopfilereader.cpp (+4/-3)
src/modules/Unity/ApplicationManager/desktopfilereader.h (+4/-2)
To merge this branch: bzr merge lp:~gerboland/unity-mir/fix-click
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Michał Sawicz Approve
Review via email: mp+181881@code.launchpad.net

Commit message

AppMan: Fix 2 issues causing click packaged apps to fail to open.

First was that command line arguments were reversed
Second that "Path:" specified in the desktop file was not being respected.

Patches ported from qtubuntu, originally authored by Michał Sawicz

Description of the change

Fix 2 issues causing click packaged apps to fail to open. Patches ported from qtubuntu

To post a comment you must log in.
Revision history for this message
Michał Sawicz (saviq) :
review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/modules/Unity/ApplicationManager/application_manager.cpp'
2--- src/modules/Unity/ApplicationManager/application_manager.cpp 2013-08-22 15:33:55 +0000
3+++ src/modules/Unity/ApplicationManager/application_manager.cpp 2013-08-23 17:34:27 +0000
4@@ -159,7 +159,7 @@
5 DASSERT(execArguments.size() > 0);
6 QString exec(execArguments[0]);
7 const int kSize = execArguments.size();
8- for (int i = 1; i < kSize; i++) {
9+ for (int i = kSize - 1; i > 0; i--) {
10 if ((execArguments[i].size() == 2) && (execArguments[i][0].toLatin1() == '%')) {
11 const char kChar = execArguments[i][1].toLatin1();
12 if (kChar == 'F' || kChar == 'u' || kChar == 'U' || kChar == 'd' || kChar == 'D'
13@@ -181,9 +181,17 @@
14
15 bool result;
16 qint64 pid = 0;
17- struct passwd* passwd = getpwuid(getuid());
18- DLOG("current working directory: '%s'", passwd ? passwd->pw_dir : "/");
19- result = QProcess::startDetached(exec, arguments, QString(passwd ? passwd->pw_dir : "/"), &pid);
20+ QString path = "/";
21+ // respect Path from .desktop file
22+ if (desktopData->path() != "") {
23+ path = desktopData->path();
24+ } else {
25+ struct passwd* passwd = getpwuid(getuid());
26+ if (passwd)
27+ path = passwd->pw_dir;
28+ }
29+ DLOG("current working directory: '%s'", path.toLatin1().data());
30+ result = QProcess::startDetached(exec, arguments, path, &pid);
31 DLOG_IF(result == false, "process failed to start");
32 if (result) {
33 #endif
34
35=== modified file 'src/modules/Unity/ApplicationManager/desktopfilereader.cpp'
36--- src/modules/Unity/ApplicationManager/desktopfilereader.cpp 2013-08-09 13:16:13 +0000
37+++ src/modules/Unity/ApplicationManager/desktopfilereader.cpp 2013-08-23 17:34:27 +0000
38@@ -56,13 +56,13 @@
39 { "Comment=", sizeof("Comment=") - 1, 1 << DesktopFileReader::kCommentIndex },
40 { "Icon=", sizeof("Icon=") - 1, 1 << DesktopFileReader::kIconIndex },
41 { "Exec=", sizeof("Exec=") - 1, 1 << DesktopFileReader::kExecIndex },
42+ { "Path=", sizeof("Path=") - 1, 1 << DesktopFileReader::kPathIndex },
43 { "X-Ubuntu-StageHint=", sizeof("X-Ubuntu-StageHint=") - 1, 1 << DesktopFileReader::kStageHintIndex }
44 };
45 const unsigned int kAllEntriesMask =
46 (1 << DesktopFileReader::kNameIndex) | (1 << DesktopFileReader::kCommentIndex)
47 | (1 << DesktopFileReader::kIconIndex) | (1 << DesktopFileReader::kExecIndex)
48- | (1 << DesktopFileReader::kStageHintIndex);
49- const unsigned int kMandatoryEntriesMask =
50+ | (1 << DesktopFileReader::kPathIndex) | (1 << DesktopFileReader::kStageHintIndex); const unsigned int kMandatoryEntriesMask =
51 (1 << DesktopFileReader::kNameIndex) | (1 << DesktopFileReader::kIconIndex)
52 | (1 << DesktopFileReader::kExecIndex);
53 const int kEntriesCount = ARRAY_SIZE(kEntryNames);
54@@ -114,11 +114,12 @@
55
56 // Check that the mandatory entries are set.
57 if ((entryFlags & kMandatoryEntriesMask) == kMandatoryEntriesMask) {
58- DLOG("loaded desktop file with name='%s', comment='%s', icon='%s', exec='%s', stagehint='%s'",
59+ DLOG("loaded desktop file with name='%s', comment='%s', icon='%s', exec='%s', path='%s', stagehint='%s'",
60 entries_[DesktopFileReader::kNameIndex].toLatin1().data(),
61 entries_[DesktopFileReader::kCommentIndex].toLatin1().data(),
62 entries_[DesktopFileReader::kIconIndex].toLatin1().data(),
63 entries_[DesktopFileReader::kExecIndex].toLatin1().data(),
64+ entries_[DesktopFileReader::kPathIndex].toLatin1().data(),
65 entries_[DesktopFileReader::kStageHintIndex].toLatin1().data());
66 return true;
67 } else {
68
69=== modified file 'src/modules/Unity/ApplicationManager/desktopfilereader.h'
70--- src/modules/Unity/ApplicationManager/desktopfilereader.h 2013-08-09 13:16:13 +0000
71+++ src/modules/Unity/ApplicationManager/desktopfilereader.h 2013-08-23 17:34:27 +0000
72@@ -31,6 +31,7 @@
73 QString comment() const { return entries_[kCommentIndex]; }
74 QString icon() const { return entries_[kIconIndex]; }
75 QString exec() const { return entries_[kExecIndex]; }
76+ QString path() const { return entries_[kPathIndex]; }
77 QString stageHint() const { return entries_[kStageHintIndex]; }
78 bool loaded() const { return loaded_; }
79
80@@ -39,8 +40,9 @@
81 kCommentIndex = 1,
82 kIconIndex = 2,
83 kExecIndex = 3,
84- kStageHintIndex = 4,
85- kNumberOfEntries = 5;
86+ kPathIndex = 4,
87+ kStageHintIndex = 5,
88+ kNumberOfEntries = 6;
89
90 bool loadDesktopFile(QString desktopFile);
91

Subscribers

People subscribed via source and target branches