on xenial help sign in
Fix appId parsing
commit5c6b4a78c540fc76224584f103e8f9bcd5977993 authorMichael Terry <michael.terry@canonical.com> dateThu 29 May 2014, 22:46 (12 years ago) parent0905b5f
1 file changed+11−12
plugins/Unity/Launcher/launchermodel.cpp+11−12
plugins/Unity/Launcher/launchermodel.cpp+11−12
@@ -200,22 +200,21 @@ QString LauncherModel::getUrlForAppId(const QString &appId) const
200200{
201201 // appId is either an appId or a legacy app name. Let's find out which
202202 QString url;
203− gchar *package, *app, *version, *longAppId;
203+ gchar *longAppId;
204204
205205 // assume legacy app until proven otherwise
206206 url = "application:///" + appId + ".desktop";
207207
208− if (upstart_app_launch_app_id_parse(appId.toLatin1().constData(),
209− &package, &app, &version)) {
210− // Turn it back into an appId to test if it's a click app or not
211− longAppId = upstart_app_launch_triplet_to_app_id(package, app, version);
212− if (longAppId != nullptr) { // it is a click app!
213− url = QString("appid://%1/%2/%3").arg(package, app, version);
214− g_free(longAppId);
215− }
216− g_free(package);
217− g_free(app);
218− g_free(version);
208+ // Test if appid is really a click package name
209+ QStringList parts = appId.split('_');
210+ QString package = parts.value(0);
211+ QString app = parts.value(1);
212+ longAppId = upstart_app_launch_triplet_to_app_id(package.toLatin1().constData(),
213+ app.toLatin1().constData(),
214+ nullptr);
215+ if (longAppId != nullptr) { // it is a click app!
216+ url = "appid://" + parts.join('/') + "/current-user-version";
217+ g_free(longAppId);
219218 }
220219
221220 return url;