plasma5-workspace/Use-iconName-instead-of-icon-in-all-runners.patch
Raymond Wooninck 05ea08576a Accepting request 423032 from home:wolfi323:test
- Add Use-iconName-instead-of-icon-in-all-runners.patch to fix problems in KRunner caused by QIcon not being thread-safe (boo#994983, kde#355122, kde#356957)

OBS-URL: https://build.opensuse.org/request/show/423032
OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/plasma5-workspace?expand=0&rev=250
2016-08-26 11:31:55 +00:00

363 lines
15 KiB
Diff

From: Kai Uwe Broulik <kde@privat.broulik.de>
Date: Fri, 17 Jun 2016 19:23:39 +0000
Subject: Use iconName instead of icon in all runners
X-Git-Url: http://quickgit.kde.org/?p=plasma-workspace.git&a=commitdiff&h=e1692f1a21458986fac18daf6eb1d1037c9d5051
---
Use iconName instead of icon in all runners
Also bump Frameworks version requirement to 5.24 for this
Differential Revision: https://phabricator.kde.org/D1922
---
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,7 +5,7 @@
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
set(QT_MIN_VERSION "5.6.0")
-set(KF5_MIN_VERSION "5.18.0")
+set(KF5_MIN_VERSION "5.24.0")
set(INSTALL_SDDM_THEME TRUE)
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets Quick QuickWidgets Concurrent Test Script Network)
find_package(ECM 1.8.0 REQUIRED NO_MODULE)
--- a/runners/activities/activityrunner.cpp
+++ b/runners/activities/activityrunner.cpp
@@ -158,7 +158,7 @@
Plasma::QueryMatch match(this);
match.setData(activity.id());
match.setType(Plasma::QueryMatch::ExactMatch);
- match.setIcon(activity.icon().isEmpty() ? QIcon::fromTheme(QStringLiteral("preferences-activities")) : QIcon::fromTheme(activity.icon()));
+ match.setIconName(activity.icon().isEmpty() ? QStringLiteral("preferences-activities") : activity.icon());
match.setText(i18n("Switch to \"%1\"", activity.name()));
match.setRelevance(0.7 + ((activity.state() == KActivities::Info::Running ||
activity.state() == KActivities::Info::Starting) ? 0.1 : 0));
--- a/runners/baloo/baloosearchrunner.cpp
+++ b/runners/baloo/baloosearchrunner.cpp
@@ -115,7 +115,7 @@
const QUrl url = QUrl::fromLocalFile(localUrl);
QString iconName = mimeDb.mimeTypeForFile(localUrl).iconName();
- match.setIcon(QIcon::fromTheme(iconName));
+ match.setIconName(iconName);
match.setId(it.filePath());
match.setText(url.fileName());
match.setData(url);
--- a/runners/calculator/calculatorrunner.cpp
+++ b/runners/calculator/calculatorrunner.cpp
@@ -215,7 +215,7 @@
if (cmd.toLower() == QLatin1String("universe") || cmd.toLower() == QLatin1String("life")) {
Plasma::QueryMatch match(this);
match.setType(Plasma::QueryMatch::InformationalMatch);
- match.setIcon(QIcon::fromTheme(QStringLiteral("accessories-calculator")));
+ match.setIconName(QStringLiteral("accessories-calculator"));
match.setText(QStringLiteral("42"));
match.setData("42");
match.setId(term);
@@ -264,7 +264,7 @@
Plasma::QueryMatch match(this);
match.setType(Plasma::QueryMatch::InformationalMatch);
- match.setIcon(QIcon::fromTheme(QStringLiteral("accessories-calculator")));
+ match.setIconName(QStringLiteral("accessories-calculator"));
match.setText(result);
match.setData(result);
match.setId(term);
--- a/runners/kill/killrunner.cpp
+++ b/runners/kill/killrunner.cpp
@@ -141,7 +141,7 @@
Plasma::QueryMatch match(this);
match.setText(i18n("Terminate %1", name));
match.setSubtext(i18n("Process ID: %1\nRunning as user: %2", QString::number(pid), user));
- match.setIcon(QIcon::fromTheme(QStringLiteral("application-exit")));
+ match.setIconName(QStringLiteral("application-exit"));
match.setData(data);
match.setId(name);
--- a/runners/locations/locationrunner.cpp
+++ b/runners/locations/locationrunner.cpp
@@ -61,9 +61,9 @@
match.setText(i18n("Open %1", term));
if (type == Plasma::RunnerContext::File) {
- match.setIcon(QIcon::fromTheme(KIO::iconNameForUrl(QUrl(term))));
- } else {
- match.setIcon(QIcon::fromTheme(QStringLiteral("system-file-manager")));
+ match.setIconName(KIO::iconNameForUrl(QUrl(term)));
+ } else {
+ match.setIconName(QStringLiteral("system-file-manager"));
}
match.setRelevance(1);
@@ -81,7 +81,7 @@
Plasma::QueryMatch match(this);
match.setType(Plasma::QueryMatch::ExactMatch);
match.setText(i18n("Open %1", term));
- match.setIcon(QIcon::fromTheme(QStringLiteral("system-help")));
+ match.setIconName(QStringLiteral("system-help"));
match.setRelevance(1);
match.setType(Plasma::QueryMatch::ExactMatch);
match.setId(QStringLiteral("help"));
@@ -101,7 +101,7 @@
Plasma::QueryMatch match(this);
match.setText(i18n("Go to %1", url.toDisplayString()));
- match.setIcon(QIcon::fromTheme(KProtocolInfo::icon(url.scheme())));
+ match.setIconName(KProtocolInfo::icon(url.scheme()));
match.setData(url.url());
if (KProtocolInfo::isHelperProtocol(url.scheme())) {
--- a/runners/powerdevil/PowerDevilRunner.cpp
+++ b/runners/powerdevil/PowerDevilRunner.cpp
@@ -197,7 +197,7 @@
}
Plasma::QueryMatch match(this);
match.setType(Plasma::QueryMatch::ExactMatch);
- match.setIcon(QIcon::fromTheme(m_profileIcon[i.key()]));
+ match.setIconName(m_profileIcon[i.key()]);
match.setText(i18n("Set Profile to '%1'", i.value()));
match.setData(i.key());
match.setRelevance(1);
@@ -217,7 +217,7 @@
int brightness = qBound(0, b, 100);
Plasma::QueryMatch match(this);
match.setType(Plasma::QueryMatch::ExactMatch);
- match.setIcon(QIcon::fromTheme(QStringLiteral("preferences-system-power-management")));
+ match.setIconName(QStringLiteral("preferences-system-power-management"));
match.setText(i18n("Set Brightness to %1", brightness));
match.setData(brightness);
match.setRelevance(1);
@@ -227,7 +227,7 @@
} else {
Plasma::QueryMatch match1(this);
match1.setType(Plasma::QueryMatch::ExactMatch);
- match1.setIcon(QIcon::fromTheme(QStringLiteral("preferences-system-power-management")));
+ match1.setIconName(QStringLiteral("preferences-system-power-management"));
match1.setText(i18n("Dim screen totally"));
match1.setRelevance(1);
match1.setId(QStringLiteral("DimTotal"));
@@ -235,7 +235,7 @@
Plasma::QueryMatch match2(this);
match2.setType(Plasma::QueryMatch::ExactMatch);
- match2.setIcon(QIcon::fromTheme(QStringLiteral("preferences-system-power-management")));
+ match2.setIconName(QStringLiteral("preferences-system-power-management"));
match2.setText(i18n("Dim screen by half"));
match2.setRelevance(1);
match2.setId(QStringLiteral("DimHalf"));
@@ -272,12 +272,12 @@
switch ((Solid::PowerManagement::SleepState)value) {
case Solid::PowerManagement::SuspendState:
case Solid::PowerManagement::StandbyState:
- match.setIcon(QIcon::fromTheme(QStringLiteral("system-suspend")));
+ match.setIconName(QStringLiteral("system-suspend"));
match.setText(i18n("Suspend to RAM"));
match.setRelevance(1);
break;
case Solid::PowerManagement::HibernateState:
- match.setIcon(QIcon::fromTheme(QStringLiteral("system-suspend-hibernate")));
+ match.setIconName(QStringLiteral("system-suspend-hibernate"));
match.setText(i18n("Suspend to Disk"));
match.setRelevance(0.99);
break;
--- a/runners/recentdocuments/recentdocuments.cpp
+++ b/runners/recentdocuments/recentdocuments.cpp
@@ -36,7 +36,6 @@
{
Q_UNUSED(args);
setObjectName( QStringLiteral("Recent Documents" ));
- m_icon = QIcon::fromTheme(QStringLiteral("document-open-recent"));
loadRecentDocuments();
// listen for changes to the list of recent documents
KDirWatch *recentDocWatch = new KDirWatch(this);
@@ -53,7 +52,6 @@
void RecentDocuments::loadRecentDocuments()
{
- //qDebug() << "Refreshing recent documents.";
m_recentdocuments = KRecentDocument::recentDocuments();
}
@@ -79,10 +77,11 @@
Plasma::QueryMatch match(this);
match.setType(Plasma::QueryMatch::PossibleMatch);
match.setRelevance(1.0);
- match.setIcon(QIcon::fromTheme(config.readIcon()));
+ match.setIconName(config.readIcon());
match.setData(config.readUrl());
match.setText(config.readName());
match.setSubtext(i18n("Recent Document"));
+
context.addMatch(match);
}
}
--- a/runners/recentdocuments/recentdocuments.h
+++ b/runners/recentdocuments/recentdocuments.h
@@ -41,7 +41,6 @@
void loadRecentDocuments();
private:
- QIcon m_icon;
QStringList m_recentdocuments;
};
--- a/runners/services/servicerunner.cpp
+++ b/runners/services/servicerunner.cpp
@@ -253,9 +253,9 @@
Plasma::QueryMatch match(this);
match.setType(Plasma::QueryMatch::HelperMatch);
if (!action.icon().isEmpty()) {
- match.setIcon(QIcon::fromTheme(action.icon()));
+ match.setIconName(action.icon());
} else {
- match.setIcon(QIcon::fromTheme(service->icon()));
+ match.setIconName(service->icon());
}
match.setText(i18nc("Jump list search result, %1 is action (eg. open new tab), %2 is application (eg. browser)",
"%1 - %2", action.text(), service->name()));
@@ -310,7 +310,7 @@
}
if (!service->icon().isEmpty()) {
- match.setIcon(QIcon::fromTheme(service->icon()));
+ match.setIconName(service->icon());
}
}
--- a/runners/sessions/sessionrunner.cpp
+++ b/runners/sessions/sessionrunner.cpp
@@ -84,7 +84,7 @@
term.compare(i18n("log out"), Qt::CaseInsensitive) == 0) {
Plasma::QueryMatch match(this);
match.setText(i18nc("log out command","Logout"));
- match.setIcon(QIcon::fromTheme(QStringLiteral("system-log-out")));
+ match.setIconName(QStringLiteral("system-log-out"));
match.setData(LogoutAction);
match.setType(Plasma::QueryMatch::ExactMatch);
match.setRelevance(0.9);
@@ -93,7 +93,7 @@
term.compare(i18nc("restart computer command", "reboot"), Qt::CaseInsensitive) == 0) {
Plasma::QueryMatch match(this);
match.setText(i18n("Restart the computer"));
- match.setIcon(QIcon::fromTheme(QStringLiteral("system-reboot")));
+ match.setIconName(QStringLiteral("system-reboot"));
match.setData(RestartAction);
match.setType(Plasma::QueryMatch::ExactMatch);
match.setRelevance(0.9);
@@ -101,7 +101,7 @@
} else if (term.compare(i18nc("shutdown computer command","shutdown"), Qt::CaseInsensitive) == 0) {
Plasma::QueryMatch match(this);
match.setText(i18n("Shutdown the computer"));
- match.setIcon(QIcon::fromTheme(QStringLiteral("system-shutdown")));
+ match.setIconName(QStringLiteral("system-shutdown"));
match.setData(ShutdownAction);
match.setType(Plasma::QueryMatch::ExactMatch);
match.setRelevance(0.9);
@@ -110,7 +110,7 @@
if (KAuthorized::authorizeKAction(QStringLiteral("lock_screen"))) {
Plasma::QueryMatch match(this);
match.setText(i18n("Lock the screen"));
- match.setIcon(QIcon::fromTheme(QStringLiteral("system-lock-screen")));
+ match.setIconName(QStringLiteral("system-lock-screen"));
match.setData(LockAction);
match.setType(Plasma::QueryMatch::ExactMatch);
match.setRelevance(0.9);
@@ -161,7 +161,7 @@
dm.numReserve() >= 0) {
Plasma::QueryMatch match(this);
match.setType(Plasma::QueryMatch::ExactMatch);
- match.setIcon(QIcon::fromTheme(QStringLiteral("system-switch-user")));
+ match.setIconName(QStringLiteral("system-switch-user"));
match.setText(i18n("New Session"));
matches << match;
}
@@ -198,7 +198,7 @@
Plasma::QueryMatch match(this);
match.setType(type);
match.setRelevance(relevance);
- match.setIcon(QIcon::fromTheme(QStringLiteral("user-identity")));
+ match.setIconName(QStringLiteral("user-identity"));
match.setText(name);
match.setData(QString::number(session.vt));
matches << match;
--- a/runners/shell/shellrunner.cpp
+++ b/runners/shell/shellrunner.cpp
@@ -66,7 +66,7 @@
Plasma::QueryMatch match(this);
match.setId(term);
match.setType(Plasma::QueryMatch::ExactMatch);
- match.setIcon(QIcon::fromTheme(QStringLiteral("system-run")));
+ match.setIconName(QStringLiteral("system-run"));
match.setText(i18n("Run %1", term));
match.setRelevance(0.7);
context.addMatch(match);
--- a/runners/webshortcuts/webshortcutrunner.cpp
+++ b/runners/webshortcuts/webshortcutrunner.cpp
@@ -32,8 +32,6 @@
Q_UNUSED(args);
setObjectName( QLatin1String("Web Shortcut" ));
setIgnoredTypes(Plasma::RunnerContext::Directory | Plasma::RunnerContext::File | Plasma::RunnerContext::Executable);
-
- m_icon = QIcon::fromTheme(QStringLiteral("internet-web-browser"));
m_match.setType(Plasma::QueryMatch::ExactMatch);
m_match.setRelevance(0.9);
@@ -134,7 +132,7 @@
m_match.setData(filterData.uri().url());
m_match.setId("WebShortcut:" + key);
- m_match.setIcon(QIcon::fromTheme(filterData.iconName()));
+ m_match.setIconName(filterData.iconName());
m_match.setText(i18n("Search %1 for %2", m_lastProvider, filterData.searchTerm()));
context.addMatch(m_match);
}
--- a/runners/webshortcuts/webshortcutrunner.h
+++ b/runners/webshortcuts/webshortcutrunner.h
@@ -41,7 +41,6 @@
void resetState();
private:
- QIcon m_icon;
Plasma::QueryMatch m_match;
bool m_filterBeforeRun;
--- a/runners/windowedwidgets/windowedwidgetsrunner.cpp
+++ b/runners/windowedwidgets/windowedwidgetsrunner.cpp
@@ -120,7 +120,7 @@
}
if (!service->icon().isEmpty()) {
- match.setIcon(QIcon::fromTheme(service->icon()));
+ match.setIconName(service->icon());
}
}
--- a/runners/windows/windowsrunner.cpp
+++ b/runners/windows/windowsrunner.cpp
@@ -399,7 +399,7 @@
match.setType(Plasma::QueryMatch::ExactMatch);
match.setData(desktop);
match.setId("desktop-" + QString::number(desktop));
- match.setIcon(QIcon::fromTheme(QStringLiteral("user-desktop")));
+ match.setIconName(QStringLiteral("user-desktop"));
QString desktopName;
if (desktop <= m_desktopNames.size()) {
desktopName = m_desktopNames[desktop - 1];