diff options
author | Saturneric <[email protected]> | 2021-08-21 16:26:07 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-08-21 16:26:07 +0000 |
commit | 516e3286d8373157291c78a499dd7a54c025133e (patch) | |
tree | d6c6b252110339a8be4390136f916b064d5b6740 /include/server/ComUtils.h | |
parent | Fixed. (diff) | |
download | GpgFrontend-516e3286d8373157291c78a499dd7a54c025133e.tar.gz GpgFrontend-516e3286d8373157291c78a499dd7a54c025133e.zip |
Functions addition and improvement;
Design and adjustment of function architecture related to server access;
Add a new module (advance);
Diffstat (limited to '')
-rw-r--r-- | include/server/ComUtils.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/include/server/ComUtils.h b/include/server/ComUtils.h index d7812bd3..a4cf543f 100644 --- a/include/server/ComUtils.h +++ b/include/server/ComUtils.h @@ -33,7 +33,7 @@ class ComUtils : public QWidget { Q_OBJECT public: - enum ServiceType { GetServiceToken, ShortenCryptText, GetFullCryptText, UploadPubkey }; + enum ServiceType { GetServiceToken, ShortenCryptText, GetFullCryptText, UploadPubkey, GetPubkey }; explicit ComUtils(QWidget *parent) : QWidget(parent), appPath(qApp->applicationDirPath()), settings(RESOURCE_DIR(appPath) + "/conf/gpgfrontend.ini", @@ -41,19 +41,19 @@ public: } - QString getUrl(ServiceType type) const; + [[nodiscard]] QString getUrl(ServiceType type) const; bool checkServerReply(const QByteArray &reply); - QString getDataValueStr(const QString &key); + [[nodiscard]] QString getDataValueStr(const QString &key) const; - bool checkDataValueStr(const QString &key); + [[nodiscard]] bool checkDataValueStr(const QString &key) const; - rapidjson::Value &getDataValue(const QString &key); + [[nodiscard]] const rapidjson::Value &getDataValue(const QString &key) const; - bool checkDataValue(const QString &key); + [[nodiscard]] bool checkDataValue(const QString &key) const; - bool checkServiceTokenFormat(const QString& serviceToken); + [[nodiscard]] bool checkServiceTokenFormat(const QString& serviceToken) const; static QByteArray getSignStringBase64(GpgME::GpgContext *ctx, const QString &str, const GpgKey& key); @@ -61,15 +61,15 @@ public: QNetworkAccessManager &getNetworkManager() {return networkMgr;} + void clear(); + private: QString appPath; QSettings settings; rapidjson::Document replyDoc; rapidjson::Value dataVal; - QNetworkAccessManager networkMgr; - QRegularExpression re_uuid{R"(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)"}; bool is_good = false; |