Disallow mounting non-mountable filesystem types.

main
Teo Mrnjavac 10 years ago
parent 9bc77fe386
commit 2ec2b4ab86

@ -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() );
}

@ -50,6 +50,7 @@ private:
PartitionSizeController* m_partitionSizeController;
void replacePartResizerWidget();
void updateMountPointPicker();
};
#endif /* EDITEXISTINGPARTITIONDIALOG_H */

Loading…
Cancel
Save