GUI: Fix for removing application.
The default application was not handled correctly when removing application from the list. If the default application is removed then we reset the default application to unknown. Otherwise we make sure the default application is correct after the removal of other application.
This commit is contained in:
parent
eabec80154
commit
085034ddf7
|
@ -209,16 +209,21 @@ void SettingsDialog::AddApplication()
|
|||
|
||||
void SettingsDialog::RemoveApplication()
|
||||
{
|
||||
|
||||
QList<QListWidgetItem *> selected = mUI.mListWidget->selectedItems();
|
||||
QListWidgetItem *item = 0;
|
||||
|
||||
foreach(item, selected)
|
||||
foreach(QListWidgetItem *item, selected)
|
||||
{
|
||||
mTempApplications->RemoveApplication(mUI.mListWidget->row(item));
|
||||
mUI.mListWidget->clear();
|
||||
PopulateApplicationList();
|
||||
const int removeIndex = mUI.mListWidget->row(item);
|
||||
const int currentDefault = mTempApplications->GetDefaultApplication();
|
||||
mTempApplications->RemoveApplication(removeIndex);
|
||||
if (removeIndex == currentDefault)
|
||||
// If default app is removed set default to unknown
|
||||
mTempApplications->SetDefault(-1);
|
||||
else if (removeIndex < currentDefault)
|
||||
// Move default app one up if earlier app was removed
|
||||
mTempApplications->SetDefault(currentDefault - 1);
|
||||
}
|
||||
mUI.mListWidget->clear();
|
||||
PopulateApplicationList();
|
||||
}
|
||||
|
||||
void SettingsDialog::EditApplication()
|
||||
|
|
Loading…
Reference in New Issue