fix: disable remove icon button for default icons

pressing this button in the icon picker dialog when a default icon is selected does nothing so why not disable it

Signed-off-by: leo78913 <leo3758@riseup.net>
This commit is contained in:
leo78913 2022-12-06 20:10:30 -03:00
parent 5ae044db93
commit 8036272e87

View File

@ -64,6 +64,7 @@ IconPickerDialog::IconPickerDialog(QWidget *parent)
// NOTE: ResetRole forces the button to be on the left, while the OK/Cancel ones are on the right. We win.
auto buttonAdd = ui->buttonBox->addButton(tr("Add Icon"), QDialogButtonBox::ResetRole);
auto buttonRemove = ui->buttonBox->addButton(tr("Remove Icon"), QDialogButtonBox::ResetRole);
buttonRemove->setObjectName("buttonRemove");
connect(buttonAdd, SIGNAL(clicked(bool)), SLOT(addNewIcon()));
connect(buttonRemove, SIGNAL(clicked(bool)), SLOT(removeSelectedIcon()));
@ -129,6 +130,8 @@ void IconPickerDialog::selectionChanged(QItemSelection selected, QItemSelection
if (!key.isEmpty()) {
selectedIconKey = key;
}
auto buttonRemove = ui->buttonBox->findChild<QPushButton *>("buttonRemove");
buttonRemove->setEnabled(APPLICATION->icons()->iconFileExists(selectedIconKey));
}
int IconPickerDialog::execWithSelection(QString selection)