diff options
author | Saturn&Eric <[email protected]> | 2021-12-05 06:25:17 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-12-05 07:33:00 +0000 |
commit | c6a0a8db19c92a7c9ca0569e2c24a3503071c574 (patch) | |
tree | 1b9972e825962dd4b4edaa1ab0111679b450328b | |
parent | Update Ci Configurre File (diff) | |
parent | Merge branch 'main' of github.com:saturneric/GpgFrontend (diff) | |
download | GpgFrontend-c6a0a8db19c92a7c9ca0569e2c24a3503071c574.tar.gz GpgFrontend-c6a0a8db19c92a7c9ca0569e2c24a3503071c574.zip |
Merge branch 'main' into develop
1. Fix issues noticed by codacy.
2. Fix CI Configure Files.
3. Modified Porject Configuration.
4. Fixed Error in Source Code.
-rw-r--r-- | .github/workflows/codeql-analysis.yml | 6 | ||||
-rw-r--r-- | .github/workflows/debug.yml | 5 | ||||
-rw-r--r-- | CMakeLists.txt | 15 | ||||
-rw-r--r-- | src/gpg/GpgContext.h | 8 | ||||
-rw-r--r-- | src/gpg/model/GpgData.cpp | 6 | ||||
-rw-r--r-- | src/main.cpp | 9 | ||||
-rw-r--r-- | src/ui/help/AboutDialog.cpp | 2 | ||||
-rw-r--r-- | src/ui/keypair_details/KeyPairUIDTab.cpp | 15 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowFileSlotFunction.cpp | 3 | ||||
-rw-r--r-- | src/ui/settings/SettingsGeneral.cpp | 4 |
10 files changed, 34 insertions, 39 deletions
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index df53d8ba..31a0dfa0 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -56,13 +56,13 @@ jobs: # Prefix the list here with "+" to use these queries and those in the config file. # queries: ./path/to/local/query, your-org/your-repo/queries@main - - name: Install Dependence (Linux) + - name: Install Dependence run: | sudo apt-get update sudo apt-get -y install build-essential binutils git autoconf automake gettext texinfo - sudo apt-get -y install gcc g++ + sudo apt-get -y install gcc g++ libconfig++-dev libboost-all-dev sudo apt-get -y install gpgsm - + - name: Cache Qt id: cache-qt uses: actions/cache@v1 diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index 184423cf..f00a3dad 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -36,10 +36,7 @@ jobs: sudo apt-get update sudo apt-get -y install build-essential binutils git autoconf automake gettext texinfo sudo apt-get -y install gcc g++ libconfig++-dev libboost-all-dev - sudo apt-get -y install gpgsm libxcb-xinerama0 libxcb-icccm4-dev libcups2-dev libdrm-dev libegl1-mesa-dev - sudo apt-get -y install libgcrypt11-dev libnss3-dev libpci-dev libpulse-dev libudev-dev libxtst-dev gyp ninja-build - sudo apt-get -y install libglu1-mesa-dev libfontconfig1-dev libx11-xcb-dev libicu-dev libxcb-image0 - sudo apt-get -y install libglu1-mesa-dev libfontconfig1-dev libx11-xcb-dev libicu-dev libxcb-* + sudo apt-get -y install gpgsm if: matrix.os == 'ubuntu-latest' - name: Codesign Configuration (macOS) diff --git a/CMakeLists.txt b/CMakeLists.txt index e67cdaf7..9cad474a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,10 +65,14 @@ if (BUILD_CONFIG) message(STATUS "Switch TEST_MINIMUM_UI_BUILD") set(MINIMUM_APPLICATION_BUILD 1) set(AppName GpgFrontend) + elseif (${BUILD_CONFIG} STREQUAL "test_all") + message(STATUS "Switch FULL_APPLICATION_BUILD") + set(FULL_APPLICATION_BUILD 1) + set(AppName GpgFrontend) endif () else () - message(STATUS "Switch Default FULL_APPLICATION_BUILD") - set(FULL_APPLICATION_BUILD 1) + message(STATUS "Switch Default STABLE_APPLICATION_BUILD") + set(STABLE_APPLICATION_BUILD 1) set(AppName GpgFrontend) endif () @@ -237,6 +241,13 @@ elseif (MINIMUM_APPLICATION_BUILD) set(APPLICATION_BUILD 1) set(BASIC_ENV_CONFIG 1) set(MULTI_LANG_SUPPORT 1) +elseif (STABLE_APPLICATION_BUILD) + set(QT5_ENV_SUPPORT 1) + set(QT_MOC_CONFIG 1) + set(GPG_CORE 1) + set(UI_CORE 1) + set(APPLICATION_BUILD 1) + set(BASIC_ENV_CONFIG 1) elseif (TEST_BUILD) message(STATUS "Build Test Cases") diff --git a/src/gpg/GpgContext.h b/src/gpg/GpgContext.h index 4a9b6fc0..5812f49f 100644 --- a/src/gpg/GpgContext.h +++ b/src/gpg/GpgContext.h @@ -26,7 +26,6 @@ #define __SGPGMEPP_CONTEXT_H__ #include "GpgConstants.h" - #include "GpgFunctionObject.h" #include "GpgInfo.h" #include "GpgModel.h" @@ -39,7 +38,7 @@ namespace GpgFrontend { class GpgContext : public SingletonFunctionObject<GpgContext> { public: explicit GpgContext(bool independent_database = false, - std::string path = std::string(), int channel = 0); + std::string path = std::string(), int channel = 0); ~GpgContext() override = default; @@ -71,8 +70,9 @@ class GpgContext : public SingletonFunctionObject<GpgContext> { int last_was_bad, int fd) { LOG(INFO) << "test_passphrase_cb Called"; size_t res; - char pass[] = "abcdefg\n"; - size_t pass_len = strlen(pass); + std::string pass = "abcdefg\n"; + auto pass_len = pass.size(); + size_t off = 0; (void)opaque; diff --git a/src/gpg/model/GpgData.cpp b/src/gpg/model/GpgData.cpp index 23cdaf2d..c6e9b2ce 100644 --- a/src/gpg/model/GpgData.cpp +++ b/src/gpg/model/GpgData.cpp @@ -52,12 +52,10 @@ GpgFrontend::GpgData::GpgData(void* buffer, size_t size, bool copy) { GpgFrontend::ByteArrayPtr GpgFrontend::GpgData::Read2Buffer() { gpgme_off_t ret = gpgme_data_seek(*this, 0, SEEK_SET); - gpgme_error_t err = gpg_error(GPG_ERR_NO_ERROR); - ByteArrayPtr out_buffer = std::make_unique<std::string>(); if (ret) { - err = gpgme_err_code_from_errno(errno); + gpgme_error_t err = gpgme_err_code_from_errno(errno); assert(gpgme_err_code(err) == GPG_ERR_NO_ERROR); } else { char buf[BUF_SIZE + 2]; @@ -68,7 +66,7 @@ GpgFrontend::ByteArrayPtr GpgFrontend::GpgData::Read2Buffer() { memcpy(out_buffer->data() + size, buf, ret); } if (ret < 0) { - err = gpgme_err_code_from_errno(errno); + gpgme_error_t err = gpgme_err_code_from_errno(errno); assert(gpgme_err_code(err) == GPG_ERR_NO_ERROR); } } diff --git a/src/main.cpp b/src/main.cpp index 82cfe9c1..ee542ff0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,10 +39,6 @@ int main(int argc, char* argv[]) { // Qt App QApplication app(argc, argv); - // get application path - auto app_path = - GpgFrontend::UI::GlobalSettingStation::GetInstance().GetAppDir(); - // logging system init_logging(); @@ -53,7 +49,7 @@ int main(int argc, char* argv[]) { QApplication::setApplicationVersion(BUILD_VERSION); QApplication::setApplicationName(PROJECT_NAME); - // dont show icons in menus + // don't show icons in menus QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); // unicode in source @@ -168,6 +164,7 @@ void init_locale() { bindtextdomain(PROJECT_NAME, GpgFrontend::UI::GlobalSettingStation::GetInstance() .GetLocaleDir() - .string().c_str()); + .string() + .c_str()); textdomain(PROJECT_NAME); } diff --git a/src/ui/help/AboutDialog.cpp b/src/ui/help/AboutDialog.cpp index 310cbddb..7358ced5 100644 --- a/src/ui/help/AboutDialog.cpp +++ b/src/ui/help/AboutDialog.cpp @@ -53,7 +53,7 @@ AboutDialog::AboutDialog(int defaultIndex, QWidget* parent) : QDialog(parent) { auto* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); connect(buttonBox, SIGNAL(accepted()), this, SLOT(close())); - + auto* mainLayout = new QVBoxLayout; mainLayout->addWidget(tabWidget); mainLayout->addWidget(buttonBox); diff --git a/src/ui/keypair_details/KeyPairUIDTab.cpp b/src/ui/keypair_details/KeyPairUIDTab.cpp index 0ca7eb2c..3d56699a 100644 --- a/src/ui/keypair_details/KeyPairUIDTab.cpp +++ b/src/ui/keypair_details/KeyPairUIDTab.cpp @@ -329,22 +329,17 @@ void KeyPairUIDTab::slotDelUID() { "</b><br/><br/>" + keynames + +"<br/>" + _("The action can not be undone."), QMessageBox::No | QMessageBox::Yes); - - bool if_all_success = true; - + if (ret == QMessageBox::Yes) { for (const auto& uid : *selected_uids) { LOG(INFO) << "KeyPairUIDTab::slotDelUID UID" << uid; if (!UidOperator::GetInstance().revUID(mKey, uid)) { - if_all_success = false; + QMessageBox::critical( + nullptr, _("Operation Failed"), + QString(_("An error occurred during the delete %1 operation.")) + .arg(uid.c_str())); } } - - if (!if_all_success) { - QMessageBox::critical( - nullptr, _("Operation Failed"), - _("At least an error occurred during the operation.")); - } emit signalUpdateUIDInfo(); } } diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp index 0b4f7837..25445dcc 100644 --- a/src/ui/main_window/MainWindowFileSlotFunction.cpp +++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp @@ -463,19 +463,16 @@ void MainWindow::slotFileEncryptCustom() { } void MainWindow::slotFileDecryptCustom() { - auto key_ids = mKeyList->getChecked(); new FileEncryptionDialog(mKeyList->getChecked(), FileEncryptionDialog::Decrypt, this); } void MainWindow::slotFileSignCustom() { - auto key_ids = mKeyList->getChecked(); new FileEncryptionDialog(mKeyList->getChecked(), FileEncryptionDialog::Sign, this); } void MainWindow::slotFileVerifyCustom() { - auto key_ids = mKeyList->getChecked(); new FileEncryptionDialog(mKeyList->getChecked(), FileEncryptionDialog::Verify, this); } diff --git a/src/ui/settings/SettingsGeneral.cpp b/src/ui/settings/SettingsGeneral.cpp index e6ee5499..98610e12 100644 --- a/src/ui/settings/SettingsGeneral.cpp +++ b/src/ui/settings/SettingsGeneral.cpp @@ -280,9 +280,9 @@ void GeneralTab::applySettings() { lang.key(langSelectBox->currentText()).toStdString(); else { general["lang"] = lang.key(langSelectBox->currentText()).toStdString(); -#endif } - +#endif + #ifdef SERVER_SUPPORT settings.setValue( "general/ownKeyId", |