on xenial help sign in
support appIds and and .dekstop files in findDesktopFile()
commita1187e49b54c9285b9639af6769c585a462f96f2 authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 4 Sep 2013, 11:38 (13 years ago) parent216b5d6
2 files changed+17−9
plugins/Unity/Launcher/backend/launcherbackend.cpp+16−3 plugins/Unity/Launcher/launchermodel.cpp+1−6
plugins/Unity/Launcher/backend/launcherbackend.cpp+16−3
@@ -262,14 +262,27 @@ QString LauncherBackend::findDesktopFile(const QString &appId) const
262262 int dashPos = -1;
263263 QString helper = appId;
264264
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+
265276 do {
266277 if (dashPos != -1) {
267278 helper = helper.replace(dashPos, 1, '/');
268279 }
269280
270− QFileInfo fileInfo(QDir("/usr/share/applications"), helper);
271− if (fileInfo.exists()) {
272− return fileInfo.absoluteFilePath();
281+ Q_FOREACH(const QString &searchDir, searchDirs) {
282+ QFileInfo fileInfo(QDir(searchDir), helper);
283+ if (fileInfo.exists()) {
284+ return fileInfo.absoluteFilePath();
285+ }
273286 }
274287
275288 dashPos = helper.indexOf("-");
plugins/Unity/Launcher/launchermodel.cpp+1−6
@@ -199,12 +199,7 @@ void LauncherModel::applicationFocused(const QString &appId)
199199 // TODO: Mark application as focued
200200 } else {
201201 // 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);
206− QString desktopFile = appId;
207−
202+ QString desktopFile = m_backend->desktopFile(appId);
208203 QString appName = m_backend->displayName(appId);
209204 QString icon = m_backend->icon(appId);
210205