diff --git a/src/gui/newdialog.cpp b/src/gui/newdialog.cpp index ff31f30..499379d 100644 --- a/src/gui/newdialog.cpp +++ b/src/gui/newdialog.cpp @@ -97,6 +97,17 @@ void NewDialog::setupDialog() dialogWidget().checkBoxEncrypt().hide(); dialogWidget().editPassphrase().hide(); + if (device().type() == Device::Disk_Device) { + dialogWidget().lvName().hide(); + dialogWidget().textLVName().hide(); + } + if (device().type() == Device::LVM_Device) { + dialogWidget().labelFreeBefore().hide(); + dialogWidget().spinFreeBefore().hide(); + dialogWidget().labelFreeAfter().hide(); + dialogWidget().spinFreeAfter().hide(); + } + dialogWidget().editPassphrase().setMinimumPasswordLength(1); dialogWidget().editPassphrase().setMaximumPasswordLength(512); // cryptsetup does not support longer passwords @@ -104,8 +115,6 @@ void NewDialog::setupDialog() KColorScheme colorScheme(QPalette::Active, KColorScheme::View); dialogWidget().editPassphrase().setBackgroundWarningColor(colorScheme.background(KColorScheme::NegativeBackground).color()); - // listen to password status updates - connect(&dialogWidget().editPassphrase(), &KNewPasswordWidget::passwordStatusChanged, this, &NewDialog::slotPasswordStatusChanged); // don't move these above the call to parent's setupDialog, because only after that has // run there is a valid partition set in the part resizer widget and they will need that. @@ -121,6 +130,9 @@ void NewDialog::setupConnections() connect(&dialogWidget().checkBoxEncrypt(), &QCheckBox::toggled, this, &NewDialog::onRoleChanged); connect(&dialogWidget().comboFileSystem(), static_cast(&QComboBox::currentIndexChanged), this, &NewDialog::onFilesystemChanged); connect(&dialogWidget().label(), &QLineEdit::textChanged, this, &NewDialog::onLabelChanged); + // listen to password status updates + connect(&dialogWidget().editPassphrase(), &KNewPasswordWidget::passwordStatusChanged, this, &NewDialog::slotPasswordStatusChanged); + connect(&dialogWidget().lvName(), &QLineEdit::textChanged, this, &NewDialog::onLVNameChanged); SizeDialogBase::setupConnections(); } @@ -227,6 +239,12 @@ void NewDialog::slotPasswordStatusChanged() } } +void NewDialog::onLVNameChanged(const QString& newName) +{ + //TODO: filter lvName + partition().setPartitionPath(device().deviceNode() + QStringLiteral("/") + newName.trimmed()); +} + void NewDialog::updateHideAndShow() { // this is mostly copy'n'pasted from PartPropsDialog::updateHideAndShow() diff --git a/src/gui/newdialog.h b/src/gui/newdialog.h index ad49841..3103557 100644 --- a/src/gui/newdialog.h +++ b/src/gui/newdialog.h @@ -44,6 +44,7 @@ protected: void onRoleChanged(bool); void onFilesystemChanged(int); void onLabelChanged(const QString& newLabel); + void onLVNameChanged(const QString& newName); void setupConnections() override; void setupDialog() override; diff --git a/src/gui/sizedialogwidget.h b/src/gui/sizedialogwidget.h index f3fc81f..185d78a 100644 --- a/src/gui/sizedialogwidget.h +++ b/src/gui/sizedialogwidget.h @@ -40,10 +40,18 @@ public: return *m_PartResizerWidget; } + QLabel& labelFreeBefore() { + Q_ASSERT(m_LabelFreeBefore); + return *m_LabelFreeBefore; + } QDoubleSpinBox& spinFreeBefore() { Q_ASSERT(m_SpinFreeBefore); return *m_SpinFreeBefore; } + QLabel& labelFreeAfter() { + Q_ASSERT(m_LabelFreeAfter); + return *m_LabelFreeAfter; + } QDoubleSpinBox& spinFreeAfter() { Q_ASSERT(m_SpinFreeAfter); return *m_SpinFreeAfter; @@ -89,6 +97,14 @@ public: Q_ASSERT(m_EditPassphrase); return *m_EditPassphrase; } + QLabel& textLVName() { + Q_ASSERT(m_LabelTextLVName); + return *m_LabelTextLVName; + } + QLineEdit& lvName() { + Q_ASSERT(m_EditLVName); + return *m_EditLVName; + } QLabel& textLabel() { Q_ASSERT(m_LabelTextLabel); diff --git a/src/gui/sizedialogwidgetbase.ui b/src/gui/sizedialogwidgetbase.ui index 8697cad..8a77219 100644 --- a/src/gui/sizedialogwidgetbase.ui +++ b/src/gui/sizedialogwidgetbase.ui @@ -7,17 +7,26 @@ 0 0 653 - 693 + 814 - - - - 0.000000000000000 + + + + + 3 + 0 + - - 999999999.000000000000000 + + F&ree space before: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + m_SpinFreeBefore @@ -37,24 +46,18 @@ - - - - - 400 - 60 - + + + + 0.000000000000000 - - - 16777215 - 60 - + + 999999999.000000000000000 - - + + 0 @@ -62,13 +65,46 @@ - Partition &type: + File system: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - m_RadioPrimary + m_ComboFileSystem + + + + + + + Set up encryption for this filesystem with LUKS. You will be asked to provide a passphrase. + + + Encrypt with LUKS + + + + + + + + 0 + 0 + + + + Maximum size: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse @@ -97,56 +133,7 @@ - - - - - 0 - 0 - - - - File system: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - m_ComboFileSystem - - - - - - - - - - - - - - Set up encryption for this filesystem with LUKS. You will be asked to provide a passphrase. - - - Encrypt with LUKS - - - - - - - Label: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - m_EditLabel - - - - + @@ -163,7 +150,62 @@ - + + + + + 400 + 60 + + + + + 16777215 + 60 + + + + + + + + + + + + + + + + 0 + 0 + + + + Partition &type: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + m_RadioPrimary + + + + + + + Label: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + m_EditLabel + + + + @@ -179,56 +221,7 @@ - - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 0 - 0 - - - - Maximum size: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse - - - - - - - - 3 - 0 - - - - F&ree space before: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - m_SpinFreeBefore - - - - + @@ -244,7 +237,7 @@ - + @@ -263,8 +256,8 @@ - - + + 0 @@ -282,7 +275,7 @@ - + 0.000000000000000 @@ -292,7 +285,7 @@ - + Qt::Vertical @@ -311,6 +304,30 @@ + + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse + + + + + + + Logical Volume Name: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + +