diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/advance/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/advance/UnknownSignersChecker.cpp | 83 | ||||
-rw-r--r-- | src/gpg/result_analyse/VerifyResultAnalyse.cpp | 12 | ||||
-rw-r--r-- | src/server/BaseAPI.cpp | 70 | ||||
-rw-r--r-- | src/server/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/server/ComUtils.cpp | 19 | ||||
-rw-r--r-- | src/server/api/PubkeyGetter.cpp | 96 | ||||
-rw-r--r-- | src/server/api/PubkeyUploader.cpp (renamed from src/server/PubkeyUploader.cpp) | 75 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowSlotFunction.cpp | 19 | ||||
-rw-r--r-- | src/ui/settings/SettingsAdvanced.cpp | 13 | ||||
-rw-r--r-- | src/ui/settings/SettingsGeneral.cpp | 19 |
12 files changed, 359 insertions, 57 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cdd0bfe7..200f5beb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,6 +2,7 @@ add_subdirectory(gpg) add_subdirectory(ui) add_subdirectory(smtp) add_subdirectory(server) +add_subdirectory(advance) aux_source_directory(. BASE_SOURCE) @@ -120,7 +121,7 @@ else() add_executable(${AppName} ${BASE_SOURCE} ${RESOURCE_FILES} ${QT5_MOCS}) endif() -set(GPGFRONTEND_LIBS smtp gpgfrontend-ui server gpg) +set(GPGFRONTEND_LIBS smtp gpgfrontend-ui advance server gpg) set(QT_DEPENDENCY_LIBS Qt5::Network Qt5::PrintSupport Qt5::Widgets Qt5::Test Qt5::Core) IF (MINGW) diff --git a/src/advance/CMakeLists.txt b/src/advance/CMakeLists.txt new file mode 100644 index 00000000..696fc8e5 --- /dev/null +++ b/src/advance/CMakeLists.txt @@ -0,0 +1,6 @@ +aux_source_directory(. ADVANCE_SOURCE) + +add_library(advance STATIC ${ADVANCE_SOURCE}) + +target_link_libraries(advance + Qt5::Network Qt5::Widgets Qt5::Core)
\ No newline at end of file diff --git a/src/advance/UnknownSignersChecker.cpp b/src/advance/UnknownSignersChecker.cpp new file mode 100644 index 00000000..30f9341f --- /dev/null +++ b/src/advance/UnknownSignersChecker.cpp @@ -0,0 +1,83 @@ +/** + * This file is part of GPGFrontend. + * + * GPGFrontend is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Foobar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <https://www.gnu.org/licenses/>. + * + * The initial version of the source code is inherited from gpg4usb-team. + * Their source code version also complies with GNU General Public License. + * + * The source code version of this software was modified and released + * by Saturneric<[email protected]> starting on May 12, 2021. + * + */ + +#include "advance/UnknownSignersChecker.h" +#include "server/api/PubkeyGetter.h" + + +UnknownSignersChecker::UnknownSignersChecker(GpgME::GpgContext *ctx, gpgme_verify_result_t result) : + appPath(qApp->applicationDirPath()), settings(RESOURCE_DIR(appPath) + "/conf/gpgfrontend.ini"), mCtx(ctx), + mResult(result) { + +} + +void UnknownSignersChecker::start() { + + auto sign = mResult->signatures; + bool canContinue = true; + + while (sign && canContinue) { + + switch (gpg_err_code(sign->status)) { + case GPG_ERR_BAD_SIGNATURE: + break; + case GPG_ERR_NO_ERROR: + if (!(sign->status & GPGME_SIGSUM_KEY_MISSING)) + check_signer(sign); + break; + case GPG_ERR_NO_PUBKEY: + break; + case GPG_ERR_CERT_REVOKED: + case GPG_ERR_SIG_EXPIRED: + case GPG_ERR_KEY_EXPIRED: + check_signer(sign); + break; + case GPG_ERR_GENERAL: + canContinue = false; + break; + default: + break; + } + sign = sign->next; + } + + auto pubkeyGetter = PubkeyGetter(mCtx, unknownFprs); + pubkeyGetter.start(); + if (!pubkeyGetter.result()) { + QMessageBox::warning(nullptr, + tr("Warning"), + tr("Automatic public key exchange failed.")); + } +} + +void UnknownSignersChecker::check_signer(gpgme_signature_t sign) { + + auto key = mCtx->getKeyByFpr(sign->fpr); + + if (settings.value("advanced/autoPubkeyExchange").toBool() && !key.good) { + qDebug() << "Find Unknown FingerPrint " << sign->fpr; + unknownFprs.append(sign->fpr); + } + +} diff --git a/src/gpg/result_analyse/VerifyResultAnalyse.cpp b/src/gpg/result_analyse/VerifyResultAnalyse.cpp index c4285351..816e889c 100644 --- a/src/gpg/result_analyse/VerifyResultAnalyse.cpp +++ b/src/gpg/result_analyse/VerifyResultAnalyse.cpp @@ -38,7 +38,7 @@ VerifyResultAnalyse::VerifyResultAnalyse(GpgME::GpgContext *ctx, gpgme_error_t e } - if(result != nullptr && result->signatures) { + if (result != nullptr && result->signatures) { stream << "------------>" << Qt::endl; auto sign = result->signatures; @@ -63,7 +63,7 @@ VerifyResultAnalyse::VerifyResultAnalyse(GpgME::GpgContext *ctx, gpgme_error_t e setStatus(-1); break; case GPG_ERR_NO_ERROR: - stream << QApplication::tr("A "); + stream << QApplication::tr("A "); if (sign->summary & GPGME_SIGSUM_GREEN) { stream << QApplication::tr("Good "); } @@ -151,16 +151,18 @@ bool VerifyResultAnalyse::printSigner(QTextStream &stream, gpgme_signature_t sig bool keyFound = true; stream << QApplication::tr("Signed By: "); auto key = mCtx->getKeyByFpr(sign->fpr); - if(!key.good) { + + key = mCtx->getKeyByFpr(sign->fpr); + + if (!key.good) { stream << tr("<Unknown>"); setStatus(0); keyFound = false; } stream << key.name; if (!key.email.isEmpty()) { - stream << "<" << key.email << ">"; + stream << "<" << key.email << ">"; } stream << Qt::endl; return keyFound; - }
\ No newline at end of file diff --git a/src/server/BaseAPI.cpp b/src/server/BaseAPI.cpp new file mode 100644 index 00000000..be388df9 --- /dev/null +++ b/src/server/BaseAPI.cpp @@ -0,0 +1,70 @@ +/** + * This file is part of GPGFrontend. + * + * GPGFrontend is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Foobar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <https://www.gnu.org/licenses/>. + * + * The initial version of the source code is inherited from gpg4usb-team. + * Their source code version also complies with GNU General Public License. + * + * The source code version of this software was modified and released + * by Saturneric<[email protected]> starting on May 12, 2021. + * + */ + +#include "server/BaseAPI.h" +#include "rapidjson/writer.h" + +BaseAPI::BaseAPI(ComUtils::ServiceType serviceType) : utils(new ComUtils(nullptr)), + reqUrl(utils->getUrl(serviceType)), request(reqUrl) { + request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); +} + +BaseAPI::~BaseAPI() { + utils->deleteLater(); +} + +QNetworkReply *BaseAPI::send_json_data() { + rapidjson::StringBuffer sb; + rapidjson::Writer<rapidjson::StringBuffer> writer(sb); + document.Accept(writer); + + QByteArray postData(sb.GetString()); + qDebug() << "postData" << QString::fromUtf8(postData); + + auto reply = utils->getNetworkManager().post(request, postData); + + while (reply->isRunning()) QApplication::processEvents(); + + QByteArray replyData = reply->readAll().constData(); + if (utils->checkServerReply(replyData)) { + good = true, deal_reply(); + } + + return reply; +} + +void BaseAPI::start() { + construct_json(); + send_json_data()->deleteLater(); +} + +void BaseAPI::refresh() { + document.Clear(); + utils->clear(); + good = false; +} + +bool BaseAPI::result() const { + return good; +} diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index 867be076..423e9d1e 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -1,3 +1,4 @@ +aux_source_directory(./api SERVER_SOURCE) aux_source_directory(. SERVER_SOURCE) add_library(server STATIC ${SERVER_SOURCE}) diff --git a/src/server/ComUtils.cpp b/src/server/ComUtils.cpp index 9cd48924..bd4072f1 100644 --- a/src/server/ComUtils.cpp +++ b/src/server/ComUtils.cpp @@ -97,7 +97,7 @@ bool ComUtils::checkServerReply(const QByteArray &reply) { * @param key key of value * @return value in string format */ -QString ComUtils::getDataValueStr(const QString &key) { +QString ComUtils::getDataValueStr(const QString &key) const { if (is_good) { auto k_byte_array = key.toUtf8(); if (dataVal.HasMember(k_byte_array.data())) { @@ -135,6 +135,9 @@ QString ComUtils::getUrl(ComUtils::ServiceType type) const { case UploadPubkey: url += "/key/upload"; break; + case GetPubkey: + url += "/key/get"; + break; } qDebug() << "ComUtils getUrl" << url; @@ -142,14 +145,14 @@ QString ComUtils::getUrl(ComUtils::ServiceType type) const { return url; } -bool ComUtils::checkDataValueStr(const QString &key) { +bool ComUtils::checkDataValueStr(const QString &key) const { auto key_byte_array_data = key.toUtf8().constData(); if (is_good) { return dataVal.HasMember(key_byte_array_data) && dataVal[key_byte_array_data].IsString(); } else return false; } -bool ComUtils::checkServiceTokenFormat(const QString &uuid) { +bool ComUtils::checkServiceTokenFormat(const QString &uuid) const { return re_uuid.match(uuid).hasMatch(); } @@ -161,7 +164,7 @@ QByteArray ComUtils::getSignStringBase64(GpgME::GpgContext *ctx, const QString & return outSignText.toBase64(); } -rapidjson::Value &ComUtils::getDataValue(const QString &key) { +const rapidjson::Value &ComUtils::getDataValue(const QString &key) const { if (is_good) { auto k_byte_array = key.toUtf8(); if (dataVal.HasMember(k_byte_array.data())) { @@ -171,9 +174,15 @@ rapidjson::Value &ComUtils::getDataValue(const QString &key) { throw std::runtime_error("Inner Error"); } -bool ComUtils::checkDataValue(const QString &key){ +bool ComUtils::checkDataValue(const QString &key) const{ auto key_byte_array_data = key.toUtf8().constData(); if (is_good) { return dataVal.HasMember(key_byte_array_data); } else return false; +} + +void ComUtils::clear() { + this->dataVal.Clear(); + this->replyDoc.Clear(); + is_good = false; }
\ No newline at end of file diff --git a/src/server/api/PubkeyGetter.cpp b/src/server/api/PubkeyGetter.cpp new file mode 100644 index 00000000..2ba55d11 --- /dev/null +++ b/src/server/api/PubkeyGetter.cpp @@ -0,0 +1,96 @@ +/** + * This file is part of GPGFrontend. + * + * GPGFrontend is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Foobar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <https://www.gnu.org/licenses/>. + * + * The initial version of the source code is inherited from gpg4usb-team. + * Their source code version also complies with GNU General Public License. + * + * The source code version of this software was modified and released + * by Saturneric<[email protected]> starting on May 12, 2021. + * + */ + +#include "server/api/PubkeyGetter.h" + +PubkeyGetter::PubkeyGetter(GpgME::GpgContext *ctx, const QVector<QString> &fprs) : BaseAPI(ComUtils::GetPubkey), + mCtx(ctx), mFprs(fprs) { +} + +void PubkeyGetter::construct_json() { + document.SetArray(); + QStringList keyIds; + + rapidjson::Document::AllocatorType &allocator = document.GetAllocator(); + + for (const auto &fprStr : mFprs) { + rapidjson::Value fpr; + + auto fprByteArray = fprStr.toUtf8(); + fpr.SetString(fprByteArray.constData(), fprByteArray.count()); + + document.PushBack(fpr, allocator); + keyIds.clear(); + } +} + +void PubkeyGetter::deal_reply() { + + const auto &utils = getUtils(); + + /** + * { + * "pubkeys" : [ + * { + * "publicKey" : ..., + * "fpr" : ..., + * "sha" : ... + * }, + * ... + * ] + * } + */ + + if (!utils.checkDataValue("pubkeys")) { + QMessageBox::critical(nullptr, tr("Error"), + tr("The communication content with the server does not meet the requirements")); + } else { + auto &pubkeys = utils.getDataValue("pubkeys"); + qDebug() << "Pubkey Getter" << pubkeys.IsArray() << pubkeys.GetArray().Size(); + if (pubkeys.IsArray()) { + for (const auto &pubkey : pubkeys.GetArray()) { + if (pubkey.IsObject() + && pubkey.HasMember("publicKey") && pubkey.HasMember("fpr") && pubkey.HasMember("sha") + && pubkey["publicKey"].IsString() && pubkey["fpr"].IsString() && pubkey["sha"].IsString()) { + + auto pubkeyData = QString(pubkey["publicKey"].GetString()); + + QCryptographicHash shaGen(QCryptographicHash::Sha256); + shaGen.addData(pubkeyData.toUtf8()); + + if (shaGen.result().toHex() == pubkey["sha"].GetString()) { + mCtx->importKey(pubkeyData.toUtf8()); + } + + } + } + + } else { + QMessageBox::critical(nullptr, tr("Error"), + tr("The communication content with the server does not meet the requirements")); + } + } +} + + diff --git a/src/server/PubkeyUploader.cpp b/src/server/api/PubkeyUploader.cpp index 70ba07ec..8051dab7 100644 --- a/src/server/PubkeyUploader.cpp +++ b/src/server/api/PubkeyUploader.cpp @@ -22,34 +22,33 @@ * */ -#include "server/PubkeyUploader.h" +#include "server/api/PubkeyUploader.h" -#include "rapidjson/prettywriter.h" - -PubkeyUploader::PubkeyUploader(GpgME::GpgContext *ctx, const QVector<GpgKey> &keys) { - auto utils = new ComUtils(nullptr); - QUrl reqUrl(utils->getUrl(ComUtils::UploadPubkey)); - QNetworkRequest request(reqUrl); +PubkeyUploader::PubkeyUploader(GpgME::GpgContext *ctx, const QVector<GpgKey> &keys) : BaseAPI(ComUtils::UploadPubkey), + mCtx(ctx), + mKeys(keys) { +} - rapidjson::Document publicKeys; - publicKeys.SetArray(); +void PubkeyUploader::construct_json() { + document.SetArray(); QStringList keyIds; - rapidjson::Document::AllocatorType& allocator = publicKeys.GetAllocator(); + rapidjson::Document::AllocatorType &allocator = document.GetAllocator(); - for(const auto &key : keys) { + for (const auto &key : mKeys) { rapidjson::Value publicKeyObj, pubkey, sha, signedFpr; QByteArray keyDataBuf; keyIds << key.id; - ctx->exportKeys(&keyIds, &keyDataBuf); + mCtx->exportKeys(&keyIds, &keyDataBuf); QCryptographicHash shaGen(QCryptographicHash::Sha256); shaGen.addData(keyDataBuf); auto shaStr = shaGen.result().toHex(); - auto signFprStr = ComUtils::getSignStringBase64(ctx, key.fpr, key); + auto signFprStr = ComUtils::getSignStringBase64(mCtx, key.fpr, key); + qDebug() << "signFprStr" << signFprStr; pubkey.SetString(keyDataBuf.constData(), keyDataBuf.count()); @@ -62,31 +61,35 @@ PubkeyUploader::PubkeyUploader(GpgME::GpgContext *ctx, const QVector<GpgKey> &ke publicKeyObj.AddMember("sha", sha, allocator); publicKeyObj.AddMember("signedFpr", signedFpr, allocator); - publicKeys.PushBack(publicKeyObj, allocator); + document.PushBack(publicKeyObj, allocator); keyIds.clear(); } +} - rapidjson::StringBuffer sb; - rapidjson::PrettyWriter<rapidjson::StringBuffer> writer(sb); - publicKeys.Accept(writer); - - QByteArray postData(sb.GetString()); - qDebug() << "postData" << QString::fromUtf8(postData); - - QNetworkReply *reply = utils->getNetworkManager().post(request, postData); - - while (reply->isRunning()) QApplication::processEvents(); - - QByteArray replyData = reply->readAll().constData(); - if (utils->checkServerReply(replyData)) { - /** - * { - * "strings" : [ - * "...", - * "..." - * ] - * } - */ +void PubkeyUploader::deal_reply() { + + const auto &utils = getUtils(); + + /** + * { + * "strings" : [ + * "...", + * "..." + * ] + * } + */ + + if (!utils.checkDataValue("strings")) { + QMessageBox::critical(nullptr, tr("Error"), + tr("The communication content with the server does not meet the requirements")); + } else { + auto &strings = utils.getDataValue("strings"); + qDebug() << "Pubkey Uploader" << strings.IsArray() << strings.GetArray().Size(); + if (strings.IsArray() && strings.GetArray().Size() == mKeys.size()) { + + } else { + QMessageBox::warning(nullptr, tr("Warning"), + tr("Partial failure of automatic pubkey exchange")); + } } - } diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index d31ef73b..3d1d6f77 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -25,6 +25,8 @@ #include "MainWindow.h" #include "ui/SendMailDialog.h" #include "ui/widgets/SignersPicker.h" +#include "server/api/PubkeyUploader.h" +#include "advance/UnknownSignersChecker.h" /** @@ -366,6 +368,16 @@ void MainWindow::slotEncryptSign() { QApplication::processEvents(); } + if (settings.value("advanced/autoPubkeyExchange").toBool()) { + auto pubkeyUploader = PubkeyUploader(mCtx, signerKeys); + pubkeyUploader.start(); + if(!pubkeyUploader.result()) { + QMessageBox::warning(nullptr, + tr("Warning"), + tr("Automatic public key exchange failed.")); + } + } + dialog->close(); if (gpgme_err_code(error) == GPG_ERR_NO_ERROR) { @@ -452,6 +464,13 @@ void MainWindow::slotDecryptVerify() { QApplication::processEvents(); } + // Automatically import public keys that are not stored locally + if(settings.value("advanced/autoPubkeyExchange").toBool()) { + auto* checker = new UnknownSignersChecker(mCtx, v_result); + checker->start(); + checker->deleteLater(); + } + dialog->close(); infoBoard->associateTextEdit(edit->curTextPage()); diff --git a/src/ui/settings/SettingsAdvanced.cpp b/src/ui/settings/SettingsAdvanced.cpp index c49ba9ce..30414250 100644 --- a/src/ui/settings/SettingsAdvanced.cpp +++ b/src/ui/settings/SettingsAdvanced.cpp @@ -31,14 +31,21 @@ settings(RESOURCE_DIR(appPath) + "/conf/gpgfrontend.ini", /***************************************** * Steganography Box *****************************************/ - auto *steganoBox = new QGroupBox(tr("Show Steganography Options [Advanced]")); + auto *steganoBox = new QGroupBox(tr("Show Steganography Options")); auto *steganoBoxLayout = new QHBoxLayout(); steganoCheckBox = new QCheckBox(tr("Show Steganographic Options."), this); steganoBoxLayout->addWidget(steganoCheckBox); steganoBox->setLayout(steganoBoxLayout); + auto *pubkeyExchangeBox = new QGroupBox(tr("Pubkey Exchange")); + auto *pubkeyExchangeBoxLayout = new QHBoxLayout(); + autoPubkeyExchangeCheckBox = new QCheckBox(tr("Auto Pubkey Exchange"), this); + pubkeyExchangeBoxLayout->addWidget(autoPubkeyExchangeCheckBox); + pubkeyExchangeBox->setLayout(pubkeyExchangeBoxLayout); + auto *mainLayout = new QVBoxLayout; mainLayout->addWidget(steganoBox); + mainLayout->addWidget(pubkeyExchangeBox); setSettings(); mainLayout->addStretch(1); setLayout(mainLayout); @@ -48,9 +55,13 @@ void AdvancedTab::setSettings() { if (settings.value("advanced/steganography").toBool()) { steganoCheckBox->setCheckState(Qt::Checked); } + if (settings.value("advanced/autoPubkeyExchange").toBool()) { + autoPubkeyExchangeCheckBox->setCheckState(Qt::Checked); + } } void AdvancedTab::applySettings() { settings.setValue("advanced/steganography", steganoCheckBox->isChecked()); + settings.setValue("advanced/autoPubkeyExchange", autoPubkeyExchangeCheckBox->isChecked()); } diff --git a/src/ui/settings/SettingsGeneral.cpp b/src/ui/settings/SettingsGeneral.cpp index 94f13b8f..0e9d9de7 100644 --- a/src/ui/settings/SettingsGeneral.cpp +++ b/src/ui/settings/SettingsGeneral.cpp @@ -43,10 +43,10 @@ GeneralTab::GeneralTab(GpgME::GpgContext *ctx, QWidget *parent) serverBoxLayout->addWidget(serverSelectBox); serverBoxLayout->addWidget(new QLabel( tr("Server that provides short key and key exchange services"))); - connect(serverSelectBox, QOverload<const QString&>::of(&QComboBox::currentTextChanged), + connect(serverSelectBox, QOverload<const QString &>::of(&QComboBox::currentTextChanged), this, [&](const QString ¤t) -> void { - settings.setValue("general/currentGpgfrontendServer", current); - }); + settings.setValue("general/currentGpgfrontendServer", current); + }); serverBox->setLayout(serverBoxLayout); @@ -257,7 +257,7 @@ void GeneralTab::slotGetServiceToken() { GpgKey key = mCtx->getKeyById(keyId); - if(!key.good) { + if (!key.good) { QMessageBox::critical(this, tr("Error"), tr("Key Not Exists")); return; @@ -279,7 +279,7 @@ void GeneralTab::slotGetServiceToken() { auto shaStr = shaGen.result().toHex(); - auto signFprStr = utils->getSignStringBase64(mCtx, key.fpr, key); + auto signFprStr = ComUtils::getSignStringBase64(mCtx, key.fpr, key); rapidjson::Value pubkey, ver, sha, signFpr; @@ -294,7 +294,7 @@ void GeneralTab::slotGetServiceToken() { sha.SetString(shaStr.constData(), shaStr.count()); signFpr.SetString(signFprStr.constData(), signFprStr.count()); - rapidjson::Document::AllocatorType& allocator = doc.GetAllocator(); + rapidjson::Document::AllocatorType &allocator = doc.GetAllocator(); doc.AddMember("publicKey", pubkey, allocator); doc.AddMember("sha", sha, allocator); @@ -328,8 +328,9 @@ void GeneralTab::slotGetServiceToken() { * } */ - if(!utils->checkDataValueStr("serviceToken") || !utils->checkDataValueStr("fpr")) { - QMessageBox::critical(this, tr("Error"), tr("The communication content with the server does not meet the requirements")); + if (!utils->checkDataValueStr("serviceToken") || !utils->checkDataValueStr("fpr")) { + QMessageBox::critical(this, tr("Error"), + tr("The communication content with the server does not meet the requirements")); return; } @@ -343,7 +344,7 @@ void GeneralTab::slotGetServiceToken() { settings.setValue("general/serviceToken", serviceToken); serviceTokenLabel->setText(serviceToken); QMessageBox::information(this, tr("Notice"), - tr("Succeed in getting service token")); + tr("Succeed in getting service token")); } else { QMessageBox::critical(this, tr("Error"), tr("There is a problem with the communication with the server")); } |