);
}
-bool Dolphin::attachToExistingInstance(const QList<QUrl>& urls, bool openFiles, bool splitView, const QString& preferredService)
+bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFiles, bool splitView, const QString& preferredService)
{
- if (KWindowSystem::isPlatformWayland()) {
- // TODO: once Wayland clients can raise or activate themselves remove this conditional
+ // TODO: once Wayland clients can raise or activate themselves remove check from conditional
+ if (KWindowSystem::isPlatformWayland() || inputUrls.isEmpty() || !GeneralSettings::openExternallyCalledFolderInNewTab()) {
return false;
}
QStringLiteral("/dolphin/Dolphin_1"),
QStringLiteral("org.kde.dolphin.MainWindow"))
);
- if (!instance->isValid()) {
+ if (!instance->isValid() || instance->lastError().isValid()) {
continue;
}
dolphinServices.append(qMakePair(instance, QStringList()));
QStringList newUrls;
// check to see if any instances already have any of the given URLs open
- for (const QString& url : QUrl::toStringList(urls)) {
+ const auto urls = QUrl::toStringList(inputUrls);
+ for (const QString& url : urls) {
bool urlFound = false;
for (auto& service: dolphinServices) {
QDBusReply<bool> isUrlOpen = service.first->call(QStringLiteral("isUrlOpen"), url);