* @brief Handles the help.json manifest fetch response. */
| 251 | * @brief Handles the help.json manifest fetch response. |
| 252 | */ |
| 253 | void Misc::HelpCenter::onManifestReply() |
| 254 | { |
| 255 | auto* reply = qobject_cast<QNetworkReply*>(sender()); |
| 256 | if (!reply) |
| 257 | return; |
| 258 | |
| 259 | reply->deleteLater(); |
| 260 | |
| 261 | if (reply->error() == QNetworkReply::NoError) { |
| 262 | const auto doc = QJsonDocument::fromJson(reply->readAll()); |
| 263 | m_allPages = doc.array(); |
| 264 | applyFilter(); |
| 265 | |
| 266 | if (!m_pendingPageId.isEmpty()) { |
| 267 | navigateToPage(m_pendingPageId); |
| 268 | m_pendingPageId.clear(); |
| 269 | } |
| 270 | |
| 271 | else if (!m_filteredPages.isEmpty()) |
| 272 | setCurrentIndex(0); |
| 273 | |
| 274 | preloadAllPages(); |
| 275 | } |
| 276 | |
| 277 | m_loading = false; |
| 278 | Q_EMIT loadingChanged(); |
| 279 | } |
| 280 | |
| 281 | /** |
| 282 | * @brief Handles the page content fetch response and caches it. |