X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/38c34eeca315c7be58e65d4d3fb72aaf7b866719..e990cbbe3fb00d4e4be42d4bbff8db74e11a2b2b:/src/main.cpp diff --git a/src/main.cpp b/src/main.cpp index e1e559f97..6df53b62e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -29,6 +30,11 @@ #include #endif +#define HAVE_STYLE_MANAGER __has_include() +#if HAVE_STYLE_MANAGER +#include +#endif + #include #include #include @@ -54,15 +60,28 @@ int main(int argc, char **argv) // Prohibit using sudo or kdesu (but allow using the root user directly) if (getuid() == 0) { if (!qEnvironmentVariableIsEmpty("SUDO_USER")) { - std::cout << "Running Dolphin with sudo can cause bugs and expose you to security vulnerabilities." << std::endl; + std::cout << "Running Dolphin with sudo is not supported as it can cause bugs and expose you to security vulnerabilities. Instead, install the " + "`kio-admin` package from your distro and use it to manage root-owned locations by right-clicking on them and selecting \"Open as " + "Administrator\"." + << std::endl; return EXIT_FAILURE; } else if (!qEnvironmentVariableIsEmpty("KDESU_USER")) { - std::cout << "Running Dolphin with kdesu can cause bugs and expose you to security vulnerabilities." << std::endl; + std::cout << "Running Dolphin with kdesu is not supported as it can cause bugs and expose you to security vulnerabilities. Instead, install the " + "`kio-admin` package from your distro and use it to manage root-owned locations by right-clicking on them and selecting \"Open as " + "Administrator\"." + << std::endl; return EXIT_FAILURE; } } #endif + /** + * trigger initialisation of proper icon theme + */ +#if KICONTHEMES_VERSION >= QT_VERSION_CHECK(6, 3, 0) + KIconTheme::initTheme(); +#endif + /** * enable high dpi support */ @@ -73,7 +92,20 @@ int main(int argc, char **argv) QApplication app(argc, argv); app.setWindowIcon(QIcon::fromTheme(QStringLiteral("system-file-manager"), app.windowIcon())); - KIO::PreviewJob::setDefaultDevicePixelRatio(app.devicePixelRatio()); +#if HAVE_STYLE_MANAGER + /** + * trigger initialisation of proper application style + */ + KStyleManager::initStyle(); +#else + /** + * For Windows and macOS: use Breeze if available + * Of all tested styles that works the best for us + */ +#if defined(Q_OS_MACOS) || defined(Q_OS_WIN) + QApplication::setStyle(QStringLiteral("breeze")); +#endif +#endif KCrash::initialize(); @@ -92,7 +124,7 @@ int main(int argc, char **argv) i18nc("@title", "File Manager"), KAboutLicense::GPL, i18nc("@info:credit", "(C) 2006-2022 The Dolphin Developers")); - aboutData.setHomepage(QStringLiteral("https://kde.org/applications/system/org.kde.dolphin")); + aboutData.setHomepage(QStringLiteral("https://apps.kde.org/dolphin")); aboutData.addAuthor(i18nc("@info:credit", "Felix Ernst"), i18nc("@info:credit", "Maintainer (since 2021) and developer"), QStringLiteral("felixernst@kde.org")); @@ -241,6 +273,8 @@ int main(int argc, char **argv) } } + mainWindow->setSessionAutoSaveEnabled(GeneralSettings::rememberOpenedTabs()); + #if HAVE_KUSERFEEDBACK auto feedbackProvider = DolphinFeedbackProvider::instance(); Q_UNUSED(feedbackProvider)