From bebcf035d264410c943e7bad861628c1b14dd1f2 Mon Sep 17 00:00:00 2001 From: Nathaniel Graham Date: Wed, 15 Nov 2017 19:48:29 -0700 Subject: [PATCH] Turn on Dolphin icon previews by default Summary: BUG: 338492 BUG: 350212 By default, turn on all preview plugins and turn on previews themselves. Depends on D8347 Test Plan: Tested this change in an up-to-date KDE Neon: removed the existing dolphinrc file, deployed Dolphin with the change, and observed that previews are now turned on for all file types for which a plugin exists except for text files, which are in the blacklist because they're mostly useless at nearly all icon sizes (still available in case people want them, though). Here's how Dolphin's main window looks by default now in KDE Neon: {F5441184} (You may notice that there are no previews for the video files; that's because Neon doesn't ship with any plugins for them, so that would be expected at this point) And here is how the Settings > General > Preview window looks like now by default: {F5435391} Reviewers: #dolphin, #vdg, markg, abetts, dfaure, aseigo, elvisangelaccio Reviewed By: #vdg, abetts, dfaure, elvisangelaccio Subscribers: abetts, cfeck, andreaska, emmanuelp, andreask, markg, broulik, anthonyfieroni, davidedmundson, ltoscano, dfaure, elvisangelaccio, #konqueror Tags: #dolphin Differential Revision: https://phabricator.kde.org/D7440 --- CMakeLists.txt | 2 +- src/kitemviews/kfileitemmodelrolesupdater.cpp | 8 ++++---- .../dolphin_directoryviewpropertysettings.kcfg | 2 +- src/settings/general/previewssettingspage.cpp | 12 ++++++------ src/views/dolphinitemlistview.cpp | 11 ++++++----- 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 38fd26bf3..5a39d6288 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATI project(Dolphin VERSION ${KDE_APPLICATIONS_VERSION}) set(QT_MIN_VERSION "5.5.0") -set(KF5_MIN_VERSION "5.37.0") +set(KF5_MIN_VERSION "5.40.0") set(ECM_MIN_VERSION "1.6.0") # ECM setup diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index 0d7f98311..8ea106a5e 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -99,10 +99,10 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel* model, QO Q_ASSERT(model); const KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings"); - m_enabledPlugins = globalConfig.readEntry("Plugins", QStringList() - << QStringLiteral("directorythumbnail") - << QStringLiteral("imagethumbnail") - << QStringLiteral("jpegthumbnail")); + m_enabledPlugins = globalConfig.readEntry("Plugins", QStringList()); + if (m_enabledPlugins.isEmpty()) { + m_enabledPlugins = KIO::PreviewJob::defaultPlugins(); + } connect(m_model, &KFileItemModel::itemsInserted, this, &KFileItemModelRolesUpdater::slotItemsInserted); diff --git a/src/settings/dolphin_directoryviewpropertysettings.kcfg b/src/settings/dolphin_directoryviewpropertysettings.kcfg index 9584fc8b3..6bcf3cd02 100644 --- a/src/settings/dolphin_directoryviewpropertysettings.kcfg +++ b/src/settings/dolphin_directoryviewpropertysettings.kcfg @@ -30,7 +30,7 @@ When this option is enabled, a preview of the file content is shown as an icon. - false + true diff --git a/src/settings/general/previewssettingspage.cpp b/src/settings/general/previewssettingspage.cpp index 1a92cd16c..ed0d9bd77 100644 --- a/src/settings/general/previewssettingspage.cpp +++ b/src/settings/general/previewssettingspage.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -172,12 +173,11 @@ void PreviewsSettingsPage::loadPreviewPlugins() void PreviewsSettingsPage::loadSettings() { - KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings"); - m_enabledPreviewPlugins = globalConfig.readEntry("Plugins", QStringList() - << QStringLiteral("directorythumbnail") - << QStringLiteral("imagethumbnail") - << QStringLiteral("jpegthumbnail")); - + const KConfigGroup globalConfig(KSharedConfig::openConfig(), QStringLiteral("PreviewSettings")); + m_enabledPreviewPlugins = globalConfig.readEntry("Plugins", QStringList()); + if (m_enabledPreviewPlugins.isEmpty()) { + m_enabledPreviewPlugins = KIO::PreviewJob::defaultPlugins(); + } const qulonglong defaultRemotePreview = static_cast(MaxRemotePreviewSize) * 1024 * 1024; const qulonglong maxRemoteByteSize = globalConfig.readEntry("MaximumRemoteSize", defaultRemotePreview); const int maxRemoteMByteSize = maxRemoteByteSize / (1024 * 1024); diff --git a/src/views/dolphinitemlistview.cpp b/src/views/dolphinitemlistview.cpp index a3740cb26..d73889fd5 100644 --- a/src/views/dolphinitemlistview.cpp +++ b/src/views/dolphinitemlistview.cpp @@ -30,6 +30,7 @@ #include #include +#include #include @@ -94,11 +95,11 @@ void DolphinItemListView::readSettings() updateGridSize(); const KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings"); - const QStringList plugins = globalConfig.readEntry("Plugins", QStringList() - << QStringLiteral("directorythumbnail") - << QStringLiteral("imagethumbnail") - << QStringLiteral("jpegthumbnail")); - setEnabledPlugins(plugins); + QStringList enabledPlugins = globalConfig.readEntry("Plugins", QStringList()); + if (enabledPlugins.isEmpty()) { + enabledPlugins = KIO::PreviewJob::defaultPlugins(); + } + setEnabledPlugins(enabledPlugins); endTransaction(); } -- 2.47.3