Changeset View
Changeset View
Standalone View
Standalone View
krusader/Konfigurator/kgpanel.cpp
Show All 27 Lines | |||||
28 | #include <QTabWidget> | 28 | #include <QTabWidget> | ||
29 | #include <QFrame> | 29 | #include <QFrame> | ||
30 | #include <QGridLayout> | 30 | #include <QGridLayout> | ||
31 | #include <QLabel> | 31 | #include <QLabel> | ||
32 | #include <QVBoxLayout> | 32 | #include <QVBoxLayout> | ||
33 | 33 | | |||
34 | #include <KI18n/KLocalizedString> | 34 | #include <KI18n/KLocalizedString> | ||
35 | #include <KWidgetsAddons/KMessageBox> | 35 | #include <KWidgetsAddons/KMessageBox> | ||
36 | #include <QtWidgets/QInputDialog> | ||||
36 | 37 | | |||
37 | #include "../GUI/krtreewidget.h" | 38 | #include "../GUI/krtreewidget.h" | ||
38 | #include "../Panel/krsearchbar.h" | 39 | #include "../Panel/krsearchbar.h" | ||
39 | #include "../Panel/PanelView/krselectionmode.h" | 40 | #include "../Panel/PanelView/krselectionmode.h" | ||
40 | #include "../Panel/PanelView/krview.h" | 41 | #include "../Panel/PanelView/krview.h" | ||
41 | #include "../Panel/PanelView/krviewfactory.h" | 42 | #include "../Panel/PanelView/krviewfactory.h" | ||
42 | #include "../Panel/krlayoutfactory.h" | 43 | #include "../Panel/krlayoutfactory.h" | ||
44 | #include "../icon.h" | ||||
45 | #include "../krglobal.h" | ||||
43 | 46 | | |||
44 | enum { | 47 | enum { | ||
45 | PAGE_GENERAL = 0, | 48 | PAGE_GENERAL = 0, | ||
46 | PAGE_VIEW, | 49 | PAGE_VIEW, | ||
47 | PAGE_PANELTOOLBAR, | 50 | PAGE_PANELTOOLBAR, | ||
48 | PAGE_MOUSE, | 51 | PAGE_MOUSE, | ||
49 | PAGE_MEDIA_MENU, | 52 | PAGE_MEDIA_MENU, | ||
50 | PAGE_LAYOUT | 53 | PAGE_LAYOUT | ||
▲ Show 20 Lines • Show All 622 Lines • ▼ Show 20 Line(s) | 667 | { | |||
673 | tabLayout->setSpacing(6); | 676 | tabLayout->setSpacing(6); | ||
674 | tabLayout->setContentsMargins(11, 11, 11, 11); | 677 | tabLayout->setContentsMargins(11, 11, 11, 11); | ||
675 | 678 | | |||
676 | 679 | | |||
677 | KONFIGURATOR_CHECKBOX_PARAM mediaMenuParams[] = { | 680 | KONFIGURATOR_CHECKBOX_PARAM mediaMenuParams[] = { | ||
678 | // cfg_class cfg_name default text restart tooltip | 681 | // cfg_class cfg_name default text restart tooltip | ||
679 | {"MediaMenu", "ShowPath", true, i18n("Show Mount Path"), false, nullptr }, | 682 | {"MediaMenu", "ShowPath", true, i18n("Show Mount Path"), false, nullptr }, | ||
680 | {"MediaMenu", "ShowFSType", true, i18n("Show File System Type"), false, nullptr }, | 683 | {"MediaMenu", "ShowFSType", true, i18n("Show File System Type"), false, nullptr }, | ||
684 | {"MediaMenu", "HideSquashFS", false, i18n("Hide SquashFS entries"), false, nullptr }, | ||||
681 | }; | 685 | }; | ||
682 | KonfiguratorCheckBoxGroup *mediaMenuCheckBoxes = | 686 | KonfiguratorCheckBoxGroup *mediaMenuCheckBoxes = | ||
683 | createCheckBoxGroup(1, 0, mediaMenuParams, | 687 | createCheckBoxGroup(1, 0, mediaMenuParams, | ||
684 | sizeof(mediaMenuParams) / sizeof(*mediaMenuParams), | 688 | sizeof(mediaMenuParams) / sizeof(*mediaMenuParams), | ||
685 | tab, PAGE_MEDIA_MENU); | 689 | tab, PAGE_MEDIA_MENU); | ||
686 | tabLayout->addWidget(mediaMenuCheckBoxes, 0, nullptr); | 690 | tabLayout->addWidget(mediaMenuCheckBoxes, 0, nullptr); | ||
687 | 691 | | |||
688 | auto *showSizeHBox = new QHBoxLayout(); | 692 | auto *showSizeHBox = new QHBoxLayout(); | ||
689 | showSizeHBox->addWidget(new QLabel(i18n("Show Size:"), tab)); | 693 | showSizeHBox->addWidget(new QLabel(i18n("Show Size:"), tab)); | ||
690 | KONFIGURATOR_NAME_VALUE_PAIR showSizeValues[] = { | 694 | KONFIGURATOR_NAME_VALUE_PAIR showSizeValues[] = { | ||
691 | { i18nc("setting 'show size'", "Always"), "Always" }, | 695 | { i18nc("setting 'show size'", "Always"), "Always" }, | ||
692 | { i18nc("setting 'show size'", "When Device has no Label"), "WhenNoLabel" }, | 696 | { i18nc("setting 'show size'", "When Device has no Label"), "WhenNoLabel" }, | ||
693 | { i18nc("setting 'show size'", "Never"), "Never" }, | 697 | { i18nc("setting 'show size'", "Never"), "Never" }, | ||
694 | }; | 698 | }; | ||
695 | KonfiguratorComboBox *showSizeCmb = | 699 | KonfiguratorComboBox *showSizeCmb = | ||
696 | createComboBox("MediaMenu", "ShowSize", | 700 | createComboBox("MediaMenu", "ShowSize", | ||
697 | "Always", showSizeValues, | 701 | "Always", showSizeValues, | ||
698 | sizeof(showSizeValues) / sizeof(*showSizeValues), | 702 | sizeof(showSizeValues) / sizeof(*showSizeValues), | ||
699 | tab, false, false, PAGE_MEDIA_MENU); | 703 | tab, false, false, PAGE_MEDIA_MENU); | ||
700 | showSizeHBox->addWidget(showSizeCmb); | 704 | showSizeHBox->addWidget(showSizeCmb); | ||
705 | createIgnoredMountpointsList(tab, tabLayout); | ||||
701 | showSizeHBox->addStretch(); | 706 | showSizeHBox->addStretch(); | ||
702 | tabLayout->addLayout(showSizeHBox); | 707 | tabLayout->addLayout(showSizeHBox); | ||
703 | 708 | | |||
704 | tabLayout->addStretch(); | 709 | tabLayout->addStretch(); | ||
705 | } | 710 | } | ||
706 | 711 | | |||
712 | void KgPanel::createIgnoredMountpointsList(QWidget *tab, QBoxLayout *tabLayout) { | ||||
713 | QWidget *vboxWidget2 = new QWidget(tab); | ||||
714 | tabLayout->addWidget(vboxWidget2); | ||||
715 | auto *vbox2 = new QVBoxLayout(vboxWidget2); | ||||
716 | | ||||
717 | QWidget *hboxWidget3 = new QWidget(vboxWidget2); | ||||
718 | vbox2->addWidget(hboxWidget3); | ||||
719 | | ||||
720 | auto *hbox3 = new QHBoxLayout(hboxWidget3); | ||||
721 | | ||||
722 | QLabel *atomLabel = new QLabel(i18n("Hide following mountpoints:"), hboxWidget3); | ||||
723 | hbox3->addWidget(atomLabel); | ||||
724 | | ||||
725 | int size = QFontMetrics(atomLabel->font()).height(); | ||||
726 | | ||||
727 | auto *addButton = new QToolButton(hboxWidget3); | ||||
728 | hbox3->addWidget(addButton); | ||||
729 | | ||||
730 | QPixmap iconPixmap = Icon("list-add").pixmap(size); | ||||
731 | addButton->setFixedSize(iconPixmap.width() + 4, iconPixmap.height() + 4); | ||||
732 | addButton->setIcon(QIcon(iconPixmap)); | ||||
733 | connect(addButton, &QToolButton::clicked, this, &KgPanel::slotAddMountpoint); | ||||
734 | | ||||
735 | auto *removeButton = new QToolButton(hboxWidget3); | ||||
736 | hbox3->addWidget(removeButton); | ||||
737 | | ||||
738 | iconPixmap = Icon("list-remove").pixmap(size); | ||||
739 | removeButton->setFixedSize(iconPixmap.width() + 4, iconPixmap.height() + 4); | ||||
740 | removeButton->setIcon(QIcon(iconPixmap)); | ||||
741 | connect(removeButton, &QToolButton::clicked, this, &KgPanel::slotRemoveMountpoint); | ||||
742 | | ||||
743 | QStringList defaultHiddenMountpoints; // Empty list | ||||
744 | listBox = createListBox("MediaMenu", "Hidden Mountpoints", | ||||
745 | defaultHiddenMountpoints, vboxWidget2, true, PAGE_MEDIA_MENU); | ||||
746 | vbox2->addWidget(listBox); | ||||
747 | } | ||||
748 | | ||||
749 | void KgPanel::slotAddMountpoint() { | ||||
750 | bool ok; | ||||
751 | QString atomExt = QInputDialog::getText(this, i18n("Add new hidden mount point"), i18n("Mount point:"), | ||||
752 | QLineEdit::Normal, QString(), &ok); | ||||
753 | | ||||
754 | if (ok) { | ||||
755 | listBox->addItem(atomExt); | ||||
756 | } | ||||
757 | } | ||||
758 | | ||||
759 | void KgPanel::slotRemoveMountpoint() { | ||||
760 | QList<QListWidgetItem *> list = listBox->selectedItems(); | ||||
761 | | ||||
762 | for (int i = 0; i != list.count(); i++) | ||||
763 | listBox->removeItem(list[i]->text()); | ||||
764 | } | ||||
765 | | ||||
707 | void KgPanel::slotEnablePanelToolbar() | 766 | void KgPanel::slotEnablePanelToolbar() | ||
708 | { | 767 | { | ||
709 | bool enableTB = buttonsCheckboxes->find("Panel Toolbar visible")->isChecked(); | 768 | bool enableTB = buttonsCheckboxes->find("Panel Toolbar visible")->isChecked(); | ||
710 | panelToolbarButtonsCheckboxes->find("Root Button Visible")->setEnabled(enableTB); | 769 | panelToolbarButtonsCheckboxes->find("Root Button Visible")->setEnabled(enableTB); | ||
711 | panelToolbarButtonsCheckboxes->find("Home Button Visible")->setEnabled(enableTB); | 770 | panelToolbarButtonsCheckboxes->find("Home Button Visible")->setEnabled(enableTB); | ||
712 | panelToolbarButtonsCheckboxes->find("Up Button Visible")->setEnabled(enableTB); | 771 | panelToolbarButtonsCheckboxes->find("Up Button Visible")->setEnabled(enableTB); | ||
713 | panelToolbarButtonsCheckboxes->find("Equal Button Visible")->setEnabled(enableTB); | 772 | panelToolbarButtonsCheckboxes->find("Equal Button Visible")->setEnabled(enableTB); | ||
714 | panelToolbarButtonsCheckboxes->find("SyncBrowse Button Visible")->setEnabled(enableTB); | 773 | panelToolbarButtonsCheckboxes->find("SyncBrowse Button Visible")->setEnabled(enableTB); | ||
Show All 31 Lines |