QTimer::singleShot(0, this, &DolphinMainWindow::updateOpenPreferredSearchToolAction);
m_fileItemActions.setParentWidget(this);
-#if KIO_VERSION >= QT_VERSION_CHECK(5, 82, 0)
connect(&m_fileItemActions, &KFileItemActions::error, this, [this](const QString &errorMessage) {
showErrorMessage(errorMessage);
});
-#endif
}
DolphinMainWindow::~DolphinMainWindow()
return viewContainers;
}
- void DolphinMainWindow::setViewsWithInvalidPathsToHome()
- {
- const QVector<DolphinViewContainer*> theViewContainers = viewContainers();
- for (DolphinViewContainer *viewContainer : theViewContainers) {
-
- // Only consider local dirs, not remote locations and abstract protocols
- if (viewContainer->url().isLocalFile()) {
- if (!QFileInfo::exists(viewContainer->url().toLocalFile())) {
- viewContainer->setUrl(QUrl::fromLocalFile(QDir::homePath()));
- }
- }
- }
- }
-
void DolphinMainWindow::openDirectories(const QList<QUrl>& dirs, bool splitView)
{
m_tabWidget->openDirectories(dirs, splitView);
stashSplit->setToolTip(i18nc("@info", "Opens the stash virtual directory in a split window"));
stashSplit->setIcon(QIcon::fromTheme(QStringLiteral("folder-stash")));
stashSplit->setCheckable(false);
- stashSplit->setVisible(QDBusConnection::sessionBus().interface()->isServiceRegistered(QStringLiteral("org.kde.kio.StashNotifier")));
+ QDBusConnectionInterface *sessionInterface = QDBusConnection::sessionBus().interface();
+ stashSplit->setVisible(sessionInterface && sessionInterface->isServiceRegistered(QStringLiteral("org.kde.kio.StashNotifier")));
connect(stashSplit, &QAction::triggered, this, &DolphinMainWindow::toggleSplitStash);
KStandardAction::redisplay(this, &DolphinMainWindow::reloadView, actionCollection());
#include <KLocalizedString>
#include <Kdelibs4ConfigMigrator>
#include <KConfigGui>
+#include <KIO/PreviewJob>
#include <QApplication>
#include <QCommandLineParser>
QApplication app(argc, argv);
app.setWindowIcon(QIcon::fromTheme(QStringLiteral("system-file-manager"), app.windowIcon()));
+ KIO::PreviewJob::setDefaultDevicePixelRatio(app.devicePixelRatio());
+
KCrash::initialize();
Kdelibs4ConfigMigrator migrate(QStringLiteral("dolphin"));
mainWindow->show();
- KDBusService dolphinDBusService;
+ // Allow starting Dolphin on a system that is not running DBus:
+ KDBusService::StartupOptions serviceOptions = KDBusService::Multiple;
+ if (!QDBusConnection::sessionBus().isConnected()) {
+ serviceOptions |= KDBusService::NoExitOnFailure;
+ }
+ KDBusService dolphinDBusService(serviceOptions);
DBusInterface interface;
if (!app.isSessionRestored()) {
// If the user passed any URLs to Dolphin, open those in the
// window after session-restoring it
if (startedWithURLs) {
- mainWindow->openDirectories(urls, splitView);
+ if (openFiles) {
+ mainWindow->openFiles(urls, splitView);
+ } else {
+ mainWindow->openDirectories(urls, splitView);
+ }
}
-
- // Now handle invalid locations in the set of active views to
- // avoid issues like https://bugs.kde.org/show_bug.cgi?id=427619
- mainWindow->setViewsWithInvalidPathsToHome();
} else {
qCWarning(DolphinDebug) << "Unknown class " << className << " in session saved data!";
}