| 1002 | } |
| 1003 | |
| 1004 | void ResultsTree::suppressHash() |
| 1005 | { |
| 1006 | if (!mSelectionModel) |
| 1007 | return; |
| 1008 | |
| 1009 | bool changed = false; |
| 1010 | ProjectFile *projectFile = ProjectFile::getActiveProject(); |
| 1011 | |
| 1012 | for (QModelIndex index : mSelectionModel->selectedRows()) { |
| 1013 | auto *item = dynamic_cast<ResultItem *>(mModel->itemFromIndex(index)); |
| 1014 | if (!item || item->getType() == ResultItem::Type::file) |
| 1015 | continue; |
| 1016 | if (item->getType() == ResultItem::Type::note) |
| 1017 | item = dynamic_cast<ResultItem *>(item->parent()); |
| 1018 | |
| 1019 | // Suppress |
| 1020 | if (projectFile && item->errorItem->hash > 0) { |
| 1021 | SuppressionList::Suppression suppression; |
| 1022 | suppression.hash = item->errorItem->hash; |
| 1023 | projectFile->addSuppression(suppression); |
| 1024 | changed = true; |
| 1025 | } |
| 1026 | |
| 1027 | // Remove item |
| 1028 | QStandardItem *fileItem = item->parent(); |
| 1029 | fileItem->removeRow(item->row()); |
| 1030 | if (fileItem->rowCount() == 0) |
| 1031 | mModel->removeRow(fileItem->row()); |
| 1032 | } |
| 1033 | |
| 1034 | if (changed) |
| 1035 | projectFile->write(); |
| 1036 | } |
| 1037 | |
| 1038 | void ResultsTree::openContainingFolder() |
| 1039 | { |
nothing calls this directly
no test coverage detected