mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-29 02:15:36 -04:00
Avoid creating a new partition with a used mountpoint.
We get the mountpoints already used by other partitions, and disable the Ok button in the "Create new partition" dialog if the user selects/writes a mountpoint which is already used. We are going to do the same in the Edit partition dialog after testing.
This commit is contained in:
parent
e5f5bb99d7
commit
c8dbeb5341
5 changed files with 63 additions and 12 deletions
|
@ -40,8 +40,9 @@
|
|||
// Qt
|
||||
#include <QComboBox>
|
||||
#include <QDir>
|
||||
#include <QSet>
|
||||
#include <QListWidgetItem>
|
||||
#include <QPushButton>
|
||||
#include <QSet>
|
||||
|
||||
static QSet< FileSystem::Type > s_unmountableFS(
|
||||
{
|
||||
|
@ -52,12 +53,13 @@ static QSet< FileSystem::Type > s_unmountableFS(
|
|||
FileSystem::Lvm2_PV
|
||||
} );
|
||||
|
||||
CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* parentPartition, QWidget* parentWidget )
|
||||
CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* parentPartition, const QStringList& usedMountPoints, QWidget* parentWidget )
|
||||
: QDialog( parentWidget )
|
||||
, m_ui( new Ui_CreatePartitionDialog )
|
||||
, m_partitionSizeController( new PartitionSizeController( this ) )
|
||||
, m_device( device )
|
||||
, m_parent( parentPartition )
|
||||
, m_usedMountPoints( usedMountPoints )
|
||||
{
|
||||
m_ui->setupUi( this );
|
||||
m_ui->encryptWidget->setText( tr( "En&crypt" ) );
|
||||
|
@ -101,6 +103,8 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device, PartitionNode* par
|
|||
connect( m_ui->fsComboBox, SIGNAL( activated( int ) ), SLOT( updateMountPointUi() ) );
|
||||
connect( m_ui->extendedRadioButton, SIGNAL( toggled( bool ) ), SLOT( updateMountPointUi() ) );
|
||||
|
||||
connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged, this, &CreatePartitionDialog::checkMountPointSelection );
|
||||
|
||||
// Select a default
|
||||
m_ui->fsComboBox->setCurrentIndex( defaultFsIndex );
|
||||
updateMountPointUi();
|
||||
|
@ -252,6 +256,18 @@ CreatePartitionDialog::updateMountPointUi()
|
|||
m_ui->mountPointComboBox->setCurrentText( QString() );
|
||||
}
|
||||
|
||||
void
|
||||
CreatePartitionDialog::checkMountPointSelection(const QString& selection)
|
||||
{
|
||||
if (m_usedMountPoints.contains(selection)) {
|
||||
m_ui->labelMountPoint->setText("Mountpoint already used. Please select another one.");
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
} else {
|
||||
m_ui->labelMountPoint->setText( QString() );
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CreatePartitionDialog::initPartResizerWidget( Partition* partition )
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue