From 15fa09167b4e83f31ef48efc2138429eb5aa2060 Mon Sep 17 00:00:00 2001 From: Florian Geyer Date: Fri, 11 May 2012 23:11:34 +0200 Subject: [PATCH] Toggle enabled status of add/remove custom icon buttons based on radio button selection. --- src/gui/EditEntryWidget.cpp | 12 ++++++++---- src/gui/EditEntryWidget.h | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/gui/EditEntryWidget.cpp b/src/gui/EditEntryWidget.cpp index 94f9c0169..8fbb98d90 100644 --- a/src/gui/EditEntryWidget.cpp +++ b/src/gui/EditEntryWidget.cpp @@ -111,9 +111,9 @@ EditEntryWidget::EditEntryWidget(QWidget* parent) connect(m_iconsUi->customIconsView, SIGNAL(clicked(QModelIndex)), this, SLOT(updateRadioButtonCustomIcons())); connect(m_iconsUi->defaultIconsRadio, SIGNAL(toggled(bool)), - this, SLOT(updateIndexDefaultIcons(bool))); + this, SLOT(updateWidgetsDefaultIcons(bool))); connect(m_iconsUi->customIconsRadio, SIGNAL(toggled(bool)), - this, SLOT(updateIndexCustomIcons(bool))); + this, SLOT(updateWidgetsCustomIcons(bool))); connect(m_iconsUi->addButton, SIGNAL(clicked()), SLOT(addCustomIcon())); connect(m_iconsUi->deleteButton, SIGNAL(clicked()), SLOT(removeCustomIcon())); @@ -457,7 +457,7 @@ void EditEntryWidget::removeCustomIcon() } } -void EditEntryWidget::updateIndexDefaultIcons(bool check) +void EditEntryWidget::updateWidgetsDefaultIcons(bool check) { if (check) { QModelIndex index = m_iconsUi->defaultIconsView->currentIndex(); @@ -469,10 +469,12 @@ void EditEntryWidget::updateIndexDefaultIcons(bool check) setCurrentIndex(index, QItemSelectionModel::ClearAndSelect); } m_iconsUi->customIconsView->selectionModel()->clearSelection(); + m_iconsUi->addButton->setEnabled(false); + m_iconsUi->deleteButton->setEnabled(false); } } -void EditEntryWidget::updateIndexCustomIcons(bool check) +void EditEntryWidget::updateWidgetsCustomIcons(bool check) { if (check) { QModelIndex index = m_iconsUi->customIconsView->currentIndex(); @@ -484,6 +486,8 @@ void EditEntryWidget::updateIndexCustomIcons(bool check) setCurrentIndex(index, QItemSelectionModel::ClearAndSelect); } m_iconsUi->defaultIconsView->selectionModel()->clearSelection(); + m_iconsUi->addButton->setEnabled(true); + m_iconsUi->deleteButton->setEnabled(true); } } diff --git a/src/gui/EditEntryWidget.h b/src/gui/EditEntryWidget.h index 0de20f4f5..a74b6c383 100644 --- a/src/gui/EditEntryWidget.h +++ b/src/gui/EditEntryWidget.h @@ -72,8 +72,8 @@ private Q_SLOTS: void removeCurrentAttachment(); void addCustomIcon(); void removeCustomIcon(); - void updateIndexDefaultIcons(bool checked); - void updateIndexCustomIcons(bool checked); + void updateWidgetsDefaultIcons(bool checked); + void updateWidgetsCustomIcons(bool checked); void updateRadioButtonDefaultIcons(); void updateRadioButtonCustomIcons();