GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
MainWindow.h
1 
29 #ifndef __GPGWIN_H__
30 #define __GPGWIN_H__
31 
32 #include "core/GpgConstants.h"
33 #include "core/function/result_analyse/GpgDecryptResultAnalyse.h"
34 #include "core/function/result_analyse/GpgEncryptResultAnalyse.h"
35 #include "core/function/result_analyse/GpgSignResultAnalyse.h"
36 #include "ui/GpgFrontendUI.h"
37 #include "ui/KeyMgmt.h"
38 #include "ui/dialog/WaitingDialog.h"
39 #include "ui/dialog/Wizard.h"
40 #include "ui/help/AboutDialog.h"
41 #include "ui/import_export/KeyUploadDialog.h"
42 #include "ui/settings/SettingsDialog.h"
43 #include "ui/widgets/FindWidget.h"
44 #include "ui/widgets/InfoBoardWidget.h"
45 #include "ui/widgets/TextEdit.h"
46 
47 namespace GpgFrontend::UI {
52 class MainWindow : public QMainWindow {
53  Q_OBJECT
54 
55  public:
56 
57  struct CryptoMenu{
58  using OperationType = unsigned int;
59 
60  static constexpr OperationType None = 0;
61  static constexpr OperationType Encrypt = 1 << 0;
62  static constexpr OperationType Sign = 1 << 1;
63  static constexpr OperationType Decrypt = 1 << 2;
64  static constexpr OperationType Verify = 1 << 3;
65  static constexpr OperationType EncryptAndSign = 1 << 4;
66  static constexpr OperationType DecryptAndVerify = 1 << 5;
67  };
68 
73  MainWindow();
74 
78  void Init() noexcept;
79 
83  void SetCryptoMenuStatus(CryptoMenu::OperationType type);
84 
85  signals:
86 
90  void SignalLoaded();
91 
92 
93  public slots:
94 
98  void SlotSetStatusBarText(const QString& text);
99 
100  protected:
106  void closeEvent(QCloseEvent* event) override;
107 
108  public slots:
109 
113  void SlotOpenFile(QString& path);
114 
118  void SlotFileEncrypt();
119 
123  void SlotFileDecrypt();
124 
128  void SlotFileSign();
129 
133  void SlotFileVerify();
134 
138  void SlotFileEncryptSign();
139 
143  void SlotFileDecryptVerify();
144 
149  void SlotSetRestartNeeded(bool needed);
150 
151  private slots:
152 
157  void slot_encrypt();
158 
163  void slot_encrypt_sign();
164 
169  void slot_decrypt();
170 
175  void slot_sign();
176 
182  void slot_verify();
183 
188  void slot_decrypt_verify();
189 
193  void slot_show_key_details();
194 
199 
203  void upload_key_to_server();
204 
208  void slot_find();
209 
213  void slot_start_wizard();
214 
219 
224 
230 
235 
239  void slot_open_file_tab();
240 
245 
251 
255  void slot_cut_pgp_header();
256 
260  void slot_add_pgp_header();
261 
266  void slot_disable_tab_actions(int number);
267 
271  void slot_version_upgrade(const SoftwareVersion& version);
272 
273  private:
278  void create_actions();
279 
283  void create_menus();
284 
288  void create_tool_bars();
289 
293  void create_status_bar();
294 
298  void create_dock_windows();
299 
303  void create_attachment_dock();
304 
308  void close_attachment_dock();
309 
313  void restore_settings();
314 
318  void save_settings();
319 
323  [[nodiscard]] bool get_restart_needed() const;
324 
326  QMenu* file_menu_{};
327  QMenu* edit_menu_{};
328  QMenu* crypt_menu_{};
329  QMenu* help_menu_{};
330  QMenu* key_menu_{};
331  QMenu* view_menu_{};
332  QMenu* import_key_menu_{};
333 #ifdef SMTP_SUPPORT
334  QMenu* email_menu_{};
335 #endif
336 
338  QToolBar* crypt_tool_bar_{};
339  QToolBar* file_tool_bar_{};
340  QToolBar* edit_tool_bar_{};
341  QToolBar*
343  QToolBar* key_tool_bar_{};
344  QToolButton*
346  QDockWidget* key_list_dock_{};
347  QDockWidget* attachment_dock_{};
348  QDockWidget* info_board_dock_{};
349 
350  QAction* new_tab_act_{};
351  QAction* switch_tab_up_act_{};
352  QAction* switch_tab_down_act_{};
353  QAction* open_act_{};
354  QAction* browser_act_{};
355  QAction* save_act_{};
356  QAction* save_as_act_{};
357  QAction* print_act_{};
358  QAction* close_tab_act_{};
359  QAction* quit_act_{};
360  QAction* encrypt_act_{};
361  QAction* encrypt_sign_act_{};
362  QAction* decrypt_verify_act_{};
363  QAction* decrypt_act_{};
364  QAction* sign_act_{};
365  QAction* verify_act_{};
368 
370  QAction*
373  QAction* open_key_management_act_{};
375  QAction* copy_act_{};
376  QAction* quote_act_{};
377  QAction* cut_act_{};
378  QAction* paste_act_{};
379  QAction* select_all_act_{};
380  QAction* find_act_{};
381  QAction* undo_act_{};
382  QAction* redo_act_{};
383  QAction* zoom_in_act_{};
384  QAction* zoom_out_act_{};
385  QAction* about_act_{};
386  QAction* check_update_act_{};
387  QAction* translate_act_{};
388  QAction* open_settings_act_{};
390  QAction* start_wizard_act_{};
391  QAction* cut_pgp_header_act_{};
392  QAction* add_pgp_header_act_{};
393  QAction* import_key_from_file_act_{};
394  QAction* import_key_from_clipboard_act_{};
395  QAction* import_key_from_key_server_act_{};
396 
397  QLabel* status_bar_icon_{};
398 
399  KeyList* m_key_list_{};
400  InfoBoardWidget* info_board_{};
401 
402  bool attachment_dock_created_{};
403  bool restart_needed_{};
404  bool prohibit_update_checking_ = false;
405 };
406 
407 } // namespace GpgFrontend::UI
408 
409 #endif // __GPGWIN_H__
GpgFrontend::UI::MainWindow::slot_verify
void slot_verify()
Definition: MainWindowSlotFunction.cpp:238
GpgFrontend::UI::MainWindow::quote_act_
QAction * quote_act_
Action to quote text.
Definition: MainWindow.h:376
GpgFrontend::UI::MainWindow::upload_key_to_server
void upload_key_to_server()
Definition: MainWindowSlotFunction.cpp:497
GpgFrontend::UI
Definition: VerifyDetailsDialog.cpp:33
GpgFrontend::UI::MainWindow::save_settings
void save_settings()
Definition: MainWindow.cpp:272
GpgFrontend::UI::MainWindow::SlotFileEncrypt
void SlotFileEncrypt()
Definition: MainWindowFileSlotFunction.cpp:151
GpgFrontend::UI::MainWindow::slot_open_file_tab
void slot_open_file_tab()
Definition: MainWindowSlotUI.cpp:58
GpgFrontend::UI::MainWindow::redo_act_
QAction * redo_act_
Action to redo last action.
Definition: MainWindow.h:382
GpgFrontend::UI::TextEdit::LoadFile
void LoadFile(const QString &fileName)
Definition: TextEdit.cpp:415
GpgFrontend::UI::TextEdit::MaybeSaveAnyTab
bool MaybeSaveAnyTab()
Definition: TextEdit.cpp:304
GpgFrontend::UI::MainWindow::quit_act_
QAction * quit_act_
Action to quit application.
Definition: MainWindow.h:359
GpgFrontend::UI::MainWindow::cut_pgp_header_act_
QAction * cut_pgp_header_act_
Action for cutting the PGP header.
Definition: MainWindow.h:391
GpgFrontend::UI::MainWindow::create_actions
void create_actions()
Definition: MainWindowUI.cpp:34
GpgFrontend::GlobalSettingStation::SyncSettings
void SyncSettings() noexcept
sync the settings to the file
Definition: GlobalSettingStation.cpp:33
GpgFrontend::UI::MainWindow::SlotFileDecryptVerify
void SlotFileDecryptVerify()
Definition: MainWindowFileSlotFunction.cpp:662
GpgFrontend::UI::MainWindow::slot_cut_pgp_header
void slot_cut_pgp_header()
Definition: MainWindowSlotUI.cpp:161
GpgFrontend::UI::MainWindow::browser_act_
QAction * browser_act_
Action to open file browser.
Definition: MainWindow.h:354
GpgFrontend::SingletonFunctionObject< GlobalSettingStation >::GetInstance
static GlobalSettingStation & GetInstance(int channel=GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL)
Get the Instance object.
Definition: GpgFunctionObject.h:57
GpgFrontend::UI::MainWindow::key_tool_bar_
QToolBar * key_tool_bar_
Toolbar holding key operations.
Definition: MainWindow.h:343
GpgFrontend::UI::MainWindow::view_menu_
QMenu * view_menu_
Submenu for view operations.
Definition: MainWindow.h:331
GpgFrontend::UI::SoftwareVersion
Definition: SoftwareVersion.h:39
GpgFrontend::GlobalSettingStation::GetUISettings
libconfig::Setting & GetUISettings() noexcept
Definition: GlobalSettingStation.h:68
GpgFrontend::UI::KeyList::SetChecked
void SetChecked(KeyIdArgsListPtr key_ids)
Set the Checked object.
Definition: KeyList.cpp:240
GpgFrontend::UI::MainWindow::file_menu_
QMenu * file_menu_
Submenu for file-operations.
Definition: MainWindow.h:326
GpgFrontend::UI::MainWindow::sign_act_
QAction * sign_act_
Action to sign text.
Definition: MainWindow.h:364
GpgFrontend::UI::MainWindow::slot_append_selected_keys
void slot_append_selected_keys()
Definition: MainWindowSlotFunction.cpp:450
GpgFrontend::UI::MainWindow::verify_act_
QAction * verify_act_
Action to verify text.
Definition: MainWindow.h:365
GpgFrontend::UI::MainWindow::about_act_
QAction * about_act_
Action to open about dialog.
Definition: MainWindow.h:385
GpgFrontend::UI::MainWindow::file_tool_bar_
QToolBar * file_tool_bar_
Toolbar holding file actions.
Definition: MainWindow.h:339
GpgFrontend::UI::MainWindow::refresh_keys_from_key_server
void refresh_keys_from_key_server()
Definition: MainWindowSlotFunction.cpp:488
GpgFrontend::UI::MainWindow::zoom_in_act_
QAction * zoom_in_act_
Action to zoom in.
Definition: MainWindow.h:383
GpgFrontend::UI::MainWindow::create_menus
void create_menus()
Definition: MainWindowUI.cpp:315
GpgFrontend::UI::MainWindow::cut_act_
QAction * cut_act_
Action to cut text.
Definition: MainWindow.h:377
GpgFrontend::UI::TextEdit
TextEdit class.
Definition: TextEdit.h:41
GpgFrontend::UI::MainWindow::slot_start_wizard
void slot_start_wizard()
Definition: MainWindowSlotUI.cpp:40
GpgFrontend::UI::MainWindow::create_dock_windows
void create_dock_windows()
Definition: MainWindowUI.cpp:445
GpgFrontend::UI::MainWindow::copy_mail_address_to_clipboard_act_
QAction * copy_mail_address_to_clipboard_act_
Definition: MainWindow.h:372
GpgFrontend::UI::KeyList::GetChecked
KeyIdArgsListPtr GetChecked()
Get the Checked object.
Definition: KeyList.cpp:182
GpgFrontend::UI::MainWindow::switch_tab_up_act_
QAction * switch_tab_up_act_
Action to switch tab up.
Definition: MainWindow.h:351
GpgFrontend::UI::MainWindow::SlotSetRestartNeeded
void SlotSetRestartNeeded(bool needed)
Definition: MainWindowSlotUI.cpp:185
GpgFrontend::UI::MainWindow::slot_clean_double_line_breaks
void slot_clean_double_line_breaks()
Definition: MainWindowSlotUI.cpp:137
GpgFrontend::UI::MainWindow::SlotOpenFile
void SlotOpenFile(QString &path)
Definition: MainWindowSlotFunction.cpp:504
GpgFrontend::UI::MainWindow::open_act_
QAction * open_act_
Action to open file.
Definition: MainWindow.h:353
GpgFrontend::UI::VersionCheckThread::SignalUpgradeVersion
void SignalUpgradeVersion(SoftwareVersion version)
GpgFrontend::UI::MainWindow::import_key_menu_
QMenu * import_key_menu_
Submenu for import operations.
Definition: MainWindow.h:332
GpgFrontend::UI::MainWindow::encrypt_sign_act_
QAction * encrypt_sign_act_
Action to encrypt and sign text.
Definition: MainWindow.h:361
GpgFrontend::UI::MainWindow::attachment_dock_
QDockWidget * attachment_dock_
Attachment Dock.
Definition: MainWindow.h:347
GpgFrontend::UI::MainWindow::paste_act_
QAction * paste_act_
Action to paste text.
Definition: MainWindow.h:378
GpgFrontend::UI::MainWindow::slot_encrypt
void slot_encrypt()
Definition: MainWindowSlotFunction.cpp:43
GpgFrontend::UI::KeyList::AddMenuAction
void AddMenuAction(QAction *act)
Definition: KeyList.cpp:301
GpgFrontend::UI::MainWindow::crypt_tool_bar_
QToolBar * crypt_tool_bar_
Toolbar holding crypt actions.
Definition: MainWindow.h:338
GpgFrontend::UI::MainWindow::steganography_menu_
QMenu * steganography_menu_
Submenu for steganography operations.
Definition: MainWindow.h:337
GpgFrontend::UI::SettingsObject::Check
nlohmann::json & Check(const std::string &key, const nlohmann::json &default_value)
Definition: SettingsObject.cpp:31
GpgFrontend::UI::MainWindow::zoom_out_act_
QAction * zoom_out_act_
Action to zoom out.
Definition: MainWindow.h:384
GpgFrontend::UI::MainWindow::key_list_dock_
QDockWidget * key_list_dock_
Encrypt Dock.
Definition: MainWindow.h:346
GpgFrontend::UI::MainWindow::slot_show_key_details
void slot_show_key_details()
Definition: MainWindowSlotFunction.cpp:476
GpgFrontend::UI::MainWindow::print_act_
QAction * print_act_
Action to print.
Definition: MainWindow.h:357
GpgFrontend::UI::MainWindow::SetCryptoMenuStatus
void SetCryptoMenuStatus(CryptoMenu::OperationType type)
Definition: MainWindowSlotUI.cpp:191
GpgFrontend::UI::MainWindow::slot_decrypt_verify
void slot_decrypt_verify()
Definition: MainWindowSlotFunction.cpp:375
GpgFrontend::UI::MainWindow::CryptoMenu
Definition: MainWindow.h:57
GpgFrontend::UI::MainWindow::slot_copy_mail_address_to_clipboard
void slot_copy_mail_address_to_clipboard()
Definition: MainWindowSlotFunction.cpp:463
GpgFrontend::UI::MainWindow
Definition: MainWindow.h:52
GpgFrontend::UI::MainWindow::switch_tab_down_act_
QAction * switch_tab_down_act_
Action to switch tab down.
Definition: MainWindow.h:352
GpgFrontend::UI::SettingsObject
The SettingsObject class This class is used to store settings for the application securely.
Definition: SettingsObject.h:43
GpgFrontend::UI::MainWindow::SlotFileSign
void SlotFileSign()
Definition: MainWindowFileSlotFunction.cpp:355
GpgFrontend::UI::MainWindow::close_attachment_dock
void close_attachment_dock()
Definition: MainWindow.cpp:307
GpgFrontend::UI::MainWindow::append_selected_keys_act_
QAction * append_selected_keys_act_
Action to append selected keys to edit.
Definition: MainWindow.h:371
GpgFrontend::UI::VersionCheckThread
Definition: VersionCheckThread.h:41
GpgFrontend::UI::MainWindow::check_update_act_
QAction * check_update_act_
Action to open about dialog.
Definition: MainWindow.h:386
GpgFrontend::UI::MainWindow::create_attachment_dock
void create_attachment_dock()
GpgFrontend::UI::MainWindow::create_tool_bars
void create_tool_bars()
Definition: MainWindowUI.cpp:380
GpgFrontend::UI::MainWindow::undo_act_
QAction * undo_act_
Action to undo last action.
Definition: MainWindow.h:381
GpgFrontend::UI::MainWindow::create_status_bar
void create_status_bar()
Definition: MainWindowUI.cpp:429
GpgFrontend::UI::MainWindow::slot_open_settings_dialog
void slot_open_settings_dialog()
Definition: MainWindowSlotUI.cpp:102
GpgFrontend::UI::MainWindow::start_wizard_act_
QAction * start_wizard_act_
Action to open the wizard.
Definition: MainWindow.h:390
GpgFrontend::UI::MainWindow::add_pgp_header_act_
QAction * add_pgp_header_act_
Action for adding the PGP header.
Definition: MainWindow.h:392
GpgFrontend::UI::MainWindow::slot_sign
void slot_sign()
Definition: MainWindowSlotFunction.cpp:120
GpgFrontend::UI::MainWindow::save_as_act_
QAction * save_as_act_
Action to save file as.
Definition: MainWindow.h:356
GpgFrontend::UI::MainWindow::import_button_
QToolButton * import_button_
Tool button for import dropdown menu in toolbar.
Definition: MainWindow.h:345
GpgFrontend::UI::MainWindow::SlotFileVerify
void SlotFileVerify()
Definition: MainWindowFileSlotFunction.cpp:447
GpgFrontend::UI::MainWindow::slot_disable_tab_actions
void slot_disable_tab_actions(int number)
Definition: MainWindowSlotUI.cpp:60
GpgFrontend::UI::MainWindow::get_restart_needed
bool get_restart_needed() const
return true, if restart is needed
Definition: MainWindowSlotUI.cpp:189
GpgFrontend::UI::MainWindow::find_act_
QAction * find_act_
Action to find text.
Definition: MainWindow.h:380
GpgFrontend::UI::KeyList
Definition: KeyList.h:152
GpgFrontend::UI::MainWindow::slot_open_key_management
void slot_open_key_management()
Definition: MainWindowSlotUI.cpp:52
GpgFrontend::UI::MainWindow::slot_version_upgrade
void slot_version_upgrade(const SoftwareVersion &version)
Definition: MainWindowSlotFunction.cpp:506
GpgFrontend::UI::MainWindow::decrypt_verify_act_
QAction * decrypt_verify_act_
Action to encrypt and sign text.
Definition: MainWindow.h:362
GpgFrontend::UI::MainWindow::clean_double_line_breaks_act_
QAction * clean_double_line_breaks_act_
Definition: MainWindow.h:367
GpgFrontend::UI::MainWindow::copy_act_
QAction * copy_act_
Action to copy text.
Definition: MainWindow.h:375
GpgFrontend::UI::MainWindow::restore_settings
void restore_settings()
Definition: MainWindow.cpp:146
GpgFrontend::UI::MainWindow::Init
void Init() noexcept
Definition: MainWindow.cpp:46
GpgFrontend::UI::MainWindow::slot_find
void slot_find()
Definition: MainWindowSlotFunction.cpp:226
GpgFrontend::UI::MainWindow::key_menu_
QMenu * key_menu_
Submenu for key-operations.
Definition: MainWindow.h:330
GpgFrontend::UI::MainWindow::import_key_from_edit_act_
QAction * import_key_from_edit_act_
Action to import key from edit.
Definition: MainWindow.h:366
GpgFrontend::UI::SignalStation::GetInstance
static SignalStation * GetInstance()
Get the Instance object.
Definition: SignalStation.cpp:35
GpgFrontend::UI::MainWindow::select_all_act_
QAction * select_all_act_
Action to select whole text.
Definition: MainWindow.h:379
GpgFrontend::UI::MainWindow::crypt_menu_
QMenu * crypt_menu_
Submenu for crypt-operations.
Definition: MainWindow.h:328
GpgFrontend::UI::MainWindow::edit_menu_
QMenu * edit_menu_
Submenu for text-operations.
Definition: MainWindow.h:327
GpgFrontend::UI::MainWindow::decrypt_act_
QAction * decrypt_act_
Action to decrypt text.
Definition: MainWindow.h:363
GpgFrontend::UI::MainWindow::special_edit_tool_bar_
QToolBar * special_edit_tool_bar_
Toolbar holding special edit actions.
Definition: MainWindow.h:342
GpgFrontend::UI::MainWindow::SlotFileEncryptSign
void SlotFileEncryptSign()
Definition: MainWindowFileSlotFunction.cpp:536
GpgFrontend::UI::MainWindow::encrypt_act_
QAction * encrypt_act_
Action to encrypt text.
Definition: MainWindow.h:360
GpgFrontend::UI::MainWindow::closeEvent
void closeEvent(QCloseEvent *event) override
Definition: MainWindow.cpp:316
GpgFrontend::UI::MainWindow::slot_import_key_from_edit
void slot_import_key_from_edit()
Definition: MainWindowSlotUI.cpp:46
GpgFrontend::UI::MainWindow::translate_act_
QAction * translate_act_
Action to open about dialog.
Definition: MainWindow.h:387
GpgFrontend::UI::MainWindow::SlotFileDecrypt
void SlotFileDecrypt()
Definition: MainWindowFileSlotFunction.cpp:283
GpgFrontend::UI::MainWindow::edit_
TextEdit * edit_
Tabwidget holding the edit-windows.
Definition: MainWindow.h:325
GpgFrontend::UI::MainWindow::open_settings_act_
QAction * open_settings_act_
Action to open settings dialog.
Definition: MainWindow.h:388
GpgFrontend::UI::MainWindow::slot_add_pgp_header
void slot_add_pgp_header()
Definition: MainWindowSlotUI.cpp:147
GpgFrontend::UI::MainWindow::new_tab_act_
QAction * new_tab_act_
Action to create new tab.
Definition: MainWindow.h:350
GpgFrontend::UI::MainWindow::help_menu_
QMenu * help_menu_
Submenu for help-operations.
Definition: MainWindow.h:329
GpgFrontend::UI::MainWindow::save_act_
QAction * save_act_
Action to save file.
Definition: MainWindow.h:355
GpgFrontend::UI::MainWindow::edit_tool_bar_
QToolBar * edit_tool_bar_
Toolbar holding edit actions.
Definition: MainWindow.h:340
GpgFrontend::UI::MainWindow::show_key_details_act_
QAction * show_key_details_act_
Action to open key-details dialog.
Definition: MainWindow.h:389
GpgFrontend::UI::MainWindow::close_tab_act_
QAction * close_tab_act_
Action to print.
Definition: MainWindow.h:358
GpgFrontend::UI::InfoBoardWidget
Class for handling the verify label shown at bottom of a textedit-page.
Definition: InfoBoardWidget.h:53
GpgFrontend::UI::MainWindow::slot_decrypt
void slot_decrypt()
Definition: MainWindowSlotFunction.cpp:183
GpgFrontend::UI::SignalStation::SignalRefreshStatusBar
void SignalRefreshStatusBar(const QString &message, int timeout)
GpgFrontend::UI::TextEdit::CurTextPage
PlainTextEditorPage * CurTextPage() const
Definition: TextEdit.cpp:359
GpgFrontend::UI::MainWindow::open_key_management_act_
QAction * open_key_management_act_
Action to open key management.
Definition: MainWindow.h:374
GpgFrontend::UI::MainWindow::slot_encrypt_sign
void slot_encrypt_sign()
Definition: MainWindowSlotFunction.cpp:276