forked from Silverfish/proton-bridge
feat(GODT-3121): QML request suggestions.
This commit is contained in:
@ -354,6 +354,23 @@ Status GRPCService::SetMainExecutable(ServerContext *, StringValue const *reques
|
|||||||
return Status::OK;
|
return Status::OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
/// \param[in] request The request.
|
||||||
|
/// \return The status for the call.
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
grpc::Status GRPCService::RequestKnowledgeBaseSuggestions(ServerContext*, StringValue const* request, Empty*) {
|
||||||
|
app().log().info(QString("RequestKnowledgeBaseSuggestions: %1").arg(QString::fromStdString(request->value()).left(10) + "..."));
|
||||||
|
QList<bridgepp::KnowledgeBaseSuggestion> suggestions(3);
|
||||||
|
for (qsizetype i = 0; i < 3; ++i) {
|
||||||
|
suggestions.push_back( {
|
||||||
|
.title = QString("Suggested link %1").arg(i),
|
||||||
|
.url = "https://proton.me/support/bridge"
|
||||||
|
});
|
||||||
|
}
|
||||||
|
qtProxy_.sendDelayedEvent(newKnowledgeBaseSuggestionsEvent(suggestions));
|
||||||
|
return Status::OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
/// \param[in] request The request
|
/// \param[in] request The request
|
||||||
|
|||||||
@ -67,6 +67,7 @@ public: // member functions.
|
|||||||
grpc::Status ReportBug(::grpc::ServerContext *, ::grpc::ReportBugRequest const *request, ::google::protobuf::Empty *) override;
|
grpc::Status ReportBug(::grpc::ServerContext *, ::grpc::ReportBugRequest const *request, ::google::protobuf::Empty *) override;
|
||||||
grpc::Status ForceLauncher(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
grpc::Status ForceLauncher(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
||||||
grpc::Status SetMainExecutable(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
grpc::Status SetMainExecutable(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
||||||
|
grpc::Status RequestKnowledgeBaseSuggestions(::grpc::ServerContext *, ::google::protobuf::StringValue const *request, ::google::protobuf::Empty *) override;
|
||||||
grpc::Status Login(::grpc::ServerContext *, ::grpc::LoginRequest const *request, ::google::protobuf::Empty *) override;
|
grpc::Status Login(::grpc::ServerContext *, ::grpc::LoginRequest const *request, ::google::protobuf::Empty *) override;
|
||||||
grpc::Status Login2FA(::grpc::ServerContext *, ::grpc::LoginRequest const *request, ::google::protobuf::Empty *) override;
|
grpc::Status Login2FA(::grpc::ServerContext *, ::grpc::LoginRequest const *request, ::google::protobuf::Empty *) override;
|
||||||
grpc::Status Login2Passwords(::grpc::ServerContext *, ::grpc::LoginRequest const *request, ::google::protobuf::Empty *) override;
|
grpc::Status Login2Passwords(::grpc::ServerContext *, ::grpc::LoginRequest const *request, ::google::protobuf::Empty *) override;
|
||||||
|
|||||||
@ -303,6 +303,16 @@ void QMLBackend::openExternalLink(QString const &url) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
//
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
void QMLBackend::requestKnowledgeBaseSuggestions() const {
|
||||||
|
HANDLE_EXCEPTION(
|
||||||
|
app().grpc().requestKnowledgeBaseSuggestions("Test");
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
/// \return The value for the 'showOnStartup' property.
|
/// \return The value for the 'showOnStartup' property.
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
|
|||||||
@ -66,6 +66,7 @@ public: // member functions.
|
|||||||
Q_INVOKABLE void clearAnswers(); ///< Clear all collected answers.
|
Q_INVOKABLE void clearAnswers(); ///< Clear all collected answers.
|
||||||
Q_INVOKABLE bool isTLSCertificateInstalled(); ///< Check if the bridge certificate is installed in the OS keychain.
|
Q_INVOKABLE bool isTLSCertificateInstalled(); ///< Check if the bridge certificate is installed in the OS keychain.
|
||||||
Q_INVOKABLE void openExternalLink(QString const & url = QString()); ///< Open a knowledge base article.
|
Q_INVOKABLE void openExternalLink(QString const & url = QString()); ///< Open a knowledge base article.
|
||||||
|
Q_INVOKABLE void requestKnowledgeBaseSuggestions() const; ///< Request knowledgebase article suggestions.
|
||||||
|
|
||||||
public: // Qt/QML properties. Note that the NOTIFY-er signal is required even for read-only properties (QML warning otherwise)
|
public: // Qt/QML properties. Note that the NOTIFY-er signal is required even for read-only properties (QML warning otherwise)
|
||||||
Q_PROPERTY(bool showOnStartup READ showOnStartup NOTIFY showOnStartupChanged)
|
Q_PROPERTY(bool showOnStartup READ showOnStartup NOTIFY showOnStartupChanged)
|
||||||
|
|||||||
@ -5,11 +5,6 @@
|
|||||||
<file>qml/AccountView.qml</file>
|
<file>qml/AccountView.qml</file>
|
||||||
<file>qml/Banner.qml</file>
|
<file>qml/Banner.qml</file>
|
||||||
<file>qml/Bridge.qml</file>
|
<file>qml/Bridge.qml</file>
|
||||||
<file>qml/BugCategoryView.qml</file>
|
|
||||||
<file>qml/BugQuestionView.qml</file>
|
|
||||||
<file>qml/BugReportFlow.qml</file>
|
|
||||||
<file>qml/BugReportView.qml</file>
|
|
||||||
<file>qml/CategoryItem.qml</file>
|
|
||||||
<file>qml/Configuration.qml</file>
|
<file>qml/Configuration.qml</file>
|
||||||
<file>qml/ConfigurationItem.qml</file>
|
<file>qml/ConfigurationItem.qml</file>
|
||||||
<file>qml/ContentWrapper.qml</file>
|
<file>qml/ContentWrapper.qml</file>
|
||||||
@ -89,6 +84,11 @@
|
|||||||
<file>qml/Notifications/Notifications.qml</file>
|
<file>qml/Notifications/Notifications.qml</file>
|
||||||
<file>qml/Notifications/qmldir</file>
|
<file>qml/Notifications/qmldir</file>
|
||||||
<file>qml/PortSettings.qml</file>
|
<file>qml/PortSettings.qml</file>
|
||||||
|
<file>qml/BugReport/BugCategoryView.qml</file>
|
||||||
|
<file>qml/BugReport/BugQuestionView.qml</file>
|
||||||
|
<file>qml/BugReport/BugReportFlow.qml</file>
|
||||||
|
<file>qml/BugReport/BugReportView.qml</file>
|
||||||
|
<file>qml/BugReport/CategoryItem.qml</file>
|
||||||
<file>qml/Proton/Action.qml</file>
|
<file>qml/Proton/Action.qml</file>
|
||||||
<file>qml/Proton/ApplicationWindow.qml</file>
|
<file>qml/Proton/ApplicationWindow.qml</file>
|
||||||
<file>qml/Proton/Button.qml</file>
|
<file>qml/Proton/Button.qml</file>
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import QtQuick
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import Proton
|
import Proton
|
||||||
|
import ".."
|
||||||
|
|
||||||
SettingsView {
|
SettingsView {
|
||||||
id: root
|
id: root
|
||||||
@ -14,6 +14,7 @@ import QtQuick
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import Proton
|
import Proton
|
||||||
|
import ".."
|
||||||
|
|
||||||
SettingsView {
|
SettingsView {
|
||||||
id: root
|
id: root
|
||||||
@ -15,6 +15,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import Proton
|
import Proton
|
||||||
import Notifications
|
import Notifications
|
||||||
|
import ".."
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@ -77,6 +78,7 @@ Item {
|
|||||||
root.showBugCategory();
|
root.showBugCategory();
|
||||||
}
|
}
|
||||||
onQuestionAnswered: {
|
onQuestionAnswered: {
|
||||||
|
Backend.requestKnowledgeBaseSuggestions();
|
||||||
root.showBugReport();
|
root.showBugReport();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14,6 +14,7 @@ import QtQuick
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import Proton
|
import Proton
|
||||||
|
import ".."
|
||||||
|
|
||||||
SettingsView {
|
SettingsView {
|
||||||
id: root
|
id: root
|
||||||
@ -14,6 +14,7 @@ import QtQuick
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import Proton
|
import Proton
|
||||||
|
import ".."
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
@ -15,6 +15,7 @@ import QtQuick.Layouts
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import Proton
|
import Proton
|
||||||
import Notifications
|
import Notifications
|
||||||
|
import "BugReport"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import QtQuick.Controls
|
|||||||
import Proton
|
import Proton
|
||||||
import Notifications
|
import Notifications
|
||||||
import "SetupWizard"
|
import "SetupWizard"
|
||||||
|
import "BugReport"
|
||||||
|
|
||||||
ApplicationWindow {
|
ApplicationWindow {
|
||||||
id: root
|
id: root
|
||||||
|
|||||||
@ -247,6 +247,22 @@ SPStreamEvent newCertificateInstallFailedEvent() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
/// \param[in] suggestions the suggestions
|
||||||
|
/// \return The event.
|
||||||
|
//****************************************************************************************************************************************************
|
||||||
|
SPStreamEvent newKnowledgeBaseSuggestionsEvent(QList<KnowledgeBaseSuggestion> const& suggestions) {
|
||||||
|
auto event = new grpc::KnowledgeBaseSuggestionsEvent;
|
||||||
|
for (KnowledgeBaseSuggestion const &suggestion: suggestions) {
|
||||||
|
grpc::KnowledgeBaseSuggestion *s = event->add_suggestions();
|
||||||
|
s->set_url(suggestion.url.toStdString());
|
||||||
|
s->set_title(suggestion.title.toStdString());
|
||||||
|
}
|
||||||
|
auto appEvent = new grpc::AppEvent;
|
||||||
|
appEvent->set_allocated_knowledgebasesuggestions(event);
|
||||||
|
return wrapAppEvent(appEvent);
|
||||||
|
}
|
||||||
|
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
/// \return The event.
|
/// \return The event.
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include "bridge.grpc.pb.h"
|
#include "bridge.grpc.pb.h"
|
||||||
#include "GRPCUtils.h"
|
#include "GRPCUtils.h"
|
||||||
|
#include <bridgepp/GRPC/GRPCClient.h>
|
||||||
|
|
||||||
|
|
||||||
namespace bridgepp {
|
namespace bridgepp {
|
||||||
@ -39,6 +40,7 @@ SPStreamEvent newCertificateInstallSuccessEvent(); ///< Create a new Certificate
|
|||||||
SPStreamEvent newCertificateInstallCanceledEvent(); ///< Create a new CertificateInstallCanceledEvent event.
|
SPStreamEvent newCertificateInstallCanceledEvent(); ///< Create a new CertificateInstallCanceledEvent event.
|
||||||
SPStreamEvent newCertificateInstallFailedEvent(); ///< Create anew CertificateInstallFailedEvent event.
|
SPStreamEvent newCertificateInstallFailedEvent(); ///< Create anew CertificateInstallFailedEvent event.
|
||||||
SPStreamEvent newShowMainWindowEvent(); ///< Create a new ShowMainWindowEvent event.
|
SPStreamEvent newShowMainWindowEvent(); ///< Create a new ShowMainWindowEvent event.
|
||||||
|
SPStreamEvent newKnowledgeBaseSuggestionsEvent(QList<KnowledgeBaseSuggestion> const& suggestions); ///< Create a new KnowledgeBaseSuggestions event.
|
||||||
|
|
||||||
// Login events
|
// Login events
|
||||||
SPStreamEvent newLoginError(grpc::LoginErrorType error, QString const &message); ///< Create a new LoginError event.
|
SPStreamEvent newLoginError(grpc::LoginErrorType error, QString const &message); ///< Create a new LoginError event.
|
||||||
|
|||||||
@ -571,7 +571,7 @@ grpc::Status GRPCClient::hostname(QString &outHostname) {
|
|||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
/// \param[in] input The user input to analyze.
|
/// \param[in] input The user input to analyze.
|
||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
grpc::Status GRPCClient::RequestKnowledgeBaseSuggestions(QString const &input) {
|
grpc::Status GRPCClient::requestKnowledgeBaseSuggestions(QString const &input) {
|
||||||
return this->logGRPCCallStatus(this->setString(&Bridge::Stub::RequestKnowledgeBaseSuggestions, input), __FUNCTION__);
|
return this->logGRPCCallStatus(this->setString(&Bridge::Stub::RequestKnowledgeBaseSuggestions, input), __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -102,7 +102,7 @@ public: // member functions.
|
|||||||
grpc::Status releaseNotesPageLink(QUrl &outUrl); ///< Performs the 'releaseNotesPageLink' call.
|
grpc::Status releaseNotesPageLink(QUrl &outUrl); ///< Performs the 'releaseNotesPageLink' call.
|
||||||
grpc::Status landingPageLink(QUrl &outUrl); ///< Performs the 'landingPageLink' call.
|
grpc::Status landingPageLink(QUrl &outUrl); ///< Performs the 'landingPageLink' call.
|
||||||
grpc::Status hostname(QString &outHostname); ///< Performs the 'Hostname' call.
|
grpc::Status hostname(QString &outHostname); ///< Performs the 'Hostname' call.
|
||||||
grpc::Status RequestKnowledgeBaseSuggestions(QString const &input); ///< Performs the 'RequestKnowledgeBaseSuggestions' call.
|
grpc::Status requestKnowledgeBaseSuggestions(QString const &input); ///< Performs the 'RequestKnowledgeBaseSuggestions' call.
|
||||||
|
|
||||||
signals: // app related signals
|
signals: // app related signals
|
||||||
void internetStatus(bool isOn);
|
void internetStatus(bool isOn);
|
||||||
|
|||||||
Reference in New Issue
Block a user