File indexing completed on 2024-04-28 17:06:08

0001 /*
0002     SPDX-FileCopyrightText: 2010 Jan Lepper <krusader@users.sourceforge.net>
0003     SPDX-FileCopyrightText: 2010-2022 Krusader Krew <https://krusader.org>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include "kgpanel.h"
0009 #include "../Dialogs/krdialogs.h"
0010 #include "../defaults.h"
0011 #include "../krglobal.h"
0012 
0013 // QtGui
0014 #include <QValidator>
0015 // QtWidgets
0016 #include <QFrame>
0017 #include <QGridLayout>
0018 #include <QLabel>
0019 #include <QTabWidget>
0020 #include <QVBoxLayout>
0021 
0022 #include <KConfigCore/KSharedConfig>
0023 #include <KI18n/KLocalizedString>
0024 #include <KWidgetsAddons/KMessageBox>
0025 #include <QtWidgets/QInputDialog>
0026 
0027 #include "../GUI/krtreewidget.h"
0028 #include "../Panel/PanelView/krselectionmode.h"
0029 #include "../Panel/PanelView/krview.h"
0030 #include "../Panel/PanelView/krviewfactory.h"
0031 #include "../Panel/krlayoutfactory.h"
0032 #include "../Panel/krsearchbar.h"
0033 #include "../icon.h"
0034 #include "../krglobal.h"
0035 
0036 enum { PAGE_GENERAL = 0, PAGE_VIEW, PAGE_PANELTOOLBAR, PAGE_MOUSE, PAGE_MEDIA_MENU, PAGE_LAYOUT };
0037 
0038 KgPanel::KgPanel(bool first, QWidget *parent)
0039     : KonfiguratorPage(first, parent)
0040 {
0041     tabWidget = new QTabWidget(this);
0042     setWidget(tabWidget);
0043     setWidgetResizable(true);
0044 
0045     setupGeneralTab();
0046     setupPanelTab();
0047     setupButtonsTab();
0048     setupMouseModeTab();
0049     setupMediaMenuTab();
0050     setupLayoutTab();
0051 }
0052 
0053 // ---------------------------------------------------------------------------------------
0054 // ---------------------------- General TAB ----------------------------------------------
0055 // ---------------------------------------------------------------------------------------
0056 void KgPanel::setupGeneralTab()
0057 {
0058     auto *scrollArea = new QScrollArea(tabWidget);
0059     QWidget *tab = new QWidget(scrollArea);
0060     scrollArea->setFrameStyle(QFrame::NoFrame);
0061     scrollArea->setWidget(tab);
0062     scrollArea->setWidgetResizable(true);
0063     tabWidget->addTab(scrollArea, i18n("General"));
0064 
0065     auto *layout = new QVBoxLayout(tab);
0066     layout->setSpacing(6);
0067     layout->setContentsMargins(11, 11, 11, 11);
0068 
0069     // ---------------------------------------------------------------------------------------
0070     // ------------------------------- Navigator bar -------------------------------------
0071     // ---------------------------------------------------------------------------------------
0072     QGroupBox *groupBox = createFrame(i18n("Navigator bar"), tab);
0073     QGridLayout *gridLayout = createGridLayout(groupBox);
0074 
0075     KONFIGURATOR_CHECKBOX_PARAM navigatorbar_settings[] = {
0076         // cfg_class, cfg_name, default, text, restart, tooltip
0077         {"Look&Feel", "Navigator Edit Mode", false, i18n("Edit Mode by default"), true, i18n("Show editable path in Navigator bar by default")},
0078         {"Look&Feel", "Navigator Full Path", false, i18n("Show full path by default"), true, i18n("Always show full path in Navigator bar by default.")},
0079     };
0080     KonfiguratorCheckBoxGroup *cbs = createCheckBoxGroup(2, 0, navigatorbar_settings, 2 /*count*/, groupBox, PAGE_GENERAL);
0081     gridLayout->addWidget(cbs, 0, 0);
0082 
0083     layout->addWidget(groupBox);
0084 
0085     // ---------------------------------------------------------------------------------------
0086     // ------------------------------- Operation ---------------------------------------------
0087     // ---------------------------------------------------------------------------------------
0088     groupBox = createFrame(i18n("Operation"), tab);
0089     gridLayout = createGridLayout(groupBox);
0090 
0091     KONFIGURATOR_CHECKBOX_PARAM operation_settings[] = {
0092         // cfg_class, cfg_name, default, text, restart, tooltip
0093         {"Look&Feel",
0094          "Mark Dirs",
0095          _MarkDirs,
0096          i18n("Autoselect folders"),
0097          false,
0098          i18n("When matching the select criteria, not only files will be selected, but also folders.")},
0099         {"Look&Feel",
0100          "Rename Selects Extension",
0101          true,
0102          i18n("Rename selects extension"),
0103          false,
0104          i18n("When renaming a file, the whole text is selected. If you want Total-Commander like renaming of just the name, without extension, uncheck this "
0105               "option.")},
0106         {"Look&Feel",
0107          "UnselectBeforeOperation",
0108          _UnselectBeforeOperation,
0109          i18n("Unselect files before copy/move"),
0110          false,
0111          i18n("Unselect files, which are to be copied/moved, before the operation starts.")},
0112         {"Look&Feel",
0113          "FilterDialogRemembersSettings",
0114          _FilterDialogRemembersSettings,
0115          i18n("Filter dialog remembers settings"),
0116          false,
0117          i18n("The filter dialog is opened with the last filter settings that where applied to the panel.")},
0118     };
0119     cbs = createCheckBoxGroup(2, 0, operation_settings, 4 /*count*/, groupBox, PAGE_GENERAL);
0120     gridLayout->addWidget(cbs, 0, 0);
0121 
0122     layout->addWidget(groupBox);
0123 
0124     // ---------------------------------------------------------------------------------------
0125     // ------------------------------ Tabs ---------------------------------------------------
0126     // ---------------------------------------------------------------------------------------
0127     groupBox = createFrame(i18n("Tabs"), tab);
0128     gridLayout = createGridLayout(groupBox);
0129 
0130     KONFIGURATOR_CHECKBOX_PARAM tabbar_settings[] = {
0131         //   cfg_class    cfg_name                      default             text                                     restart tooltip
0132         {"Look&Feel",
0133          "Fullpath Tab Names",
0134          _FullPathTabNames,
0135          i18n("Use full path tab names"),
0136          true,
0137          i18n("Display the full path in the folder tabs. By default only the last part of the path is displayed.")},
0138         {"Look&Feel", "Show Close Tab Buttons", true, i18n("Show close tab buttons"), true, i18n("Show close tab buttons.")},
0139         {"Look&Feel", "Expanding Tabs", true, i18n("Expanding tabs"), true, i18n("Expanding tabs.")},
0140         {"Look&Feel", "Show New Tab Button", true, i18n("Show new tab button"), true, i18n("Show new tab button.")},
0141         {"Look&Feel", "Insert Tabs After Current", false, i18n("Insert tabs after current"), false, i18n("Insert new tabs to the right of the current one.")},
0142         {"Look&Feel", "Show Tab Bar On Single Tab", true, i18n("Show Tab Bar on single tab"), true, i18n("Show the tab bar with only one tab.")},
0143         {"Look&Feel", "Close Tab By Double Click", false, i18n("Close tab by double click"), false, i18n("Close tab by double click.")},
0144         {"Look&Feel",
0145          "New Tab Button Duplicates",
0146          false,
0147          i18n("New tab button duplicates a tab"),
0148          false,
0149          i18n("If checked, new tab button duplicates a tab, otherwise it opens a tab in home directory.")}};
0150     cbs = createCheckBoxGroup(2, 0, tabbar_settings, 8 /*count*/, groupBox, PAGE_GENERAL);
0151     gridLayout->addWidget(cbs, 0, 0, 1, 2);
0152 
0153     // -------------- Duplicate tab by click --------------------
0154     QHBoxLayout *hbox = new QHBoxLayout();
0155 
0156     QLabel *labelDupTabs = new QLabel(i18n("Duplicate active tab by click:"), groupBox);
0157     hbox->addWidget(labelDupTabs);
0158 
0159     KONFIGURATOR_NAME_VALUE_PAIR duptabs[] = {{i18n("Disabled"), "disabled"}, {i18n("Alt+Click"), "alt_click"}, {i18n("Ctrl+Click"), "ctrl_click"}};
0160 
0161     KonfiguratorComboBox *cmb = createComboBox("Look&Feel",
0162                                                "Duplicate Tab Click",
0163                                                "disabled",
0164                                                duptabs,
0165                                                3,
0166                                                labelDupTabs,
0167                                                groupBox,
0168                                                true,
0169                                                false,
0170                                                i18n("Duplicate active tab by clicking Ctrl/Alt+LMB"),
0171                                                PAGE_GENERAL);
0172 
0173     hbox->addWidget(cmb);
0174     hbox->addWidget(createSpacer(groupBox));
0175     gridLayout->addLayout(hbox, 1, 0);
0176 
0177     // -------------- Tab Bar position --------------------------
0178     hbox = new QHBoxLayout();
0179 
0180     QLabel *labelTabBar = new QLabel(i18n("Tab Bar position:"), groupBox);
0181     hbox->addWidget(labelTabBar);
0182 
0183     KONFIGURATOR_NAME_VALUE_PAIR positions[] = {{i18n("Top"), "top"}, {i18n("Bottom"), "bottom"}};
0184 
0185     cmb = createComboBox("Look&Feel", "Tab Bar Position", "bottom", positions, 2, labelTabBar, groupBox, true, false, QString(), PAGE_GENERAL);
0186 
0187     hbox->addWidget(cmb);
0188     gridLayout->addLayout(hbox, 2, 0, Qt::AlignLeft);
0189 
0190     layout->addWidget(groupBox);
0191 
0192     // ---------------------------------------------------------------------------------------
0193     // -----------------------------  Search bar  --------------------------------------------
0194     // ---------------------------------------------------------------------------------------
0195     groupBox = createFrame(i18n("Search bar"), tab);
0196     gridLayout = createGridLayout(groupBox);
0197 
0198     KONFIGURATOR_CHECKBOX_PARAM quicksearch[] = {
0199         //   cfg_class  cfg_name                default             text                              restart tooltip
0200         {"Look&Feel",
0201          "New Style Quicksearch",
0202          _NewStyleQuicksearch,
0203          i18n("Start by typing"),
0204          false,
0205          i18n("Open search bar and start searching by typing in panel.")},
0206         {"Look&Feel", "Case Sensitive Quicksearch", _CaseSensitiveQuicksearch, i18n("Case sensitive"), false, i18n("Search must match case.")},
0207         {"Look&Feel",
0208          "Up/Down Cancels Quicksearch",
0209          false,
0210          i18n("Up/Down cancels search"),
0211          false,
0212          i18n("Pressing the Up/Down buttons closes the search bar (only in search mode).")},
0213         {"Look&Feel",
0214          "Navigation with Right Arrow Quicksearch",
0215          _NavigationWithRightArrowQuicksearch,
0216          i18n("Folder navigation with Right Arrow"),
0217          false,
0218          i18n("Pressing the Right button enters folder if no search text editing intention is captured.")},
0219     };
0220 
0221     cbs = createCheckBoxGroup(2, 0, quicksearch, 4 /*count*/, groupBox, PAGE_GENERAL);
0222     gridLayout->addWidget(cbs, 0, 0, 1, -1);
0223 
0224     // -------------- Search bar position -----------------------
0225 
0226     hbox = new QHBoxLayout();
0227     QLabel *labelPosit = new QLabel(i18n("Position:"), groupBox);
0228     hbox->addWidget(labelPosit);
0229     cmb = createComboBox("Look&Feel", "Quicksearch Position", "bottom", positions, 2, labelPosit, groupBox, true, false, QString(), PAGE_GENERAL);
0230     hbox->addWidget(cmb);
0231     hbox->addWidget(createSpacer(groupBox));
0232     gridLayout->addLayout(hbox, 1, 0);
0233 
0234     // -------------- Default search mode -----------------------
0235 
0236     hbox = new QHBoxLayout();
0237     QLabel *labelMode = new QLabel(i18n("Default mode:"), groupBox);
0238     hbox->addWidget(labelMode);
0239     KONFIGURATOR_NAME_VALUE_PAIR modes[] = {{i18n("Search"), QString::number(KrSearchBar::MODE_SEARCH)},
0240                                             {i18n("Select"), QString::number(KrSearchBar::MODE_SELECT)},
0241                                             {i18n("Filter"), QString::number(KrSearchBar::MODE_FILTER)}};
0242     cmb = createComboBox("Look&Feel",
0243                          "Default Search Mode",
0244                          QString::number(KrSearchBar::MODE_SEARCH),
0245                          modes,
0246                          3,
0247                          labelMode,
0248                          groupBox,
0249                          true,
0250                          false,
0251                          i18n("Set the default mode on first usage"),
0252                          PAGE_GENERAL);
0253     hbox->addWidget(cmb);
0254     hbox->addWidget(createSpacer(groupBox));
0255     gridLayout->addLayout(hbox, 1, 1);
0256 
0257     layout->addWidget(groupBox);
0258 
0259     // --------------------------------------------------------------------------------------------
0260     // ------------------------------- Bookmark search settings ----------------------------------
0261     // --------------------------------------------------------------------------------------------
0262     groupBox = createFrame(i18n("Bookmark Search"), tab);
0263     gridLayout = createGridLayout(groupBox);
0264 
0265     KONFIGURATOR_CHECKBOX_PARAM bookmarkSearchSettings[] = {
0266         {"Look&Feel", "Always show search bar", true, i18n("Always show search bar"), false, i18n("Make bookmark search bar always visible")},
0267         {"Look&Feel",
0268          "Search in special items",
0269          false,
0270          i18n("Search in special items"),
0271          false,
0272          i18n("Bookmark search is also applied to special items in bookmark menu like Trash, Popular URLs, Jump Back, etc.")},
0273     };
0274     KonfiguratorCheckBoxGroup *bookmarkSearchSettingsGroup = createCheckBoxGroup(2, 0, bookmarkSearchSettings, 2 /*count*/, groupBox, PAGE_GENERAL);
0275     gridLayout->addWidget(bookmarkSearchSettingsGroup, 1, 0, 1, 2);
0276     layout->addWidget(groupBox);
0277 
0278     // --------------------------------------------------------------------------------------------
0279     // ------------------------------- Status/Totalsbar settings ----------------------------------
0280     // --------------------------------------------------------------------------------------------
0281     groupBox = createFrame(i18n("Status/Totalsbar"), tab);
0282     gridLayout = createGridLayout(groupBox);
0283 
0284     KONFIGURATOR_CHECKBOX_PARAM barSettings[] = {
0285         {"Look&Feel", "Show Size In Bytes", false, i18n("Show size in bytes too"), true, i18n("Show size in bytes too")},
0286         {"Look&Feel", "ShowSpaceInformation", true, i18n("Show space information"), true, i18n("Show free/total space on the device")},
0287     };
0288     KonfiguratorCheckBoxGroup *barSett = createCheckBoxGroup(2, 0, barSettings, 2 /*count*/, groupBox, PAGE_GENERAL);
0289     gridLayout->addWidget(barSett, 1, 0, 1, 2);
0290 
0291     layout->addWidget(groupBox);
0292 }
0293 
0294 // --------------------------------------------------------------------------------------------
0295 // ------------------------------------ Layout Tab --------------------------------------------
0296 // --------------------------------------------------------------------------------------------
0297 void KgPanel::setupLayoutTab()
0298 {
0299     auto *scrollArea = new QScrollArea(tabWidget);
0300     QWidget *tab = new QWidget(scrollArea);
0301     scrollArea->setFrameStyle(QFrame::NoFrame);
0302     scrollArea->setWidget(tab);
0303     scrollArea->setWidgetResizable(true);
0304     tabWidget->addTab(scrollArea, i18n("Layout"));
0305 
0306     QGridLayout *grid = createGridLayout(tab);
0307 
0308     QStringList layoutNames = KrLayoutFactory::layoutNames();
0309     int numLayouts = layoutNames.count();
0310 
0311     grid->addWidget(createSpacer(tab), 0, 2);
0312 
0313     QLabel *l = new QLabel(i18n("Layout:"), tab);
0314     l->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
0315     grid->addWidget(l, 0, 0);
0316     auto *layouts = new KONFIGURATOR_NAME_VALUE_PAIR[numLayouts];
0317     for (int i = 0; i != numLayouts; i++) {
0318         layouts[i].text = KrLayoutFactory::layoutDescription(layoutNames[i]);
0319         layouts[i].value = layoutNames[i];
0320     }
0321     KonfiguratorComboBox *cmb = createComboBox("PanelLayout", "Layout", "default", layouts, numLayouts, l, tab, true, false, QString(), PAGE_LAYOUT);
0322     grid->addWidget(cmb, 0, 1);
0323     delete[] layouts;
0324 
0325     l = new QLabel(i18n("Frame Color:"), tab);
0326     l->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
0327     grid->addWidget(l, 1, 0);
0328     KONFIGURATOR_NAME_VALUE_PAIR frameColor[] = {{i18nc("Frame color", "Defined by Layout"), "default"},
0329                                                  {i18nc("Frame color", "None"), "none"},
0330                                                  {i18nc("Frame color", "Statusbar"), "Statusbar"}};
0331     cmb = createComboBox("PanelLayout", "FrameColor", "default", frameColor, 3, l, tab, true, false, QString(), PAGE_LAYOUT);
0332     grid->addWidget(cmb, 1, 1);
0333 
0334     l = new QLabel(i18n("Frame Shape:"), tab);
0335     l->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
0336     grid->addWidget(l, 2, 0);
0337     KONFIGURATOR_NAME_VALUE_PAIR frameShape[] = {
0338         {i18nc("Frame shape", "Defined by Layout"), "default"},
0339         {i18nc("Frame shape", "None"), "NoFrame"},
0340         {i18nc("Frame shape", "Box"), "Box"},
0341         {i18nc("Frame shape", "Panel"), "Panel"},
0342     };
0343     cmb = createComboBox("PanelLayout", "FrameShape", "default", frameShape, 4, l, tab, true, false, QString(), PAGE_LAYOUT);
0344     grid->addWidget(cmb, 2, 1);
0345 
0346     l = new QLabel(i18n("Frame Shadow:"), tab);
0347     l->setAlignment(Qt::AlignRight | Qt::AlignVCenter);
0348     grid->addWidget(l, 3, 0);
0349     KONFIGURATOR_NAME_VALUE_PAIR frameShadow[] = {
0350         {i18nc("Frame shadow", "Defined by Layout"), "default"},
0351         {i18nc("Frame shadow", "None"), "Plain"},
0352         {i18nc("Frame shadow", "Raised"), "Raised"},
0353         {i18nc("Frame shadow", "Sunken"), "Sunken"},
0354     };
0355     cmb = createComboBox("PanelLayout", "FrameShadow", "default", frameShadow, 4, l, tab, true, false, QString(), PAGE_LAYOUT);
0356     grid->addWidget(cmb, 3, 1);
0357 }
0358 
0359 void KgPanel::setupView(KrViewInstance *instance, QWidget *parent)
0360 {
0361     QGridLayout *grid = createGridLayout(parent);
0362 
0363     // -------------------- Filelist icon size ----------------------------------
0364     auto *hbox = new QHBoxLayout();
0365 
0366     QLabel *labelIconSize = new QLabel(i18n("Default icon size:"), parent);
0367     hbox->addWidget(labelIconSize);
0368 
0369     auto *iconSizes = new KONFIGURATOR_NAME_VALUE_PAIR[KrView::iconSizes.count()];
0370     for (int i = 0; i < KrView::iconSizes.count(); i++)
0371         iconSizes[i].text = iconSizes[i].value = QString::number(KrView::iconSizes[i]);
0372     KonfiguratorComboBox *cmb = createComboBox(instance->name(),
0373                                                "IconSize",
0374                                                _FilelistIconSize,
0375                                                iconSizes,
0376                                                KrView::iconSizes.count(),
0377                                                labelIconSize,
0378                                                parent,
0379                                                true,
0380                                                true,
0381                                                QString(),
0382                                                PAGE_VIEW);
0383     delete[] iconSizes;
0384     cmb->lineEdit()->setValidator(new QRegExpValidator(QRegExp("[1-9]\\d{0,1}"), cmb));
0385     hbox->addWidget(cmb);
0386 
0387     hbox->addWidget(createSpacer(parent));
0388 
0389     grid->addLayout(hbox, 1, 0);
0390 
0391     //--------------------------------------------------------------------
0392     KONFIGURATOR_CHECKBOX_PARAM iconSettings[] =
0393         //   cfg_class             cfg_name        default       text            restart        tooltip
0394         {
0395             {instance->name(), "With Icons", _WithIcons, i18n("Use icons in the filenames"), true, i18n("Show the icons for filenames and folders.")},
0396             {instance->name(), "ShowPreviews", false, i18n("Show previews by default"), false, i18n("Show previews of files and folders.")},
0397         };
0398 
0399     KonfiguratorCheckBoxGroup *iconSett = createCheckBoxGroup(2, 0, iconSettings, 2 /*count*/, parent, PAGE_VIEW);
0400 
0401     grid->addWidget(iconSett, 2, 0, 1, 2);
0402 }
0403 
0404 // ----------------------------------------------------------------------------------
0405 //  ---------------------------- VIEW TAB -------------------------------------------
0406 // ----------------------------------------------------------------------------------
0407 void KgPanel::setupPanelTab()
0408 {
0409     auto *scrollArea = new QScrollArea(tabWidget);
0410     QWidget *tab_panel = new QWidget(scrollArea);
0411     scrollArea->setFrameStyle(QFrame::NoFrame);
0412     scrollArea->setWidget(tab_panel);
0413     scrollArea->setWidgetResizable(true);
0414     tabWidget->addTab(scrollArea, i18n("View"));
0415 
0416     auto *panelLayout = new QGridLayout(tab_panel);
0417     panelLayout->setSpacing(6);
0418     panelLayout->setContentsMargins(11, 11, 11, 11);
0419     QGroupBox *panelGrp = createFrame(i18n("General"), tab_panel);
0420     panelLayout->addWidget(panelGrp, 0, 0);
0421     QGridLayout *panelGrid = createGridLayout(panelGrp);
0422 
0423     // ----------------------------------------------------------------------------------
0424     //  ---------------------------- General settings -----------------------------------
0425     // ----------------------------------------------------------------------------------
0426 
0427     // -------------------- Panel Font ----------------------------------
0428     auto *hbox = new QHBoxLayout();
0429 
0430     auto *fontLayout = new QHBoxLayout();
0431     QLabel *labelFontLay = new QLabel(i18n("View font:"), panelGrp);
0432     fontLayout->addWidget(labelFontLay);
0433     KonfiguratorFontChooser *chsr = createFontChooser("Look&Feel", "Filelist Font", _FilelistFont, labelFontLay, panelGrp, true, QString(), PAGE_VIEW);
0434     fontLayout->addWidget(chsr);
0435     fontLayout->addStretch(1);
0436     hbox->addLayout(fontLayout, 1);
0437 
0438     // -------------------- Panel Tooltip ----------------------------------
0439     auto *tooltipLayout = new QHBoxLayout();
0440     const QString delayTip = i18n(
0441         "The duration after a tooltip is shown for a file item, in "
0442         "milliseconds. Set a negative value to disable tooltips.");
0443     QLabel *tooltipLabel = new QLabel(i18n("Tooltip delay (msec):"));
0444     tooltipLayout->addWidget(tooltipLabel);
0445     KonfiguratorSpinBox *tooltipSpinBox =
0446         createSpinBox("Look&Feel", "Panel Tooltip Delay", 1000, -100, 5000, tooltipLabel, panelGrp, false, delayTip, PAGE_VIEW);
0447     tooltipSpinBox->setSingleStep(100);
0448     tooltipLayout->addWidget(tooltipSpinBox);
0449     tooltipLayout->addStretch(1);
0450     hbox->addLayout(tooltipLayout, 1);
0451 
0452     panelGrid->addLayout(hbox, 1, 0);
0453 
0454     // -------------------- General options ----------------------------------
0455     KONFIGURATOR_CHECKBOX_PARAM panelSettings[] =
0456         //   cfg_class  cfg_name                default text                                  restart tooltip
0457         {
0458             {"Look&Feel",
0459              "Human Readable Size",
0460              _HumanReadableSize,
0461              i18n("Use human-readable file size"),
0462              true,
0463              i18n("File sizes are displayed in B, KB, MB and GB, not just in bytes.")},
0464             {"Look&Feel", "Show Hidden", _ShowHidden, i18n("Show hidden files"), false, i18n("Display files beginning with a dot.")},
0465             {"Look&Feel",
0466              "Numeric permissions",
0467              _NumericPermissions,
0468              i18n("Numeric Permissions"),
0469              true,
0470              i18n("Show octal numbers (0755) instead of the standard permissions (rwxr-xr-x) in the permission column.")},
0471             {"Look&Feel",
0472              "Load User Defined Folder Icons",
0473              _UserDefinedFolderIcons,
0474              i18n("Load the user defined folder icons"),
0475              true,
0476              i18n("Load the user defined folder icons (can cause decrease in performance).")},
0477             {"Look&Feel",
0478              "Always Show Current Item",
0479              _AlwaysShowCurrentItem,
0480              i18n("Always show current item"),
0481              false,
0482              i18n("Show current item border decoration in inactive panel.")},
0483         };
0484 
0485     KonfiguratorCheckBoxGroup *panelSett = createCheckBoxGroup(2, 0, panelSettings, 5 /*count*/, panelGrp, PAGE_VIEW);
0486 
0487     panelGrid->addWidget(panelSett, 3, 0, 1, 2);
0488 
0489     // =========================================================
0490     panelGrid->addWidget(createLine(panelGrp), 4, 0);
0491 
0492     // ------------------------ Sort Method ----------------------------------
0493 
0494     hbox = new QHBoxLayout();
0495 
0496     QLabel *labelSort = new QLabel(i18n("Sort method:"), panelGrp);
0497     hbox->addWidget(labelSort);
0498 
0499     KONFIGURATOR_NAME_VALUE_PAIR sortMethods[] = {{i18n("Alphabetical"), QString::number(KrViewProperties::Alphabetical)},
0500                                                   {i18n("Alphabetical and numbers"), QString::number(KrViewProperties::AlphabeticalNumbers)},
0501                                                   {i18n("Character code"), QString::number(KrViewProperties::CharacterCode)},
0502                                                   {i18n("Character code and numbers"), QString::number(KrViewProperties::CharacterCodeNumbers)},
0503                                                   {i18nc("Krusader sort", "Krusader"), QString::number(KrViewProperties::Krusader)}};
0504     KonfiguratorComboBox *cmb =
0505         createComboBox("Look&Feel", "Sort method", QString::number(_DefaultSortMethod), sortMethods, 5, labelSort, panelGrp, true, false, QString(), PAGE_VIEW);
0506     hbox->addWidget(cmb);
0507     hbox->addWidget(createSpacer(panelGrp));
0508 
0509     panelGrid->addLayout(hbox, 5, 0);
0510 
0511     // ------------------------ Sort Options ----------------------------------
0512     KONFIGURATOR_CHECKBOX_PARAM sortSettings[] =
0513         // cfg_class, cfg_name, default, text, restart, tooltip
0514         {
0515             {"Look&Feel",
0516              "Case Sensative Sort",
0517              _CaseSensativeSort,
0518              i18n("Case sensitive sorting"),
0519              true,
0520              i18n("All files beginning with capital letters appear before files beginning with non-capital letters (UNIX default).")},
0521             {"Look&Feel", "Show Directories First", true, i18n("Show folders first"), true, nullptr},
0522             {"Look&Feel",
0523              "Always sort dirs by name",
0524              false,
0525              i18n("Always sort dirs by name"),
0526              true,
0527              i18n("Folders are sorted by name, regardless of the sort column.")},
0528             {"Look&Feel",
0529              "Locale Aware Sort",
0530              true,
0531              i18n("Locale aware sorting"),
0532              true,
0533              i18n("The sorting is performed in a locale- and also platform-dependent manner. Can be slow.")},
0534         };
0535 
0536     KonfiguratorCheckBoxGroup *sortSett = createCheckBoxGroup(2, 0, sortSettings, 4 /*count*/, panelGrp, PAGE_VIEW);
0537     sortSett->find("Show Directories First")->addDep(sortSett->find("Always sort dirs by name"));
0538 
0539     panelGrid->addWidget(sortSett, 6, 0, 1, 2);
0540 
0541     // ----------------------------------------------------------------------------------
0542     //  ---------------------------- View modes -----------------------------------------
0543     // ----------------------------------------------------------------------------------
0544 
0545     panelGrp = createFrame(i18n("View modes"), tab_panel);
0546     panelLayout->addWidget(panelGrp, 1, 0);
0547     panelGrid = createGridLayout(panelGrp);
0548 
0549     // -------------------- Default Panel Type ----------------------------------
0550     hbox = new QHBoxLayout();
0551 
0552     QLabel *labelViewMode = new QLabel(i18n("Default view mode:"), panelGrp);
0553     hbox->addWidget(labelViewMode);
0554 
0555     QList<KrViewInstance *> views = KrViewFactory::registeredViews();
0556     const int viewsSize = views.size();
0557     auto *panelTypes = new KONFIGURATOR_NAME_VALUE_PAIR[viewsSize];
0558 
0559     QString defType = QString('0');
0560 
0561     for (int i = 0; i != viewsSize; i++) {
0562         KrViewInstance *inst = views[i];
0563         panelTypes[i].text = inst->description();
0564         panelTypes[i].text.remove('&');
0565         panelTypes[i].value = QString("%1").arg(inst->id());
0566         if (inst->id() == KrViewFactory::defaultViewId())
0567             defType = QString("%1").arg(inst->id());
0568     }
0569 
0570     cmb = createComboBox("Look&Feel", "Default Panel Type", defType, panelTypes, viewsSize, labelViewMode, panelGrp, false, false, QString(), PAGE_VIEW);
0571     hbox->addWidget(cmb);
0572     hbox->addWidget(createSpacer(panelGrp));
0573 
0574     delete[] panelTypes;
0575 
0576     panelGrid->addLayout(hbox, 0, 0);
0577 
0578     // ----- Individual Settings Per View Type ------------------------
0579     auto *tabs_view = new QTabWidget(panelGrp);
0580     panelGrid->addWidget(tabs_view, 11, 0);
0581 
0582     for (int i = 0; i < views.count(); i++) {
0583         QWidget *tab = new QWidget(tabs_view);
0584         tabs_view->addTab(tab, views[i]->description());
0585         setupView(views[i], tab);
0586     }
0587 }
0588 
0589 // -----------------------------------------------------------------------------------
0590 //  -------------------------- Panel Toolbar TAB ----------------------------------
0591 // -----------------------------------------------------------------------------------
0592 void KgPanel::setupButtonsTab()
0593 {
0594     auto *scrollArea = new QScrollArea(tabWidget);
0595     QWidget *tab = new QWidget(scrollArea);
0596     scrollArea->setFrameStyle(QFrame::NoFrame);
0597     scrollArea->setWidget(tab);
0598     scrollArea->setWidgetResizable(true);
0599     tabWidget->addTab(scrollArea, i18n("Buttons"));
0600 
0601     QBoxLayout *tabLayout = new QVBoxLayout(tab);
0602     tabLayout->setSpacing(6);
0603     tabLayout->setContentsMargins(11, 11, 11, 11);
0604 
0605     KONFIGURATOR_CHECKBOX_PARAM buttonsParams[] =
0606         //   cfg_class    cfg_name                default        text                          restart tooltip
0607         {
0608             {"ListPanelButtons", "Icons", false, i18n("Toolbar buttons have icons"), true, ""},
0609             {"Look&Feel", "Media Button Visible", true, i18n("Show Media Button"), true, i18n("The media button will be visible.")},
0610             {"Look&Feel", "Back Button Visible", false, i18n("Show Back Button"), true, "Goes back in history."},
0611             {"Look&Feel", "Forward Button Visible", false, i18n("Show Forward Button"), true, "Goes forward in history."},
0612             {"Look&Feel", "History Button Visible", true, i18n("Show History Button"), true, i18n("The history button will be visible.")},
0613             {"Look&Feel", "Bookmarks Button Visible", true, i18n("Show Bookmarks Button"), true, i18n("The bookmarks button will be visible.")},
0614             {"Look&Feel", "Panel Toolbar visible", _PanelToolBar, i18n("Show Panel Toolbar"), true, i18n("The panel toolbar will be visible.")},
0615         };
0616     buttonsCheckboxes = createCheckBoxGroup(1, 0, buttonsParams, 7 /*count*/, tab, PAGE_PANELTOOLBAR);
0617     connect(buttonsCheckboxes->find("Panel Toolbar visible"), &KonfiguratorCheckBox::stateChanged, this, &KgPanel::slotEnablePanelToolbar);
0618     tabLayout->addWidget(buttonsCheckboxes, 0, Qt::Alignment());
0619 
0620     QGroupBox *panelToolbarGrp = createFrame(i18n("Visible Panel Toolbar buttons"), tab);
0621     QGridLayout *panelToolbarGrid = createGridLayout(panelToolbarGrp);
0622     KONFIGURATOR_CHECKBOX_PARAM panelToolbarButtonsParams[] = {
0623         //   cfg_class    cfg_name                default             text                       restart tooltip
0624         {"Look&Feel", "Equal Button Visible", _cdOther, i18n("Equal button (=)"), true, i18n("Changes the panel folder to the other panel folder.")},
0625         {"Look&Feel", "Up Button Visible", _cdUp, i18n("Up button (..)"), true, i18n("Changes the panel folder to the parent folder.")},
0626         {"Look&Feel", "Home Button Visible", _cdHome, i18n("Home button (~)"), true, i18n("Changes the panel folder to the home folder.")},
0627         {"Look&Feel", "Root Button Visible", _cdRoot, i18n("Root button (/)"), true, i18n("Changes the panel folder to the root folder.")},
0628         {"Look&Feel",
0629          "SyncBrowse Button Visible",
0630          _syncBrowseButton,
0631          i18n("Toggle-button for sync-browsing"),
0632          true,
0633          i18n("Each folder change in the panel is also performed in the other panel.")},
0634     };
0635     panelToolbarButtonsCheckboxes = createCheckBoxGroup(1,
0636                                                         0,
0637                                                         panelToolbarButtonsParams,
0638                                                         sizeof(panelToolbarButtonsParams) / sizeof(*panelToolbarButtonsParams),
0639                                                         panelToolbarGrp,
0640                                                         PAGE_PANELTOOLBAR);
0641     panelToolbarGrid->addWidget(panelToolbarButtonsCheckboxes, 0, 0);
0642     tabLayout->addWidget(panelToolbarGrp, 1, Qt::Alignment());
0643 
0644     // Enable panel toolbar checkboxes
0645     slotEnablePanelToolbar();
0646 }
0647 
0648 // ---------------------------------------------------------------------------
0649 //  -------------------------- Mouse TAB ----------------------------------
0650 // ---------------------------------------------------------------------------
0651 void KgPanel::setupMouseModeTab()
0652 {
0653     auto *scrollArea = new QScrollArea(tabWidget);
0654     QWidget *tab_mouse = new QWidget(scrollArea);
0655     scrollArea->setFrameStyle(QFrame::NoFrame);
0656     scrollArea->setWidget(tab_mouse);
0657     scrollArea->setWidgetResizable(true);
0658     tabWidget->addTab(scrollArea, i18n("Selection Mode"));
0659     auto *mouseLayout = new QGridLayout(tab_mouse);
0660     mouseLayout->setSpacing(6);
0661     mouseLayout->setContentsMargins(11, 11, 11, 11);
0662 
0663     // -------------- General -----------------
0664     QGroupBox *mouseGeneralGroup = createFrame(i18n("General"), tab_mouse);
0665     QGridLayout *mouseGeneralGrid = createGridLayout(mouseGeneralGroup);
0666     mouseGeneralGrid->setSpacing(0);
0667     mouseGeneralGrid->setContentsMargins(5, 5, 5, 5);
0668 
0669     KONFIGURATOR_NAME_VALUE_TIP mouseSelection[] = {
0670         //     name           value          tooltip
0671         {i18n("Krusader Mode"),
0672          "0",
0673          i18n("Both keys allow selecting files. To select more than one file, hold the Ctrl key and click the left mouse button. Right-click menu is invoked "
0674               "using a short click on the right mouse button.")},
0675         {i18n("Konqueror Mode"),
0676          "1",
0677          i18n("Pressing the left mouse button selects files - you can click and select multiple files. Right-click menu is invoked using a short click on the "
0678               "right mouse button.")},
0679         {i18n("Total-Commander Mode"),
0680          "2",
0681          i18n("The left mouse button does not select, but sets the current file without affecting the current selection. The right mouse button selects "
0682               "multiple files and the right-click menu is invoked by pressing and holding the right mouse button.")},
0683         {i18n("Ergonomic Mode"),
0684          "4",
0685          i18n("The left mouse button does not select, but sets the current file without affecting the current selection. The right mouse button invokes the "
0686               "context-menu. You can select with Ctrl key and the left button.")},
0687         {i18n("Custom Selection Mode"), "3", i18n("Design your own selection mode.")}};
0688     mouseRadio = createRadioButtonGroup("Look&Feel", "Mouse Selection", "0", 1, 5, mouseSelection, 5, mouseGeneralGroup, true, PAGE_MOUSE);
0689     mouseRadio->layout()->setContentsMargins(0, 0, 0, 0);
0690     mouseGeneralGrid->addWidget(mouseRadio, 0, 0);
0691 
0692     for (int i = 0; i != mouseRadio->count(); i++)
0693         connect(mouseRadio->find(i), &QRadioButton::clicked, this, &KgPanel::slotSelectionModeChanged);
0694 
0695     mouseLayout->addWidget(mouseGeneralGroup, 0, 0);
0696 
0697     // -------------- Details -----------------
0698     QGroupBox *mouseDetailGroup = createFrame(i18n("Details"), tab_mouse);
0699     QGridLayout *mouseDetailGrid = createGridLayout(mouseDetailGroup);
0700     mouseDetailGrid->setSpacing(0);
0701     mouseDetailGrid->setContentsMargins(5, 5, 5, 5);
0702 
0703     KONFIGURATOR_NAME_VALUE_TIP singleOrDoubleClick[] = {
0704         //          name            value            tooltip
0705         {i18n("Double-click selects (classic)"),
0706          "0",
0707          i18n("A single click on a file will select and focus, a double click opens the file or steps into the folder.")},
0708         {i18n("Obey global selection policy"), "1", i18n("<p>Use global setting:</p><p><i>Plasma System Settings -> Input Devices -> Mouse</i></p>")}};
0709     KonfiguratorRadioButtons *clickRadio =
0710         createRadioButtonGroup("Look&Feel", "Single Click Selects", "0", 1, 0, singleOrDoubleClick, 2, mouseDetailGroup, true, PAGE_MOUSE);
0711     clickRadio->layout()->setContentsMargins(0, 0, 0, 0);
0712     mouseDetailGrid->addWidget(clickRadio, 0, 0);
0713 
0714     KONFIGURATOR_CHECKBOX_PARAM mouseCheckboxesParam[] = {
0715         // {cfg_class,   cfg_name,   default
0716         //  text,  restart,
0717         //  tooltip }
0718         {"Custom Selection Mode",
0719          "QT Selection",
0720          _QtSelection,
0721          i18n("Based on KDE's selection mode"),
0722          true,
0723          i18n("If checked, use a mode based on KDE's style.")},
0724         {"Custom Selection Mode",
0725          "Left Selects",
0726          _LeftSelects,
0727          i18n("Left mouse button selects"),
0728          true,
0729          i18n("If checked, left clicking an item will select it.")},
0730         {"Custom Selection Mode",
0731          "Left Preserves",
0732          _LeftPreserves,
0733          i18n("Left mouse button preserves selection"),
0734          true,
0735          i18n("If checked, left clicking an item will select it, but will not unselect other, already selected items.")},
0736         {"Custom Selection Mode",
0737          "ShiftCtrl Left Selects",
0738          _ShiftCtrlLeft,
0739          i18n("Shift/Ctrl-Left mouse button selects"),
0740          true,
0741          i18n("If checked, Shift/Ctrl left clicking will select items.\nNote: this is meaningless if 'Left Button Selects' is checked.")},
0742         {"Custom Selection Mode",
0743          "Right Selects",
0744          _RightSelects,
0745          i18n("Right mouse button selects"),
0746          true,
0747          i18n("If checked, right clicking an item will select it.")},
0748         {"Custom Selection Mode",
0749          "Right Preserves",
0750          _RightPreserves,
0751          i18n("Right mouse button preserves selection"),
0752          true,
0753          i18n("If checked, right clicking an item will select it, but will not unselect other, already selected items.")},
0754         {"Custom Selection Mode",
0755          "ShiftCtrl Right Selects",
0756          _ShiftCtrlRight,
0757          i18n("Shift/Ctrl-Right mouse button selects"),
0758          true,
0759          i18n("If checked, Shift/Ctrl right clicking will select items.\nNote: this is meaningless if 'Right Button Selects' is checked.")},
0760         {"Custom Selection Mode",
0761          "Space Moves Down",
0762          _SpaceMovesDown,
0763          i18n("Spacebar moves down"),
0764          true,
0765          i18n("If checked, pressing the spacebar will select the current item and move down.\nOtherwise, current item is selected, but remains the current "
0766               "item.")},
0767         {"Custom Selection Mode",
0768          "Space Calc Space",
0769          _SpaceCalcSpace,
0770          i18n("Spacebar calculates disk space"),
0771          true,
0772          i18n("If checked, pressing the spacebar while the current item is a folder, will (except from selecting the folder)\ncalculate space occupied of the "
0773               "folder (recursively).")},
0774         {"Custom Selection Mode",
0775          "Insert Moves Down",
0776          _InsertMovesDown,
0777          i18n("Insert moves down"),
0778          true,
0779          i18n("If checked, pressing Insert will select the current item, and move down to the next item.\nOtherwise, current item is not changed.")},
0780         {"Custom Selection Mode",
0781          "Immediate Context Menu",
0782          _ImmediateContextMenu,
0783          i18n("Right clicking pops context menu immediately"),
0784          true,
0785          i18n("If checked, right clicking will result in an immediate showing of the context menu.\nOtherwise, user needs to click and hold the right mouse "
0786               "button for 500ms.")},
0787         {"Custom Selection Mode",
0788          "Reset Selection Items",
0789          _ResetSelectionItems,
0790          i18n("A plain mouse button resets selection"),
0791          true,
0792          i18n("Reset selection on a mouse click without modifiers (i.e. Shift or Ctrl).\nSelection with Shift/Ctrl for the mouse button have to be enabled for "
0793               "this setting to work.")},
0794     };
0795 
0796     mouseCheckboxes = createCheckBoxGroup(1, 0, mouseCheckboxesParam, 12 /*count*/, mouseDetailGroup, PAGE_MOUSE);
0797     mouseDetailGrid->addWidget(mouseCheckboxes, 1, 0);
0798 
0799     for (int i = 0; i < mouseCheckboxes->count(); i++)
0800         connect(mouseCheckboxes->find(i), &KonfiguratorCheckBox::clicked, this, &KgPanel::slotMouseCheckBoxChanged);
0801 
0802     mouseLayout->addWidget(mouseDetailGroup, 0, 1, 2, 1);
0803 
0804     // Disable the details-button if not in custom-mode
0805     slotSelectionModeChanged();
0806 
0807     // -------------- Preview -----------------
0808     QGroupBox *mousePreviewGroup = createFrame(i18n("Preview"), tab_mouse);
0809     QGridLayout *mousePreviewGrid = createGridLayout(mousePreviewGroup);
0810     // TODO preview
0811     mousePreview = new KrTreeWidget(mousePreviewGroup);
0812     mousePreviewGrid->addWidget(mousePreview, 0, 0);
0813     mousePreviewGroup->setEnabled(false); // TODO re-enable once the preview is implemented
0814     // ------------------------------------------
0815     mouseLayout->addWidget(mousePreviewGroup, 1, 0);
0816 }
0817 
0818 // ---------------------------------------------------------------------------
0819 //  -------------------------- Media Menu TAB ----------------------------------
0820 // ---------------------------------------------------------------------------
0821 void KgPanel::setupMediaMenuTab()
0822 {
0823     auto *scrollArea = new QScrollArea(tabWidget);
0824     QWidget *tab = new QWidget(scrollArea);
0825     scrollArea->setFrameStyle(QFrame::NoFrame);
0826     scrollArea->setWidget(tab);
0827     scrollArea->setWidgetResizable(true);
0828     tabWidget->addTab(scrollArea, i18n("Media Menu"));
0829 
0830     QBoxLayout *tabLayout = new QVBoxLayout(tab);
0831     tabLayout->setSpacing(6);
0832     tabLayout->setContentsMargins(11, 11, 11, 11);
0833 
0834     KONFIGURATOR_CHECKBOX_PARAM mediaMenuParams[] = {
0835         //   cfg_class    cfg_name    default    text   restart tooltip
0836         {"MediaMenu", "ShowPath", true, i18n("Show Mount Path"), false, nullptr},
0837         {"MediaMenu", "ShowFSType", true, i18n("Show File System Type"), false, nullptr},
0838         {"MediaMenu", "HideSquashFS", false, i18n("Hide SquashFS entries"), false, nullptr},
0839     };
0840     KonfiguratorCheckBoxGroup *mediaMenuCheckBoxes =
0841         createCheckBoxGroup(1, 0, mediaMenuParams, sizeof(mediaMenuParams) / sizeof(*mediaMenuParams), tab, PAGE_MEDIA_MENU);
0842     tabLayout->addWidget(mediaMenuCheckBoxes, 0, Qt::Alignment());
0843 
0844     auto *showSizeHBox = new QHBoxLayout();
0845     QLabel *labelShowSize = new QLabel(i18n("Show Size:"), tab);
0846     showSizeHBox->addWidget(labelShowSize);
0847     KONFIGURATOR_NAME_VALUE_PAIR showSizeValues[] = {
0848         {i18nc("setting 'show size'", "Always"), "Always"},
0849         {i18nc("setting 'show size'", "When Device has no Label"), "WhenNoLabel"},
0850         {i18nc("setting 'show size'", "Never"), "Never"},
0851     };
0852     KonfiguratorComboBox *showSizeCmb = createComboBox("MediaMenu",
0853                                                        "ShowSize",
0854                                                        "Always",
0855                                                        showSizeValues,
0856                                                        sizeof(showSizeValues) / sizeof(*showSizeValues),
0857                                                        labelShowSize,
0858                                                        tab,
0859                                                        false,
0860                                                        false,
0861                                                        QString(),
0862                                                        PAGE_MEDIA_MENU);
0863     showSizeHBox->addWidget(showSizeCmb);
0864     createIgnoredMountpointsList(tab, tabLayout);
0865     showSizeHBox->addStretch();
0866     tabLayout->addLayout(showSizeHBox);
0867 
0868     tabLayout->addStretch();
0869 }
0870 
0871 void KgPanel::createIgnoredMountpointsList(QWidget *tab, QBoxLayout *tabLayout)
0872 {
0873     QWidget *vboxWidget2 = new QWidget(tab);
0874     tabLayout->addWidget(vboxWidget2);
0875     auto *vbox2 = new QVBoxLayout(vboxWidget2);
0876 
0877     QWidget *hboxWidget3 = new QWidget(vboxWidget2);
0878     vbox2->addWidget(hboxWidget3);
0879 
0880     auto *hbox3 = new QHBoxLayout(hboxWidget3);
0881 
0882     QLabel *atomLabel = new QLabel(i18n("Hide following mountpoints:"), hboxWidget3);
0883     hbox3->addWidget(atomLabel);
0884 
0885     int size = QFontMetrics(atomLabel->font()).height();
0886 
0887     auto *addButton = new QToolButton(hboxWidget3);
0888     hbox3->addWidget(addButton);
0889 
0890     QPixmap iconPixmap = Icon("list-add").pixmap(size);
0891     addButton->setFixedSize(iconPixmap.width() + 4, iconPixmap.height() + 4);
0892     addButton->setIcon(QIcon(iconPixmap));
0893     connect(addButton, &QToolButton::clicked, this, &KgPanel::slotAddMountpoint);
0894 
0895     auto *removeButton = new QToolButton(hboxWidget3);
0896     hbox3->addWidget(removeButton);
0897 
0898     iconPixmap = Icon("list-remove").pixmap(size);
0899     removeButton->setFixedSize(iconPixmap.width() + 4, iconPixmap.height() + 4);
0900     removeButton->setIcon(QIcon(iconPixmap));
0901     connect(removeButton, &QToolButton::clicked, this, &KgPanel::slotRemoveMountpoint);
0902 
0903     QStringList defaultHiddenMountpoints; // Empty list
0904     listBox = createListBox("MediaMenu", "Hidden Mountpoints", defaultHiddenMountpoints, vboxWidget2, true, QString(), PAGE_MEDIA_MENU);
0905     vbox2->addWidget(listBox);
0906 }
0907 
0908 void KgPanel::slotAddMountpoint()
0909 {
0910     bool ok;
0911     QString atomExt = QInputDialog::getText(this, i18n("Add new hidden mount point"), i18n("Mount point:"), QLineEdit::Normal, QString(), &ok);
0912 
0913     if (ok) {
0914         listBox->addItem(atomExt);
0915     }
0916 }
0917 
0918 void KgPanel::slotRemoveMountpoint()
0919 {
0920     QList<QListWidgetItem *> list = listBox->selectedItems();
0921 
0922     for (int i = 0; i != list.count(); i++)
0923         listBox->removeItem(list[i]->text());
0924 }
0925 
0926 void KgPanel::slotEnablePanelToolbar()
0927 {
0928     bool enableTB = buttonsCheckboxes->find("Panel Toolbar visible")->isChecked();
0929     panelToolbarButtonsCheckboxes->find("Root Button Visible")->setEnabled(enableTB);
0930     panelToolbarButtonsCheckboxes->find("Home Button Visible")->setEnabled(enableTB);
0931     panelToolbarButtonsCheckboxes->find("Up Button Visible")->setEnabled(enableTB);
0932     panelToolbarButtonsCheckboxes->find("Equal Button Visible")->setEnabled(enableTB);
0933     panelToolbarButtonsCheckboxes->find("SyncBrowse Button Visible")->setEnabled(enableTB);
0934 }
0935 
0936 void KgPanel::slotSelectionModeChanged()
0937 {
0938     KrSelectionMode *selectionMode = KrSelectionMode::getSelectionHandlerForMode(mouseRadio->selectedValue());
0939     if (selectionMode == nullptr) // User mode
0940         return;
0941     selectionMode->init();
0942     mouseCheckboxes->find("QT Selection")->setChecked(selectionMode->useQTSelection());
0943     mouseCheckboxes->find("Left Selects")->setChecked(selectionMode->leftButtonSelects());
0944     mouseCheckboxes->find("Left Preserves")->setChecked(selectionMode->leftButtonPreservesSelection());
0945     mouseCheckboxes->find("ShiftCtrl Left Selects")->setChecked(selectionMode->shiftCtrlLeftButtonSelects());
0946     mouseCheckboxes->find("Right Selects")->setChecked(selectionMode->rightButtonSelects());
0947     mouseCheckboxes->find("Right Preserves")->setChecked(selectionMode->rightButtonPreservesSelection());
0948     mouseCheckboxes->find("ShiftCtrl Right Selects")->setChecked(selectionMode->shiftCtrlRightButtonSelects());
0949     mouseCheckboxes->find("Space Moves Down")->setChecked(selectionMode->spaceMovesDown());
0950     mouseCheckboxes->find("Space Calc Space")->setChecked(selectionMode->spaceCalculatesDiskSpace());
0951     mouseCheckboxes->find("Insert Moves Down")->setChecked(selectionMode->insertMovesDown());
0952     mouseCheckboxes->find("Immediate Context Menu")->setChecked(selectionMode->showContextMenu() == -1);
0953     mouseCheckboxes->find("Reset Selection Items")->setChecked(selectionMode->resetSelectionItems());
0954 }
0955 
0956 void KgPanel::slotMouseCheckBoxChanged()
0957 {
0958     mouseRadio->selectButton("3"); // custom selection mode
0959 }
0960 
0961 int KgPanel::activeSubPage()
0962 {
0963     return tabWidget->currentIndex();
0964 }
0965 
0966 bool KgPanel::apply()
0967 {
0968     // We read the IconSize config file before and after
0969     // applying the change, to see if it really changed
0970     KConfigGroup briefView(krConfig, "KrInterBriefView");
0971     KConfigGroup detailedView(krConfig, "KrInterDetailedView");
0972 
0973     int oldiconBriefSize = briefView.readEntry("IconSize", _FilelistIconSize).toInt();
0974     int oldiconDetailSize = detailedView.readEntry("IconSize", _FilelistIconSize).toInt();
0975     KonfiguratorPage::apply();
0976     int iconBriefSize = briefView.readEntry("IconSize", _FilelistIconSize).toInt();
0977     int iconDetailSize = detailedView.readEntry("IconSize", _FilelistIconSize).toInt();
0978 
0979     return oldiconBriefSize != iconBriefSize || oldiconDetailSize != iconDetailSize;
0980 }