Changeset View
Changeset View
Standalone View
Standalone View
libtaskmanager/xwindowtasksmodel.cpp
| Show First 20 Lines • Show All 529 Lines • ▼ Show 20 Line(s) | 529 | return windowUrlFromMetadata(info->windowClassClass(), | |||
|---|---|---|---|---|---|
| 530 | info->pid(), | 530 | info->pid(), | ||
| 531 | rulesConfig, info->windowClassName()); | 531 | rulesConfig, info->windowClassName()); | ||
| 532 | } | 532 | } | ||
| 533 | 533 | | |||
| 534 | QUrl XWindowTasksModel::Private::launcherUrl(WId window, bool encodeFallbackIcon) | 534 | QUrl XWindowTasksModel::Private::launcherUrl(WId window, bool encodeFallbackIcon) | ||
| 535 | { | 535 | { | ||
| 536 | const AppData &data = appData(window); | 536 | const AppData &data = appData(window); | ||
| 537 | 537 | | |||
| 538 | if (!encodeFallbackIcon || !data.icon.name().isEmpty()) { | | |||
| 539 | return data.url; | | |||
| 540 | } | | |||
| 541 | 538 | | |||
| 542 | QUrl url = data.url; | 539 | QUrl url = data.url; | ||
| 540 | if (!encodeFallbackIcon || !data.icon.name().isEmpty()) { | ||||
| 541 | return url; | ||||
| 542 | } | ||||
| 543 | 543 | | |||
| 544 | // Forego adding the window icon pixmap if the URL is otherwise empty. | 544 | // Forego adding the window icon pixmap if the URL is otherwise empty. | ||
| 545 | if (!url.isValid()) { | 545 | if (!url.isValid()) { | ||
| 546 | return QUrl(); | 546 | return QUrl(); | ||
| 547 | } | 547 | } | ||
| 548 | 548 | | |||
| 549 | // Only serialize pixmap data if the window pixmap is actually being used. | ||||
| 550 | // QIcon::name() used above only returns a themed icon name but nothing when | ||||
| 551 | // the icon was created using an absolute path, as can be the case with, e.g. | ||||
| 552 | // containerized apps. | ||||
| 553 | if (!usingFallbackIcon.contains(window)) { | ||||
| 554 | return url; | ||||
| 555 | } | ||||
| 556 | | ||||
| 549 | const QPixmap pixmap = KWindowSystem::icon(window, KIconLoader::SizeLarge, KIconLoader::SizeLarge, false); | 557 | const QPixmap pixmap = KWindowSystem::icon(window, KIconLoader::SizeLarge, KIconLoader::SizeLarge, false); | ||
| 550 | if (pixmap.isNull()) { | 558 | if (pixmap.isNull()) { | ||
| 551 | return data.url; | 559 | return data.url; | ||
| 552 | } | 560 | } | ||
| 553 | QUrlQuery uQuery(url); | 561 | QUrlQuery uQuery(url); | ||
| 554 | QByteArray bytes; | 562 | QByteArray bytes; | ||
| 555 | QBuffer buffer(&bytes); | 563 | QBuffer buffer(&bytes); | ||
| 556 | buffer.open(QIODevice::WriteOnly); | 564 | buffer.open(QIODevice::WriteOnly); | ||
| ▲ Show 20 Lines • Show All 560 Lines • Show Last 20 Lines | |||||