From 73b75404683b1296766d767f3a6304e58ffac3ee Mon Sep 17 00:00:00 2001 From: Camila San Date: Fri, 2 Feb 2018 15:49:58 +0100 Subject: [PATCH] Enable/disable remove all button depending on the number of rows. Signed-off-by: Camila San --- src/gui/ignorelisteditor.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/ignorelisteditor.cpp b/src/gui/ignorelisteditor.cpp index 29482ce5f..2e0d8ef1a 100644 --- a/src/gui/ignorelisteditor.cpp +++ b/src/gui/ignorelisteditor.cpp @@ -29,6 +29,7 @@ namespace OCC { static int patternCol = 0; static int deletableCol = 1; +static int readOnlyRows = 3; IgnoreListEditor::IgnoreListEditor(QWidget *parent) : QDialog(parent) @@ -96,6 +97,8 @@ void IgnoreListEditor::slotItemSelectionChanged() void IgnoreListEditor::slotRemoveCurrentItem() { ui->tableWidget->removeRow(ui->tableWidget->currentRow()); + if(ui->tableWidget->rowCount() == readOnlyRows) + ui->removeAllPushButton->setEnabled(false); } void IgnoreListEditor::slotRemoveAllItems() @@ -212,6 +215,11 @@ int IgnoreListEditor::addPattern(const QString &pattern, bool deletable, bool re deletableItem->setFlags(deletableItem->flags() ^ Qt::ItemIsEnabled); } + // most of the time we will have more than the read only rows + ui->removeAllPushButton->setEnabled(true); + if(ui->tableWidget->rowCount() == readOnlyRows) + ui->removeAllPushButton->setEnabled(false); + return newRow; }