Commit e60e3f07 authored by Nathaniel Graham's avatar Nathaniel Graham

Use KConfig::readEntry()'s default argument properly

Summary: Follow-on patch to D7440 to use KConfig::readEntry()'s default argument properly to reduce some unnecessary code

Test Plan: Tested in KDE Neon. no regressions; by default, all plugins are enabled if the key is not set, and if it is set, user changes to the list are remembered

Reviewers: #dolphin, elvisangelaccio, dfaure, apol

Reviewed By: #dolphin, elvisangelaccio, apol

Differential Revision: https://phabricator.kde.org/D8846
parent bebcf035
......@@ -99,10 +99,7 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel* model, QO
Q_ASSERT(model);
const KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings");
m_enabledPlugins = globalConfig.readEntry("Plugins", QStringList());
if (m_enabledPlugins.isEmpty()) {
m_enabledPlugins = KIO::PreviewJob::defaultPlugins();
}
m_enabledPlugins = globalConfig.readEntry("Plugins", KIO::PreviewJob::defaultPlugins());
connect(m_model, &KFileItemModel::itemsInserted,
this, &KFileItemModelRolesUpdater::slotItemsInserted);
......
......@@ -174,10 +174,8 @@ void PreviewsSettingsPage::loadPreviewPlugins()
void PreviewsSettingsPage::loadSettings()
{
const KConfigGroup globalConfig(KSharedConfig::openConfig(), QStringLiteral("PreviewSettings"));
m_enabledPreviewPlugins = globalConfig.readEntry("Plugins", QStringList());
if (m_enabledPreviewPlugins.isEmpty()) {
m_enabledPreviewPlugins = KIO::PreviewJob::defaultPlugins();
}
m_enabledPreviewPlugins = globalConfig.readEntry("Plugins", KIO::PreviewJob::defaultPlugins());
const qulonglong defaultRemotePreview = static_cast<qulonglong>(MaxRemotePreviewSize) * 1024 * 1024;
const qulonglong maxRemoteByteSize = globalConfig.readEntry("MaximumRemoteSize", defaultRemotePreview);
const int maxRemoteMByteSize = maxRemoteByteSize / (1024 * 1024);
......
......@@ -95,11 +95,7 @@ void DolphinItemListView::readSettings()
updateGridSize();
const KConfigGroup globalConfig(KSharedConfig::openConfig(), "PreviewSettings");
QStringList enabledPlugins = globalConfig.readEntry("Plugins", QStringList());
if (enabledPlugins.isEmpty()) {
enabledPlugins = KIO::PreviewJob::defaultPlugins();
}
setEnabledPlugins(enabledPlugins);
setEnabledPlugins(globalConfig.readEntry("Plugins", KIO::PreviewJob::defaultPlugins()));
endTransaction();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment