aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSaturn&Eric <[email protected]>2021-12-05 06:25:17 +0000
committerSaturneric <[email protected]>2021-12-05 07:33:00 +0000
commitc6a0a8db19c92a7c9ca0569e2c24a3503071c574 (patch)
tree1b9972e825962dd4b4edaa1ab0111679b450328b /src
parentUpdate Ci Configurre File (diff)
parentMerge branch 'main' of github.com:saturneric/GpgFrontend (diff)
downloadGpgFrontend-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.
Diffstat (limited to 'src')
-rw-r--r--src/gpg/GpgContext.h8
-rw-r--r--src/gpg/model/GpgData.cpp6
-rw-r--r--src/main.cpp9
-rw-r--r--src/ui/help/AboutDialog.cpp2
-rw-r--r--src/ui/keypair_details/KeyPairUIDTab.cpp15
-rw-r--r--src/ui/main_window/MainWindowFileSlotFunction.cpp3
-rw-r--r--src/ui/settings/SettingsGeneral.cpp4
7 files changed, 17 insertions, 30 deletions
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",