Changeset View
Changeset View
Standalone View
Standalone View
applets/systemtray/systemtray.cpp
Context not available. | |||||
37 | #include <Plasma/PluginLoader> | 37 | #include <Plasma/PluginLoader> | ||
---|---|---|---|---|---|
38 | #include <Plasma/ServiceJob> | 38 | #include <Plasma/ServiceJob> | ||
39 | 39 | | |||
40 | #include <KIconLoader> | | |||
41 | #include <KIconEngine> | | |||
42 | #include <KActionCollection> | 40 | #include <KActionCollection> | ||
43 | #include <KLocalizedString> | 41 | #include <KLocalizedString> | ||
44 | 42 | | |||
Context not available. | |||||
145 | } | 143 | } | ||
146 | } | 144 | } | ||
147 | 145 | | |||
148 | QVariant SystemTray::resolveIcon(const QVariant &variant, const QString &iconThemePath) | | |||
149 | { | | |||
150 | if (variant.canConvert<QString>()) { | | |||
151 | if (!iconThemePath.isEmpty()) { | | |||
152 | const QString path = iconThemePath; | | |||
153 | if (!path.isEmpty()) { | | |||
154 | // FIXME: If last part of path is not "icons", this won't work! | | |||
155 | auto tokens = path.splitRef('/', QString::SkipEmptyParts); | | |||
156 | if (tokens.length() >= 3 && tokens.takeLast() == QLatin1String("icons")) { | | |||
157 | const QString appName = tokens.takeLast().toString(); | | |||
158 | | ||||
159 | return QVariant(QIcon(new AppIconEngine(variant.toString(), path, appName))); | | |||
160 | } else { | | |||
161 | qCWarning(SYSTEM_TRAY) << "Wrong IconThemePath" << path << ": too short or does not end with 'icons'"; | | |||
162 | } | | |||
163 | } | | |||
164 | | ||||
165 | //return just the string hoping that IconItem will know how to interpret it anyways as either a normal icon or a SVG from the theme | | |||
166 | return variant; | | |||
167 | } | | |||
168 | } | | |||
169 | | ||||
170 | // Most importantly QIcons. Nothing to do for those. | | |||
171 | return variant; | | |||
172 | } | | |||
173 | | ||||
174 | void SystemTray::showPlasmoidMenu(QQuickItem *appletInterface, int x, int y) | 146 | void SystemTray::showPlasmoidMenu(QQuickItem *appletInterface, int x, int y) | ||
175 | { | 147 | { | ||
176 | if (!appletInterface) { | 148 | if (!appletInterface) { | ||
Context not available. |