~mterry/unity8/split

« back to all changes in this revision

Viewing changes to plugins/Unity/Launcher/launchermodel.cpp

  • Committer: Michael Terry
  • Date: 2014-05-29 14:10:46 UTC
  • Revision ID: michael.terry@canonical.com-20140529141046-72xhsg7apf4s4uhd
undo accidental commits

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
#include "backend/launcherbackend.h"
23
23
 
24
24
#include <unity/shell/application/ApplicationInfoInterface.h>
25
 
#include <upstart-app-launch.h>
26
25
 
27
26
using namespace unity::shell::application;
28
27
 
196
195
    m_backend->setUser(username);
197
196
}
198
197
 
199
 
QString LauncherModel::getUrlForAppId(const QString &appId)
200
 
{
201
 
    // appId is either an appId or a legacy app name.  Let's find out which
202
 
    QString url;
203
 
    gchar *package, *app, *version, *longAppId;
204
 
 
205
 
    // assume legacy app until proven otherwise
206
 
    url = "application:///" + appId + ".desktop";
207
 
 
208
 
    if (upstart_app_launch_app_id_parse(appId.first().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").args(package, app, version);
214
 
            g_free(longAppId);
215
 
        }
216
 
        g_free(package);
217
 
        g_free(app);
218
 
        g_free(version);
219
 
    }
220
 
 
221
 
    return url;
222
 
}
223
 
 
224
198
void LauncherModel::refreshStoredApplications()
225
199
{
226
200
    // First remove any existing ones