diff options
author | Christian Kamm <mail@ckamm.de> | 2018-02-23 14:30:29 +0300 |
---|---|---|
committer | ckamm <mail@ckamm.de> | 2018-03-06 15:02:54 +0300 |
commit | faec059a9b0a5277f96444c1135517724d4bb1a1 (patch) | |
tree | 45f83f5a8b09f5e24ba363074721a30fca4698f1 /src/gui/issueswidget.cpp | |
parent | 641eddfbdf79d55eed33ae8543029f21ca03e4a3 (diff) |
IssuesWidget: Don't allow two issues for the same file/folder
This is intended to safeguard against invalidation bugs that cause the
same error to be added again for every sync run.
Diffstat (limited to 'src/gui/issueswidget.cpp')
-rw-r--r-- | src/gui/issueswidget.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/issueswidget.cpp b/src/gui/issueswidget.cpp index 95eccec09..fbfe59b88 100644 --- a/src/gui/issueswidget.cpp +++ b/src/gui/issueswidget.cpp @@ -196,6 +196,17 @@ void IssuesWidget::addItem(QTreeWidgetItem *item) } } + // Wipe any existing message for the same folder and path + auto newData = ProtocolItem::extraData(item); + for (int i = 0; i < count; ++i) { + auto otherItem = _ui->_treeWidget->topLevelItem(i); + auto otherData = ProtocolItem::extraData(otherItem); + if (otherData.path == newData.path && otherData.folderName == newData.folderName) { + delete otherItem; + break; + } + } + _ui->_treeWidget->insertTopLevelItem(insertLoc, item); item->setHidden(!shouldBeVisible(item, currentAccountFilter(), currentFolderFilter())); emit issueCountUpdated(_ui->_treeWidget->topLevelItemCount()); |