feat(GODT-3121): suggestions are transferred to QML.

This commit is contained in:
Xavier Michelon
2023-11-29 17:43:50 +01:00
parent 2e2648fcd5
commit cfd07cf893
6 changed files with 18 additions and 6 deletions

View File

@ -1315,6 +1315,7 @@ void QMLBackend::connectGrpcEvents() {
connect(client, &GRPCClient::certificateInstallCanceled, this, &QMLBackend::certificateInstallCanceled);
connect(client, &GRPCClient::certificateInstallFailed, this, &QMLBackend::certificateInstallFailed);
connect(client, &GRPCClient::showMainWindow, [&]() { this->showMainWindow("gRPC showMainWindow event"); });
connect(client, &GRPCClient::knowledgeBasSuggestionsReceived, this, &QMLBackend::receivedKnowledgeBaseSuggestions);
// cache events
connect(client, &GRPCClient::cantMoveDiskCache, this, &QMLBackend::cantMoveDiskCache);

View File

@ -279,6 +279,7 @@ signals: // Signals received from the Go backend, to be forwarded to QML
void selectUser(QString const& userID, bool forceShowWindow); ///< Signal emitted in order to selected a user with a given ID in the list.
void genericError(QString const &title, QString const &description); ///< Signal for the 'genericError' gRPC stream event.
void imapLoginWhileSignedOut(QString const& username); ///< Signal for the notification of IMAP login attempt on a signed out account.
void receivedKnowledgeBaseSuggestions(QList<bridgepp::KnowledgeBaseSuggestion> const& suggestions); ///< Signal for the reception of knowledgebase article suggestions.
// This signal is emitted when an exception is intercepted is calls triggered by QML. QML engine would intercept the exception otherwise.
void fatalError(bridgepp::Exception const& e) const; ///< Signal emitted when an fatal error occurs.

View File

@ -155,7 +155,12 @@ SettingsView {
function onReportBugFinished() {
sendButton.loading = false;
}
function onReceivedKnowledgeBaseSuggestions(suggestions) {
console.error("QML: onReceivedKnowledgeBaseSuggestions() - len = %1".arg(suggestions.length))
console.error("QML: %1: %2".arg(suggestions[0].title).arg(suggestions[0].url))
console.error("QML: %1: %2".arg(suggestions[1].title).arg(suggestions[1].url))
console.error("QML: %1: %2".arg(suggestions[2].title).arg(suggestions[2].url))
}
target: Backend
}
}