| 251 | } |
| 252 | |
| 253 | void GrepOutputView::changeModel(int index) |
| 254 | { |
| 255 | if (model()) { |
| 256 | disconnect(model(), &GrepOutputModel::showMessage, |
| 257 | this, &GrepOutputView::showMessage); |
| 258 | disconnect(model(), &GrepOutputModel::dataChanged, |
| 259 | this, &GrepOutputView::updateApplyState); |
| 260 | } |
| 261 | |
| 262 | replacementCombo->clearEditText(); |
| 263 | |
| 264 | //after deleting the whole search history, index is -1 |
| 265 | if(index >= 0) |
| 266 | { |
| 267 | QVariant var = modelSelector->itemData(index); |
| 268 | auto *resultModel = static_cast<GrepOutputModel *>(qvariant_cast<QObject*>(var)); |
| 269 | resultsTreeView->setModel(resultModel); |
| 270 | resultsTreeView->expandAll(); |
| 271 | |
| 272 | connect(model(), &GrepOutputModel::showMessage, |
| 273 | this, &GrepOutputView::showMessage); |
| 274 | connect(model(), &GrepOutputModel::dataChanged, |
| 275 | this, &GrepOutputView::updateApplyState); |
| 276 | model()->showMessageEmit(); |
| 277 | applyButton->setEnabled(model()->hasResults() && |
| 278 | model()->getRootItem() && |
| 279 | model()->getRootItem()->checkState() != Qt::Unchecked && |
| 280 | !replacementCombo->currentText().isEmpty()); |
| 281 | if(model()->hasResults()) |
| 282 | expandElements(QModelIndex()); |
| 283 | else { |
| 284 | updateButtonState(false); |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | updateCheckable(); |
| 289 | updateApplyState(model()->index(0, 0), model()->index(0, 0)); |
| 290 | m_refresh->setEnabled(true); |
| 291 | m_clearSearchHistory->setEnabled(true); |
| 292 | } |
| 293 | |
| 294 | void GrepOutputView::setMessage(const QString& msg, MessageType type) |
| 295 | { |
nothing calls this directly
no test coverage detected