File indexing completed on 2024-04-28 05:46:34
0001 /* 0002 SPDX-FileCopyrightText: 2008-2012 Volker Lanz <vl@fidra.de> 0003 SPDX-FileCopyrightText: 2014-2017 Andrius Štikonas <andrius@stikonas.eu> 0004 SPDX-FileCopyrightText: 2016 Chantara Tith <tith.chantara@gmail.com> 0005 0006 SPDX-License-Identifier: GPL-3.0-or-later 0007 */ 0008 0009 #if !defined(NEWDIALOG_H) 0010 0011 #define NEWDIALOG_H 0012 0013 #include "gui/sizedialogbase.h" 0014 0015 #include <core/partition.h> 0016 0017 #include <fs/filesystem.h> 0018 0019 class Device; 0020 0021 /** Dialog to create new Partitions. 0022 0023 Dialog to create a new Partition in some unallocated space on a Device. 0024 0025 @author Volker Lanz <vl@fidra.de> 0026 */ 0027 class NewDialog : public SizeDialogBase 0028 { 0029 public: 0030 NewDialog(QWidget* parent, Device& device, Partition& unallocatedPartition, PartitionRole::Roles r); 0031 ~NewDialog(); 0032 0033 // returns true if any user can write on the partition. 0034 // has the same effect as running `chmod 777` on it. 0035 bool useUnsecuredPartition() const; 0036 protected: 0037 void accept() override; 0038 void onRoleChanged(bool); 0039 void onFilesystemChanged(int); 0040 void onLabelChanged(const QString& newLabel); 0041 0042 void setupConnections() override; 0043 void setupDialog() override; 0044 void slotPasswordStatusChanged(); 0045 void updateHideAndShow(); 0046 void updateOkButtonStatus() override; 0047 void updateFileSystem(FileSystem::Type t); 0048 PartitionRole::Roles partitionRoles() const { 0049 return m_PartitionRoles; 0050 } 0051 bool canGrow() const override { 0052 return true; 0053 } 0054 bool canShrink() const override { 0055 return true; 0056 } 0057 bool canMove() const override; 0058 0059 bool isValidPassword() const { 0060 return m_IsValidPassword; 0061 } 0062 0063 private: 0064 PartitionRole::Roles m_PartitionRoles; 0065 bool m_IsValidPassword; 0066 }; 0067 0068 #endif