Changeset View
Changeset View
Standalone View
Standalone View
src/platformtheme/kdeplatformsystemtrayicon.cpp
Show All 20 Lines | |||||
21 | #include <kstatusnotifieritem.h> | 21 | #include <kstatusnotifieritem.h> | ||
22 | #include <QAction> | 22 | #include <QAction> | ||
23 | #include <QIcon> | 23 | #include <QIcon> | ||
24 | #include <QMenu> | 24 | #include <QMenu> | ||
25 | #include <QRect> | 25 | #include <QRect> | ||
26 | #include <QApplication> | 26 | #include <QApplication> | ||
27 | #include <QDBusInterface> | 27 | #include <QDBusInterface> | ||
28 | 28 | | |||
29 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) | | |||
30 | SystemTrayMenu::SystemTrayMenu() | 29 | SystemTrayMenu::SystemTrayMenu() | ||
31 | : QPlatformMenu() | 30 | : QPlatformMenu() | ||
32 | , m_tag(0) | 31 | , m_tag(0) | ||
33 | , m_menu(new QMenu()) | 32 | , m_menu(new QMenu()) | ||
34 | { | 33 | { | ||
35 | connect(m_menu.data(), &QMenu::aboutToShow, this, &QPlatformMenu::aboutToShow); | 34 | connect(m_menu.data(), &QMenu::aboutToShow, this, &QPlatformMenu::aboutToShow); | ||
36 | connect(m_menu.data(), &QMenu::aboutToHide, this, &QPlatformMenu::aboutToHide); | 35 | connect(m_menu.data(), &QMenu::aboutToHide, this, &QPlatformMenu::aboutToHide); | ||
37 | } | 36 | } | ||
▲ Show 20 Lines • Show All 209 Lines • ▼ Show 20 Line(s) | |||||
247 | { | 246 | { | ||
248 | return m_tag; | 247 | return m_tag; | ||
249 | } | 248 | } | ||
250 | 249 | | |||
251 | QAction *SystemTrayMenuItem::action() const | 250 | QAction *SystemTrayMenuItem::action() const | ||
252 | { | 251 | { | ||
253 | return m_action; | 252 | return m_action; | ||
254 | } | 253 | } | ||
255 | #endif | | |||
256 | 254 | | |||
257 | KDEPlatformSystemTrayIcon::KDEPlatformSystemTrayIcon() | 255 | KDEPlatformSystemTrayIcon::KDEPlatformSystemTrayIcon() | ||
258 | : QPlatformSystemTrayIcon() | 256 | : QPlatformSystemTrayIcon() | ||
259 | , m_sni(Q_NULLPTR) | 257 | , m_sni(Q_NULLPTR) | ||
260 | { | 258 | { | ||
261 | } | 259 | } | ||
262 | 260 | | |||
263 | KDEPlatformSystemTrayIcon::~KDEPlatformSystemTrayIcon() | 261 | KDEPlatformSystemTrayIcon::~KDEPlatformSystemTrayIcon() | ||
▲ Show 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | 304 | { | |||
307 | if (!m_sni) { | 305 | if (!m_sni) { | ||
308 | return; | 306 | return; | ||
309 | } | 307 | } | ||
310 | m_sni->setToolTipTitle(tooltip); | 308 | m_sni->setToolTipTitle(tooltip); | ||
311 | } | 309 | } | ||
312 | 310 | | |||
313 | void KDEPlatformSystemTrayIcon::updateMenu(QPlatformMenu *menu) | 311 | void KDEPlatformSystemTrayIcon::updateMenu(QPlatformMenu *menu) | ||
314 | { | 312 | { | ||
315 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) | | |||
316 | if (!m_sni) { | 313 | if (!m_sni) { | ||
317 | return; | 314 | return; | ||
318 | } | 315 | } | ||
319 | if (SystemTrayMenu *ourMenu = qobject_cast<SystemTrayMenu*>(menu)) { | 316 | if (SystemTrayMenu *ourMenu = qobject_cast<SystemTrayMenu*>(menu)) { | ||
320 | m_sni->setContextMenu(ourMenu->menu()); | 317 | m_sni->setContextMenu(ourMenu->menu()); | ||
321 | } | 318 | } | ||
322 | #else | | |||
323 | Q_UNUSED(menu) | | |||
324 | #endif | | |||
325 | } | 319 | } | ||
326 | 320 | | |||
327 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0)) | | |||
328 | QPlatformMenu *KDEPlatformSystemTrayIcon::createMenu() const | 321 | QPlatformMenu *KDEPlatformSystemTrayIcon::createMenu() const | ||
329 | { | 322 | { | ||
330 | return new SystemTrayMenu(); | 323 | return new SystemTrayMenu(); | ||
331 | } | 324 | } | ||
332 | #endif | | |||
333 | 325 | | |||
334 | QRect KDEPlatformSystemTrayIcon::geometry() const | 326 | QRect KDEPlatformSystemTrayIcon::geometry() const | ||
335 | { | 327 | { | ||
336 | // StatusNotifierItem doesn't provide the geometry | 328 | // StatusNotifierItem doesn't provide the geometry | ||
337 | return QRect(); | 329 | return QRect(); | ||
338 | } | 330 | } | ||
339 | 331 | | |||
340 | void KDEPlatformSystemTrayIcon::showMessage(const QString &title, const QString &msg, | 332 | void KDEPlatformSystemTrayIcon::showMessage(const QString &title, const QString &msg, | ||
Show All 23 Lines |