mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-29 18:35:37 -04:00
[partition] Centralize setting-of-mountpoint
- map empty to the 0'th index - add new entries as needed This avoids having selected index 0, but a different text.
This commit is contained in:
parent
a49c39bb53
commit
4402198b37
3 changed files with 24 additions and 1 deletions
|
@ -65,3 +65,24 @@ selectedMountPoint(QComboBox& combo)
|
|||
return QString();
|
||||
return combo.currentText();
|
||||
}
|
||||
|
||||
void
|
||||
setSelectedMountPoint(QComboBox& combo, const QString& selected)
|
||||
{
|
||||
cDebug() << "Setting mount point" << selected;
|
||||
if ( selected.isEmpty() )
|
||||
combo.setCurrentIndex( 0 ); // (no mount point)
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < combo.count(); ++i )
|
||||
if ( selected == combo.itemText( i ) )
|
||||
{
|
||||
cDebug() << " .. found at index" << i;
|
||||
combo.setCurrentIndex( i );
|
||||
return;
|
||||
}
|
||||
cDebug() << " .. new item";
|
||||
combo.addItem( selected );
|
||||
combo.setCurrentIndex( combo.count() - 1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue