[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
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->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
{
m_ui->labelMountPoint->setText( QString() );

View file

@ -295,11 +295,17 @@ EditExistingPartitionDialog::updateMountPointPicker()
void
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->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
{
m_ui->labelMountPoint->setText( QString() );