diff options
author | saturneric <[email protected]> | 2025-02-16 12:36:41 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2025-02-16 12:36:41 +0000 |
commit | 8dfe4599860656b90fe8fb7f855f25233cc25912 (patch) | |
tree | f40584a9ac9b00e4523d6997714b791d0d91604a /src | |
parent | chore: update appstream info (diff) | |
download | GpgFrontend-8dfe4599860656b90fe8fb7f855f25233cc25912.tar.gz GpgFrontend-8dfe4599860656b90fe8fb7f855f25233cc25912.zip |
fix: do not check commit hash in flatpak container
Diffstat (limited to 'src')
-rw-r--r-- | src/core/GpgCoreInit.cpp | 3 | ||||
-rw-r--r-- | src/core/utils/CommonUtils.cpp | 3 | ||||
-rw-r--r-- | src/core/utils/CommonUtils.h | 8 | ||||
-rw-r--r-- | src/sdk/GFSDKBasic.cpp | 7 | ||||
-rw-r--r-- | src/sdk/GFSDKBasic.h | 8 | ||||
-rw-r--r-- | src/ui/dialog/key_generate/KeyGenerateDialog.cpp | 3 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowSlotFunction.cpp | 2 |
7 files changed, 29 insertions, 5 deletions
diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp index e12c71f1..a5f86207 100644 --- a/src/core/GpgCoreInit.cpp +++ b/src/core/GpgCoreInit.cpp @@ -499,8 +499,7 @@ auto InitGpgFrontendCore(CoreInitArgs args) -> int { auto use_pinentry_as_password_input_dialog = settings - .value("gnupg/use_pinentry_as_password_input_dialog", - QString::fromLocal8Bit(qgetenv("container")) != "flatpak") + .value("gnupg/use_pinentry_as_password_input_dialog", !IsFlatpakENV()) .toBool(); // try to restart all components diff --git a/src/core/utils/CommonUtils.cpp b/src/core/utils/CommonUtils.cpp index 526f5856..9687acd4 100644 --- a/src/core/utils/CommonUtils.cpp +++ b/src/core/utils/CommonUtils.cpp @@ -95,4 +95,7 @@ auto GFUnStrDup(const char* s) -> QString { return GFUnStrDup(const_cast<char*>(s)); } +auto GPGFRONTEND_CORE_EXPORT IsFlatpakENV() -> bool { + return QString::fromLocal8Bit(qgetenv("container")) == "flatpak"; +} } // namespace GpgFrontend
\ No newline at end of file diff --git a/src/core/utils/CommonUtils.h b/src/core/utils/CommonUtils.h index 83490cc4..de77114f 100644 --- a/src/core/utils/CommonUtils.h +++ b/src/core/utils/CommonUtils.h @@ -65,4 +65,12 @@ auto GPGFRONTEND_CORE_EXPORT GFStrDup(const QString &) -> char *; */ auto GPGFRONTEND_CORE_EXPORT GFUnStrDup(const char *) -> QString; +/** + * @brief + * + * @return true + * @return false + */ +auto GPGFRONTEND_CORE_EXPORT IsFlatpakENV() -> bool; + } // namespace GpgFrontend
\ No newline at end of file diff --git a/src/sdk/GFSDKBasic.cpp b/src/sdk/GFSDKBasic.cpp index b912740e..316ddd7b 100644 --- a/src/sdk/GFSDKBasic.cpp +++ b/src/sdk/GFSDKBasic.cpp @@ -32,6 +32,7 @@ #include "core/function/SecureMemoryAllocator.h" #include "core/function/gpg/GpgCommandExecutor.h" #include "core/utils/BuildInfoUtils.h" +#include "core/utils/CommonUtils.h" #include "private/GFSDKPrivat.h" #include "ui/UIModuleManager.h" @@ -134,4 +135,8 @@ auto GPGFRONTEND_MODULE_SDK_EXPORT GFCacheSaveWithTTL(const char* key, auto GPGFRONTEND_MODULE_SDK_EXPORT GFProjectGitCommitHash() -> const char* { return GFStrDup(GpgFrontend::GetProjectBuildGitCommitHash()); -}
\ No newline at end of file +} + +auto GPGFRONTEND_MODULE_SDK_EXPORT GFIsFlatpakENV() -> bool { + return GpgFrontend::IsFlatpakENV(); +} diff --git a/src/sdk/GFSDKBasic.h b/src/sdk/GFSDKBasic.h index 6af2176d..da83b157 100644 --- a/src/sdk/GFSDKBasic.h +++ b/src/sdk/GFSDKBasic.h @@ -170,4 +170,12 @@ auto GPGFRONTEND_MODULE_SDK_EXPORT GFCacheSaveWithTTL(const char* key, * @return const char* */ auto GPGFRONTEND_MODULE_SDK_EXPORT GFCacheGet(const char* key) -> const char*; + +/** + * @brief + * + * @return true + * @return false + */ +auto GPGFRONTEND_MODULE_SDK_EXPORT GFIsFlatpakENV() -> bool; }
\ No newline at end of file diff --git a/src/ui/dialog/key_generate/KeyGenerateDialog.cpp b/src/ui/dialog/key_generate/KeyGenerateDialog.cpp index 39c39c91..a12db246 100644 --- a/src/ui/dialog/key_generate/KeyGenerateDialog.cpp +++ b/src/ui/dialog/key_generate/KeyGenerateDialog.cpp @@ -33,6 +33,7 @@ #include "core/function/gpg/GpgKeyOpera.h" #include "core/typedef/GpgTypedef.h" #include "core/utils/CacheUtils.h" +#include "core/utils/CommonUtils.h" #include "core/utils/GpgUtils.h" #include "ui/UISignalStation.h" #include "ui/UserInterfaceUtils.h" @@ -600,7 +601,7 @@ void KeyGenerateDialog::slot_easy_combination_changed(const QString& mode) { void KeyGenerateDialog::do_generate() { if (!GetSettings() .value("gnupg/use_pinentry_as_password_input_dialog", - QString::fromLocal8Bit(qgetenv("container")) != "flatpak") + !IsFlatpakENV()) .toBool() && !ui_->noPassphraseCheckBox->isChecked()) { SetCacheValue("PinentryContext", "NEW_PASSPHRASE"); diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index 8743c937..781c67d1 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -296,7 +296,7 @@ void MainWindow::slot_version_upgrade_notify() { [=]() { (new AboutDialog(tr("Update"), this))->show(); }); statusBar()->addPermanentWidget(b); - } else if (is_git_commit_hash_mismatch) { + } else if (is_git_commit_hash_mismatch && !IsFlatpakENV()) { QMessageBox::information( this, tr("Commit Hash Mismatch"), tr("The current version's commit hash does not match the official " |