diff --git a/src/modules/partition/gui/EditExistingPartitionDialog.cpp b/src/modules/partition/gui/EditExistingPartitionDialog.cpp index a5ea137b7..0f6262da1 100644 --- a/src/modules/partition/gui/EditExistingPartitionDialog.cpp +++ b/src/modules/partition/gui/EditExistingPartitionDialog.cpp @@ -70,6 +70,14 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit m_ui->fileSystemLabel->setEnabled( doFormat ); m_ui->fileSystemComboBox->setEnabled( doFormat ); + + updateMountPointPicker(); + } ); + + connect( m_ui->fileSystemComboBox, &QComboBox::currentTextChanged, + [ this ]( QString ) + { + updateMountPointPicker(); } ); // File system @@ -185,3 +193,32 @@ EditExistingPartitionDialog::replacePartResizerWidget() m_partitionSizeController->setPartResizerWidget( widget, m_ui->formatRadioButton->isChecked() ); } + +void +EditExistingPartitionDialog::updateMountPointPicker() +{ + bool doFormat = m_ui->formatRadioButton->isChecked(); + FileSystem::Type fsType = FileSystem::Unknown; + if ( doFormat ) + { + fsType = FileSystem::typeForName( m_ui->fileSystemComboBox->currentText() ); + } + else + { + fsType = m_partition->fileSystem().type(); + } + bool canMount = true; + if ( fsType == FileSystem::Extended || + fsType == FileSystem::LinuxSwap || + fsType == FileSystem::Unformatted || + fsType == FileSystem::Unknown || + fsType == FileSystem::Lvm2_PV ) + { + canMount = false; + } + + m_ui->mountPointLabel->setEnabled( canMount ); + m_ui->mountPointComboBox->setEnabled( canMount ); + if ( !canMount ) + m_ui->mountPointComboBox->setCurrentText( QString() ); +} diff --git a/src/modules/partition/gui/EditExistingPartitionDialog.h b/src/modules/partition/gui/EditExistingPartitionDialog.h index e9cc099ac..6ea0300f9 100644 --- a/src/modules/partition/gui/EditExistingPartitionDialog.h +++ b/src/modules/partition/gui/EditExistingPartitionDialog.h @@ -50,6 +50,7 @@ private: PartitionSizeController* m_partitionSizeController; void replacePartResizerWidget(); + void updateMountPointPicker(); }; #endif /* EDITEXISTINGPARTITIONDIALOG_H */