mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 04:08:54 +03:00
Enable/disable remove all button depending on the number of rows.
Signed-off-by: Camila San <hello@camila.codes>
This commit is contained in:
parent
c29d3b7e0b
commit
73b7540468
1 changed files with 8 additions and 0 deletions
|
@ -29,6 +29,7 @@ namespace OCC {
|
||||||
|
|
||||||
static int patternCol = 0;
|
static int patternCol = 0;
|
||||||
static int deletableCol = 1;
|
static int deletableCol = 1;
|
||||||
|
static int readOnlyRows = 3;
|
||||||
|
|
||||||
IgnoreListEditor::IgnoreListEditor(QWidget *parent)
|
IgnoreListEditor::IgnoreListEditor(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
|
@ -96,6 +97,8 @@ void IgnoreListEditor::slotItemSelectionChanged()
|
||||||
void IgnoreListEditor::slotRemoveCurrentItem()
|
void IgnoreListEditor::slotRemoveCurrentItem()
|
||||||
{
|
{
|
||||||
ui->tableWidget->removeRow(ui->tableWidget->currentRow());
|
ui->tableWidget->removeRow(ui->tableWidget->currentRow());
|
||||||
|
if(ui->tableWidget->rowCount() == readOnlyRows)
|
||||||
|
ui->removeAllPushButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IgnoreListEditor::slotRemoveAllItems()
|
void IgnoreListEditor::slotRemoveAllItems()
|
||||||
|
@ -212,6 +215,11 @@ int IgnoreListEditor::addPattern(const QString &pattern, bool deletable, bool re
|
||||||
deletableItem->setFlags(deletableItem->flags() ^ Qt::ItemIsEnabled);
|
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;
|
return newRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue