File indexing completed on 2024-04-28 05:46:32
0001 /* 0002 SPDX-FileCopyrightText: 2010 Volker Lanz <vl@fidra.de> 0003 SPDX-FileCopyrightText: 2014-2018 Andrius Štikonas <andrius@stikonas.eu> 0004 SPDX-FileCopyrightText: 2018 Abhijeet Sharma <sharma.abhijeet2096@gmail.com> 0005 0006 SPDX-License-Identifier: GPL-3.0-or-later 0007 */ 0008 0009 #if !defined(EDITMOUNTPOINTDIALOGWIDGET_H) 0010 0011 #define EDITMOUNTPOINTDIALOGWIDGET_H 0012 0013 #include "ui_editmountpointdialogwidgetbase.h" 0014 #include <core/fstab.h> 0015 0016 #include <map> 0017 0018 #include <QString> 0019 #include <QStringList> 0020 #include <QWidget> 0021 0022 class Partition; 0023 0024 class QFile; 0025 class QSpinBox; 0026 class QCheckBox; 0027 class QComboBox; 0028 class QPushButton; 0029 0030 class EditMountPointDialogWidget : public QWidget, public Ui::EditMountPointDialogWidgetBase 0031 { 0032 Q_OBJECT 0033 public: 0034 EditMountPointDialogWidget(QWidget* parent, Partition& p); 0035 ~EditMountPointDialogWidget(); 0036 0037 QPushButton& buttonMore() { 0038 return *m_ButtonMore; 0039 } 0040 QLabel& labelName() { 0041 return *m_LabelNameValue; 0042 } 0043 QComboBox& editPath() { 0044 return *m_EditPath; 0045 } 0046 QSpinBox& spinDumpFreq() { 0047 return *m_SpinDumpFreq; 0048 } 0049 QSpinBox& spinPassNumber() { 0050 return *m_SpinPassNumber; 0051 } 0052 QLabel& labelType() { 0053 return *m_LabelTypeValue; 0054 } 0055 QStringList options() const; 0056 QRadioButton& radioUUID() { 0057 return *m_RadioUUID; 0058 } 0059 QRadioButton& radioLabel() { 0060 return *m_RadioLabel; 0061 } 0062 QRadioButton& radioDeviceNode() { 0063 return *m_RadioDeviceNode; 0064 } 0065 FstabEntryList& fstabEntries() { 0066 return m_fstabEntries; 0067 } 0068 0069 bool isValid() const; 0070 0071 void acceptChanges(); 0072 void removeMountPoint(); 0073 bool writeMountpoints(const QString& filename); 0074 0075 Q_SIGNALS: 0076 void isValidChanged(bool newValid); 0077 0078 protected: 0079 void buttonSelectClicked(bool); 0080 void buttonMoreClicked(bool); 0081 void currentPathChanged(const QString &newPath); 0082 0083 private: 0084 void setupOptions(const QStringList& options); 0085 void setupRadio(const FstabEntry::Type entryType); 0086 std::map<QString, QCheckBox*>& boxOptions() { 0087 return m_BoxOptions; 0088 } 0089 const std::map<QString, QCheckBox*>& boxOptions() const { 0090 return m_BoxOptions; 0091 } 0092 0093 Partition& partition() { 0094 return m_Partition; 0095 } 0096 0097 const Partition& partition() const { 0098 return m_Partition; 0099 } 0100 0101 private: 0102 FstabEntryList m_fstabEntries; 0103 QList<FstabEntry *> entry; // All fstab entries for this partition 0104 FstabEntry *currentEntry; 0105 Partition& m_Partition; 0106 QString m_Options; 0107 QString m_deviceNode; 0108 QStringList mountPointList; 0109 std::map<QString, QCheckBox*> m_BoxOptions; 0110 std::map<QString, QCheckBox*>::iterator iterator_BoxOptions; 0111 bool m_valid = false; 0112 }; 0113 0114 #endif