diff options
author | saturneric <[email protected]> | 2025-01-26 18:40:43 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2025-01-26 18:40:43 +0000 |
commit | 731ec7339dc6f251a814d4aef59c05b1900ecf3f (patch) | |
tree | 3c0abf0dafb81578c97c0c9d169acbff99cb94d0 | |
parent | fix: optimums unknown fpr verifying helper (diff) | |
download | GpgFrontend-731ec7339dc6f251a814d4aef59c05b1900ecf3f.tar.gz GpgFrontend-731ec7339dc6f251a814d4aef59c05b1900ecf3f.zip |
fix: improve code compatibility
-rw-r--r-- | src/core/GpgCoreInit.cpp | 2 | ||||
-rw-r--r-- | src/core/function/gpg/GpgKeyManager.cpp | 7 | ||||
-rw-r--r-- | src/core/function/gpg/GpgKeyOpera.cpp | 11 | ||||
-rw-r--r-- | src/core/function/gpg/GpgUIDOperator.cpp | 11 | ||||
-rw-r--r-- | src/core/function/result_analyse/GpgVerifyResultAnalyse.h | 2 | ||||
-rw-r--r-- | src/core/model/GpgGenKeyInfo.h | 4 | ||||
-rw-r--r-- | src/core/model/GpgKeyTableModel.h | 6 | ||||
-rw-r--r-- | src/core/module/GlobalModuleContext.cpp | 2 | ||||
-rw-r--r-- | src/core/struct/cache_object/FavoriteKeyPairsByKeyDatabaseCO.h | 2 | ||||
-rw-r--r-- | src/core/typedef/GpgTypedef.h | 2 | ||||
-rw-r--r-- | src/core/utils/GpgUtils.cpp | 2 | ||||
-rw-r--r-- | src/ui/dialog/settings/SettingsGeneral.h | 2 | ||||
-rw-r--r-- | src/ui/main_window/MainWindow.h | 16 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowFileSlotFunction.cpp | 18 | ||||
-rw-r--r-- | src/ui/model/GpgKeyTableProxyModel.h | 2 | ||||
-rw-r--r-- | src/ui/struct/GpgOperaResultContext.h | 26 | ||||
-rw-r--r-- | src/ui/widgets/FilePage.cpp | 5 | ||||
-rw-r--r-- | src/ui/widgets/FilePage.h | 4 | ||||
-rw-r--r-- | src/ui/widgets/FileTreeView.cpp | 4 | ||||
-rw-r--r-- | src/ui/widgets/FileTreeView.h | 10 |
20 files changed, 56 insertions, 82 deletions
diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp index 5c535319..86d68af4 100644 --- a/src/core/GpgCoreInit.cpp +++ b/src/core/GpgCoreInit.cpp @@ -54,7 +54,7 @@ auto VerifyGpgconfPath(const QFileInfo& gnupg_install_fs_path) -> bool { gnupg_install_fs_path.isFile(); } -auto SearchGpgconfPath(const QList<QString>& candidate_paths) -> QString { +auto SearchGpgconfPath(const QStringList& candidate_paths) -> QString { for (const auto& path : candidate_paths) { if (VerifyGpgconfPath(QFileInfo(path))) { // return a unify path diff --git a/src/core/function/gpg/GpgKeyManager.cpp b/src/core/function/gpg/GpgKeyManager.cpp index 674a3884..afa775eb 100644 --- a/src/core/function/gpg/GpgKeyManager.cpp +++ b/src/core/function/gpg/GpgKeyManager.cpp @@ -271,13 +271,8 @@ auto GpgKeyManager::RevokeSubkey(const GpgKey& key, int subkey_index, } // dealing with reason text -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 4) - auto reason_text_lines = SecureCreateSharedObject<QList<QString>>( + auto reason_text_lines = SecureCreateSharedObject<QStringList>( reason_text.split('\n', Qt::SkipEmptyParts).toVector()); -#else - auto reason_text_lines = SecureCreateSharedObject<QVector<QString>>( - reason_text.split('\n', Qt::SkipEmptyParts).toVector()); -#endif AutomatonNextStateHandler next_state_handler = [](AutomatonState state, QString status, QString args) { diff --git a/src/core/function/gpg/GpgKeyOpera.cpp b/src/core/function/gpg/GpgKeyOpera.cpp index 92a969ae..800a6708 100644 --- a/src/core/function/gpg/GpgKeyOpera.cpp +++ b/src/core/function/gpg/GpgKeyOpera.cpp @@ -112,15 +112,8 @@ void GpgKeyOpera::GenerateRevokeCert(const GpgKey& key, << "text:" << revocation_reason_text; // dealing with reason text -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 4) - auto reason_text_lines = - GpgFrontend::SecureCreateSharedObject<QList<QString>>( - revocation_reason_text.split('\n', Qt::SkipEmptyParts).toVector()); -#else - auto reason_text_lines = - GpgFrontend::SecureCreateSharedObject<QVector<QString>>( - revocation_reason_text.split('\n', Qt::SkipEmptyParts).toVector()); -#endif + auto reason_text_lines = GpgFrontend::SecureCreateSharedObject<QStringList>( + revocation_reason_text.split('\n', Qt::SkipEmptyParts).toVector()); const auto app_path = Module::RetrieveRTValueTypedOrDefault<>( "core", "gpgme.ctx.app_path", QString{}); diff --git a/src/core/function/gpg/GpgUIDOperator.cpp b/src/core/function/gpg/GpgUIDOperator.cpp index 3fc506f4..e87a710d 100644 --- a/src/core/function/gpg/GpgUIDOperator.cpp +++ b/src/core/function/gpg/GpgUIDOperator.cpp @@ -155,15 +155,8 @@ auto GpgUIDOperator::RevokeUID(const GpgKey& key, int uid_index, } // dealing with reason text -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 4) - auto reason_text_lines = - GpgFrontend::SecureCreateSharedObject<QList<QString>>( - reason_text.split('\n', Qt::SkipEmptyParts).toVector()); -#else - auto reason_text_lines = - GpgFrontend::SecureCreateSharedObject<QVector<QString>>( - reason_text.split('\n', Qt::SkipEmptyParts).toVector()); -#endif + auto reason_text_lines = GpgFrontend::SecureCreateSharedObject<QStringList>( + reason_text.split('\n', Qt::SkipEmptyParts).toVector()); AutomatonNextStateHandler next_state_handler = [](AutomatonState state, QString status, diff --git a/src/core/function/result_analyse/GpgVerifyResultAnalyse.h b/src/core/function/result_analyse/GpgVerifyResultAnalyse.h index b5f681ab..719bb107 100644 --- a/src/core/function/result_analyse/GpgVerifyResultAnalyse.h +++ b/src/core/function/result_analyse/GpgVerifyResultAnalyse.h @@ -65,7 +65,7 @@ class GPGFRONTEND_CORE_EXPORT GpgVerifyResultAnalyse : public GpgResultAnalyse { /** * @brief Get the Unknown Signatures object * - * @return QList<QString> + * @return QStringList */ [[nodiscard]] auto GetUnknownSignatures() const -> QStringList; diff --git a/src/core/model/GpgGenKeyInfo.h b/src/core/model/GpgGenKeyInfo.h index 4092c8e9..460dffc6 100644 --- a/src/core/model/GpgGenKeyInfo.h +++ b/src/core/model/GpgGenKeyInfo.h @@ -48,14 +48,14 @@ class GPGFRONTEND_CORE_EXPORT GenKeyInfo { /** * @brief Get the Supported Key Algo object * - * @return const QContainer<QString>& + * @return const QContainer<KeyGenAlgo>& */ static auto GetSupportedKeyAlgo() -> const QContainer<KeyGenAlgo> &; /** * @brief Get the Supported Subkey Algo object * - * @return const QContainer<QString>& + * @return const QContainer<KeyGenAlgo>& */ static auto GetSupportedSubkeyAlgo() -> const QContainer<KeyGenAlgo> &; diff --git a/src/core/model/GpgKeyTableModel.h b/src/core/model/GpgKeyTableModel.h index cc5704e5..0529bf7b 100644 --- a/src/core/model/GpgKeyTableModel.h +++ b/src/core/model/GpgKeyTableModel.h @@ -216,11 +216,7 @@ class GPGFRONTEND_CORE_EXPORT GpgKeyTableModel : public QAbstractTableModel { QStringList column_headers_; int gpg_context_channel_; -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 4) - QList<bool> key_check_state_; -#else - QVector<bool> key_check_state_; -#endif + QContainer<bool> key_check_state_; }; } // namespace GpgFrontend
\ No newline at end of file diff --git a/src/core/module/GlobalModuleContext.cpp b/src/core/module/GlobalModuleContext.cpp index 71ea85d2..932fcac1 100644 --- a/src/core/module/GlobalModuleContext.cpp +++ b/src/core/module/GlobalModuleContext.cpp @@ -352,7 +352,7 @@ class GlobalModuleContext::Impl { bool registered; bool activate; bool integrated; - QList<QString> listening_event_ids; + QStringList listening_event_ids; }; using ModuleRegisterInfoPtr = std::shared_ptr<ModuleRegisterInfo>; diff --git a/src/core/struct/cache_object/FavoriteKeyPairsByKeyDatabaseCO.h b/src/core/struct/cache_object/FavoriteKeyPairsByKeyDatabaseCO.h index 4722dd56..25618b45 100644 --- a/src/core/struct/cache_object/FavoriteKeyPairsByKeyDatabaseCO.h +++ b/src/core/struct/cache_object/FavoriteKeyPairsByKeyDatabaseCO.h @@ -31,7 +31,7 @@ namespace GpgFrontend { struct FavoriteKeyPairsByKeyDatabaseCO { - QList<QString> key_ids; + QStringList key_ids; FavoriteKeyPairsByKeyDatabaseCO() = default; diff --git a/src/core/typedef/GpgTypedef.h b/src/core/typedef/GpgTypedef.h index fb315215..c052b6a2 100644 --- a/src/core/typedef/GpgTypedef.h +++ b/src/core/typedef/GpgTypedef.h @@ -49,7 +49,7 @@ using GpgErrorDesc = QPair<QString, QString>; using KeyId = QString; using SubkeyId = QString; using KeyIdArgsList = QStringList; ///< -using UIDArgsList = QContainer<QString>; ///< +using UIDArgsList = QStringList; ///< using SignIdArgsList = QContainer<QPair<QString, QString>>; ///< using KeyArgsList = QContainer<GpgKey>; ///< using GpgKeyLinkList = QContainer<GpgKey>; ///< diff --git a/src/core/utils/GpgUtils.cpp b/src/core/utils/GpgUtils.cpp index c4478f6f..bfbee963 100644 --- a/src/core/utils/GpgUtils.cpp +++ b/src/core/utils/GpgUtils.cpp @@ -268,7 +268,7 @@ auto VerifyKeyDatabasePath(const QFileInfo& key_database_fs_path) -> bool { key_database_fs_path.isDir(); } -auto SearchKeyDatabasePath(const QList<QString>& candidate_paths) -> QString { +auto SearchKeyDatabasePath(const QStringList& candidate_paths) -> QString { for (const auto& path : candidate_paths) { if (VerifyKeyDatabasePath(QFileInfo(path))) { // return a unify path diff --git a/src/ui/dialog/settings/SettingsGeneral.h b/src/ui/dialog/settings/SettingsGeneral.h index 0739f466..2bd717d0 100644 --- a/src/ui/dialog/settings/SettingsGeneral.h +++ b/src/ui/dialog/settings/SettingsGeneral.h @@ -82,7 +82,7 @@ class GeneralTab : public QWidget { private: std::shared_ptr<Ui_GeneralSettings> ui_; ///< QHash<QString, QString> lang_; ///< - QContainer<QString> key_ids_list_; ///< + QStringList key_ids_list_; ///< KeyList* m_key_list_{}; ///< }; } // namespace GpgFrontend::UI diff --git a/src/ui/main_window/MainWindow.h b/src/ui/main_window/MainWindow.h index cc3ffd0e..8f8cd05e 100644 --- a/src/ui/main_window/MainWindow.h +++ b/src/ui/main_window/MainWindow.h @@ -214,28 +214,28 @@ class MainWindow : public GeneralMainWindow { /** * @details Open dialog for encrypting file. */ - void SlotFileEncrypt(const QContainer<QString>& paths); + void SlotFileEncrypt(const QStringList& paths); /** * @brief * * @param path */ - void SlotFileDecrypt(const QContainer<QString>& paths); + void SlotFileDecrypt(const QStringList& paths); /** * @brief * * @param path */ - void SlotFileSign(const QContainer<QString>& paths); + void SlotFileSign(const QStringList& paths); /** * @brief * * @param path */ - void SlotFileVerify(const QContainer<QString>& paths); + void SlotFileVerify(const QStringList& paths); /** * @brief @@ -249,14 +249,14 @@ class MainWindow : public GeneralMainWindow { * * @param path */ - void SlotFileEncryptSign(const QContainer<QString>& paths); + void SlotFileEncryptSign(const QStringList& paths); /** * @brief * * @param path */ - void SlotFileDecryptVerify(const QContainer<QString>& paths); + void SlotFileDecryptVerify(const QStringList& paths); /** * @details get value of member restartNeeded to needed. @@ -604,7 +604,7 @@ class MainWindow : public GeneralMainWindow { * @return true * @return false */ - auto check_read_file_paths_helper(const QContainer<QString>& paths) -> bool; + auto check_read_file_paths_helper(const QStringList& paths) -> bool; /** * @brief @@ -613,7 +613,7 @@ class MainWindow : public GeneralMainWindow { * @return true * @return false */ - auto check_write_file_paths_helper(const QContainer<QString>& paths) -> bool; + auto check_write_file_paths_helper(const QStringList& paths) -> bool; /** * @brief diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp index baf21396..7958505b 100644 --- a/src/ui/main_window/MainWindowFileSlotFunction.cpp +++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp @@ -45,7 +45,7 @@ namespace GpgFrontend::UI { -auto MainWindow::check_read_file_paths_helper(const QContainer<QString>& paths) +auto MainWindow::check_read_file_paths_helper(const QStringList& paths) -> bool { QStringList invalid_files; for (const auto& path : paths) { @@ -70,8 +70,8 @@ auto MainWindow::check_read_file_paths_helper(const QContainer<QString>& paths) return true; } -auto MainWindow::check_write_file_paths_helper( - const QContainer<QString>& o_paths) -> bool { +auto MainWindow::check_write_file_paths_helper(const QStringList& o_paths) + -> bool { for (const auto& o_path : o_paths) { if (QFile::exists(o_path)) { auto out_file_name = tr("The target file %1 already exists, " @@ -303,7 +303,7 @@ void MainWindow::build_operas_directory_encrypt( } } -void MainWindow::SlotFileEncrypt(const QContainer<QString>& paths) { +void MainWindow::SlotFileEncrypt(const QStringList& paths) { auto contexts = QSharedPointer<GpgOperaContexts>::create(); bool const non_ascii_at_file_operation = @@ -456,7 +456,7 @@ void MainWindow::build_operas_archive_decrypt( } } -void MainWindow::SlotFileDecrypt(const QContainer<QString>& paths) { +void MainWindow::SlotFileDecrypt(const QStringList& paths) { auto contexts = QSharedPointer<GpgOperaContexts>::create(); contexts->ascii = true; @@ -530,7 +530,7 @@ void MainWindow::build_operas_file_sign( } } -void MainWindow::SlotFileSign(const QContainer<QString>& paths) { +void MainWindow::SlotFileSign(const QStringList& paths) { auto contexts = QSharedPointer<GpgOperaContexts>::create(); bool const non_ascii_at_file_operation = @@ -612,7 +612,7 @@ void MainWindow::build_operas_file_verify( } } -void MainWindow::SlotFileVerify(const QContainer<QString>& paths) { +void MainWindow::SlotFileVerify(const QStringList& paths) { auto contexts = QSharedPointer<GpgOperaContexts>::create(); if (!check_read_file_paths_helper(paths)) return; @@ -764,7 +764,7 @@ void MainWindow::build_operas_directory_encrypt_sign( } } -void MainWindow::SlotFileEncryptSign(const QContainer<QString>& paths) { +void MainWindow::SlotFileEncryptSign(const QStringList& paths) { auto contexts = QSharedPointer<GpgOperaContexts>::create(); bool const non_ascii_at_file_operation = @@ -937,7 +937,7 @@ void MainWindow::build_operas_archive_decrypt_verify( } } -void MainWindow::SlotFileDecryptVerify(const QContainer<QString>& paths) { +void MainWindow::SlotFileDecryptVerify(const QStringList& paths) { auto contexts = QSharedPointer<GpgOperaContexts>::create(); contexts->ascii = true; diff --git a/src/ui/model/GpgKeyTableProxyModel.h b/src/ui/model/GpgKeyTableProxyModel.h index dd086ba9..bad1aa97 100644 --- a/src/ui/model/GpgKeyTableProxyModel.h +++ b/src/ui/model/GpgKeyTableProxyModel.h @@ -95,7 +95,7 @@ class GpgKeyTableProxyModel : public QSortFilterProxyModel { GpgKeyTableDisplayMode display_mode_; GpgKeyTableColumn filter_columns_; QString filter_keywords_; - QList<QString> favorite_key_ids_; + QStringList favorite_key_ids_; KeyFilter custom_filter_; QFont default_font_; diff --git a/src/ui/struct/GpgOperaResultContext.h b/src/ui/struct/GpgOperaResultContext.h index f0073c7e..ca68dde1 100644 --- a/src/ui/struct/GpgOperaResultContext.h +++ b/src/ui/struct/GpgOperaResultContext.h @@ -36,8 +36,8 @@ namespace GpgFrontend::UI { struct GpgOperaCategory { - QContainer<QString> paths; - QContainer<QString> o_paths; + QStringList paths; + QStringList o_paths; }; struct GpgOperaContext { @@ -45,15 +45,15 @@ struct GpgOperaContext { QContainer<GpgOperaResult>& opera_results; GpgKeyList& keys; GpgKeyList& singer_keys; - QContainer<QString>& unknown_fprs; + QStringList& unknown_fprs; bool ascii; - QContainer<QString> paths; - QContainer<QString> o_paths; + QStringList paths; + QStringList o_paths; GpgOperaContext(QContainer<OperaWaitingCb>& operas, QContainer<GpgOperaResult>& opera_results, GpgKeyList& keys, - GpgKeyList& singer_keys, QContainer<QString>& unknown_fprs) + GpgKeyList& singer_keys, QStringList& unknown_fprs) : operas(operas), opera_results(opera_results), keys(keys), @@ -66,23 +66,23 @@ struct GpgOperaContexts { QContainer<GpgOperaResult> opera_results; GpgKeyList keys; GpgKeyList singer_keys; - QContainer<QString> unknown_fprs; + QStringList unknown_fprs; bool ascii; QMap<int, GpgOperaCategory> categories; - auto GetContextPath(int category) -> QContainer<QString>& { + auto GetContextPath(int category) -> QStringList& { if (!categories.contains(category)) categories[category] = {}; return categories[category].paths; } - auto GetContextOutPath(int category) -> QContainer<QString>& { + auto GetContextOutPath(int category) -> QStringList& { if (!categories.contains(category)) categories[category] = {}; return categories[category].o_paths; } - auto GetAllPath() -> QContainer<QString> { - QContainer<QString> res; + auto GetAllPath() -> QStringList { + QStringList res; for (auto& category : categories) { res.append(category.paths); @@ -90,8 +90,8 @@ struct GpgOperaContexts { return res; } - auto GetAllOutPath() -> QContainer<QString> { - QContainer<QString> res; + auto GetAllOutPath() -> QStringList { + QStringList res; for (auto& category : categories) { res.append(category.o_paths); diff --git a/src/ui/widgets/FilePage.cpp b/src/ui/widgets/FilePage.cpp index 5f6fbae0..309bf376 100644 --- a/src/ui/widgets/FilePage.cpp +++ b/src/ui/widgets/FilePage.cpp @@ -111,7 +111,7 @@ FilePage::FilePage(QWidget* parent, const QString& target_path) &UISignalStation::SignalMainWindowUpdateBasicOperaMenu); } -auto FilePage::GetSelected() const -> QContainer<QString> { +auto FilePage::GetSelected() const -> QStringList { return file_tree_view_->GetSelectedPaths(); } @@ -126,8 +126,7 @@ void FilePage::keyPressEvent(QKeyEvent* event) { } } -void FilePage::update_main_basic_opera_menu( - const QContainer<QString>& selected_paths) { +void FilePage::update_main_basic_opera_menu(const QStringList& selected_paths) { if (selected_paths.isEmpty()) { emit SignalMainWindowUpdateBasicOperaMenu(MainWindow::OperationMenu::kNone); return; diff --git a/src/ui/widgets/FilePage.h b/src/ui/widgets/FilePage.h index c6d9ec99..ae84e246 100644 --- a/src/ui/widgets/FilePage.h +++ b/src/ui/widgets/FilePage.h @@ -55,7 +55,7 @@ class FilePage : public QWidget { * * @return QString */ - [[nodiscard]] auto GetSelected() const -> QContainer<QString>; + [[nodiscard]] auto GetSelected() const -> QStringList; /** * @brief @@ -132,7 +132,7 @@ class FilePage : public QWidget { * @brief * */ - void update_main_basic_opera_menu(const QContainer<QString>&); + void update_main_basic_opera_menu(const QStringList&); }; } // namespace GpgFrontend::UI diff --git a/src/ui/widgets/FileTreeView.cpp b/src/ui/widgets/FileTreeView.cpp index aa29d040..d50f8726 100644 --- a/src/ui/widgets/FileTreeView.cpp +++ b/src/ui/widgets/FileTreeView.cpp @@ -147,9 +147,7 @@ auto FileTreeView::GetPathByClickPoint(const QPoint& point) -> QString { return dir_model_->fileInfo(index).absoluteFilePath(); } -auto FileTreeView::GetSelectedPaths() -> QContainer<QString> { - return selected_paths_; -} +auto FileTreeView::GetSelectedPaths() -> QStringList { return selected_paths_; } auto FileTreeView::SlotDeleteSelectedItem() -> void { QModelIndex const index = this->currentIndex(); diff --git a/src/ui/widgets/FileTreeView.h b/src/ui/widgets/FileTreeView.h index aa6c85dc..0c9c0749 100644 --- a/src/ui/widgets/FileTreeView.h +++ b/src/ui/widgets/FileTreeView.h @@ -55,7 +55,7 @@ class FileTreeView : public QTreeView { * * @return QString */ - auto GetSelectedPaths() -> QContainer<QString>; + auto GetSelectedPaths() -> QStringList; /** * @brief Get the Path By Click Point object @@ -116,7 +116,7 @@ class FileTreeView : public QTreeView { * @brief * */ - void SignalSelectedChanged(const QContainer<QString>&); + void SignalSelectedChanged(const QStringList&); /** * @brief @@ -234,9 +234,9 @@ class FileTreeView : public QTreeView { void slot_adjust_column_widths(); private: - QFileSystemModel* dir_model_; ///< - QString current_path_; ///< - QContainer<QString> selected_paths_; ///< + QFileSystemModel* dir_model_; ///< + QString current_path_; ///< + QStringList selected_paths_; ///< QMenu* popup_menu_; QMenu* new_item_action_menu_; |