Otherwise this results in the generic executable icon as bouncy cursor.
Differential Revision: https://phabricator.kde.org/D4823
if (urls.isEmpty()) {
return;
}
- KRun::run(QStringLiteral("dolphin %U"), urls, nullptr);
+ Dolphin::openNewWindow(urls);
}
void DBusInterface::ShowItems(const QStringList& uriList, const QString& startUpId)
if (urls.isEmpty()) {
return;
}
- KRun::run(QStringLiteral("dolphin --select %U"), urls, nullptr);
+ Dolphin::openNewWindow(urls, nullptr, Dolphin::OpenNewWindowFlag::Select);
}
void DBusInterface::ShowItemProperties(const QStringList& uriList, const QString& startUpId)
void DolphinMainWindow::openNewMainWindow()
{
- KRun::run(QStringLiteral("dolphin %u"), QList<QUrl>(), this);
+ Dolphin::openNewWindow({}, this);
}
void DolphinMainWindow::openNewActivatedTab()
}
if (!newWindowUrl.isEmpty()) {
- KRun::run(QStringLiteral("dolphin %u"), {newWindowUrl}, this);
+ Dolphin::openNewWindow({newWindowUrl}, this);
}
}
changeUrl(KIO::upUrl(item.url()));
break;
- case DolphinContextMenu::OpenParentFolderInNewWindow: {
-
- KRun::run(QStringLiteral("dolphin %u"), {KIO::upUrl(item.url())}, this);
+ case DolphinContextMenu::OpenParentFolderInNewWindow:
+ Dolphin::openNewWindow({KIO::upUrl(item.url())}, this);
break;
- }
case DolphinContextMenu::OpenParentFolderInNewTab:
openNewTab(KIO::upUrl(item.url()));
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <QApplication>
+#include <QIcon>
+
+#include <KRun>
+
#include "global.h"
#include "dolphindebug.h"
{
return QUrl::fromUserInput(GeneralSettings::homeUrl(), QString(), QUrl::AssumeLocalFile);
}
+
+void Dolphin::openNewWindow(const QList<QUrl> &urls, QWidget *window, const OpenNewWindowFlags &flags)
+{
+ QString command = QStringLiteral("dolphin");
+
+ if (flags.testFlag(OpenNewWindowFlag::Select)) {
+ command.append(QLatin1String(" --select"));
+ }
+
+ if (!urls.isEmpty()) {
+ command.append(QLatin1String(" %U"));
+ }
+
+ KRun::run(command, urls, window, qApp->applicationDisplayName(), qApp->windowIcon().name());
+}
* Returns the home url which is defined in General Settings
*/
QUrl homeUrl();
+
+ enum class OpenNewWindowFlag {
+ None = 0,
+ Select = 1<<1
+ };
+ Q_DECLARE_FLAGS(OpenNewWindowFlags, OpenNewWindowFlag)
+
+ /**
+ * Opens a new Dolphin window
+ */
+ void openNewWindow(const QList<QUrl> &urls = {}, QWidget *window = nullptr, const OpenNewWindowFlags &flags = OpenNewWindowFlag::None);
}
#endif //GLOBAL_H