]> cloud.milkyroute.net Git - dolphin.git/blobdiff - src/settings/dolphinsettingsdialog.cpp
Merge remote-tracking branch 'fork/work/zakharafoniam/useful-groups'
[dolphin.git] / src / settings / dolphinsettingsdialog.cpp
index 0d2c76e3c8b841d142bba10a5bea70aa9cd14083..1c8178651abdbdee5ff7505e7cc8e38d6c6d3cd2 100644 (file)
@@ -21,6 +21,7 @@
 #include <KAuthorized>
 #include <KLocalizedString>
 #include <KMessageBox>
+#include <KRuntimePlatform>
 #include <KWindowConfig>
 
 #include <kwidgetsaddons_version.h>
@@ -37,21 +38,13 @@ DolphinSettingsDialog::DolphinSettingsDialog(const QUrl &url, QWidget *parent, K
     const QSize minSize = minimumSize();
     setMinimumSize(QSize(540, minSize.height()));
 
-    setFaceType(List);
+    setFaceType(KRuntimePlatform::runtimePlatform().contains(QLatin1String("phone")) ? Tabbed : List);
     setWindowTitle(i18nc("@title:window", "Configure"));
-    QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults);
-    box->button(QDialogButtonBox::Apply)->setEnabled(false);
-    box->button(QDialogButtonBox::Ok)->setDefault(true);
-    setButtonBox(box);
-
-    connect(box->button(QDialogButtonBox::Ok), &QAbstractButton::clicked, this, &DolphinSettingsDialog::applySettings);
-    connect(box->button(QDialogButtonBox::Apply), &QAbstractButton::clicked, this, &DolphinSettingsDialog::applySettings);
-    connect(box->button(QDialogButtonBox::RestoreDefaults), &QAbstractButton::clicked, this, &DolphinSettingsDialog::restoreDefaults);
 
     // Interface
     InterfaceSettingsPage *interfaceSettingsPage = new InterfaceSettingsPage(this);
     KPageWidgetItem *interfaceSettingsFrame = addPage(interfaceSettingsPage, i18nc("@title:group Interface settings", "Interface"));
-    interfaceSettingsFrame->setIcon(QIcon::fromTheme(QStringLiteral("system-file-manager")));
+    interfaceSettingsFrame->setIcon(QIcon::fromTheme(QStringLiteral("org.kde.dolphin")));
     connect(interfaceSettingsPage, &InterfaceSettingsPage::changed, this, &DolphinSettingsDialog::enableApply);
 
     // View
@@ -65,9 +58,11 @@ DolphinSettingsDialog::DolphinSettingsDialog(const QUrl &url, QWidget *parent, K
                                                                actions,
                                                                {QStringLiteral("add_to_places"),
                                                                 QStringLiteral("sort"),
+                                                                QStringLiteral("group"),
                                                                 QStringLiteral("view_mode"),
                                                                 QStringLiteral("open_in_new_tab"),
                                                                 QStringLiteral("open_in_new_window"),
+                                                                QStringLiteral("open_in_split_view"),
                                                                 QStringLiteral("copy_location"),
                                                                 QStringLiteral("duplicate"),
                                                                 QStringLiteral("open_terminal_here"),
@@ -111,13 +106,23 @@ DolphinSettingsDialog::DolphinSettingsDialog(const QUrl &url, QWidget *parent, K
     }
 #endif
 
-    const KConfigGroup dialogConfig(KSharedConfig::openStateConfig(), "SettingsDialog");
+    // Create the buttons last so they are also last in the keyboard Tab focus order.
+    QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults);
+    box->button(QDialogButtonBox::Apply)->setEnabled(false);
+    box->button(QDialogButtonBox::Ok)->setDefault(true);
+    setButtonBox(box);
+
+    connect(box->button(QDialogButtonBox::Ok), &QAbstractButton::clicked, this, &DolphinSettingsDialog::applySettings);
+    connect(box->button(QDialogButtonBox::Apply), &QAbstractButton::clicked, this, &DolphinSettingsDialog::applySettings);
+    connect(box->button(QDialogButtonBox::RestoreDefaults), &QAbstractButton::clicked, this, &DolphinSettingsDialog::restoreDefaults);
+
+    const KConfigGroup dialogConfig(KSharedConfig::openStateConfig(), QStringLiteral("SettingsDialog"));
     KWindowConfig::restoreWindowSize(windowHandle(), dialogConfig);
 }
 
 DolphinSettingsDialog::~DolphinSettingsDialog()
 {
-    KConfigGroup dialogConfig(KSharedConfig::openStateConfig(), "SettingsDialog");
+    KConfigGroup dialogConfig(KSharedConfig::openStateConfig(), QStringLiteral("SettingsDialog"));
     KWindowConfig::saveWindowSize(windowHandle(), dialogConfig);
 }
 
@@ -160,29 +165,17 @@ void DolphinSettingsDialog::closeEvent(QCloseEvent *event)
         return;
     }
 
-#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
     const auto response = KMessageBox::warningTwoActionsCancel(this,
-#else
-    const auto response = KMessageBox::warningYesNoCancel(this,
-#endif
                                                                i18n("You have unsaved changes. Do you want to apply the changes or discard them?"),
                                                                i18n("Warning"),
                                                                KStandardGuiItem::save(),
                                                                KStandardGuiItem::discard(),
                                                                KStandardGuiItem::cancel());
     switch (response) {
-#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
     case KMessageBox::PrimaryAction:
-#else
-    case KMessageBox::Yes:
-#endif
         applySettings();
         Q_FALLTHROUGH();
-#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 100, 0)
     case KMessageBox::SecondaryAction:
-#else
-    case KMessageBox::No:
-#endif
         event->accept();
         break;
     case KMessageBox::Cancel: