Add a button to allow the user to select if the partition is open for
everyone
This commit is contained in:
parent
4f17fc5548
commit
6b27467943
|
@ -27,6 +27,7 @@
|
|||
#include <QtGlobal>
|
||||
#include <QFontDatabase>
|
||||
#include <QPalette>
|
||||
#include <QCheckBox>
|
||||
|
||||
#include <KColorScheme>
|
||||
#include <KConfigGroup>
|
||||
|
@ -54,6 +55,12 @@ NewDialog::NewDialog(QWidget* parent, Device& device, Partition& unallocatedPart
|
|||
|
||||
KConfigGroup kcg(KSharedConfig::openConfig(), "newDialog");
|
||||
restoreGeometry(kcg.readEntry<QByteArray>("Geometry", QByteArray()));
|
||||
|
||||
// Hack on top of hack. The dialog is created via two inheritances.
|
||||
auto *allowEveryone = new QCheckBox(i18n("Allow everyone to use this partition"));
|
||||
QBoxLayout *l = qobject_cast<QBoxLayout*>(layout());
|
||||
int lCount = l->count();
|
||||
l->insertWidget(lCount-1, allowEveryone);
|
||||
}
|
||||
|
||||
NewDialog::~NewDialog()
|
||||
|
@ -284,3 +291,8 @@ void NewDialog::updateOkButtonStatus()
|
|||
{
|
||||
okButton->setEnabled(isValidPassword() && isValidLVName());
|
||||
}
|
||||
|
||||
bool NewDialog::useUnsecuredPartition() const
|
||||
{
|
||||
return m_unsecuredPartition->checkState() == Qt::CheckState::Checked;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <fs/filesystem.h>
|
||||
|
||||
class Device;
|
||||
class QCheckBox;
|
||||
|
||||
/** Dialog to create new Partitions.
|
||||
|
||||
|
@ -30,6 +31,9 @@ public:
|
|||
NewDialog(QWidget* parent, Device& device, Partition& unallocatedPartition, PartitionRole::Roles r);
|
||||
~NewDialog();
|
||||
|
||||
// returns true if any user can write on the partition.
|
||||
// has the same effect as running `chmod 777` on it.
|
||||
bool useUnsecuredPartition() const;
|
||||
protected:
|
||||
void accept() override;
|
||||
void onRoleChanged(bool);
|
||||
|
@ -60,6 +64,7 @@ protected:
|
|||
private:
|
||||
PartitionRole::Roles m_PartitionRoles;
|
||||
bool m_IsValidPassword;
|
||||
QCheckBox *m_unsecuredPartition;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -504,10 +504,14 @@ void PartitionManagerWidget::onNewPartition()
|
|||
Partition* newPartition = NewOperation::createNew(*selectedPartition(), static_cast<FileSystem::Type>(Config::defaultFileSystem()));
|
||||
|
||||
QPointer<NewDialog> dlg = new NewDialog(this, *selectedDevice(), *newPartition, selectedDevice()->partitionTable()->childRoles(*selectedPartition()));
|
||||
if (dlg->exec() == QDialog::Accepted)
|
||||
if (dlg->exec() == QDialog::Accepted) {
|
||||
operationStack().push(new NewOperation(*selectedDevice(), newPartition));
|
||||
else
|
||||
if (dlg->useUnsecuredPartition()) {
|
||||
// operationStac().push(new ChangePermissionOperation("777", *selectedDevice(), newPartition);
|
||||
}
|
||||
} else {
|
||||
delete newPartition;
|
||||
}
|
||||
|
||||
delete dlg;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue