diff options
author | saturneric <[email protected]> | 2025-02-03 15:03:32 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2025-02-03 15:04:09 +0000 |
commit | dd8bca46a64dc01ed5a914632b1176cfb4a4ef86 (patch) | |
tree | 9096b7c68533e77b824c9929d775ce60493eb4f7 /src/ui/widgets/FilePage.cpp | |
parent | refactor: make some function names shorter (diff) | |
download | GpgFrontend-dd8bca46a64dc01ed5a914632b1176cfb4a4ef86.tar.gz GpgFrontend-dd8bca46a64dc01ed5a914632b1176cfb4a4ef86.zip |
feat: allow switch ascii mode at file page options
Diffstat (limited to 'src/ui/widgets/FilePage.cpp')
-rw-r--r-- | src/ui/widgets/FilePage.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/ui/widgets/FilePage.cpp b/src/ui/widgets/FilePage.cpp index fb27163f..605ae1d2 100644 --- a/src/ui/widgets/FilePage.cpp +++ b/src/ui/widgets/FilePage.cpp @@ -29,6 +29,7 @@ #include "ui/widgets/FilePage.h" #include "core/GpgModel.h" +#include "core/function/GlobalSettingStation.h" #include "ui/UISignalStation.h" #include "ui/main_window/MainWindow.h" #include "ui_FilePage.h" @@ -73,8 +74,19 @@ FilePage::FilePage(QWidget* parent, const QString& target_path) connect(show_system_act, &QAction::triggered, file_tree_view_, &FileTreeView::SlotShowSystemFile); option_popup_menu_->addAction(show_system_act); + + auto* switch_asc_mode_act = new QAction(tr("ASCII Mode"), this); + switch_asc_mode_act->setCheckable(true); + connect(switch_asc_mode_act, &QAction::triggered, this, + [=](bool on) { ascii_mode_ = on; }); + option_popup_menu_->addAction(switch_asc_mode_act); + ui_->optionsButton->setMenu(option_popup_menu_); + ascii_mode_ = !( + GetSettings().value("gnupg/non_ascii_at_file_operation", true).toBool()); + switch_asc_mode_act->setChecked(ascii_mode_); + connect(ui_->pathEdit, &QLineEdit::textChanged, [=]() { auto path = ui_->pathEdit->text(); auto dir = QDir(path); @@ -193,4 +205,6 @@ void FilePage::update_main_basic_opera_menu(const QStringList& selected_paths) { auto FilePage::IsBatchMode() const -> bool { return ui_->batchModeButton->isChecked(); } + +auto FilePage::IsASCIIMode() const -> bool { return ascii_mode_; } } // namespace GpgFrontend::UI |