[partition] Mount points should start with a /

This commit is contained in:
Adriaan de Groot 2022-02-01 14:07:38 +01:00
parent fbcd1ffbbe
commit d8be9a9443
2 changed files with 14 additions and 2 deletions

View File

@ -325,11 +325,17 @@ CreatePartitionDialog::updateMountPointUi()
void void
CreatePartitionDialog::checkMountPointSelection() CreatePartitionDialog::checkMountPointSelection()
{ {
if ( m_usedMountPoints.contains( selectedMountPoint( m_ui->mountPointComboBox ) ) ) const QString mountPoint = selectedMountPoint( m_ui->mountPointComboBox );
if ( m_usedMountPoints.contains( mountPoint ) )
{ {
m_ui->labelMountPoint->setText( tr( "Mountpoint already in use. Please select another one." ) ); m_ui->labelMountPoint->setText( tr( "Mountpoint already in use. Please select another one." ) );
m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false ); m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
} }
else if ( !mountPoint.isEmpty() && !mountPoint.startsWith( '/' ) )
{
m_ui->labelMountPoint->setText( tr( "Mountpoint must start with a <pre>/</pre>." ) );
m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
}
else else
{ {
m_ui->labelMountPoint->setText( QString() ); m_ui->labelMountPoint->setText( QString() );

View File

@ -295,11 +295,17 @@ EditExistingPartitionDialog::updateMountPointPicker()
void void
EditExistingPartitionDialog::checkMountPointSelection() EditExistingPartitionDialog::checkMountPointSelection()
{ {
if ( m_usedMountPoints.contains( selectedMountPoint( m_ui->mountPointComboBox ) ) ) const QString mountPoint = selectedMountPoint( m_ui->mountPointComboBox );
if ( m_usedMountPoints.contains( mountPoint ) )
{ {
m_ui->labelMountPoint->setText( tr( "Mountpoint already in use. Please select another one." ) ); m_ui->labelMountPoint->setText( tr( "Mountpoint already in use. Please select another one." ) );
m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false ); m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
} }
else if ( !mountPoint.isEmpty() && !mountPoint.startsWith( '/' ) )
{
m_ui->labelMountPoint->setText( tr( "Mountpoint must start with a <pre>/</pre>." ) );
m_ui->buttonBox->button( QDialogButtonBox::Ok )->setEnabled( false );
}
else else
{ {
m_ui->labelMountPoint->setText( QString() ); m_ui->labelMountPoint->setText( QString() );