]> cloud.milkyroute.net Git - dolphin.git/commitdiff
Merge branch 'release/21.08'
authorElvis Angelaccio <elvis.angelaccio@kde.org>
Sun, 29 Aug 2021 17:42:51 +0000 (19:42 +0200)
committerElvis Angelaccio <elvis.angelaccio@kde.org>
Sun, 29 Aug 2021 17:42:51 +0000 (19:42 +0200)
26 files changed:
CMakeLists.txt
CMakePresets.json
src/CMakeLists.txt
src/dbusinterface.cpp
src/dolphinmainwindow.cpp
src/dolphinpart.cpp
src/dolphinrecenttabsmenu.cpp
src/global.cpp
src/kitemviews/kfileitemmodel.cpp
src/kitemviews/kfileitemmodel.h
src/kitemviews/kstandarditemlistwidget.cpp
src/kitemviews/private/kfileitemmodeldirlister.cpp [deleted file]
src/kitemviews/private/kfileitemmodeldirlister.h [deleted file]
src/main.cpp
src/org.kde.dolphin.appdata.xml
src/panels/information/informationpanelcontent.cpp
src/settings/kcm/kcmdolphingeneral.cpp
src/settings/kcm/kcmdolphingeneral.desktop
src/settings/kcm/kcmdolphinnavigation.cpp
src/settings/kcm/kcmdolphinnavigation.desktop
src/settings/kcm/kcmdolphinviewmodes.cpp
src/settings/kcm/kcmdolphinviewmodes.desktop
src/tests/kfileitemlistviewtest.cpp
src/tests/kfileitemmodeltest.cpp
src/trash/dolphintrash.cpp
src/views/dolphinview.cpp

index 7cd82296a52dcb1cbb3e2147f3862d3d8a7b300a..7d50205bc583063433e5df55ec1da87e0740e2b9 100644 (file)
@@ -2,13 +2,13 @@ cmake_minimum_required(VERSION 3.16)
 
 # KDE Application Version, managed by release script
 set (RELEASE_SERVICE_VERSION_MAJOR "21")
-set (RELEASE_SERVICE_VERSION_MINOR "08")
-set (RELEASE_SERVICE_VERSION_MICRO "1")
+set (RELEASE_SERVICE_VERSION_MINOR "11")
+set (RELEASE_SERVICE_VERSION_MICRO "70")
 set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE_VERSION_MINOR}.${RELEASE_SERVICE_VERSION_MICRO}")
 project(Dolphin VERSION ${RELEASE_SERVICE_VERSION})
 
 set(QT_MIN_VERSION "5.15.0")
-set(KF5_MIN_VERSION "5.81.0")
+set(KF5_MIN_VERSION "5.82.0")
 
 set(CMAKE_CXX_STANDARD 17)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
index 22e3de72eaffa37fc4375e0ce4bae645ab811d8c..d927f9984b9489d9b651ed0d92686cee482926ab 100644 (file)
                "CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
             }
         },
+        {
+            "name": "dev-disable-deprecated",
+            "displayName": "Build as without deprecated methods",
+            "generator": "Ninja",
+            "binaryDir": "${sourceDir}/build-disable-deprecated",
+            "cacheVariables": {
+                "CMAKE_BUILD_TYPE": "Debug",
+                "CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
+               "CMAKE_CXX_FLAGS_INIT": "-DQT_DISABLE_DEPRECATED_BEFORE=0x060000 -DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x060000"
+            }
+        },
         {
             "name": "asan",
             "displayName": "Build with Asan support.",
             "name": "dev",
             "configurePreset": "dev"
         },
+        {
+            "name": "asan",
+            "configurePreset": "asan"
+        },
+       {
+            "name": "dev-disable-deprecated",
+            "configurePreset": "dev-disable-deprecated"
+        },
+       {
+            "name": "unity",
+            "configurePreset": "unity"
+        },
         {
             "name": "clazy",
             "configurePreset": "clazy",
index 46dbaa152f086983eefc3d1075cf820eb869530b..147f18c003696f1f056da7f9a706ffb8434d6b96 100644 (file)
@@ -82,7 +82,6 @@ target_sources(dolphinprivate PRIVATE
     kitemviews/private/kdirectorycontentscounter.cpp
     kitemviews/private/kdirectorycontentscounterworker.cpp
     kitemviews/private/kfileitemclipboard.cpp
-    kitemviews/private/kfileitemmodeldirlister.cpp
     kitemviews/private/kfileitemmodelfilter.cpp
     kitemviews/private/kitemlistheaderwidget.cpp
     kitemviews/private/kitemlistkeyboardsearchmanager.cpp
index 7e453f72ac785ffddcba23582c6b2129cc10444a..e4f647f737ea0d9ca7e7fcbb5d06eb20e1f86e55 100644 (file)
@@ -9,6 +9,7 @@
 #include "dolphin_generalsettings.h"
 
 #include <KPropertiesDialog>
+#include <KWindowSystem>
 
 #include <QApplication>
 #include <QDBusConnection>
@@ -20,17 +21,19 @@ DBusInterface::DBusInterface() :
 {
     QDBusConnection::sessionBus().registerObject(QStringLiteral("/org/freedesktop/FileManager1"), this,
             QDBusConnection::ExportScriptableContents | QDBusConnection::ExportAdaptors);
-    QDBusConnection::sessionBus().interface()->registerService(QStringLiteral("org.freedesktop.FileManager1"),
-                                                               QDBusConnectionInterface::QueueService);
+    QDBusConnectionInterface *sessionInterface = QDBusConnection::sessionBus().interface();
+    if (sessionInterface) {
+        sessionInterface->registerService(QStringLiteral("org.freedesktop.FileManager1"), QDBusConnectionInterface::QueueService);
+    }
 }
 
 void DBusInterface::ShowFolders(const QStringList& uriList, const QString& startUpId)
 {
-    Q_UNUSED(startUpId)
     const QList<QUrl> urls = Dolphin::validateUris(uriList);
     if (urls.isEmpty()) {
         return;
     }
+    KWindowSystem::setCurrentXdgActivationToken(startUpId);
     const auto serviceName = isDaemon() ? QString() : QStringLiteral("org.kde.dolphin-%1").arg(QCoreApplication::applicationPid());
     if(!Dolphin::attachToExistingInstance(urls, false, GeneralSettings::splitView(), serviceName)) {
         Dolphin::openNewWindow(urls);
@@ -39,11 +42,11 @@ void DBusInterface::ShowFolders(const QStringList& uriList, const QString& start
 
 void DBusInterface::ShowItems(const QStringList& uriList, const QString& startUpId)
 {
-    Q_UNUSED(startUpId)
     const QList<QUrl> urls = Dolphin::validateUris(uriList);
     if (urls.isEmpty()) {
         return;
     }
+    KWindowSystem::setCurrentXdgActivationToken(startUpId);
     const auto serviceName = isDaemon() ? QString() : QStringLiteral("org.kde.dolphin-%1").arg(QCoreApplication::applicationPid());
     if(!Dolphin::attachToExistingInstance(urls, true, GeneralSettings::splitView(), serviceName)) {
         Dolphin::openNewWindow(urls, nullptr, Dolphin::OpenNewWindowFlag::Select);
@@ -52,9 +55,9 @@ void DBusInterface::ShowItems(const QStringList& uriList, const QString& startUp
 
 void DBusInterface::ShowItemProperties(const QStringList& uriList, const QString& startUpId)
 {
-    Q_UNUSED(startUpId)
     const QList<QUrl> urls = Dolphin::validateUris(uriList);
     if (!urls.isEmpty()) {
+        KWindowSystem::setCurrentXdgActivationToken(startUpId);
         KPropertiesDialog::showDialog(urls);
     }
 }
index 961607d867c84ec69f4a51bf76320fe66c3a0ef3..62e347032be8604f65b8d29c0af7491230507834 100644 (file)
@@ -211,11 +211,9 @@ DolphinMainWindow::DolphinMainWindow() :
     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()
@@ -1529,7 +1527,8 @@ void DolphinMainWindow::setupActions()
     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());
index e2e5393da35b6e8387163c80efe18672f863bbb6..9c551d67abf797cbc6883cb31fb860773c9b9a07 100644 (file)
@@ -11,7 +11,6 @@
 #include "dolphinpart_ext.h"
 #include "dolphinremoveaction.h"
 #include "kitemviews/kfileitemmodel.h"
-#include "kitemviews/private/kfileitemmodeldirlister.h"
 #include "views/dolphinnewfilemenuobserver.h"
 #include "views/dolphinremoteencoding.h"
 #include "views/dolphinview.h"
@@ -22,6 +21,7 @@
 #include <KAuthorized>
 #include <KConfigGroup>
 #include <KDialogJobUiDelegate>
+#include <KDirLister>
 #include <KFileItemListProperties>
 #include <KIconLoader>
 #include <KJobWidgets>
index 38eb4f65717b89d7161a6f17237817c10bc9cf75..d8bd06b5c82a529ba5da17f8edbdb1a03f49e083 100644 (file)
@@ -66,7 +66,7 @@ void DolphinRecentTabsMenu::handleAction(QAction* action)
         // action and the separator
         QList<QAction*> actions = menu()->actions();
         const int count = actions.size();
-        for (int i = 2; i < count; ++i) {
+        for (int i = count - 1; i >= 2; i--) {
             removeAction(actions.at(i));
         }
         Q_EMIT closedTabsCountChanged(0);
index 92b1f7f56939ddfa64933465ff2559d065a67a99..0712aa173f8c7429d7e6c80ce0f86a7692e4c441 100644 (file)
@@ -62,8 +62,7 @@ bool Dolphin::attachToExistingInstance(const QList<QUrl>& inputUrls, bool openFi
 {
     bool attached = false;
 
-    // TODO: once Wayland clients can raise or activate themselves remove check from conditional
-    if (KWindowSystem::isPlatformWayland() || inputUrls.isEmpty() || !GeneralSettings::openExternallyCalledFolderInNewTab()) {
+    if (inputUrls.isEmpty() || !GeneralSettings::openExternallyCalledFolderInNewTab()) {
         return false;
     }
 
@@ -118,7 +117,8 @@ QVector<QPair<QSharedPointer<OrgKdeDolphinMainWindowInterface>, QStringList>> Do
     }
 
     // Look for dolphin instances among all available dbus services.
-    const QStringList dbusServices = QDBusConnection::sessionBus().interface()->registeredServiceNames().value();
+    QDBusConnectionInterface *sessionInterface = QDBusConnection::sessionBus().interface();
+    const QStringList dbusServices = sessionInterface ? sessionInterface->registeredServiceNames().value() : QStringList();
     // Don't match the service without trailing "-" (unique instance)
     const QString pattern = QStringLiteral("org.kde.dolphin-");
     // Don't match the pid without leading "-"
index ffd933d25d6946121ead506c4fd3e5c0e0cc808e..776466d68c3c03ab20d94b63f29de756d20ec684 100644 (file)
 #include "dolphin_generalsettings.h"
 #include "dolphin_detailsmodesettings.h"
 #include "dolphindebug.h"
-#include "private/kfileitemmodeldirlister.h"
 #include "private/kfileitemmodelsortalgorithm.h"
 
-#include <kio_version.h>
+#include <KDirLister>
+#include <KIO/Job>
 #include <KLocalizedString>
 #include <KUrlMimeData>
 
@@ -53,7 +53,8 @@ KFileItemModel::KFileItemModel(QObject* parent) :
 
     loadSortingSettings();
 
-    m_dirLister = new KFileItemModelDirLister(this);
+    m_dirLister = new KDirLister(this);
+    m_dirLister->setAutoErrorHandlingEnabled(false);
     m_dirLister->setDelayedMimeTypes(true);
 
     const QWidget* parentWidget = qobject_cast<QWidget*>(parent);
@@ -61,23 +62,17 @@ KFileItemModel::KFileItemModel(QObject* parent) :
         m_dirLister->setMainWindow(parentWidget->window());
     }
 
-    connect(m_dirLister, &KFileItemModelDirLister::started, this, &KFileItemModel::directoryLoadingStarted);
+    connect(m_dirLister, &KCoreDirLister::started, this, &KFileItemModel::directoryLoadingStarted);
     connect(m_dirLister, QOverload<>::of(&KCoreDirLister::canceled), this, &KFileItemModel::slotCanceled);
-    connect(m_dirLister, &KFileItemModelDirLister::itemsAdded, this, &KFileItemModel::slotItemsAdded);
-    connect(m_dirLister, &KFileItemModelDirLister::itemsDeleted, this, &KFileItemModel::slotItemsDeleted);
-    connect(m_dirLister, &KFileItemModelDirLister::refreshItems, this, &KFileItemModel::slotRefreshItems);
+    connect(m_dirLister, &KCoreDirLister::itemsAdded, this, &KFileItemModel::slotItemsAdded);
+    connect(m_dirLister, &KCoreDirLister::itemsDeleted, this, &KFileItemModel::slotItemsDeleted);
+    connect(m_dirLister, &KCoreDirLister::refreshItems, this, &KFileItemModel::slotRefreshItems);
     connect(m_dirLister, QOverload<>::of(&KCoreDirLister::clear), this, &KFileItemModel::slotClear);
-    connect(m_dirLister, &KFileItemModelDirLister::infoMessage, this, &KFileItemModel::infoMessage);
-    connect(m_dirLister, &KFileItemModelDirLister::errorMessage, this, &KFileItemModel::errorMessage);
-    connect(m_dirLister, &KFileItemModelDirLister::percent, this, &KFileItemModel::directoryLoadingProgress);
+    connect(m_dirLister, &KCoreDirLister::infoMessage, this, &KFileItemModel::infoMessage);
+    connect(m_dirLister, &KCoreDirLister::jobError, this, &KFileItemModel::slotListerError);
+    connect(m_dirLister, &KCoreDirLister::percent, this, &KFileItemModel::directoryLoadingProgress);
     connect(m_dirLister, QOverload<const QUrl&, const QUrl&>::of(&KCoreDirLister::redirection), this, &KFileItemModel::directoryRedirection);
-    connect(m_dirLister, &KFileItemModelDirLister::urlIsFileError, this, &KFileItemModel::urlIsFileError);
-
-#if KIO_VERSION < QT_VERSION_CHECK(5, 79, 0)
-    connect(m_dirLister, QOverload<const QUrl&>::of(&KCoreDirLister::completed), this, &KFileItemModel::slotCompleted);
-#else
     connect(m_dirLister, &KCoreDirLister::listingDirCompleted, this, &KFileItemModel::slotCompleted);
-#endif
 
     // Apply default roles that should be determined
     resetRoles();
@@ -1796,6 +1791,11 @@ void KFileItemModel::sort(const QList<KFileItemModel::ItemData*>::iterator &begi
 
 int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const QCollator& collator) const
 {
+    // This function must never return 0, because that would break stable
+    // sorting, which leads to all kinds of bugs.
+    // See: https://bugs.kde.org/show_bug.cgi?id=433247
+    // If two items have equal sort values, let the fallbacks at the bottom of
+    // the function handle it.
     const KFileItem& itemA = a->item;
     const KFileItem& itemB = b->item;
 
@@ -1813,29 +1813,21 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const
             auto valueA = a->values.value("count");
             auto valueB = b->values.value("count");
             if (valueA.isNull()) {
-                if (valueB.isNull()) {
-                    result = 0;
-                    break;
-                } else {
-                    result = -1;
-                    break;
+                if (!valueB.isNull()) {
+                    return -1;
                 }
             } else if (valueB.isNull()) {
-                result = +1;
-                break;
+                return +1;
             } else {
                 if (valueA.toLongLong() < valueB.toLongLong()) {
-                    result = -1;
-                    break;
+                    return -1;
                 } else if (valueA.toLongLong() > valueB.toLongLong()) {
-                    result = +1;
-                    break;
-                } else {
-                    result = 0;
-                    break;
+                    return +1;
                 }
             }
+            break;
         }
+
         KIO::filesize_t sizeA = 0;
         if (itemA.isDir()) {
             sizeA = a->values.value("size").toULongLong();
@@ -1848,12 +1840,10 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const
         } else {
             sizeB = itemB.size();
         }
-        if (sizeA > sizeB) {
-            result = +1;
-        } else if (sizeA < sizeB) {
-            result = -1;
-        } else {
-            result = 0;
+        if (sizeA < sizeB) {
+            return -1;
+        } else if (sizeA > sizeB) {
+            return +1;
         }
         break;
     }
@@ -1862,9 +1852,9 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const
         const long long dateTimeA = itemA.entry().numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME, -1);
         const long long dateTimeB = itemB.entry().numberValue(KIO::UDSEntry::UDS_MODIFICATION_TIME, -1);
         if (dateTimeA < dateTimeB) {
-            result = -1;
+            return -1;
         } else if (dateTimeA > dateTimeB) {
-            result = +1;
+            return +1;
         }
         break;
     }
@@ -1873,9 +1863,9 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const
         const long long dateTimeA = itemA.entry().numberValue(KIO::UDSEntry::UDS_CREATION_TIME, -1);
         const long long dateTimeB = itemB.entry().numberValue(KIO::UDSEntry::UDS_CREATION_TIME, -1);
         if (dateTimeA < dateTimeB) {
-            result = -1;
+            return -1;
         } else if (dateTimeA > dateTimeB) {
-            result = +1;
+            return +1;
         }
         break;
     }
@@ -1884,9 +1874,9 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const
         const QDateTime dateTimeA = a->values.value("deletiontime").toDateTime();
         const QDateTime dateTimeB = b->values.value("deletiontime").toDateTime();
         if (dateTimeA < dateTimeB) {
-            result = -1;
+            return -1;
         } else if (dateTimeA > dateTimeB) {
-            result = +1;
+            return +1;
         }
         break;
     }
@@ -1907,9 +1897,9 @@ int KFileItemModel::sortRoleCompare(const ItemData* a, const ItemData* b, const
         const QString roleValueA = a->values.value(role).toString();
         const QString roleValueB = b->values.value(role).toString();
         if (!roleValueA.isEmpty() && roleValueB.isEmpty()) {
-            result = -1;
+            return -1;
         } else if (roleValueA.isEmpty() && !roleValueB.isEmpty()) {
-            result = +1;
+            return +1;
         } else if (isRoleValueNatural(m_sortRole)) {
             result = stringCompare(roleValueA, roleValueB, collator);
         } else {
@@ -2517,3 +2507,15 @@ bool KFileItemModel::isConsistent() const
 
     return true;
 }
+
+void KFileItemModel::slotListerError(KIO::Job *job)
+{
+    if (job->error() == KIO::ERR_IS_FILE) {
+        if (auto *listJob = qobject_cast<KIO::ListJob *>(job)) {
+            Q_EMIT urlIsFileError(listJob->url());
+        }
+    } else {
+        const QString errorString = job->errorString();
+        Q_EMIT errorMessage(!errorString.isEmpty() ? errorString : i18nc("@info:status", "Unknown error."));
+    }
+}
index acf4b761cf51bde3b470c197ce5ad36e81721962..3602c16c12227f6a250561d60d67ca29e0d64744 100644 (file)
 
 #include <functional>
 
-class KFileItemModelDirLister;
+class KDirLister;
+
 class QTimer;
 
+namespace KIO {
+    class Job;
+}
+
 /**
  * @brief KItemModelBase implementation for KFileItems.
  *
@@ -270,6 +275,7 @@ private Q_SLOTS:
     void slotRefreshItems(const QList<QPair<KFileItem, KFileItem> >& items);
     void slotClear();
     void slotSortingChoiceChanged();
+    void slotListerError(KIO::Job *job);
 
     void dispatchPendingItemsToInsert();
 
@@ -458,7 +464,7 @@ private:
     bool isConsistent() const;
 
 private:
-    KFileItemModelDirLister* m_dirLister;
+    KDirLister *m_dirLister = nullptr;
 
     QCollator m_collator;
     bool m_naturalSorting;
index 9c527fa171deb2e4b74672b9cf6ca40c8e642e67..1751812710f8d78dce8baa1e52c5de9d4f22ece6 100644 (file)
@@ -226,8 +226,22 @@ void KStandardItemListWidgetInformant::calculateCompactLayoutItemSizeHints(QVect
 void KStandardItemListWidgetInformant::calculateDetailsLayoutItemSizeHints(QVector<qreal>& logicalHeightHints, qreal& logicalWidthHint, const KItemListView* view) const
 {
     const KItemListStyleOption& option = view->styleOption();
-    const qreal height = option.padding * 2 + qMax(option.iconSize, option.fontMetrics.height());
-    logicalHeightHints.fill(height);
+
+    float zoomLevel = 1;
+    if (option.iconSize >= KIconLoader::SizeEnormous) {
+        zoomLevel = 2;
+    } else if (option.iconSize >= KIconLoader::SizeHuge) {
+        zoomLevel = 1.8;
+    } else if (option.iconSize >= KIconLoader::SizeLarge) {
+        zoomLevel = 1.6;
+    } else if (option.iconSize >= KIconLoader::SizeMedium) {
+        zoomLevel = 1.4;
+    } else if (option.iconSize >= KIconLoader::SizeSmallMedium) {
+        zoomLevel = 1.2;
+    }
+
+    const qreal contentHeight = qMax<qreal>(option.iconSize, zoomLevel * option.fontMetrics.height());
+    logicalHeightHints.fill(contentHeight + 2 * option.padding);
     logicalWidthHint = -1.0;
 }
 
diff --git a/src/kitemviews/private/kfileitemmodeldirlister.cpp b/src/kitemviews/private/kfileitemmodeldirlister.cpp
deleted file mode 100644 (file)
index eb860a2..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2006-2012 Peter Penz <peter.penz19@gmail.com>
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#include "kfileitemmodeldirlister.h"
-
-#include <KLocalizedString>
-#include <KIO/Job>
-#include <kio_version.h>
-
-KFileItemModelDirLister::KFileItemModelDirLister(QObject* parent) :
-    KDirLister(parent)
-{
-#if KIO_VERSION < QT_VERSION_CHECK(5, 82, 0)
-    setAutoErrorHandlingEnabled(false, nullptr);
-#else
-    setAutoErrorHandlingEnabled(false);
-#endif
-}
-
-KFileItemModelDirLister::~KFileItemModelDirLister()
-{
-}
-
-void KFileItemModelDirLister::handleError(KIO::Job* job)
-{
-    if (job->error() == KIO::ERR_IS_FILE) {
-        Q_EMIT urlIsFileError(url());
-    } else {
-        const QString errorString = job->errorString();
-        if (errorString.isEmpty()) {
-            Q_EMIT errorMessage(i18nc("@info:status", "Unknown error."));
-        } else {
-            Q_EMIT errorMessage(errorString);
-        }
-    }
-}
-
diff --git a/src/kitemviews/private/kfileitemmodeldirlister.h b/src/kitemviews/private/kfileitemmodeldirlister.h
deleted file mode 100644 (file)
index 5636959..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2006-2012 Peter Penz <peter.penz19@gmail.com>
- *
- * SPDX-License-Identifier: GPL-2.0-or-later
- */
-
-#ifndef KFILEITEMMODELDIRLISTER_H
-#define KFILEITEMMODELDIRLISTER_H
-
-#include "dolphin_export.h"
-
-#include <KDirLister>
-
-#include <QUrl>
-
-/**
- * @brief Extends the class KDirLister by emitting a signal when an
- *        error occurred instead of showing an error dialog.
- *        KDirLister::autoErrorHandlingEnabled() is set to false.
- */
-class DOLPHIN_EXPORT KFileItemModelDirLister : public KDirLister
-{
-    Q_OBJECT
-
-public:
-    explicit KFileItemModelDirLister(QObject* parent = nullptr);
-    ~KFileItemModelDirLister() override;
-
-Q_SIGNALS:
-    /** Is emitted whenever an error has occurred. */
-    void errorMessage(const QString& msg);
-
-    /**
-     * Is emitted when the URL of the directory lister represents a file.
-     * In this case no signal errorMessage() will be emitted.
-     */
-    void urlIsFileError(const QUrl& url);
-
-protected:
-    void handleError(KIO::Job* job) override;
-};
-
-#endif
index 6e9ef0b2a6dce729aecb29f5a641618aa7f950c5..779690c1c5de280c9742f2d432e0a3c395156986 100644 (file)
@@ -23,6 +23,7 @@
 #include <KLocalizedString>
 #include <Kdelibs4ConfigMigrator>
 #include <KConfigGui>
+#include <KIO/PreviewJob>
 
 #include <QApplication>
 #include <QCommandLineParser>
@@ -61,6 +62,8 @@ 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());
+
     KCrash::initialize();
 
     Kdelibs4ConfigMigrator migrate(QStringLiteral("dolphin"));
@@ -178,7 +181,12 @@ int main(int argc, char **argv)
 
     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()) {
index 5e8ff388759b17589ee98bafc7d58090d0c5a522..18c2577a4c2f7a9084aadab2d34552ce077aa9c7 100644 (file)
   <summary xml:lang="zh-TW">檔案管理員</summary>
   <description>
     <p>Dolphin is KDE's file manager that lets you navigate and browse the contents of your hard drives, USB sticks, SD cards, and more. Creating, moving, or deleting files and folders is simple and fast.</p>
+    <p xml:lang="ar">دولفين هو مدير ملفات كدي الذي يتيح لك التنقل وتصفح محتويات محركات الأقراص الثابتة و USB وبطاقات SD والمزيد. يعد إنشاء الملفات والمجلدات أو نقلها أو حذفها أمرًا بسيطًا وسريعًا.</p>
     <p xml:lang="az">Dolphin sizin sərt disklərinizin, USB yaddaş qurğularınızın, SD katlarınızın və s. tərkibindəkiləri nəzərdən keçirmənizə imkan verən fayl meneceridir. Faylların və qovluqların yaradılması, Köçürülməsi və ya silinməsi sadə, rahat və cəld icra edilir.</p>
     <p xml:lang="ca">El Dolphin és el gestor de fitxers del KDE que permet navegar i explorar el contingut dels discs durs, memòries USB, targetes SD i més. Crear, moure o suprimir fitxers i carpetes és senzill i ràpid.</p>
     <p xml:lang="de">Dolphin ist die Dateiverwaltung von KDE und ermöglicht es Ihnen, den Inhalt Ihrer Festplatten, USB-Sticks, SD-Speicherkarten und anderen Geräten einzusehen. Das Erstellen, Verschieben und Löschen von Dateien und Ordnern funktioniert einfach und schnell.</p>
     <p xml:lang="x-test">xxDolphin is KDE's file manager that lets you navigate and browse the contents of your hard drives, USB sticks, SD cards, and more. Creating, moving, or deleting files and folders is simple and fast.xx</p>
     <p xml:lang="zh-CN">Dolphin 是 KDE 的文件管理器,您可以使用它来浏览硬盘、U 盘、SD 卡和其他存储设备中的内容,也可以方便快捷地创建、移动、删除文件和文件夹。</p>
     <p>Dolphin contains plenty of productivity features that will save you time. The multiple tabs and split view features allow navigating multiple folders at the same time, and you can easily drag and drop files between views to move or copy them. Dolphin's right-click menu provides with many quick actions that let you compress, share, and duplicate files, among many other things. You can also add your own custom actions.</p>
+    <p xml:lang="ar">يحتوي دولفين على الكثير من ميزات الإنتاجية التي ستوفر لك الوقت.تسمح علامات التبويب المتعددة وميزات العرض المقسم بالتنقل في مجلدات متعددة في نفس الوقت ، ويمكنك بسهولة سحب الملفات وإفلاتها بين طرق العرض لنقلها أو نسخها. توفر قائمة النقر بزر الفأرة الأيمن في دولفين العديد من الإجراءات السريعة التي تتيح لك ضغط الملفات ومشاركتها وتكرارها ، من بين أشياء أخرى كثيرة. يمكنك أيضًا إضافة الإجراءات المخصصة الخاصة بك.</p>
     <p xml:lang="az">Dolphin, səmərəliyi artıracaq bir çox funksiyalardan ibarətdir və bu da sizə vaxtınıza qənaət edəcəkdir. Birdən çox vərəq və bölünmə funksiyaları, qovluqlar arasında rahat hərəkət etməyə imkan verir, həmçinin, siz faylları, həmin görünən qovluqlar arasında tutub yerini dəyişməklə köçürə və kopyalaya bilərsiniz. Siçanın sağ düyməsi ilə açılan Dolpin menyusunda faylları sıxmağa, paylaşmağa, yeni surətini yaratmağa və bu kimi başqa bir çox cəld əməlləri təqdim edir. Bundan başqa siz həmçinin öz fərdi əməlinizi də bu menyuya daxil edə bilərsiniz.</p>
     <p xml:lang="ca">El Dolphin conté moltes característiques de productivitat que us estalviaran temps. Les característiques de múltiples pestanyes i de vista dividida permeten navegar per diverses carpetes al mateix temps, i poder arrossegar i deixar anar els fitxers amb facilitat entre les vistes per a moure'ls o copiar-los. El menú contextual del Dolphin ofereix moltes accions ràpides que us permeten comprimir, compartir i duplicar els fitxers, entre moltes altres coses. També podreu afegir-hi les vostres pròpies accions personalitzades.</p>
     <p xml:lang="de">Dolphin beinhaltet eine Vielzahl von Produktivitätsfunktionen, die Ihnen Zeit sparen. Dank Registerkarten und geteilten Ansichten können Sie in mehreren Ordnern gleichzeitig navigieren und Sie können einfach Dateien zwischen verschiedenen Ansichten mittels Ziehen kopieren oder verschieben. Dolphins Kontextmenü bietet viele Schnellzugriffe zu Aktionen, mit denen Sie Dateien unter anderem komprimieren, teilen und duplizieren können. Sie können außerdem eigene Aktionen hinzufügen.</p>
     <p xml:lang="x-test">xxDolphin contains plenty of productivity features that will save you time. The multiple tabs and split view features allow navigating multiple folders at the same time, and you can easily drag and drop files between views to move or copy them. Dolphin's right-click menu provides with many quick actions that let you compress, share, and duplicate files, among many other things. You can also add your own custom actions.xx</p>
     <p xml:lang="zh-CN">Dolphin 内建了许多有助于提高工作效率的功能。多标签页窗口、拆分视图等功能可以让您同时浏览多个文件夹,还可以在标签页和拆分的视图之间拖放、复制、移动文件。Dolphin 的右键菜单内建了许多快捷操作功能,例如压缩、分享、创建文件的副本等。您还可以将自定义操作添加到右键菜单。</p>
     <p>Dolphin is very lightweight, but at the same time, you can adapt it to your specific needs. This means that you can carry out your file management exactly the way you want to. Dolphin supports three different view modes: a classic grid view of all the files, a more detailed view, and a tree view. You can also configure most of Dolphin's behavior.</p>
+    <p xml:lang="ar">دولفين خفيف للغاية ، ولكن في نفس الوقت، يمكنك تكييفه مع احتياجاتك الخاصة. هذا يعني أنه يمكنك تنفيذ إدارة الملفات بالطريقة التي تريدها بالضبط. يدعم دولفين ثلاثة أوضاع عرض مختلفة: عرض الشبكة الكلاسيكي لجميع الملفات ، وعرض أكثر تفصيلاً ، وعرض شجرة. يمكنك أيضًا ضبط معظم سلوك دولفين. </p>
     <p xml:lang="az">Dolphin çox yüngüldür, bununla belə siz onu öz ehtiyaclarınıza uyğunlaşdıra bilərsiniz. Bu o deməkdir ki, siz fayllarınızı istədiyiniz kimi idarə edə bilərsiniz. Dolphin üç müxtəlif baxış rejimini dəstəkləyir: bütün faylları üçün şəbəkə formasında klassik görünüş, budaqlanan şəkildə daha təfərrüatlı baxış forması. Siz həmçinin daha çox Dolphin davranışlarını tənzimləyə bilərsiniz.</p>
     <p xml:lang="ca">El Dolphin és molt lleuger, però al mateix temps, podreu adaptar-lo a les vostres necessitats específiques. Això significa que podreu realitzar la gestió de fitxers exactament de la manera que vulgueu. El Dolphin admet tres modes de vista diferents: una vista de quadrícula clàssica amb tots els fitxers, una vista més detallada i una vista en arbre. També podreu configurar la major part del comportament del Dolphin.</p>
     <p xml:lang="de">Dolphin ist sehr leichtgewichtig, kann dabei aber dennoch an Ihre spezifischen Bedürfnisse angepasst werden. Das bedeutet, dass Sie Ihre Dateiverwaltung so vornehmen können, wie Sie es wollen. Dolphin bietet drei unterschiedliche Ansichtsmodi: eine klassische Rasteransicht aller Dateien mit Symbolen, eine detailliertere Ansicht sowie eine Baumansicht. Sie können außerdem einen großen Teil des Verhaltens von Dolphin anpassen.</p>
     <p xml:lang="x-test">xxDolphin is very lightweight, but at the same time, you can adapt it to your specific needs. This means that you can carry out your file management exactly the way you want to. Dolphin supports three different view modes: a classic grid view of all the files, a more detailed view, and a tree view. You can also configure most of Dolphin's behavior.xx</p>
     <p xml:lang="zh-CN">Dolphin 虽然是一款轻量级的应用程序,但依然支持用户按照自己的需要对界面和功能进行深入定制,让文件管理操作更加得心应手。Dolphin 的文件视图有三种模式:经典的图标网格模式、简洁的紧凑模式、显示多栏元数据的详情模式。Dolphin 的绝大多数程序行为都能进行配置。</p>
     <p>Dolphin can display files and folders from many Internet cloud services and other remote machines as if they were right there on your desktop.</p>
+    <p xml:lang="ar">يمكن لدولفين عرض الملفات والمجلدات من العديد من خدمات الإنترنت السحابية والأجهزة البعيدة الأخرى كما لو كانت موجودة على سطح المكتب.</p>
     <p xml:lang="az">Dolphin, bir çox İnternet və digər uzaq maşınların bulud xidmətindən faylları və qovluqları birbaşa sizin İş Masanızdakı kimi göstərəcəkdir.</p>
     <p xml:lang="ca">El Dolphin pot mostrar els fitxers i carpetes de molts serveis en el núvol d'Internet i altres màquines remotes com si hi estiguessin al vostre escriptori.</p>
     <p xml:lang="de">Dolphin kann Dateien und Ordner vieler Internet-Clouddienste und anderer entfernter Maschinen anzeigen, als wären sie direkt lokal auf Ihrem Rechner.</p>
     <p xml:lang="x-test">xxDolphin can display files and folders from many Internet cloud services and other remote machines as if they were right there on your desktop.xx</p>
     <p xml:lang="zh-CN">Dolphin 可以显示多种云存储服务和远程计算机中的文件和文件夹,使用体验与本机文件完全一致。</p>
     <p>Dolphin also comes with an integrated terminal that allows you to run commands on the current folder. You can extend the capabilities of Dolphin even further with powerful plugins to adapt it to your workflow. You can use the git integration plugin to interact with git repositories, or the Nextcloud plugin to synchronize your files online, and much more.</p>
+    <p xml:lang="ar">يأتي دولفين أيضًا مع محطة طرفية متكاملة تتيح لك تشغيل الأوامر في المجلد الحالي. يمكنك توسيع إمكانيات دولفين إلى أبعد من ذلك باستخدام المكونات الإضافية القوية لتكييفها مع سير عملك. يمكنك استخدام المكون الإضافي git للتكامل للتفاعل مع مستودعات git ، أو المكون الإضافي Nextcloud لمزامنة ملفاتك عبر الإنترنت ، وغير ذلك الكثير.</p>
     <p xml:lang="az">Dolphin həmçinin daxilə quraşdırılmış terminalla təmin olunur ki, bu da cari qovluqda əmrləri başlatmağa imkan verir. Siz, Dolphinin imkanlarını iş prosesinizə uyğunlaşdıracaq, güclü qoşmaların köməyi ilə daha da genişləndirə bilərsiniz. Sİz git repazitoriyaları ilə işləmək üçün, qoşulmuş git inteqrasiya modulundan və ya fayllarınızı internet üzərindən sinxronlaşdırmaq üçün Nextcloud qoşmasından və s. istifadə edə bilərsiniz.</p>
     <p xml:lang="ca">El Dolphin també ve amb un terminal integrat que permet executar ordres a la carpeta actual. Podreu estendre encara més les capacitats de Dolphin amb potents connectors per a que s'adapti al vostre flux de treball. Podreu utilitzar el connector d'integració amb el Git per a interactuar amb els repositoris de Git, o el connector de Nextcloud per a sincronitzar els vostres fitxers en línia, i molt més.</p>
     <p xml:lang="de">Dolphin beinhaltet ein integriertes Terminal, in welchem Sie Befehle im aktuellen Ordner ausführen können. Sie können die Fähigkeiten von Dolphin mit zusätzlichen Modulen noch weiter ausbauen, um ihn an Ihre Arbeitsweise anzupassen. Sie können durch das Integrationsmodul für Git mit Git-Repositorys interagieren, mit dem Nextcloud-Modul Ihre Dateien online synchronisieren und vieles mehr.</p>
   <screenshots>
     <screenshot type="default">
       <caption>File management in Dolphin</caption>
+      <caption xml:lang="ar">إدارة الملفات في دولفين</caption>
       <caption xml:lang="ast">Xestión de ficheros en Dolphin</caption>
       <caption xml:lang="az">Dolphində faylların idarə edilməsi</caption>
       <caption xml:lang="ca">Gestió de fitxers al Dolphin</caption>
     </screenshot>
     <screenshot type="default">
       <caption>Embedded Terminal in Dolphin</caption>
+      <caption xml:lang="ar">طرفية مضمنة في دولفين</caption>
       <caption xml:lang="az">Dolphin daxilinə yerləşdirilmiş Terminal</caption>
       <caption xml:lang="ca">Terminal incrustat en el Dolphin</caption>
       <caption xml:lang="cs">Zabudovaný terminál v Dolphinu</caption>
     </screenshot>
     <screenshot>
       <caption>Dolphin lets you configure your file manager exactly how you want</caption>
+      <caption xml:lang="ar">يتيح لك دولفين ضبط مدير الملفات الخاص بك بالطريقة التي تريدها بالضبط</caption>
       <caption xml:lang="az">Dolphin, fayl bələdçisini tam istədiyiniz kimi tənzimləməyə imkan verir</caption>
       <caption xml:lang="ca">El Dolphin permet configurar el gestor de fitxers exactament com es vol</caption>
       <caption xml:lang="de">Mit Dolphin können Sie Ihre Dateiverwaltung genau so einrichten, wie Sie es wünschen</caption>
index d43b9f5205d72b92531b0b9849f652a59078d881..98c012243752fe98562ee419e84ea784bd6db98f 100644 (file)
@@ -394,8 +394,8 @@ void InformationPanelContent::showPreview(const KFileItem& item,
         // adds a play arrow
 
         // compute relative pixel positions
-        const int zeroX = static_cast<int>(p.width() / 2 - PLAY_ARROW_SIZE / 2 / devicePixelRatio());
-        const int zeroY = static_cast<int>(p.height() / 2 - PLAY_ARROW_SIZE / 2 / devicePixelRatio());
+        const int zeroX = static_cast<int>((p.width() / 2 - PLAY_ARROW_SIZE / 2) / pixmap.devicePixelRatio());
+        const int zeroY = static_cast<int>((p.height() / 2 - PLAY_ARROW_SIZE / 2) / pixmap.devicePixelRatio());
 
         QPolygon arrow;
         arrow << QPoint(zeroX, zeroY);
index 3a0aa779bdfc3defc179739d77731508701f4ea2..fd0044325260233bf62cc771d901c20f79ac8a06 100644 (file)
@@ -17,7 +17,7 @@
 #include <QTabWidget>
 #include <QVBoxLayout>
 
-K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory, registerPlugin<DolphinGeneralConfigModule>(QStringLiteral("dolphingeneral"));)
+K_PLUGIN_FACTORY(KCMDolphinGeneralConfigFactory, registerPlugin<DolphinGeneralConfigModule>();)
 
 DolphinGeneralConfigModule::DolphinGeneralConfigModule(QWidget *parent, const QVariantList &args) :
     KCModule(parent, args),
index 0c37e03f55baa68125ad3cf24b99b7daa668d08e..fecb72ebaf5dc15f052a63d0b5fb2c8b3df91dec 100644 (file)
@@ -108,7 +108,6 @@ Type=Service
 X-KDE-ServiceTypes=KCModule
 
 X-KDE-Library=kcm_dolphingeneral
-X-KDE-PluginKeyword=dolphingeneral
 X-DocPath=dolphin/configuring-dolphin.html#preferences-dialog
 # ctxt: Random file browsing settings.
 Name=General
index 74fce85c7f3ac2155b5421840034b572a9c27dad..f749628ab6aeed17abcbbcb29a07f91b164aee12 100644 (file)
@@ -13,7 +13,7 @@
 
 #include <QVBoxLayout>
 
-K_PLUGIN_FACTORY(KCMDolphinNavigationConfigFactory, registerPlugin<DolphinNavigationConfigModule>(QStringLiteral("dolphinnavigation"));)
+K_PLUGIN_FACTORY(KCMDolphinNavigationConfigFactory, registerPlugin<DolphinNavigationConfigModule>();)
 
 DolphinNavigationConfigModule::DolphinNavigationConfigModule(QWidget *parent, const QVariantList &args) :
     KCModule(parent, args),
index 954ad991fc60db77bc0e553a4eddf0ee29b99d8d..b7f7fe8d3b5b342e5f8733d8607b4375dfdcf988 100644 (file)
@@ -108,7 +108,6 @@ Type=Service
 X-KDE-ServiceTypes=KCModule
 
 X-KDE-Library=kcm_dolphinnavigation
-X-KDE-PluginKeyword=dolphinnavigation
 X-DocPath=dolphin/configuring-dolphin.html#preferences-dialog-navigation
 Name=Navigation
 Name[ar]=التّنقّل
index fcd33a0f0f05bd71e498d32fec38d2300c3285b1..0c287ed220786858663fc7e925911be94a15ee3a 100644 (file)
@@ -17,7 +17,7 @@
 #include <QTabWidget>
 #include <QVBoxLayout>
 
-K_PLUGIN_FACTORY(KCMDolphinViewModesConfigFactory, registerPlugin<DolphinViewModesConfigModule>(QStringLiteral("dolphinviewmodes"));)
+K_PLUGIN_FACTORY(KCMDolphinViewModesConfigFactory, registerPlugin<DolphinViewModesConfigModule>();)
 
 DolphinViewModesConfigModule::DolphinViewModesConfigModule(QWidget *parent, const QVariantList &args) :
     KCModule(parent, args),
index 5bbb0eed5d0496b11309b2d0317d8483dba48684..c652f0d3964a4a54fa1a61297c9ac9789ddf0498 100644 (file)
@@ -106,7 +106,6 @@ Type=Service
 X-KDE-ServiceTypes=KCModule
 
 X-KDE-Library=kcm_dolphinviewmodes
-X-KDE-PluginKeyword=dolphinviewmodes
 X-DocPath=dolphin/configuring-dolphin.html#preferences-dialog-viewmodes
 Name=View Modes
 Name[ar]=أوضاع المنظور
index 4a5cd063021dffc612ef49d0382e9d0448fe3341..22d5d3a01ae143e691bf13e9aedfa6303dfa6129 100644 (file)
@@ -6,9 +6,10 @@
 
 #include "kitemviews/kfileitemlistview.h"
 #include "kitemviews/kfileitemmodel.h"
-#include "kitemviews/private/kfileitemmodeldirlister.h"
 #include "testdir.h"
 
+#include <KDirLister>
+
 #include <QGraphicsView>
 #include <QTest>
 #include <QSignalSpy>
index 558a00ab592475fb2b30a6a295967d2913221943..c7d5307ed287d469520dbbe7a3a67cb8706c33b1 100644 (file)
 #include <QTimer>
 #include <QMimeData>
 
+#include <KDirLister>
 #include <kio/job.h>
 
 #include "kitemviews/kfileitemmodel.h"
-#include "kitemviews/private/kfileitemmodeldirlister.h"
 #include "testdir.h"
 
 void myMessageOutput(QtMsgType type, const QMessageLogContext& context, const QString& msg)
index 8684cda0690db9a2c337e50dd441a78816ffda3a..df88345561b1268a44dca0281e570fac31713906 100644 (file)
@@ -22,11 +22,7 @@ Trash::Trash()
     // The trash icon must always be updated dependent on whether
     // the trash is empty or not. We use a KDirLister that automatically
     // watches for changes if the number of items has been changed.
-#if KIO_VERSION < QT_VERSION_CHECK(5, 82, 0)
-    m_trashDirLister->setAutoErrorHandlingEnabled(false, nullptr);
-#else
     m_trashDirLister->setAutoErrorHandlingEnabled(false);
-#endif
     m_trashDirLister->setDelayedMimeTypes(true);
     auto trashDirContentChanged = [this]() {
         bool isTrashEmpty = m_trashDirLister->items().isEmpty();
index f5c21a2c5561ecf16898f98b5aefeb5d61f9b3ed..9c85303fdf157b7746b342999dbe8a7a027e8bcd 100644 (file)
@@ -7,7 +7,9 @@
 
 #include "dolphinview.h"
 
+#include "dolphin_compactmodesettings.h"
 #include "dolphin_detailsmodesettings.h"
+#include "dolphin_iconsmodesettings.h"
 #include "dolphin_generalsettings.h"
 #include "dolphinitemlistview.h"
 #include "dolphinnewfilemenuobserver.h"
@@ -1508,16 +1510,30 @@ QUrl DolphinView::openItemAsFolderUrl(const KFileItem& item, const bool browseTh
 
 void DolphinView::resetZoomLevel()
 {
-    ViewModeSettings::ViewMode mode;
-
+    // TODO : Switch to using ViewModeSettings after MR #256 is merged
+    int defaultIconSize = KIconLoader::SizeSmall;
     switch (m_mode) {
-    case IconsView:     mode = ViewModeSettings::IconsMode;   break;
-    case CompactView:   mode = ViewModeSettings::CompactMode; break;
-    case DetailsView:   mode = ViewModeSettings::DetailsMode; break;
+    case IconsView:
+        IconsModeSettings::self()->useDefaults(true);
+        defaultIconSize = IconsModeSettings::iconSize();
+        IconsModeSettings::self()->useDefaults(false);
+        break;
+    case DetailsView:
+        DetailsModeSettings::self()->useDefaults(true);
+        defaultIconSize = DetailsModeSettings::iconSize();
+        DetailsModeSettings::self()->useDefaults(false);
+        break;
+    case CompactView:
+        CompactModeSettings::self()->useDefaults(true);
+        defaultIconSize = CompactModeSettings::iconSize();
+        CompactModeSettings::self()->useDefaults(false);
+        break;
+    default:
+        Q_ASSERT(false);
+        break;
     }
-    const ViewModeSettings settings(mode);
-    const QSize iconSize = QSize(settings.iconSize(), settings.iconSize());
-    setZoomLevel(ZoomLevelInfo::zoomLevelForIconSize(iconSize));
+
+    setZoomLevel(ZoomLevelInfo::zoomLevelForIconSize(QSize(defaultIconSize, defaultIconSize)));
 }
 
 void DolphinView::observeCreatedItem(const QUrl& url)