示例#1
0
bool KRunnerItemHandler::openUrl(const KUrl& url)
{
    QString runner = url.host();
    QString id = url.fragment();
    if (id.startsWith(QLatin1Char('/'))) {
        id = id.remove(0, 1);
    }

    runnerManager()->run(id);
    return true;
}
示例#2
0
KService::Ptr serviceForUrl(const KUrl & url)
{
    QString runner = url.host();
    QString id = url.fragment();

    if (id.startsWith(QLatin1Char('/'))) {
        id = id.remove(0, 1);
    }

    if (runner != QLatin1String("services")) {
        return KService::Ptr(NULL);
    }

    // URL path example: services_kde4-kate.desktop
    // or: services_firefox.desktop
    id.remove("services_");

    return KService::serviceByStorageId(id);
}