From 11d813625aaaf8d33cb88209c84c626fb31cfbd3 Mon Sep 17 00:00:00 2001 From: Alexander Lohnau Date: Sun, 17 Dec 2023 12:25:22 +0100 Subject: [PATCH] windowsrunner: Reuse QVariantMap object --- .../windowsrunnerinterface.cpp | 26 +++++++------------ 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/plugins/krunner-integration/windowsrunnerinterface.cpp b/src/plugins/krunner-integration/windowsrunnerinterface.cpp index 7cb065cb15..63cc3e35be 100644 --- a/src/plugins/krunner-integration/windowsrunnerinterface.cpp +++ b/src/plugins/krunner-integration/windowsrunnerinterface.cpp @@ -250,11 +250,7 @@ RemoteMatch WindowsRunner::desktopMatch(const VirtualDesktop *desktop, const Win match.iconName = QStringLiteral("user-desktop"); match.text = desktop->name(); match.relevance = relevance; - - QVariantMap properties; - - properties[QStringLiteral("subtext")] = i18n("Switch to desktop %1", desktop->name()); - match.properties = properties; + match.properties.insert(QStringLiteral("subtext"), i18n("Switch to desktop %1", desktop->name())); return match; } @@ -266,7 +262,6 @@ RemoteMatch WindowsRunner::windowsMatch(const Window *window, const WindowsRunne match.iconName = window->icon().name(); match.relevance = relevance; match.categoryRelevance = categoryRelevance; - QVariantMap properties; const QList desktops = window->desktops(); bool allDesktops = window->isOnAllDesktops(); @@ -288,38 +283,37 @@ RemoteMatch WindowsRunner::windowsMatch(const Window *window, const WindowsRunne 8, // bitsPerSample 4, // channels QByteArray(reinterpret_cast(convertedImage.constBits()), convertedImage.sizeInBytes())}; - properties.insert(QStringLiteral("icon-data"), QVariant::fromValue(remoteImage)); + match.properties.insert(QStringLiteral("icon-data"), QVariant::fromValue(remoteImage)); } const QString desktopName = targetDesktop->name(); switch (action) { case CloseAction: - properties[QStringLiteral("subtext")] = i18n("Close running window on %1", desktopName); + match.properties[QStringLiteral("subtext")] = i18n("Close running window on %1", desktopName); break; case MinimizeAction: - properties[QStringLiteral("subtext")] = i18n("(Un)minimize running window on %1", desktopName); + match.properties[QStringLiteral("subtext")] = i18n("(Un)minimize running window on %1", desktopName); break; case MaximizeAction: - properties[QStringLiteral("subtext")] = i18n("Maximize/restore running window on %1", desktopName); + match.properties[QStringLiteral("subtext")] = i18n("Maximize/restore running window on %1", desktopName); break; case FullscreenAction: - properties[QStringLiteral("subtext")] = i18n("Toggle fullscreen for running window on %1", desktopName); + match.properties[QStringLiteral("subtext")] = i18n("Toggle fullscreen for running window on %1", desktopName); break; case ShadeAction: - properties[QStringLiteral("subtext")] = i18n("(Un)shade running window on %1", desktopName); + match.properties[QStringLiteral("subtext")] = i18n("(Un)shade running window on %1", desktopName); break; case KeepAboveAction: - properties[QStringLiteral("subtext")] = i18n("Toggle keep above for running window on %1", desktopName); + match.properties[QStringLiteral("subtext")] = i18n("Toggle keep above for running window on %1", desktopName); break; case KeepBelowAction: - properties[QStringLiteral("subtext")] = i18n("Toggle keep below running window on %1", desktopName); + match.properties[QStringLiteral("subtext")] = i18n("Toggle keep below running window on %1", desktopName); break; case ActivateAction: default: - properties[QStringLiteral("subtext")] = i18n("Activate running window on %1", desktopName); + match.properties[QStringLiteral("subtext")] = i18n("Activate running window on %1", desktopName); break; } - match.properties = properties; return match; }