2020-09-16 00:35:12 +01:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2008-2012 Volker Lanz <vl@fidra.de>
|
|
|
|
SPDX-FileCopyrightText: 2014-2017 Andrius Štikonas <andrius@stikonas.eu>
|
|
|
|
SPDX-FileCopyrightText: 2016 Chantara Tith <tith.chantara@gmail.com>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*/
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2017-09-11 16:27:51 +01:00
|
|
|
#if !defined(NEWDIALOG_H)
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2017-09-11 16:27:51 +01:00
|
|
|
#define NEWDIALOG_H
|
2008-09-24 20:32:01 +01:00
|
|
|
|
|
|
|
#include "gui/sizedialogbase.h"
|
|
|
|
|
2016-01-12 00:12:49 +00:00
|
|
|
#include <core/partition.h>
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2016-01-12 00:12:49 +00:00
|
|
|
#include <fs/filesystem.h>
|
2010-03-11 23:33:41 +00:00
|
|
|
|
2008-09-24 20:32:01 +01:00
|
|
|
class Device;
|
|
|
|
|
2010-05-18 23:27:30 +01:00
|
|
|
/** Dialog to create new Partitions.
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
Dialog to create a new Partition in some unallocated space on a Device.
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
@author Volker Lanz <vl@fidra.de>
|
2008-09-24 20:32:01 +01:00
|
|
|
*/
|
|
|
|
class NewDialog : public SizeDialogBase
|
|
|
|
{
|
2015-07-13 15:17:41 +01:00
|
|
|
public:
|
|
|
|
NewDialog(QWidget* parent, Device& device, Partition& unallocatedPartition, PartitionRole::Roles r);
|
|
|
|
~NewDialog();
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2021-12-09 13:10:21 +00:00
|
|
|
// returns true if any user can write on the partition.
|
|
|
|
// has the same effect as running `chmod 777` on it.
|
|
|
|
bool useUnsecuredPartition() const;
|
2016-05-22 20:03:49 +01:00
|
|
|
protected:
|
2016-04-28 00:17:47 +01:00
|
|
|
void accept() override;
|
2015-07-13 15:17:41 +01:00
|
|
|
void onRoleChanged(bool);
|
|
|
|
void onFilesystemChanged(int);
|
|
|
|
void onLabelChanged(const QString& newLabel);
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2016-04-28 00:17:47 +01:00
|
|
|
void setupConnections() override;
|
|
|
|
void setupDialog() override;
|
2016-05-17 01:06:45 +01:00
|
|
|
void slotPasswordStatusChanged();
|
2015-07-13 15:17:41 +01:00
|
|
|
void updateHideAndShow();
|
2017-10-28 18:35:53 +01:00
|
|
|
void updateOkButtonStatus() override;
|
2015-07-13 15:17:41 +01:00
|
|
|
void updateFileSystem(FileSystem::Type t);
|
|
|
|
PartitionRole::Roles partitionRoles() const {
|
|
|
|
return m_PartitionRoles;
|
|
|
|
}
|
2016-05-17 18:03:28 +01:00
|
|
|
bool canGrow() const override {
|
2015-07-13 15:17:41 +01:00
|
|
|
return true;
|
|
|
|
}
|
2016-05-17 18:03:28 +01:00
|
|
|
bool canShrink() const override {
|
2015-07-13 15:17:41 +01:00
|
|
|
return true;
|
|
|
|
}
|
2016-06-25 17:59:26 +01:00
|
|
|
bool canMove() const override;
|
2008-09-24 20:32:01 +01:00
|
|
|
|
2016-07-17 08:25:56 +01:00
|
|
|
bool isValidPassword() const {
|
|
|
|
return m_IsValidPassword;
|
|
|
|
}
|
|
|
|
|
2015-07-13 15:17:41 +01:00
|
|
|
private:
|
|
|
|
PartitionRole::Roles m_PartitionRoles;
|
2016-07-17 08:25:56 +01:00
|
|
|
bool m_IsValidPassword;
|
2008-09-24 20:32:01 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|