on xenial help sign in
support appIds and and .dekstop files in findDesktopFile()
a1187e4Michael Zanetti
plugins/Unity/Launcher/backend/launcherbackend.cpp+16−3
@@ -262,14 +262,27 @@ QString LauncherBackend::findDesktopFile(const QString &appId) const
262 int dashPos = -1;
262 int dashPos = -1;
263 QString helper = appId;
263 QString helper = appId;
264
264
265+ QStringList searchDirs;
266+ searchDirs << "/usr/share/applications";
267+
268+// FIXME: Right now the appId can be (or rather is) a full path
269+// to a .desktop file. This will change in the future. Remove this
270+// once the ApplicationManager has been switched over to use appIds.
271+ searchDirs << "";
272+//#if LAUNCHER_TESTING
273+// searchDirs << "";
274+//#endif
275+
265 do {
276 do {
266 if (dashPos != -1) {
277 if (dashPos != -1) {
267 helper = helper.replace(dashPos, 1, '/');
278 helper = helper.replace(dashPos, 1, '/');
268 }
279 }
269
280
281+ Q_FOREACH(const QString &searchDir, searchDirs) {
270− QFileInfo fileInfo(QDir("/usr/share/applications"), helper);
282+ QFileInfo fileInfo(QDir(searchDir), helper);
271− if (fileInfo.exists()) {
283+ if (fileInfo.exists()) {
272− return fileInfo.absoluteFilePath();
284+ return fileInfo.absoluteFilePath();
285+ }
273 }
286 }
274
287
275 dashPos = helper.indexOf("-");
288 dashPos = helper.indexOf("-");
plugins/Unity/Launcher/launchermodel.cpp+1−6
@@ -199,12 +199,7 @@ void LauncherModel::applicationFocused(const QString &appId)
199 // TODO: Mark application as focued
199 // TODO: Mark application as focued
200 } else {
200 } else {
201 // Add app to recent apps
201 // Add app to recent apps
202−
203− // FIXME: The backend does not yet support this stuff
204− // and currently the appId still is the desktopFile
205− //QString desktopFile = m_backend->desktopFile(appId);
202+ QString desktopFile = m_backend->desktopFile(appId);
206− QString desktopFile = appId;
207−
208 QString appName = m_backend->displayName(appId);
203 QString appName = m_backend->displayName(appId);
209 QString icon = m_backend->icon(appId);
204 QString icon = m_backend->icon(appId);
210
205