- // 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) {
+ auto isActiveWindowReply = interface.first->isActiveWindow();
+ isActiveWindowReply.waitForFinished();
+ if (!isActiveWindowReply.isError() && isActiveWindowReply.value()) {
+ break;
+ }
+ }
+
+ // check to see if any instances already have any of the given URLs or their parents open
+ QList<QUrl> newWindowURLs;
+ for (const QUrl &url : inputUrls) {