MCPcopy Create free account
hub / github.com/KDE/kdevelop / setupDBus

Method setupDBus

plugins/debuggercommon/midebuggerplugin.cpp:144–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144void MIDebuggerPlugin::setupDBus()
145{
146 auto serviceRegistered = [this](const QString& service) {
147 if (m_drkonqis.contains(service))
148 return;
149 // New registration
150 const QString name = i18n("KDevelop (%1) - %2", m_displayName, core()->activeSession()->name());
151 auto drkonqiProxy = new DBusProxy(service, name, this);
152 m_drkonqis.insert(service, drkonqiProxy);
153 connect(drkonqiProxy->interface(), SIGNAL(acceptDebuggingApplication(QString)),
154 drkonqiProxy, SLOT(debuggerAccepted(QString)));
155 connect(drkonqiProxy, &DBusProxy::debugProcess,
156 this, &MIDebuggerPlugin::slotDebugExternalProcess);
157
158 drkonqiProxy->interface()->call(QStringLiteral("registerDebuggingApplication"), name, QCoreApplication::applicationPid());
159 };
160 auto serviceUnregistered = [this](const QString& service) {
161 // Deregistration
162 if (auto* proxy = m_drkonqis.take(service)) {
163 proxy->Invalidate();
164 delete proxy;
165 }
166 };
167
168 m_watcher = new QDBusServiceWatcher(QStringLiteral("org.kde.drkonqi*"), QDBusConnection::sessionBus(),
169 QDBusServiceWatcher::WatchForOwnerChange, this);
170 connect(m_watcher, &QDBusServiceWatcher::serviceRegistered, this, serviceRegistered);
171 connect(m_watcher, &QDBusServiceWatcher::serviceUnregistered, this, serviceUnregistered);
172
173 auto registeredServiceNames = QDBusConnection::sessionBus().interface()->registeredServiceNames();
174 if (!registeredServiceNames.isValid()) {
175 return;
176 }
177 for (const auto &serviceName : registeredServiceNames.value()) {
178 if (serviceName.startsWith(QStringLiteral("org.kde.drkonqi."))) {
179 serviceRegistered(serviceName);
180 }
181 }
182}
183
184void MIDebuggerPlugin::unload()
185{

Callers

nothing calls this directly

Calls 8

InvalidateMethod · 0.80
containsMethod · 0.45
nameMethod · 0.45
activeSessionMethod · 0.45
insertMethod · 0.45
interfaceMethod · 0.45
isValidMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected