Commit 5e1d92af authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇

[Task Manager] Strip application:// prefix before looking up service

According to Unity Launcher API documentation [1] this prefix should be there, actually, so we weren't standard-compliant here.

[1] https://wiki.ubuntu.com/Unity/LauncherAPI

CHANGELOG: Badges and progress display in task manager now works with more 3rd party applications

Differential Revision: https://phabricator.kde.org/D3416
parent a0179220
......@@ -147,7 +147,16 @@ void Backend::update(const QString &uri, const QMap<QString, QVariant> &properti
auto foundStorageId = m_launcherUrlToStorageId.constFind(uri);
if (foundStorageId == m_launcherUrlToStorageId.constEnd()) { // we don't know this one, register
KService::Ptr service = KService::serviceByStorageId(uri);
// According to Unity Launcher API documentation applications *should* send along their
// desktop file name with application:// prefix
const QString applicationSchemePrefix = QStringLiteral("application://");
QString normalizedUri = uri;
if (normalizedUri.startsWith(applicationSchemePrefix)) {
normalizedUri = uri.mid(applicationSchemePrefix.length());
}
KService::Ptr service = KService::serviceByStorageId(normalizedUri);
if (!service) {
qWarning() << "Failed to find service for Unity Launcher" << uri;
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment