on xenial help sign in
Fix appId parsing
5c6b4a7Michael Terry
plugins/Unity/Launcher/launchermodel.cpp+11−12
@@ -200,22 +200,21 @@ QString LauncherModel::getUrlForAppId(const QString &appId) const
200{
200{
201 // appId is either an appId or a legacy app name. Let's find out which
201 // appId is either an appId or a legacy app name. Let's find out which
202 QString url;
202 QString url;
203− gchar *package, *app, *version, *longAppId;
203+ gchar *longAppId;
204
204
205 // assume legacy app until proven otherwise
205 // assume legacy app until proven otherwise
206 url = "application:///" + appId + ".desktop";
206 url = "application:///" + appId + ".desktop";
207
207
208− if (upstart_app_launch_app_id_parse(appId.toLatin1().constData(),
208+ // Test if appid is really a click package name
209− &package, &app, &version)) {
209+ QStringList parts = appId.split('_');
210− // Turn it back into an appId to test if it's a click app or not
210+ QString package = parts.value(0);
211+ QString app = parts.value(1);
211− longAppId = upstart_app_launch_triplet_to_app_id(package, app, version);
212+ longAppId = upstart_app_launch_triplet_to_app_id(package.toLatin1().constData(),
213+ app.toLatin1().constData(),
214+ nullptr);
212− if (longAppId != nullptr) { // it is a click app!
215+ if (longAppId != nullptr) { // it is a click app!
213− url = QString("appid://%1/%2/%3").arg(package, app, version);
216+ url = "appid://" + parts.join('/') + "/current-user-version";
214− g_free(longAppId);
215− }
216− g_free(package);
217− g_free(app);
217+ g_free(longAppId);
218− g_free(version);
219 }
218 }
220
219
221 return url;
220 return url;