+ QStringList newUrls;
+
+ // check to see if any instances already have any of the given URLs open
+ const auto urls = QUrl::toStringList(inputUrls);
+ for (const QString& url : urls) {
+ bool urlFound = false;
+ for (auto& interface: dolphinInterfaces) {
+ auto isUrlOpenReply = interface.first->isUrlOpen(url);
+ isUrlOpenReply.waitForFinished();
+ if (!isUrlOpenReply.isError() && isUrlOpenReply.value()) {
+ interface.second.append(url);
+ urlFound = true;
+ break;
+ }
+ }
+ if (!urlFound) {
+ newUrls.append(url);
+ }
+ }
+
+ for (const auto& interface: qAsConst(dolphinInterfaces)) {
+ auto reply = openFiles ? interface.first->openFiles(newUrls, splitView) : interface.first->openDirectories(newUrls, splitView);
+ reply.waitForFinished();
+ if (!reply.isError()) {
+ interface.first->activateWindow();
+ attached = true;
+ break;
+ }
+ }
+ return attached;
+}
+
+QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> Dolphin::dolphinGuiInstances(const QString& preferredService)
+{
+ QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> dolphinInterfaces;