┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/settings/interface
diff options
context:
space:
mode:
authorDimosthenis Krallis <[email protected]>2023-08-18 07:07:48 +0000
committerMéven Car <[email protected]>2023-08-18 07:07:48 +0000
commit489b56b68bb29e81337e115c490eea4403001b71 (patch)
tree4d88f18b937387cb2b8b025f1bdf7efde12f7c4f /src/settings/interface
parentf413e83a2266db274409dfc01bf157b74eea922a (diff)
Dolphin settings revamp
It includes a move of the settings in the Navigation and Startup sections to the Interface (formerly Behavior) section. It also includes a new tab in the View (formerly View Mode) section, called General where some settings regarding Display style, Browsing and Miscellaneous settings The Interface section has new tabs named Folders & Tabs and Status & Location bars respectively where most of the Startup and Navigation settings moved. The `dolphin/kcms/kcm_dolphinnavigation` kcm is removed.
Diffstat (limited to 'src/settings/interface')
-rw-r--r--src/settings/interface/configurepreviewplugindialog.cpp73
-rw-r--r--src/settings/interface/configurepreviewplugindialog.h36
-rw-r--r--src/settings/interface/confirmationssettingspage.cpp177
-rw-r--r--src/settings/interface/confirmationssettingspage.h48
-rw-r--r--src/settings/interface/folderstabssettingspage.cpp263
-rw-r--r--src/settings/interface/folderstabssettingspage.h69
-rw-r--r--src/settings/interface/interfacesettingspage.cpp74
-rw-r--r--src/settings/interface/interfacesettingspage.h42
-rw-r--r--src/settings/interface/previewssettingspage.cpp205
-rw-r--r--src/settings/interface/previewssettingspage.h59
-rw-r--r--src/settings/interface/statusandlocationbarssettingspage.cpp128
-rw-r--r--src/settings/interface/statusandlocationbarssettingspage.h55
12 files changed, 1229 insertions, 0 deletions
diff --git a/src/settings/interface/configurepreviewplugindialog.cpp b/src/settings/interface/configurepreviewplugindialog.cpp
new file mode 100644
index 000000000..8846d8261
--- /dev/null
+++ b/src/settings/interface/configurepreviewplugindialog.cpp
@@ -0,0 +1,73 @@
+/*
+ * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "configurepreviewplugindialog.h"
+
+#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87)
+
+#include <KIO/DeleteJob>
+#include <KIO/JobUiDelegate>
+#include <KIO/ThumbCreator>
+#include <KJobWidgets>
+#include <KLocalizedString>
+#include <QPluginLoader>
+
+#include <QDialogButtonBox>
+#include <QPushButton>
+#include <QStandardPaths>
+#include <QUrl>
+#include <QVBoxLayout>
+
+ConfigurePreviewPluginDialog::ConfigurePreviewPluginDialog(const QString &pluginName, const QString &desktopEntryName, QWidget *parent)
+ : QDialog(parent)
+{
+ QSharedPointer<ThumbCreator> previewPlugin;
+ const QString pluginPath = QPluginLoader(desktopEntryName).fileName();
+ if (!pluginPath.isEmpty()) {
+ newCreator create = (newCreator)QLibrary::resolve(pluginPath, "new_creator");
+ if (create) {
+ previewPlugin.reset(dynamic_cast<ThumbCreator *>(create()));
+ }
+ }
+
+ setWindowTitle(i18nc("@title:window", "Configure Preview for %1", pluginName));
+ setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Minimum);
+ setMinimumWidth(400);
+
+ auto layout = new QVBoxLayout(this);
+
+ if (previewPlugin) {
+ auto configurationWidget = previewPlugin->createConfigurationWidget();
+ configurationWidget->setParent(this);
+ layout->addWidget(configurationWidget);
+
+ layout->addStretch();
+
+ connect(this, &ConfigurePreviewPluginDialog::accepted, this, [=] {
+ // TODO: It would be great having a mechanism to tell PreviewJob that only previews
+ // for a specific MIME-type should be regenerated. As this is not available yet we
+ // delete the whole thumbnails directory.
+ previewPlugin->writeConfiguration(configurationWidget);
+
+ // https://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html#DIRECTORY
+ const QString thumbnailsPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QLatin1String("/thumbnails/");
+ KIO::del(QUrl::fromLocalFile(thumbnailsPath), KIO::HideProgressInfo);
+ });
+ }
+
+ auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
+ connect(buttonBox, &QDialogButtonBox::accepted, this, &ConfigurePreviewPluginDialog::accept);
+ connect(buttonBox, &QDialogButtonBox::rejected, this, &ConfigurePreviewPluginDialog::reject);
+ layout->addWidget(buttonBox);
+
+ auto okButton = buttonBox->button(QDialogButtonBox::Ok);
+ okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
+ okButton->setDefault(true);
+}
+
+#include "moc_configurepreviewplugindialog.cpp"
+
+#endif // KIO_VERSION
diff --git a/src/settings/interface/configurepreviewplugindialog.h b/src/settings/interface/configurepreviewplugindialog.h
new file mode 100644
index 000000000..66504cce2
--- /dev/null
+++ b/src/settings/interface/configurepreviewplugindialog.h
@@ -0,0 +1,36 @@
+/*
+ * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef CONFIGUREPREVIEWPLUGINDIALOG_H
+#define CONFIGUREPREVIEWPLUGINDIALOG_H
+
+#include <kiowidgets_export.h>
+
+#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87)
+
+#include <QDialog>
+
+/**
+ * @brief Dialog for configuring preview-plugins.
+ */
+class ConfigurePreviewPluginDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @param pluginName User visible name of the plugin
+ * @param desktopEntryName The name of the plugin that is noted in the desktopentry.
+ * Is used to instantiate the plugin to get the configuration
+ * widget.
+ * @param parent Parent widget.
+ */
+ ConfigurePreviewPluginDialog(const QString &pluginName, const QString &desktopEntryName, QWidget *parent);
+ ~ConfigurePreviewPluginDialog() override = default;
+};
+#endif // KIOWIDGETS_BUILD_DEPRECATED_SINCE
+
+#endif
diff --git a/src/settings/interface/confirmationssettingspage.cpp b/src/settings/interface/confirmationssettingspage.cpp
new file mode 100644
index 000000000..61c3a14b6
--- /dev/null
+++ b/src/settings/interface/confirmationssettingspage.cpp
@@ -0,0 +1,177 @@
+/*
+ * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "confirmationssettingspage.h"
+
+#include "dolphin_generalsettings.h"
+#include "global.h"
+
+#include <KLocalizedString>
+
+#include <QCheckBox>
+#include <QComboBox>
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QVBoxLayout>
+
+namespace
+{
+enum ScriptExecution { AlwaysAsk = 0, Open = 1, Execute = 2 };
+
+const bool ConfirmEmptyTrash = true;
+const bool ConfirmTrash = false;
+const bool ConfirmDelete = true;
+const int ConfirmScriptExecution = ScriptExecution::AlwaysAsk;
+}
+
+ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget *parent)
+ : SettingsPageBase(parent)
+ , m_confirmMoveToTrash(nullptr)
+ , m_confirmEmptyTrash(nullptr)
+ , m_confirmDelete(nullptr)
+ ,
+
+#if HAVE_TERMINAL
+ m_confirmClosingTerminalRunningProgram(nullptr)
+ ,
+#endif
+
+ m_confirmClosingMultipleTabs(nullptr)
+{
+ QVBoxLayout *topLayout = new QVBoxLayout(this);
+
+ QLabel *confirmLabelKde = new QLabel(i18nc("@title:group", "Ask for confirmation in all KDE applications when:"), this);
+ confirmLabelKde->setWordWrap(true);
+
+ m_confirmMoveToTrash = new QCheckBox(i18nc("@option:check Ask for confirmation when", "Moving files or folders to trash"), this);
+ m_confirmEmptyTrash = new QCheckBox(i18nc("@option:check Ask for confirmation when", "Emptying trash"), this);
+ m_confirmDelete = new QCheckBox(i18nc("@option:check Ask for confirmation when", "Deleting files or folders"), this);
+
+ QLabel *confirmLabelDolphin = new QLabel(i18nc("@title:group", "Ask for confirmation in Dolphin when:"), this);
+ confirmLabelDolphin->setWordWrap(true);
+
+ m_confirmClosingMultipleTabs = new QCheckBox(i18nc("@option:check Ask for confirmation in Dolphin when", "Closing windows with multiple tabs"), this);
+
+#if HAVE_TERMINAL
+ m_confirmClosingTerminalRunningProgram =
+ new QCheckBox(i18nc("@option:check Ask for confirmation when", "Closing windows with a program running in the Terminal panel"), this);
+#endif
+
+ QHBoxLayout *executableScriptLayout = new QHBoxLayout();
+ QLabel *executableScriptLabel = new QLabel(i18nc("@title:group", "When opening an executable file:"), this);
+ confirmLabelKde->setWordWrap(true);
+ executableScriptLayout->addWidget(executableScriptLabel);
+
+ m_confirmScriptExecution = new QComboBox(this);
+ m_confirmScriptExecution->addItems({i18n("Always ask"), i18n("Open in application"), i18n("Run script")});
+ executableScriptLayout->addWidget(m_confirmScriptExecution);
+
+ topLayout->addWidget(confirmLabelKde);
+ topLayout->addWidget(m_confirmMoveToTrash);
+ topLayout->addWidget(m_confirmEmptyTrash);
+ topLayout->addWidget(m_confirmDelete);
+ topLayout->addSpacing(Dolphin::VERTICAL_SPACER_HEIGHT);
+ topLayout->addWidget(confirmLabelDolphin);
+ topLayout->addWidget(m_confirmClosingMultipleTabs);
+
+#if HAVE_TERMINAL
+ topLayout->addWidget(m_confirmClosingTerminalRunningProgram);
+#endif
+
+ topLayout->addSpacing(Dolphin::VERTICAL_SPACER_HEIGHT);
+ topLayout->addLayout(executableScriptLayout);
+
+ topLayout->addStretch();
+
+ loadSettings();
+
+ connect(m_confirmMoveToTrash, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed);
+ connect(m_confirmEmptyTrash, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed);
+ connect(m_confirmDelete, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed);
+ connect(m_confirmScriptExecution, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &ConfirmationsSettingsPage::changed);
+ connect(m_confirmClosingMultipleTabs, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed);
+
+#if HAVE_TERMINAL
+ connect(m_confirmClosingTerminalRunningProgram, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed);
+#endif
+}
+
+ConfirmationsSettingsPage::~ConfirmationsSettingsPage()
+{
+}
+
+void ConfirmationsSettingsPage::applySettings()
+{
+ KSharedConfig::Ptr kioConfig = KSharedConfig::openConfig(QStringLiteral("kiorc"), KConfig::NoGlobals);
+ KConfigGroup confirmationGroup(kioConfig, "Confirmations");
+ confirmationGroup.writeEntry("ConfirmTrash", m_confirmMoveToTrash->isChecked());
+ confirmationGroup.writeEntry("ConfirmEmptyTrash", m_confirmEmptyTrash->isChecked());
+ confirmationGroup.writeEntry("ConfirmDelete", m_confirmDelete->isChecked());
+
+ KConfigGroup scriptExecutionGroup(kioConfig, "Executable scripts");
+ const int index = m_confirmScriptExecution->currentIndex();
+ switch (index) {
+ case ScriptExecution::AlwaysAsk:
+ scriptExecutionGroup.writeEntry("behaviourOnLaunch", "alwaysAsk");
+ break;
+ case ScriptExecution::Open:
+ scriptExecutionGroup.writeEntry("behaviourOnLaunch", "open");
+ break;
+ case ScriptExecution::Execute:
+ scriptExecutionGroup.writeEntry("behaviourOnLaunch", "execute");
+ break;
+ }
+ kioConfig->sync();
+
+ GeneralSettings *settings = GeneralSettings::self();
+ settings->setConfirmClosingMultipleTabs(m_confirmClosingMultipleTabs->isChecked());
+
+#if HAVE_TERMINAL
+ settings->setConfirmClosingTerminalRunningProgram(m_confirmClosingTerminalRunningProgram->isChecked());
+#endif
+
+ settings->save();
+}
+
+void ConfirmationsSettingsPage::restoreDefaults()
+{
+ GeneralSettings *settings = GeneralSettings::self();
+ settings->useDefaults(true);
+ loadSettings();
+ settings->useDefaults(false);
+
+ m_confirmMoveToTrash->setChecked(ConfirmTrash);
+ m_confirmEmptyTrash->setChecked(ConfirmEmptyTrash);
+ m_confirmDelete->setChecked(ConfirmDelete);
+ m_confirmScriptExecution->setCurrentIndex(ConfirmScriptExecution);
+}
+
+void ConfirmationsSettingsPage::loadSettings()
+{
+ KSharedConfig::Ptr kioConfig = KSharedConfig::openConfig(QStringLiteral("kiorc"), KConfig::IncludeGlobals);
+ const KConfigGroup confirmationGroup(kioConfig, "Confirmations");
+ m_confirmMoveToTrash->setChecked(confirmationGroup.readEntry("ConfirmTrash", ConfirmTrash));
+ m_confirmEmptyTrash->setChecked(confirmationGroup.readEntry("ConfirmEmptyTrash", ConfirmEmptyTrash));
+ m_confirmDelete->setChecked(confirmationGroup.readEntry("ConfirmDelete", ConfirmDelete));
+
+ const KConfigGroup scriptExecutionGroup(KSharedConfig::openConfig(QStringLiteral("kiorc")), "Executable scripts");
+ const QString value = scriptExecutionGroup.readEntry("behaviourOnLaunch", "alwaysAsk");
+ if (value == QLatin1String("alwaysAsk")) {
+ m_confirmScriptExecution->setCurrentIndex(ScriptExecution::AlwaysAsk);
+ } else if (value == QLatin1String("execute")) {
+ m_confirmScriptExecution->setCurrentIndex(ScriptExecution::Execute);
+ } else /* if (value == QLatin1String("open"))*/ {
+ m_confirmScriptExecution->setCurrentIndex(ScriptExecution::Open);
+ }
+
+ m_confirmClosingMultipleTabs->setChecked(GeneralSettings::confirmClosingMultipleTabs());
+
+#if HAVE_TERMINAL
+ m_confirmClosingTerminalRunningProgram->setChecked(GeneralSettings::confirmClosingTerminalRunningProgram());
+#endif
+}
+
+#include "moc_confirmationssettingspage.cpp"
diff --git a/src/settings/interface/confirmationssettingspage.h b/src/settings/interface/confirmationssettingspage.h
new file mode 100644
index 000000000..56dd1a78c
--- /dev/null
+++ b/src/settings/interface/confirmationssettingspage.h
@@ -0,0 +1,48 @@
+/*
+ * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef CONFIRMATIONSSETTINGSPAGE_H
+#define CONFIRMATIONSSETTINGSPAGE_H
+
+#include "config-dolphin.h"
+#include "settings/settingspagebase.h"
+
+class QCheckBox;
+class QComboBox;
+
+/**
+ * @brief Page for the enabling or disabling confirmation dialogs.
+ */
+class ConfirmationsSettingsPage : public SettingsPageBase
+{
+ Q_OBJECT
+
+public:
+ explicit ConfirmationsSettingsPage(QWidget *parent);
+ ~ConfirmationsSettingsPage() override;
+
+ /** @see SettingsPageBase::applySettings() */
+ void applySettings() override;
+
+ /** @see SettingsPageBase::restoreDefaults() */
+ void restoreDefaults() override;
+
+private:
+ void loadSettings();
+
+private:
+ QCheckBox *m_confirmMoveToTrash;
+ QCheckBox *m_confirmEmptyTrash;
+ QCheckBox *m_confirmDelete;
+
+#if HAVE_TERMINAL
+ QCheckBox *m_confirmClosingTerminalRunningProgram;
+#endif
+
+ QCheckBox *m_confirmClosingMultipleTabs;
+ QComboBox *m_confirmScriptExecution;
+};
+
+#endif
diff --git a/src/settings/interface/folderstabssettingspage.cpp b/src/settings/interface/folderstabssettingspage.cpp
new file mode 100644
index 000000000..d71ad2d96
--- /dev/null
+++ b/src/settings/interface/folderstabssettingspage.cpp
@@ -0,0 +1,263 @@
+/*
+ * SPDX-FileCopyrightText: 2006 Peter Penz ([email protected]) and Patrice Tremblay
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "folderstabssettingspage.h"
+#include "dolphinmainwindow.h"
+#include "dolphinviewcontainer.h"
+#include "global.h"
+
+#include <KLocalizedString>
+#include <KMessageBox>
+#include <KProtocolManager>
+
+#include <QButtonGroup>
+#include <QCheckBox>
+#include <QFileDialog>
+#include <QFormLayout>
+#include <QGridLayout>
+#include <QHBoxLayout>
+#include <QLineEdit>
+#include <QPushButton>
+#include <QRadioButton>
+#include <QSpacerItem>
+
+FoldersTabsSettingsPage::FoldersTabsSettingsPage(QWidget *parent)
+ : SettingsPageBase(parent)
+ , m_homeUrlBoxLayoutContainer(nullptr)
+ , m_buttonBoxLayoutContainer(nullptr)
+ , m_homeUrlRadioButton(nullptr)
+ , m_homeUrl(nullptr)
+ , m_rememberOpenedTabsRadioButton(nullptr)
+ , m_openNewTabAfterLastTab(nullptr)
+ , m_openNewTabAfterCurrentTab(nullptr)
+ , m_splitView(nullptr)
+ , m_filterBar(nullptr)
+ , m_showFullPathInTitlebar(nullptr)
+ , m_openExternallyCalledFolderInNewTab(nullptr)
+ , m_useTabForSplitViewSwitch(nullptr)
+{
+ QFormLayout *topLayout = new QFormLayout(this);
+
+ // Show on startup
+ m_rememberOpenedTabsRadioButton = new QRadioButton(i18nc("@option:radio Show on startup", "Folders, tabs, and window state from last time"));
+ m_homeUrlRadioButton = new QRadioButton();
+ // HACK: otherwise the radio button has too much spacing in a grid layout
+ m_homeUrlRadioButton->setMaximumWidth(24);
+
+ QButtonGroup *initialViewGroup = new QButtonGroup(this);
+ initialViewGroup->addButton(m_rememberOpenedTabsRadioButton);
+ initialViewGroup->addButton(m_homeUrlRadioButton);
+
+ // create 'Home URL' editor
+ m_homeUrlBoxLayoutContainer = new QWidget(this);
+ QHBoxLayout *homeUrlBoxLayout = new QHBoxLayout(m_homeUrlBoxLayoutContainer);
+ homeUrlBoxLayout->setContentsMargins(0, 0, 0, 0);
+
+ m_homeUrl = new QLineEdit();
+ m_homeUrl->setClearButtonEnabled(true);
+ homeUrlBoxLayout->addWidget(m_homeUrl);
+
+ QPushButton *selectHomeUrlButton = new QPushButton(QIcon::fromTheme(QStringLiteral("folder-open")), QString());
+ homeUrlBoxLayout->addWidget(selectHomeUrlButton);
+
+#ifndef QT_NO_ACCESSIBILITY
+ selectHomeUrlButton->setAccessibleName(i18nc("@action:button", "Select Home Location"));
+#endif
+
+ connect(selectHomeUrlButton, &QPushButton::clicked, this, &FoldersTabsSettingsPage::selectHomeUrl);
+
+ m_buttonBoxLayoutContainer = new QWidget(this);
+ QHBoxLayout *buttonBoxLayout = new QHBoxLayout(m_buttonBoxLayoutContainer);
+ buttonBoxLayout->setContentsMargins(0, 0, 0, 0);
+
+ QPushButton *useCurrentButton = new QPushButton(i18nc("@action:button", "Use Current Location"));
+ buttonBoxLayout->addWidget(useCurrentButton);
+ connect(useCurrentButton, &QPushButton::clicked, this, &FoldersTabsSettingsPage::useCurrentLocation);
+ QPushButton *useDefaultButton = new QPushButton(i18nc("@action:button", "Use Default Location"));
+ buttonBoxLayout->addWidget(useDefaultButton);
+ connect(useDefaultButton, &QPushButton::clicked, this, &FoldersTabsSettingsPage::useDefaultLocation);
+
+ QGridLayout *startInLocationLayout = new QGridLayout();
+ startInLocationLayout->setHorizontalSpacing(0);
+ startInLocationLayout->setContentsMargins(0, 0, 0, 0);
+ startInLocationLayout->addWidget(m_homeUrlRadioButton, 0, 0);
+ startInLocationLayout->addWidget(m_homeUrlBoxLayoutContainer, 0, 1);
+ startInLocationLayout->addWidget(m_buttonBoxLayoutContainer, 1, 1);
+
+ topLayout->addRow(i18nc("@label:textbox", "Show on startup:"), m_rememberOpenedTabsRadioButton);
+ topLayout->addRow(QString(), startInLocationLayout);
+
+ topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
+ // Opening Folders
+ m_openExternallyCalledFolderInNewTab = new QCheckBox(i18nc("@option:check Opening Folders", "Keep a single Dolphin window, opening new folders in tabs"));
+ topLayout->addRow(i18nc("@label:checkbox", "Opening Folders:"), m_openExternallyCalledFolderInNewTab);
+ // Window
+ m_showFullPathInTitlebar = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path in title bar"));
+ topLayout->addRow(i18nc("@label:checkbox", "Window:"), m_showFullPathInTitlebar);
+ m_filterBar = new QCheckBox(i18nc("@option:check Window Startup Settings", "Show filter bar"));
+ topLayout->addRow(QString(), m_filterBar);
+
+ topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
+
+ // Tabs properties
+ m_openNewTabAfterCurrentTab = new QRadioButton(i18nc("option:radio", "After current tab"));
+ m_openNewTabAfterLastTab = new QRadioButton(i18nc("option:radio", "At end of tab bar"));
+ QButtonGroup *tabsBehaviorGroup = new QButtonGroup(this);
+ tabsBehaviorGroup->addButton(m_openNewTabAfterCurrentTab);
+ tabsBehaviorGroup->addButton(m_openNewTabAfterLastTab);
+ topLayout->addRow(i18nc("@title:group", "Open new tabs: "), m_openNewTabAfterCurrentTab);
+ topLayout->addRow(QString(), m_openNewTabAfterLastTab);
+
+ // Split Views
+ topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
+
+ // 'Switch between panes of split views with tab key'
+ m_useTabForSplitViewSwitch = new QCheckBox(i18nc("option:check split view panes", "Switch between panes with Tab key"));
+ topLayout->addRow(i18nc("@title:group", "Split view: "), m_useTabForSplitViewSwitch);
+
+ // 'Close active pane when turning off split view'
+ m_closeActiveSplitView = new QCheckBox(i18nc("option:check", "Turning off split view closes active pane"));
+ topLayout->addRow(QString(), m_closeActiveSplitView);
+ m_closeActiveSplitView->setToolTip(i18n("When deactivated, turning off split view will close the inactive pane"));
+
+ // 'Begin in split view mode'
+ m_splitView = new QCheckBox(i18nc("@option:check Startup Settings", "Begin in split view mode"));
+ topLayout->addRow(i18n("New windows:"), m_splitView);
+
+ loadSettings();
+
+ updateInitialViewOptions();
+
+ connect(m_homeUrl, &QLineEdit::textChanged, this, &FoldersTabsSettingsPage::slotSettingsChanged);
+ connect(m_rememberOpenedTabsRadioButton, &QRadioButton::toggled, this, &FoldersTabsSettingsPage::slotSettingsChanged);
+ connect(m_homeUrlRadioButton, &QRadioButton::toggled, this, &FoldersTabsSettingsPage::slotSettingsChanged);
+
+ connect(m_splitView, &QCheckBox::toggled, this, &FoldersTabsSettingsPage::slotSettingsChanged);
+ connect(m_filterBar, &QCheckBox::toggled, this, &FoldersTabsSettingsPage::slotSettingsChanged);
+
+ connect(m_openExternallyCalledFolderInNewTab, &QCheckBox::toggled, this, &FoldersTabsSettingsPage::slotSettingsChanged);
+ connect(m_showFullPathInTitlebar, &QCheckBox::toggled, this, &FoldersTabsSettingsPage::slotSettingsChanged);
+
+ connect(m_useTabForSplitViewSwitch, &QCheckBox::toggled, this, &FoldersTabsSettingsPage::changed);
+ connect(m_closeActiveSplitView, &QCheckBox::toggled, this, &FoldersTabsSettingsPage::changed);
+
+ connect(m_openNewTabAfterCurrentTab, &QRadioButton::toggled, this, &FoldersTabsSettingsPage::changed);
+ connect(m_openNewTabAfterLastTab, &QRadioButton::toggled, this, &FoldersTabsSettingsPage::changed);
+}
+
+FoldersTabsSettingsPage::~FoldersTabsSettingsPage()
+{
+}
+
+void FoldersTabsSettingsPage::applySettings()
+{
+ GeneralSettings *settings = GeneralSettings::self();
+
+ settings->setUseTabForSwitchingSplitView(m_useTabForSplitViewSwitch->isChecked());
+ settings->setCloseActiveSplitView(m_closeActiveSplitView->isChecked());
+ const QUrl url(QUrl::fromUserInput(m_homeUrl->text(), QString(), QUrl::AssumeLocalFile));
+ if (url.isValid() && KProtocolManager::supportsListing(url)) {
+ KIO::StatJob *job = KIO::statDetails(url, KIO::StatJob::SourceSide, KIO::StatDetail::StatBasic, KIO::JobFlag::HideProgressInfo);
+ connect(job, &KJob::result, this, [this, settings, url](KJob *job) {
+ if (job->error() == 0 && qobject_cast<KIO::StatJob *>(job)->statResult().isDir()) {
+ settings->setHomeUrl(url.toDisplayString(QUrl::PreferLocalFile));
+ } else {
+ showSetDefaultDirectoryError();
+ }
+ });
+ } else {
+ showSetDefaultDirectoryError();
+ }
+
+ // Remove saved state if "remember open tabs" has been turned off
+ if (!m_rememberOpenedTabsRadioButton->isChecked()) {
+ KConfigGroup windowState{KSharedConfig::openConfig(QStringLiteral("dolphinrc")), "WindowState"};
+ if (windowState.exists()) {
+ windowState.deleteGroup();
+ }
+ }
+
+ settings->setRememberOpenedTabs(m_rememberOpenedTabsRadioButton->isChecked());
+ settings->setSplitView(m_splitView->isChecked());
+ settings->setFilterBar(m_filterBar->isChecked());
+ settings->setOpenExternallyCalledFolderInNewTab(m_openExternallyCalledFolderInNewTab->isChecked());
+ settings->setShowFullPathInTitlebar(m_showFullPathInTitlebar->isChecked());
+
+ settings->setOpenNewTabAfterLastTab(m_openNewTabAfterLastTab->isChecked());
+
+ settings->save();
+}
+
+void FoldersTabsSettingsPage::restoreDefaults()
+{
+ GeneralSettings *settings = GeneralSettings::self();
+ settings->useDefaults(true);
+ loadSettings();
+ settings->useDefaults(false);
+}
+
+void FoldersTabsSettingsPage::slotSettingsChanged()
+{
+ // Provide a hint that the startup settings have been changed. This allows the views
+ // to apply the startup settings only if they have been explicitly changed by the user
+ // (see bug #254947).
+ GeneralSettings::setModifiedStartupSettings(true);
+
+ // Enable and disable home URL controls appropriately
+ updateInitialViewOptions();
+ Q_EMIT changed();
+}
+
+void FoldersTabsSettingsPage::updateInitialViewOptions()
+{
+ m_homeUrlBoxLayoutContainer->setEnabled(m_homeUrlRadioButton->isChecked());
+ m_buttonBoxLayoutContainer->setEnabled(m_homeUrlRadioButton->isChecked());
+}
+
+void FoldersTabsSettingsPage::selectHomeUrl()
+{
+ const QUrl homeUrl(QUrl::fromUserInput(m_homeUrl->text(), QString(), QUrl::AssumeLocalFile));
+ QUrl url = QFileDialog::getExistingDirectoryUrl(this, QString(), homeUrl);
+ if (!url.isEmpty()) {
+ m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile));
+ slotSettingsChanged();
+ }
+}
+
+void FoldersTabsSettingsPage::useCurrentLocation()
+{
+ m_homeUrl->setText(m_url.toDisplayString(QUrl::PreferLocalFile));
+}
+
+void FoldersTabsSettingsPage::useDefaultLocation()
+{
+ m_homeUrl->setText(QDir::homePath());
+}
+
+void FoldersTabsSettingsPage::loadSettings()
+{
+ const QUrl url(Dolphin::homeUrl());
+ m_homeUrl->setText(url.toDisplayString(QUrl::PreferLocalFile));
+ m_rememberOpenedTabsRadioButton->setChecked(GeneralSettings::rememberOpenedTabs());
+ m_homeUrlRadioButton->setChecked(!GeneralSettings::rememberOpenedTabs());
+ m_splitView->setChecked(GeneralSettings::splitView());
+ m_filterBar->setChecked(GeneralSettings::filterBar());
+ m_showFullPathInTitlebar->setChecked(GeneralSettings::showFullPathInTitlebar());
+ m_openExternallyCalledFolderInNewTab->setChecked(GeneralSettings::openExternallyCalledFolderInNewTab());
+
+ m_useTabForSplitViewSwitch->setChecked(GeneralSettings::useTabForSwitchingSplitView());
+ m_closeActiveSplitView->setChecked(GeneralSettings::closeActiveSplitView());
+
+ m_openNewTabAfterLastTab->setChecked(GeneralSettings::openNewTabAfterLastTab());
+ m_openNewTabAfterCurrentTab->setChecked(!m_openNewTabAfterLastTab->isChecked());
+}
+
+void FoldersTabsSettingsPage::showSetDefaultDirectoryError()
+{
+ KMessageBox::error(this, i18nc("@info", "The location for the home folder is invalid or does not exist, it will not be applied."));
+}
+
+#include "moc_folderstabssettingspage.cpp"
diff --git a/src/settings/interface/folderstabssettingspage.h b/src/settings/interface/folderstabssettingspage.h
new file mode 100644
index 000000000..89e5c0982
--- /dev/null
+++ b/src/settings/interface/folderstabssettingspage.h
@@ -0,0 +1,69 @@
+/*
+ * SPDX-FileCopyrightText: 2008 Peter Penz <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef FOLDERSTABSSETTINGSPAGE_H
+#define FOLDERSTABSSETTINGSPAGE_H
+
+#include "dolphin_generalsettings.h"
+#include "settings/settingspagebase.h"
+
+#include <QUrl>
+#include <qobject.h>
+
+class QCheckBox;
+class QLineEdit;
+class QLabel;
+class QRadioButton;
+
+/**
+ * @brief Tab page for the 'Behavior' settings of the Dolphin settings dialog.
+ */
+class FoldersTabsSettingsPage : public SettingsPageBase
+{
+ Q_OBJECT
+
+public:
+ FoldersTabsSettingsPage(QWidget *parent);
+ ~FoldersTabsSettingsPage() override;
+
+ /** @see SettingsPageBase::applySettings() */
+ void applySettings() override;
+
+ /** @see SettingsPageBase::restoreDefaults() */
+ void restoreDefaults() override;
+
+public:
+ QWidget *m_homeUrlBoxLayoutContainer;
+ QWidget *m_buttonBoxLayoutContainer;
+ QRadioButton *m_homeUrlRadioButton;
+
+private Q_SLOTS:
+ void slotSettingsChanged();
+ void updateInitialViewOptions();
+ void selectHomeUrl();
+ void useCurrentLocation();
+ void useDefaultLocation();
+
+private:
+ void loadSettings();
+ void showSetDefaultDirectoryError();
+
+private:
+ QUrl m_url;
+ QLineEdit *m_homeUrl;
+ QRadioButton *m_rememberOpenedTabsRadioButton;
+
+ QRadioButton *m_openNewTabAfterLastTab;
+ QRadioButton *m_openNewTabAfterCurrentTab;
+
+ QCheckBox *m_splitView;
+ QCheckBox *m_filterBar;
+ QCheckBox *m_showFullPathInTitlebar;
+ QCheckBox *m_openExternallyCalledFolderInNewTab;
+ QCheckBox *m_useTabForSplitViewSwitch;
+ QCheckBox *m_closeActiveSplitView;
+};
+
+#endif
diff --git a/src/settings/interface/interfacesettingspage.cpp b/src/settings/interface/interfacesettingspage.cpp
new file mode 100644
index 000000000..e941cf467
--- /dev/null
+++ b/src/settings/interface/interfacesettingspage.cpp
@@ -0,0 +1,74 @@
+/*
+ * SPDX-FileCopyrightText: 2006 Peter Penz <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "interfacesettingspage.h"
+
+#include "confirmationssettingspage.h"
+#include "folderstabssettingspage.h"
+#include "previewssettingspage.h"
+#include "statusandlocationbarssettingspage.h"
+
+#include <KLocalizedString>
+
+#include <QTabWidget>
+#include <QVBoxLayout>
+
+InterfaceSettingsPage::InterfaceSettingsPage(QWidget *parent)
+ : SettingsPageBase(parent)
+ , m_pages()
+{
+ QVBoxLayout *topLayout = new QVBoxLayout(this);
+ topLayout->setContentsMargins(0, 0, 0, 0);
+
+ QTabWidget *tabWidget = new QTabWidget(this);
+
+ // initialize 'Folders & Tabs' tab
+ FoldersTabsSettingsPage *foldersTabsPage = new FoldersTabsSettingsPage(tabWidget);
+ tabWidget->addTab(foldersTabsPage, i18nc("@title:tab Folders & Tabs settings", "Folders && Tabs"));
+ connect(foldersTabsPage, &FoldersTabsSettingsPage::changed, this, &InterfaceSettingsPage::changed);
+
+ // initialize 'Previews' tab
+ PreviewsSettingsPage *previewsPage = new PreviewsSettingsPage(tabWidget);
+ tabWidget->addTab(previewsPage, i18nc("@title:tab Previews settings", "Previews"));
+ connect(previewsPage, &PreviewsSettingsPage::changed, this, &InterfaceSettingsPage::changed);
+
+ // initialize 'Context Menu' tab
+ ConfirmationsSettingsPage *confirmationsPage = new ConfirmationsSettingsPage(tabWidget);
+ tabWidget->addTab(confirmationsPage, i18nc("@title:tab Confirmations settings", "Confirmations"));
+ connect(confirmationsPage, &ConfirmationsSettingsPage::changed, this, &InterfaceSettingsPage::changed);
+
+ // initialize 'Status & location bars' tab
+ StatusAndLocationBarsSettingsPage *statusAndLocationBarsPage = new StatusAndLocationBarsSettingsPage(tabWidget, foldersTabsPage);
+ tabWidget->addTab(statusAndLocationBarsPage, i18nc("@title:tab Status & Location bars settings", "Status && Location bars"));
+ connect(statusAndLocationBarsPage, &StatusAndLocationBarsSettingsPage::changed, this, &InterfaceSettingsPage::changed);
+
+ m_pages.append(foldersTabsPage);
+ m_pages.append(previewsPage);
+ m_pages.append(confirmationsPage);
+ m_pages.append(statusAndLocationBarsPage);
+
+ topLayout->addWidget(tabWidget, 0, {});
+}
+
+InterfaceSettingsPage::~InterfaceSettingsPage()
+{
+}
+
+void InterfaceSettingsPage::applySettings()
+{
+ for (SettingsPageBase *page : qAsConst(m_pages)) {
+ page->applySettings();
+ }
+}
+
+void InterfaceSettingsPage::restoreDefaults()
+{
+ for (SettingsPageBase *page : qAsConst(m_pages)) {
+ page->restoreDefaults();
+ }
+}
+
+#include "moc_interfacesettingspage.cpp"
diff --git a/src/settings/interface/interfacesettingspage.h b/src/settings/interface/interfacesettingspage.h
new file mode 100644
index 000000000..1faee1afb
--- /dev/null
+++ b/src/settings/interface/interfacesettingspage.h
@@ -0,0 +1,42 @@
+/*
+ * SPDX-FileCopyrightText: 2006 Peter Penz <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef INTERFACESETTINGSPAGE_H
+#define INTERFACESETTINGSPAGE_H
+
+#include "settings/settingspagebase.h"
+
+#include <QWidget>
+
+class QUrl;
+class SettingsPageBase;
+
+/**
+ * @brief Page for the 'Interface' settings of the Dolphin settings dialog.
+ *
+ * The interface settings include:
+ * - Folders & Tabs
+ * - Previews
+ * - Context Menu
+ */
+class InterfaceSettingsPage : public SettingsPageBase
+{
+ Q_OBJECT
+
+public:
+ InterfaceSettingsPage(QWidget *parent);
+ ~InterfaceSettingsPage() override;
+
+ /** @see SettingsPageBase::applySettings() */
+ void applySettings() override;
+
+ /** @see SettingsPageBase::restoreDefaults() */
+ void restoreDefaults() override;
+
+private:
+ QList<SettingsPageBase *> m_pages;
+};
+
+#endif
diff --git a/src/settings/interface/previewssettingspage.cpp b/src/settings/interface/previewssettingspage.cpp
new file mode 100644
index 000000000..ef98d0f8d
--- /dev/null
+++ b/src/settings/interface/previewssettingspage.cpp
@@ -0,0 +1,205 @@
+/*
+ * SPDX-FileCopyrightText: 2006 Peter Penz <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "previewssettingspage.h"
+
+#include "configurepreviewplugindialog.h"
+#include "dolphin_generalsettings.h"
+#include "settings/serviceitemdelegate.h"
+#include "settings/servicemodel.h"
+
+#include <KIO/PreviewJob>
+#include <KLocalizedString>
+#include <KPluginMetaData>
+
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QListView>
+#include <QScroller>
+#include <QShowEvent>
+#include <QSortFilterProxyModel>
+#include <QSpinBox>
+
+// default settings
+namespace
+{
+const int DefaultMaxLocalPreviewSize = 0; // 0 MB
+const int DefaultMaxRemotePreviewSize = 0; // 0 MB
+}
+
+PreviewsSettingsPage::PreviewsSettingsPage(QWidget *parent)
+ : SettingsPageBase(parent)
+ , m_initialized(false)
+ , m_listView(nullptr)
+ , m_enabledPreviewPlugins()
+ , m_localFileSizeBox(nullptr)
+ , m_remoteFileSizeBox(nullptr)
+{
+ QVBoxLayout *topLayout = new QVBoxLayout(this);
+
+ QLabel *showPreviewsLabel = new QLabel(i18nc("@title:group", "Show previews in the view for:"), this);
+
+ m_listView = new QListView(this);
+ QScroller::grabGesture(m_listView->viewport(), QScroller::TouchGesture);
+
+#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87)
+ ServiceItemDelegate *delegate = new ServiceItemDelegate(m_listView, m_listView);
+ connect(delegate, &ServiceItemDelegate::requestServiceConfiguration, this, &PreviewsSettingsPage::configureService);
+ m_listView->setItemDelegate(delegate);
+#endif
+
+ ServiceModel *serviceModel = new ServiceModel(this);
+ QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
+ proxyModel->setSourceModel(serviceModel);
+ proxyModel->setSortRole(Qt::DisplayRole);
+ proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
+
+ m_listView->setModel(proxyModel);
+ m_listView->setVerticalScrollMode(QListView::ScrollPerPixel);
+ m_listView->setUniformItemSizes(true);
+
+ QLabel *localFileSizeLabel = new QLabel(i18n("Skip previews for local files above:"), this);
+
+ m_localFileSizeBox = new QSpinBox(this);
+ m_localFileSizeBox->setSingleStep(1);
+ m_localFileSizeBox->setSuffix(i18nc("Mebibytes; used as a suffix in a spinbox showing e.g. '3 MiB'", " MiB"));
+ m_localFileSizeBox->setRange(0, 9999999); /* MB */
+ m_localFileSizeBox->setSpecialValueText(i18n("No limit"));
+
+ QHBoxLayout *localFileSizeBoxLayout = new QHBoxLayout();
+ localFileSizeBoxLayout->addWidget(localFileSizeLabel);
+ localFileSizeBoxLayout->addStretch(0);
+ localFileSizeBoxLayout->addWidget(m_localFileSizeBox);
+
+ QLabel *remoteFileSizeLabel = new QLabel(i18nc("@label", "Skip previews for remote files above:"), this);
+
+ m_remoteFileSizeBox = new QSpinBox(this);
+ m_remoteFileSizeBox->setSingleStep(1);
+ m_remoteFileSizeBox->setSuffix(i18nc("Mebibytes; used as a suffix in a spinbox showing e.g. '3 MiB'", " MiB"));
+ m_remoteFileSizeBox->setRange(0, 9999999); /* MB */
+ m_remoteFileSizeBox->setSpecialValueText(i18n("No previews"));
+
+ QHBoxLayout *remoteFileSizeBoxLayout = new QHBoxLayout();
+ remoteFileSizeBoxLayout->addWidget(remoteFileSizeLabel);
+ remoteFileSizeBoxLayout->addStretch(0);
+ remoteFileSizeBoxLayout->addWidget(m_remoteFileSizeBox);
+
+ topLayout->addWidget(showPreviewsLabel);
+ topLayout->addWidget(m_listView);
+ topLayout->addLayout(localFileSizeBoxLayout);
+ topLayout->addLayout(remoteFileSizeBoxLayout);
+
+ loadSettings();
+
+ connect(m_listView, &QListView::clicked, this, &PreviewsSettingsPage::changed);
+ connect(m_localFileSizeBox, &QSpinBox::valueChanged, this, &PreviewsSettingsPage::changed);
+ connect(m_remoteFileSizeBox, &QSpinBox::valueChanged, this, &PreviewsSettingsPage::changed);
+}
+
+PreviewsSettingsPage::~PreviewsSettingsPage()
+{
+}
+
+void PreviewsSettingsPage::applySettings()
+{
+ const QAbstractItemModel *model = m_listView->model();
+ const int rowCount = model->rowCount();
+ if (rowCount > 0) {
+ m_enabledPreviewPlugins.clear();
+ for (int i = 0; i < rowCount; ++i) {
+ const QModelIndex index = model->index(i, 0);
+ const bool checked = model->data(index, Qt::CheckStateRole).toBool();
+ if (checked) {
+ const QString enabledPlugin = model->data(index, Qt::UserRole).toString();
+ m_enabledPreviewPlugins.append(enabledPlugin);
+ }
+ }
+ }
+
+ KConfigGroup globalConfig(KSharedConfig::openConfig(), QStringLiteral("PreviewSettings"));
+ globalConfig.writeEntry("Plugins", m_enabledPreviewPlugins);
+
+ if (!m_localFileSizeBox->value()) {
+ globalConfig.deleteEntry("MaximumSize", KConfigBase::Normal | KConfigBase::Global);
+ } else {
+ const qulonglong maximumLocalSize = static_cast<qulonglong>(m_localFileSizeBox->value()) * 1024 * 1024;
+ globalConfig.writeEntry("MaximumSize", maximumLocalSize, KConfigBase::Normal | KConfigBase::Global);
+ }
+
+ const qulonglong maximumRemoteSize = static_cast<qulonglong>(m_remoteFileSizeBox->value()) * 1024 * 1024;
+ globalConfig.writeEntry("MaximumRemoteSize", maximumRemoteSize, KConfigBase::Normal | KConfigBase::Global);
+
+ globalConfig.sync();
+}
+
+void PreviewsSettingsPage::restoreDefaults()
+{
+ m_localFileSizeBox->setValue(DefaultMaxLocalPreviewSize);
+ m_remoteFileSizeBox->setValue(DefaultMaxRemotePreviewSize);
+}
+
+void PreviewsSettingsPage::showEvent(QShowEvent *event)
+{
+ if (!event->spontaneous() && !m_initialized) {
+ loadPreviewPlugins();
+ m_initialized = true;
+ }
+ SettingsPageBase::showEvent(event);
+}
+
+#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87)
+void PreviewsSettingsPage::configureService(const QModelIndex &index)
+{
+ const QAbstractItemModel *model = index.model();
+ const QString pluginName = model->data(index).toString();
+ const QString desktopEntryName = model->data(index, ServiceModel::DesktopEntryNameRole).toString();
+
+ ConfigurePreviewPluginDialog *dialog = new ConfigurePreviewPluginDialog(pluginName, desktopEntryName, this);
+ dialog->setAttribute(Qt::WA_DeleteOnClose);
+ dialog->show();
+}
+#endif
+
+void PreviewsSettingsPage::loadPreviewPlugins()
+{
+ QAbstractItemModel *model = m_listView->model();
+
+ const QVector<KPluginMetaData> plugins = KIO::PreviewJob::availableThumbnailerPlugins();
+ for (const KPluginMetaData &plugin : plugins) {
+ const bool show = m_enabledPreviewPlugins.contains(plugin.pluginId());
+
+ model->insertRow(0);
+ const QModelIndex index = model->index(0, 0);
+ model->setData(index, show, Qt::CheckStateRole);
+ model->setData(index, plugin.name(), Qt::DisplayRole);
+ model->setData(index, plugin.pluginId(), ServiceModel::DesktopEntryNameRole);
+
+#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87)
+ const bool configurable = plugin.value(QStringLiteral("Configurable"), false);
+ model->setData(index, configurable, ServiceModel::ConfigurableRole);
+#endif
+ }
+
+ model->sort(Qt::DisplayRole);
+}
+
+void PreviewsSettingsPage::loadSettings()
+{
+ const KConfigGroup globalConfig(KSharedConfig::openConfig(), QStringLiteral("PreviewSettings"));
+ m_enabledPreviewPlugins = globalConfig.readEntry("Plugins", KIO::PreviewJob::defaultPlugins());
+
+ const qulonglong defaultLocalPreview = static_cast<qulonglong>(DefaultMaxLocalPreviewSize) * 1024 * 1024;
+ const qulonglong maxLocalByteSize = globalConfig.readEntry("MaximumSize", defaultLocalPreview);
+ const int maxLocalMByteSize = maxLocalByteSize / (1024 * 1024);
+ m_localFileSizeBox->setValue(maxLocalMByteSize);
+
+ const qulonglong defaultRemotePreview = static_cast<qulonglong>(DefaultMaxRemotePreviewSize) * 1024 * 1024;
+ const qulonglong maxRemoteByteSize = globalConfig.readEntry("MaximumRemoteSize", defaultRemotePreview);
+ const int maxRemoteMByteSize = maxRemoteByteSize / (1024 * 1024);
+ m_remoteFileSizeBox->setValue(maxRemoteMByteSize);
+}
+
+#include "moc_previewssettingspage.cpp"
diff --git a/src/settings/interface/previewssettingspage.h b/src/settings/interface/previewssettingspage.h
new file mode 100644
index 000000000..2c3e4dfef
--- /dev/null
+++ b/src/settings/interface/previewssettingspage.h
@@ -0,0 +1,59 @@
+/*
+ * SPDX-FileCopyrightText: 2006 Peter Penz <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef PREVIEWSSETTINGSPAGE_H
+#define PREVIEWSSETTINGSPAGE_H
+
+#include <kiowidgets_export.h>
+
+#include "settings/settingspagebase.h"
+
+class QSpinBox;
+class QListView;
+class QModelIndex;
+
+/**
+ * @brief Allows the configuration of file previews.
+ */
+class PreviewsSettingsPage : public SettingsPageBase
+{
+ Q_OBJECT
+
+public:
+ explicit PreviewsSettingsPage(QWidget *parent);
+ ~PreviewsSettingsPage() override;
+
+ /**
+ * Applies the general settings for the view modes
+ * The settings are persisted automatically when
+ * closing Dolphin.
+ */
+ void applySettings() override;
+
+ /** Restores the settings to default values. */
+ void restoreDefaults() override;
+
+protected:
+ void showEvent(QShowEvent *event) override;
+
+private Q_SLOTS:
+#if KIOWIDGETS_BUILD_DEPRECATED_SINCE(5, 87)
+ void configureService(const QModelIndex &index);
+#endif
+
+private:
+ void loadPreviewPlugins();
+ void loadSettings();
+
+private:
+ bool m_initialized;
+ QListView *m_listView;
+ QStringList m_enabledPreviewPlugins;
+ QSpinBox *m_localFileSizeBox;
+ QSpinBox *m_remoteFileSizeBox;
+};
+
+#endif
diff --git a/src/settings/interface/statusandlocationbarssettingspage.cpp b/src/settings/interface/statusandlocationbarssettingspage.cpp
new file mode 100644
index 000000000..5e0536a6e
--- /dev/null
+++ b/src/settings/interface/statusandlocationbarssettingspage.cpp
@@ -0,0 +1,128 @@
+/*
+ * SPDX-FileCopyrightText: 2023 Dimosthenis Krallis <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "statusandlocationbarssettingspage.h"
+#include "dolphinmainwindow.h"
+#include "dolphinviewcontainer.h"
+#include "settings/interface/folderstabssettingspage.h"
+
+#include <KLocalizedString>
+
+#include <QCheckBox>
+#include <QFormLayout>
+
+#include <QRadioButton>
+#include <QSpacerItem>
+
+StatusAndLocationBarsSettingsPage::StatusAndLocationBarsSettingsPage(QWidget *parent, FoldersTabsSettingsPage *foldersPage)
+ : SettingsPageBase(parent)
+ , m_editableUrl(nullptr)
+ , m_showFullPath(nullptr)
+ , m_showStatusBar(nullptr)
+ , m_showZoomSlider(nullptr)
+ , m_showSpaceInfo(nullptr)
+{
+ // We need to update some urls at the Folders & Tabs tab. We get that from foldersPage and set it on a private attribute
+ // foldersTabsPage. That way, we can modify the necessary stuff from here. Specifically, any changes on locationUpdateInitialViewOptions()
+ // which is a copy of updateInitialViewOptions() on Folders & Tabs.
+ foldersTabsPage = foldersPage;
+
+ QFormLayout *topLayout = new QFormLayout(this);
+
+ // Status bar
+ m_showStatusBar = new QCheckBox(i18nc("@option:check", "Show status bar"), this);
+ m_showZoomSlider = new QCheckBox(i18nc("@option:check", "Show zoom slider"), this);
+ m_showSpaceInfo = new QCheckBox(i18nc("@option:check", "Show space information"), this);
+
+ topLayout->addRow(i18nc("@title:group", "Status Bar: "), m_showStatusBar);
+ topLayout->addRow(QString(), m_showZoomSlider);
+ topLayout->addRow(QString(), m_showSpaceInfo);
+
+ topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
+
+ // Location bar
+ m_editableUrl = new QCheckBox(i18nc("@option:check Startup Settings", "Make location bar editable"));
+ topLayout->addRow(i18n("Location bar:"), m_editableUrl);
+
+ m_showFullPath = new QCheckBox(i18nc("@option:check Startup Settings", "Show full path inside location bar"));
+ topLayout->addRow(QString(), m_showFullPath);
+
+ loadSettings();
+
+ locationUpdateInitialViewOptions();
+
+ connect(m_editableUrl, &QCheckBox::toggled, this, &StatusAndLocationBarsSettingsPage::locationSlotSettingsChanged);
+ connect(m_showFullPath, &QCheckBox::toggled, this, &StatusAndLocationBarsSettingsPage::locationSlotSettingsChanged);
+
+ connect(m_showStatusBar, &QCheckBox::toggled, this, &StatusAndLocationBarsSettingsPage::changed);
+ connect(m_showStatusBar, &QCheckBox::toggled, this, &StatusAndLocationBarsSettingsPage::onShowStatusBarToggled);
+ connect(m_showZoomSlider, &QCheckBox::toggled, this, &StatusAndLocationBarsSettingsPage::changed);
+ connect(m_showSpaceInfo, &QCheckBox::toggled, this, &StatusAndLocationBarsSettingsPage::changed);
+}
+
+StatusAndLocationBarsSettingsPage::~StatusAndLocationBarsSettingsPage()
+{
+}
+
+void StatusAndLocationBarsSettingsPage::applySettings()
+{
+ GeneralSettings *settings = GeneralSettings::self();
+
+ settings->setEditableUrl(m_editableUrl->isChecked());
+ settings->setShowFullPath(m_showFullPath->isChecked());
+
+ settings->setShowStatusBar(m_showStatusBar->isChecked());
+ settings->setShowZoomSlider(m_showZoomSlider->isChecked());
+ settings->setShowSpaceInfo(m_showSpaceInfo->isChecked());
+
+ settings->save();
+}
+
+void StatusAndLocationBarsSettingsPage::onShowStatusBarToggled()
+{
+ const bool checked = m_showStatusBar->isChecked();
+ m_showZoomSlider->setEnabled(checked);
+ m_showSpaceInfo->setEnabled(checked);
+}
+
+void StatusAndLocationBarsSettingsPage::restoreDefaults()
+{
+ GeneralSettings *settings = GeneralSettings::self();
+ settings->useDefaults(true);
+ loadSettings();
+ settings->useDefaults(false);
+}
+
+void StatusAndLocationBarsSettingsPage::locationSlotSettingsChanged()
+{
+ // Provide a hint that the startup settings have been changed. This allows the views
+ // to apply the startup settings only if they have been explicitly changed by the user
+ // (see bug #254947).
+ GeneralSettings::setModifiedStartupSettings(true);
+
+ // Enable and disable home URL controls appropriately
+ locationUpdateInitialViewOptions();
+ Q_EMIT changed();
+}
+
+void StatusAndLocationBarsSettingsPage::locationUpdateInitialViewOptions()
+{
+ foldersTabsPage->m_homeUrlBoxLayoutContainer->setEnabled(foldersTabsPage->m_homeUrlRadioButton->isChecked());
+ foldersTabsPage->m_buttonBoxLayoutContainer->setEnabled(foldersTabsPage->m_homeUrlRadioButton->isChecked());
+}
+
+void StatusAndLocationBarsSettingsPage::loadSettings()
+{
+ m_editableUrl->setChecked(GeneralSettings::editableUrl());
+ m_showFullPath->setChecked(GeneralSettings::showFullPath());
+ m_showStatusBar->setChecked(GeneralSettings::showStatusBar());
+ m_showZoomSlider->setChecked(GeneralSettings::showZoomSlider());
+ m_showSpaceInfo->setChecked(GeneralSettings::showSpaceInfo());
+
+ onShowStatusBarToggled();
+}
+
+#include "moc_statusandlocationbarssettingspage.cpp"
diff --git a/src/settings/interface/statusandlocationbarssettingspage.h b/src/settings/interface/statusandlocationbarssettingspage.h
new file mode 100644
index 000000000..c22ff2041
--- /dev/null
+++ b/src/settings/interface/statusandlocationbarssettingspage.h
@@ -0,0 +1,55 @@
+/*
+ * SPDX-FileCopyrightText: 2009 Peter Penz <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef STATUSANDLOCATIONBARSSETTINGSPAGE_H
+#define STATUSANDLOCATIONBARSSETTINGSPAGE_H
+
+#include "dolphin_generalsettings.h"
+#include "folderstabssettingspage.h"
+#include "settings/settingspagebase.h"
+
+#include <QUrl>
+
+class QCheckBox;
+class QLineEdit;
+class QLabel;
+class QRadioButton;
+
+/**
+ * @brief Tab page for the 'Behavior' settings of the Dolphin settings dialog.
+ */
+class StatusAndLocationBarsSettingsPage : public SettingsPageBase
+{
+ Q_OBJECT
+
+public:
+ StatusAndLocationBarsSettingsPage(QWidget *parent, FoldersTabsSettingsPage *foldersPage);
+ ~StatusAndLocationBarsSettingsPage() override;
+
+ /** @see SettingsPageBase::applySettings() */
+ void applySettings() override;
+
+ /** @see SettingsPageBase::restoreDefaults() */
+ void restoreDefaults() override;
+
+private Q_SLOTS:
+ void locationSlotSettingsChanged();
+ void locationUpdateInitialViewOptions();
+
+private:
+ void loadSettings();
+ void onShowStatusBarToggled();
+
+private:
+ FoldersTabsSettingsPage *foldersTabsPage;
+ QCheckBox *m_editableUrl;
+ QCheckBox *m_showFullPath;
+
+ QCheckBox *m_showStatusBar;
+ QCheckBox *m_showZoomSlider;
+ QCheckBox *m_showSpaceInfo;
+};
+
+#endif