Changeset View
Changeset View
Standalone View
Standalone View
kate/main.cpp
Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Line(s) | 277 | if (QDBusConnectionInterface * const sessionBusInterface = QDBusConnection::sessionBus().interface()) { | |||
---|---|---|---|---|---|
278 | /** | 278 | /** | ||
279 | * try to get the current running kate instances | 279 | * try to get the current running kate instances | ||
280 | */ | 280 | */ | ||
281 | KateRunningInstanceMap mapSessionRii; | 281 | KateRunningInstanceMap mapSessionRii; | ||
282 | if (!fillinRunningKateAppInstances(&mapSessionRii)) { | 282 | if (!fillinRunningKateAppInstances(&mapSessionRii)) { | ||
283 | return 1; | 283 | return 1; | ||
284 | } | 284 | } | ||
285 | 285 | | |||
286 | QString currentActivity; | ||||
287 | QDBusMessage m = QDBusMessage::createMethodCall( | ||||
288 | QStringLiteral("org.kde.ActivityManager"), | ||||
289 | QStringLiteral("/ActivityManager/Activities"), QStringLiteral("org.kde.ActivityManager.Activities"), QStringLiteral("CurrentActivity")); | ||||
290 | QDBusMessage res = QDBusConnection::sessionBus().call(m); | ||||
291 | QList<QVariant> answer = res.arguments(); | ||||
292 | if (answer.size() == 1) { | ||||
293 | currentActivity = answer.at(0).toString(); | ||||
294 | } | ||||
295 | | ||||
286 | QStringList kateServices; | 296 | QStringList kateServices; | ||
287 | for (KateRunningInstanceMap::const_iterator it = mapSessionRii.constBegin(); it != mapSessionRii.constEnd(); ++it) { | 297 | for (KateRunningInstanceMap::const_iterator it = mapSessionRii.constBegin(); it != mapSessionRii.constEnd(); ++it) { | ||
288 | kateServices << (*it)->serviceName; | 298 | QString serviceName = (*it)->serviceName; | ||
299 | | ||||
300 | if (currentActivity.length() != 0) { | ||||
301 | QDBusMessage m = QDBusMessage::createMethodCall(serviceName, | ||||
302 | QStringLiteral("/MainApplication"), QStringLiteral("org.kde.Kate.Application"), QStringLiteral("isOnActivity")); | ||||
303 | | ||||
304 | QList<QVariant> dbargs; | ||||
305 | | ||||
306 | // convert to an url | ||||
307 | dbargs.append(currentActivity); | ||||
308 | m.setArguments(dbargs); | ||||
309 | | ||||
310 | QDBusMessage res = QDBusConnection::sessionBus().call(m); | ||||
311 | QList<QVariant> answer = res.arguments(); | ||||
312 | if (answer.size() == 1) { | ||||
313 | const bool canBeUsed = answer.at(0).toBool(); | ||||
dhaumann: const bool ... | |||||
314 | | ||||
315 | // If the Kate instance is in a specific activity, add it to | ||||
316 | // the list of candidate reusable services | ||||
317 | if (canBeUsed) { | ||||
318 | kateServices << serviceName; | ||||
289 | } | 319 | } | ||
320 | } | ||||
321 | } else { | ||||
322 | kateServices << serviceName; | ||||
323 | } | ||||
324 | } | ||||
325 | | ||||
290 | QString serviceName; | 326 | QString serviceName; | ||
291 | 327 | | |||
292 | QString start_session; | 328 | QString start_session; | ||
293 | bool session_already_opened = false; | 329 | bool session_already_opened = false; | ||
294 | 330 | | |||
295 | //check if we try to start an already opened session | 331 | //check if we try to start an already opened session | ||
296 | if (parser.isSet(startAnonymousSessionOption)) { | 332 | if (parser.isSet(startAnonymousSessionOption)) { | ||
297 | force_new = true; | 333 | force_new = true; | ||
▲ Show 20 Lines • Show All 299 Lines • Show Last 20 Lines |
const bool ...