Changeset View
Changeset View
Standalone View
Standalone View
krusader/Konfigurator/kgpanel.cpp
Context not available. | |||||
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" | ||
Context not available. | |||||
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, | ||
Context not available. | |||||
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, | ||
Context not available. | |||||
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(); | ||
Context not available. |