mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-27 17:35:37 -04:00
Check mountpoints when editing a partition too.
This commit is contained in:
parent
8c1199df2d
commit
349470ae71
4 changed files with 40 additions and 5 deletions
|
@ -43,13 +43,15 @@
|
|||
// Qt
|
||||
#include <QComboBox>
|
||||
#include <QDir>
|
||||
#include <QPushButton>
|
||||
|
||||
EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partition* partition, QWidget* parentWidget )
|
||||
EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partition* partition, const QStringList& usedMountPoints, QWidget* parentWidget )
|
||||
: QDialog( parentWidget )
|
||||
, m_ui( new Ui_EditExistingPartitionDialog )
|
||||
, m_device( device )
|
||||
, m_partition( partition )
|
||||
, m_partitionSizeController( new PartitionSizeController( this ) )
|
||||
, m_usedMountPoints( usedMountPoints )
|
||||
{
|
||||
m_ui->setupUi( this );
|
||||
|
||||
|
@ -60,11 +62,14 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
|
|||
mountPoints.sort();
|
||||
m_ui->mountPointComboBox->addItems( mountPoints );
|
||||
|
||||
m_usedMountPoints.removeOne( PartitionInfo::mountPoint( partition ) );
|
||||
|
||||
QColor color = ColorUtils::colorForPartition( m_partition );
|
||||
m_partitionSizeController->init( m_device, m_partition, color );
|
||||
m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox );
|
||||
|
||||
m_ui->mountPointComboBox->setCurrentText( PartitionInfo::mountPoint( partition ) );
|
||||
connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged, this, &EditExistingPartitionDialog::checkMountPointSelection );
|
||||
|
||||
replacePartResizerWidget();
|
||||
|
||||
|
@ -291,3 +296,17 @@ EditExistingPartitionDialog::updateMountPointPicker()
|
|||
if ( !canMount )
|
||||
m_ui->mountPointComboBox->setCurrentText( QString() );
|
||||
}
|
||||
|
||||
void
|
||||
EditExistingPartitionDialog::checkMountPointSelection()
|
||||
{
|
||||
const QString& selection = m_ui->mountPointComboBox->currentText();
|
||||
|
||||
if (m_usedMountPoints.contains(selection)) {
|
||||
m_ui->labelMountPoint->setText("Mountpoint already in use. 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue