if the file system we want to set the combo box to cannot be found in it, set

it to the first value; don't set it to -1

svn path=/trunk/extragear/sysadmin/partitionmanager/; revision=1119609
This commit is contained in:
Volker Lanz 2010-04-27 13:19:34 +00:00
parent d603f21b1e
commit 1c97342be3
3 changed files with 4 additions and 4 deletions

2
TODO
View File

@ -9,8 +9,6 @@ Plans and ideas for 1.1:
Bugs to fix for 1.1:
* make sure the default file system can indeed be created
* handling of illegal values in the size dialog spin boxes is not correct: we
need to make use of the validator, not just overwrite with the previous value
if the new one is not legal. i.e., we must constantly update the valid ranges

View File

@ -42,7 +42,8 @@ FileSystem::Type GeneralPageWidget::defaultFileSystem() const
void GeneralPageWidget::setDefaultFileSystem(FileSystem::Type t)
{
comboDefaultFileSystem().setCurrentIndex(comboDefaultFileSystem().findText(FileSystem::nameForType(t)));
const int idx = comboDefaultFileSystem().findText(FileSystem::nameForType(t));
comboDefaultFileSystem().setCurrentIndex(idx != -1 ? idx : 0);
}
QString GeneralPageWidget::backend() const

View File

@ -72,7 +72,8 @@ void NewDialog::setupDialog()
dialogWidget().comboFileSystem().addItem(createFileSystemColor(FileSystem::typeForName(fsName), 8), fsName);
QString selected = FileSystem::nameForType(FileSystem::defaultFileSystem());
dialogWidget().comboFileSystem().setCurrentIndex(dialogWidget().comboFileSystem().findText(selected));
const int idx = dialogWidget().comboFileSystem().findText(selected);
dialogWidget().comboFileSystem().setCurrentIndex(idx != -1 ? idx : 0);
dialogWidget().radioPrimary().setVisible(partitionRoles() & PartitionRole::Primary);
dialogWidget().radioExtended().setVisible(partitionRoles() & PartitionRole::Extended);