[partition] Convenience for selecting default mount point
- map blank to the "(no mount point)" string for UI purposes
This commit is contained in:
parent
fda2e54e0f
commit
a4997c4be8
@ -56,13 +56,12 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, Partit
|
|||||||
, m_usedMountPoints( usedMountPoints )
|
, m_usedMountPoints( usedMountPoints )
|
||||||
{
|
{
|
||||||
m_ui->setupUi( this );
|
m_ui->setupUi( this );
|
||||||
standardMountPoints( *(m_ui->mountPointComboBox) );
|
standardMountPoints( *(m_ui->mountPointComboBox), PartitionInfo::mountPoint( partition ) );
|
||||||
|
|
||||||
QColor color = ColorUtils::colorForPartition( m_partition );
|
QColor color = ColorUtils::colorForPartition( m_partition );
|
||||||
m_partitionSizeController->init( m_device, m_partition, color );
|
m_partitionSizeController->init( m_device, m_partition, color );
|
||||||
m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox );
|
m_partitionSizeController->setSpinBox( m_ui->sizeSpinBox );
|
||||||
|
|
||||||
m_ui->mountPointComboBox->setCurrentText( PartitionInfo::mountPoint( partition ) );
|
|
||||||
connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged,
|
connect( m_ui->mountPointComboBox, &QComboBox::currentTextChanged,
|
||||||
this, &EditExistingPartitionDialog::checkMountPointSelection );
|
this, &EditExistingPartitionDialog::checkMountPointSelection );
|
||||||
|
|
||||||
|
@ -46,3 +46,12 @@ standardMountPoints(QComboBox& combo)
|
|||||||
combo.addItems( standardMountPoints() );
|
combo.addItems( standardMountPoints() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
standardMountPoints(QComboBox& combo, const QString& selected)
|
||||||
|
{
|
||||||
|
standardMountPoints( combo );
|
||||||
|
if ( selected.isEmpty() )
|
||||||
|
combo.setCurrentIndex( 0 );
|
||||||
|
else
|
||||||
|
combo.setCurrentText( selected );
|
||||||
|
}
|
||||||
|
@ -38,4 +38,10 @@ QStringList standardMountPoints();
|
|||||||
*/
|
*/
|
||||||
void standardMountPoints( QComboBox& );
|
void standardMountPoints( QComboBox& );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* As above, but also sets the displayed mount point to @p selected,
|
||||||
|
* unless it is empty, in which case "(no mount point)" is chosen.
|
||||||
|
*/
|
||||||
|
void standardMountPoints( QComboBox&, const QString& selected );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user