#include <KCrash>
#include <KDBusService>
#include <KLocalizedString>
-#include <KToolBar>
#include <Kdelibs4ConfigMigrator>
#include <KConfigGui>
+#include <KIO/PreviewJob>
#include <QApplication>
#include <QCommandLineParser>
#endif
#include <iostream>
-extern "C" Q_DECL_EXPORT int kdemain(int argc, char **argv)
+int main(int argc, char **argv)
{
#ifndef Q_OS_WIN
// Prohibit using sudo or kdesu (but allow using the root user directly)
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!";
}
}
}
- Qt::ToolBarArea area = mainWindow->toolBarArea(mainWindow->toolBar());
- if (area != Qt::TopToolBarArea && area != Qt::BottomToolBarArea) {
- // Migrate users with disabled tool bar positions.
- // Remove this a few years from now (2020).
- mainWindow->addToolBar(Qt::TopToolBarArea, mainWindow->toolBar());
- }
#ifdef HAVE_KUSERFEEDBACK
auto feedbackProvider = DolphinFeedbackProvider::instance();