| 415 | } |
| 416 | |
| 417 | void CheckSetSelectionManager::onDefaultCheckSetSelectionChanged(const QString& path) |
| 418 | { |
| 419 | QFile defaultCheckSetSelectionFile(path); |
| 420 | if (!defaultCheckSetSelectionFile.open(QIODevice::ReadOnly)) { |
| 421 | qCDebug(KDEV_CLAZY) << "Failed to open checkset selection file " << path; |
| 422 | return; |
| 423 | } |
| 424 | |
| 425 | const QByteArray fileContent = defaultCheckSetSelectionFile.readAll(); |
| 426 | const QString checkSetSelectionId = QString::fromUtf8(fileContent); |
| 427 | defaultCheckSetSelectionFile.close(); |
| 428 | |
| 429 | // no id set? |
| 430 | if (checkSetSelectionId.isEmpty()) { |
| 431 | return; |
| 432 | } |
| 433 | |
| 434 | // no change? |
| 435 | if (m_defaultCheckSetSelectionId == checkSetSelectionId) { |
| 436 | return; |
| 437 | } |
| 438 | |
| 439 | bool isExisting = false; |
| 440 | for (const CheckSetSelection& checkSetSelection : std::as_const(m_checkSetSelections)) { |
| 441 | if (checkSetSelection.id() == checkSetSelectionId) { |
| 442 | isExisting = true; |
| 443 | break; |
| 444 | } |
| 445 | } |
| 446 | |
| 447 | if (isExisting) { |
| 448 | m_defaultCheckSetSelectionId = checkSetSelectionId; |
| 449 | emit defaultCheckSetSelectionChanged(m_defaultCheckSetSelectionId); |
| 450 | } |
| 451 | } |
| 452 | |
| 453 | } |
| 454 | |