qdbusmenuconnection.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/platformsupport/dbusmenu/qdbusmenuconnection.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6extern const QLoggingCategory &qLcMenu();-
7-
8const QString StatusNotifierWatcherService = QLatin1String("org.kde.StatusNotifierWatcher");-
9const QString StatusNotifierWatcherPath = QLatin1String("/StatusNotifierWatcher");-
10const QString StatusNotifierItemPath = QLatin1String("/StatusNotifierItem");-
11const QString MenuBarPath = QLatin1String("/MenuBar");-
12-
13-
14-
15-
16-
17-
18-
19QDBusMenuConnection::QDBusMenuConnection(QObject *parent, const QString &serviceName)-
20 : QObject(parent)-
21 , m_connection(serviceName.isNull() ? QDBusConnection::sessionBus()-
22 : QDBusConnection::connectToBus(QDBusConnection::SessionBus, serviceName))-
23 , m_dbusWatcher(new QDBusServiceWatcher(StatusNotifierWatcherService, m_connection, QDBusServiceWatcher::WatchForRegistration, this))-
24 , m_statusNotifierHostRegistered(false)-
25{-
26-
27 QDBusInterface systrayHost(StatusNotifierWatcherService, StatusNotifierWatcherPath, StatusNotifierWatcherService, m_connection);-
28 if (systrayHost.isValid()
systrayHost.isValid()Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSystemTrayIcon
&& systrayHost.property("IsStatusNotifierHostRegistered").toBool()
systrayHost.pr...red").toBool()Description
TRUEnever evaluated
FALSEnever evaluated
)
0-1
29 m_statusNotifierHostRegistered = true;
never executed: m_statusNotifierHostRegistered = true;
0
30 else-
31 for (bool qt_category_enabled = qLcMenu().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QSystemTrayIcon
; qt_category_enabled = false) QMessageLogger(__FILE__, 80, __PRETTY_FUNCTION__, qLcMenu().categoryName()).debug() << "StatusNotifierHost is not registered";
never executed: QMessageLogger(__FILE__, 80, __PRETTY_FUNCTION__, qLcMenu().categoryName()).debug() << "StatusNotifierHost is not registered";
0-1
32-
33}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QSystemTrayIcon
1
34-
35void QDBusMenuConnection::dbusError(const QDBusError &error)-
36{-
37 QMessageLogger(__FILE__, 86, __PRETTY_FUNCTION__).warning() << "QDBusTrayIcon encountered a D-Bus error:" << error;-
38}
never executed: end of block
0
39-
40-
41bool QDBusMenuConnection::registerTrayIconMenu(QDBusTrayIcon *item)-
42{-
43 bool success = connection().registerObject(MenuBarPath, item->menu());-
44 if (!success
!successDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
45 for (bool qt_category_enabled = qLcMenu().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 94, __PRETTY_FUNCTION__, qLcMenu().categoryName()).debug() << "failed to register" << item->instanceId() << MenuBarPath;
never executed: QMessageLogger(__FILE__, 94, __PRETTY_FUNCTION__, qLcMenu().categoryName()).debug() << "failed to register" << item->instanceId() << MenuBarPath;
0
46 return
never executed: return success;
success;
never executed: return success;
0
47}-
48-
49void QDBusMenuConnection::unregisterTrayIconMenu(QDBusTrayIcon *item)-
50{-
51 if (item->menu()
item->menu()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
52 connection().unregisterObject(MenuBarPath);
never executed: connection().unregisterObject(MenuBarPath);
0
53}
never executed: end of block
0
54-
55bool QDBusMenuConnection::registerTrayIcon(QDBusTrayIcon *item)-
56{-
57 bool success = connection().registerService(item->instanceId());-
58 if (!success
!successDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
59 QMessageLogger(__FILE__, 108, __PRETTY_FUNCTION__).warning() << "failed to register service" << item->instanceId();-
60 return
never executed: return false;
false;
never executed: return false;
0
61 }-
62-
63 success = connection().registerObject(StatusNotifierItemPath, item);-
64 if (!success
!successDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
65 unregisterTrayIcon(item);-
66 QMessageLogger(__FILE__, 115, __PRETTY_FUNCTION__).warning() << "failed to register" << item->instanceId() << StatusNotifierItemPath;-
67 return
never executed: return false;
false;
never executed: return false;
0
68 }-
69-
70 if (item->menu()
item->menu()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
71 registerTrayIconMenu(item);
never executed: registerTrayIconMenu(item);
0
72-
73 QDBusMessage registerMethod = QDBusMessage::createMethodCall(-
74 StatusNotifierWatcherService, StatusNotifierWatcherPath, StatusNotifierWatcherService,-
75 QLatin1String("RegisterStatusNotifierItem"));-
76 registerMethod.setArguments(QVariantList() << item->instanceId());-
77 success = m_connection.callWithCallback(registerMethod, this, qFlagLocation("2""trayIconRegistered()" "\0" __FILE__ ":" "126"), qFlagLocation("1""dbusError(QDBusError)" "\0" __FILE__ ":" "126"));-
78-
79 return
never executed: return success;
success;
never executed: return success;
0
80}-
81-
82bool QDBusMenuConnection::unregisterTrayIcon(QDBusTrayIcon *item)-
83{-
84 unregisterTrayIconMenu(item);-
85 connection().unregisterObject(StatusNotifierItemPath);-
86 bool success = connection().unregisterService(item->instanceId());-
87 if (!success
!successDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
88 QMessageLogger(__FILE__, 137, __PRETTY_FUNCTION__).warning() << "failed to unregister service" << item->instanceId();
never executed: QMessageLogger(__FILE__, 137, __PRETTY_FUNCTION__).warning() << "failed to unregister service" << item->instanceId();
0
89 return
never executed: return success;
success;
never executed: return success;
0
90}-
91-
92-
93-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9