| 534 | } |
| 535 | |
| 536 | void ChatRootView::saveHistory(const QString &filePath) |
| 537 | { |
| 538 | if (filePath != m_recentFilePath) { |
| 539 | if (auto registry = sessionFileRegistry(); registry && registry->isLocked(filePath)) { |
| 540 | m_lastErrorMessage |
| 541 | = tr("This chat file is already in use by another QodeAssist chat session."); |
| 542 | emit lastErrorMessageChanged(); |
| 543 | return; |
| 544 | } |
| 545 | } |
| 546 | |
| 547 | auto result = m_historyStore->save(filePath); |
| 548 | if (!result.success) { |
| 549 | LOG_MESSAGE(QString("Failed to save chat history: %1").arg(result.errorMessage)); |
| 550 | } else { |
| 551 | setRecentFilePath(filePath); |
| 552 | } |
| 553 | } |
| 554 | |
| 555 | void ChatRootView::loadHistory(const QString &filePath) |
| 556 | { |