GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
MainWindow.h
1 
29 #pragma once
30 
31 #include "ui/main_window/GeneralMainWindow.h"
32 
33 namespace GpgFrontend {
34 class GpgPassphraseContext;
35 }
36 
37 namespace GpgFrontend::UI {
38 
39 class KeyList;
40 class TextEdit;
41 class InfoBoardWidget;
42 
47 class MainWindow : public GeneralMainWindow {
48  Q_OBJECT
49 
50  public:
54  struct CryptoMenu {
55  using OperationType = unsigned int;
56 
57  static constexpr OperationType None = 0;
58  static constexpr OperationType Encrypt = 1 << 0;
59  static constexpr OperationType Sign = 1 << 1;
60  static constexpr OperationType Decrypt = 1 << 2;
61  static constexpr OperationType Verify = 1 << 3;
62  static constexpr OperationType EncryptAndSign = 1 << 4;
63  static constexpr OperationType DecryptAndVerify = 1 << 5;
64  };
65 
70  MainWindow();
71 
75  void Init() noexcept;
76 
77  signals:
78 
82  void SignalLoaded();
83 
87  void SignalRestartApplication(int);
88 
92  void SignalUIRefresh();
93 
97  void SignalKeyDatabaseRefresh();
98 
99  public slots:
100 
104  void SlotSetStatusBarText(const QString& text);
105 
106  protected:
112  void closeEvent(QCloseEvent* event) override;
113 
114  public slots:
115 
119  void SlotUpdateCryptoMenuStatus(unsigned int type);
120 
124  void SlotOpenFile(const QString& path);
125 
130  void SlotEncrypt();
131 
136  void SlotEncryptSign();
137 
142  void SlotDecrypt();
143 
148  void SlotSign();
149 
155  void SlotVerify();
156 
161  void SlotDecryptVerify();
162 
166  void SlotFileEncrypt(const QString&);
167 
172  void SlotDirectoryEncrypt(const QString&);
173 
179  void SlotFileDecrypt(const QString& path);
180 
186  void SlotArchiveDecrypt(const QString& path);
187 
193  void SlotFileSign(const QString& path);
194 
200  void SlotFileVerify(const QString& path);
201 
207  void SlotFileEncryptSign(const QString& path);
208 
214  void SlotDirectoryEncryptSign(const QString& path);
215 
221  void SlotFileDecryptVerify(const QString& path);
222 
228  void SlotArchiveDecryptVerify(const QString& path);
229 
234  void SlotSetRestartNeeded(int);
235 
239  void SlotRaisePinentry(QSharedPointer<GpgPassphraseContext>);
240 
241  private slots:
242 
247  void slot_refresh_current_file_view();
248 
252  void slot_show_key_details();
253 
258 
262  void upload_key_to_server();
263 
267  void slot_find();
268 
272  void slot_start_wizard();
273 
278 
283 
288  void slot_append_keys_create_datetime();
289 
294  void slot_append_keys_expire_datetime();
295 
300  void slot_append_keys_fingerprint();
301 
307 
313 
319 
324 
328  void slot_open_file_tab();
329 
334 
340 
344  void slot_cut_pgp_header();
345 
349  void slot_add_pgp_header();
350 
355  void slot_disable_tab_actions(int number);
356 
361 
365  void slot_add_key_2_favourite();
366 
370  void slot_remove_key_from_favourite();
371 
375  void slot_set_owner_trust_level_of_key();
376 
377  private:
382  void create_actions();
383 
387  void create_menus();
388 
392  void create_tool_bars();
393 
397  void create_status_bar();
398 
402  void create_dock_windows();
403 
408 
412  void close_attachment_dock();
413 
417  void restore_settings();
418 
422  void recover_editor_unsaved_pages_from_cache();
423 
427  [[nodiscard]] int get_restart_needed() const;
428 
430  QMenu* file_menu_{};
431  QMenu* edit_menu_{};
432  QMenu* crypt_menu_{};
433  QMenu* gpg_menu_{};
434  QMenu* help_menu_{};
435  QMenu* key_menu_{};
436  QMenu* view_menu_{};
437  QMenu* import_key_menu_{};
438 #ifdef SMTP_SUPPORT
439  QMenu* email_menu_{};
440 #endif
441 
443  QToolBar* crypt_tool_bar_{};
444  QToolBar* file_tool_bar_{};
445  QToolBar* edit_tool_bar_{};
446  QToolBar*
448  QToolBar* key_tool_bar_{};
449  QToolButton*
451  QDockWidget* key_list_dock_{};
452  QDockWidget* attachment_dock_{};
453  QDockWidget* info_board_dock_{};
454 
455  QAction* new_tab_act_{};
456  QAction* switch_tab_up_act_{};
457  QAction* switch_tab_down_act_{};
458  QAction* open_act_{};
459  QAction* browser_act_{};
460  QAction* save_act_{};
461  QAction* save_as_act_{};
462  QAction* print_act_{};
463  QAction* close_tab_act_{};
464  QAction* quit_act_{};
465  QAction* encrypt_act_{};
466  QAction* encrypt_sign_act_{};
467  QAction* decrypt_verify_act_{};
468  QAction* decrypt_act_{};
469  QAction* sign_act_{};
470  QAction* verify_act_{};
474 
475  QAction* gnupg_controller_open_act_{};
476  QAction* clean_gpg_password_cache_act_{};
477  QAction* reload_components_act_{};
478  QAction* restart_components_act_{};
479 
480  QAction*
482  QAction* append_key_fingerprint_to_editor_act_{};
483  QAction* append_key_create_date_to_editor_act_{};
484  QAction* append_key_expire_date_to_editor_act_{};
485 
488  QAction* copy_key_id_to_clipboard_act_{};
489  QAction* copy_key_default_uid_to_clipboard_act_{};
490 
491  QAction* add_key_2_favourtie_act_{};
492  QAction* remove_key_from_favourtie_act_{};
493  QAction* set_owner_trust_of_key_act_{};
494 
496  QAction* copy_act_{};
497  QAction* quote_act_{};
498  QAction* cut_act_{};
499  QAction* paste_act_{};
500  QAction* select_all_act_{};
501  QAction* find_act_{};
502  QAction* undo_act_{};
503  QAction* redo_act_{};
504  QAction* zoom_in_act_{};
505  QAction* zoom_out_act_{};
506  QAction* about_act_{};
507  QAction* check_update_act_{};
508  QAction* translate_act_{};
509  QAction* gnupg_act_{};
510  QAction* open_settings_act_{};
512  QAction* start_wizard_act_{};
513  QAction* cut_pgp_header_act_{};
514  QAction* add_pgp_header_act_{};
515  QAction* import_key_from_file_act_{};
516  QAction* import_key_from_clipboard_act_{};
517  QAction* import_key_from_key_server_act_{};
518 
519  QLabel* status_bar_icon_{};
520 
521  KeyList* m_key_list_{};
522  InfoBoardWidget* info_board_{};
523 
524  bool attachment_dock_created_{};
525  int restart_needed_{0};
526  bool prohibit_update_checking_ = false;
527 };
528 
529 } // namespace GpgFrontend::UI
Definition: GpgPassphraseContext.h:35
Definition: GeneralMainWindow.h:38
Definition: MainWindow.h:47
QAction * import_key_from_edit_act_
Action to import key from edit.
Definition: MainWindow.h:471
void slot_show_key_details()
Definition: MainWindowSlotFunction.cpp:189
void create_dock_windows()
Definition: MainWindowUI.cpp:677
void SlotEncrypt()
Definition: MainWindowGpgOperaFunction.cpp:46
void Init() noexcept
Definition: MainWindow.cpp:55
QAction * close_tab_act_
Action to print.
Definition: MainWindow.h:463
void create_actions()
Definition: MainWindowUI.cpp:41
QAction * clean_double_line_breaks_act_
Definition: MainWindow.h:472
QAction * sign_act_
Action to sign text.
Definition: MainWindow.h:469
QMenu * view_menu_
Submenu for view operations.
Definition: MainWindow.h:436
QAction * verify_act_
Action to verify text.
Definition: MainWindow.h:470
QMenu * key_menu_
Submenu for key-operations.
Definition: MainWindow.h:435
void slot_open_key_management()
Definition: MainWindowSlotUI.cpp:58
void closeEvent(QCloseEvent *event) override
Definition: MainWindow.cpp:234
void create_status_bar()
Definition: MainWindowUI.cpp:661
QToolBar * file_tool_bar_
Toolbar holding file actions.
Definition: MainWindow.h:444
QMenu * crypt_menu_
Submenu for crypt-operations.
Definition: MainWindow.h:432
void restore_settings()
Definition: MainWindow.cpp:165
QAction * save_as_act_
Action to save file as.
Definition: MainWindow.h:461
QAction * encrypt_sign_act_
Action to encrypt and sign text.
Definition: MainWindow.h:466
void slot_disable_tab_actions(int number)
Definition: MainWindowSlotUI.cpp:67
void SlotSetRestartNeeded(int)
Definition: MainWindowSlotUI.cpp:181
void slot_open_file_tab()
Definition: MainWindowSlotUI.cpp:65
void slot_version_upgrade_nofity()
Definition: MainWindowSlotFunction.cpp:264
QMenu * gpg_menu_
Submenu for help-operations.
Definition: MainWindow.h:433
QAction * cut_act_
Action to cut text.
Definition: MainWindow.h:498
QAction * cut_pgp_header_act_
Action for cutting the PGP header.
Definition: MainWindow.h:513
void SlotDecrypt()
Definition: MainWindowGpgOperaFunction.cpp:195
QToolBar * key_tool_bar_
Toolbar holding key operations.
Definition: MainWindow.h:448
void slot_copy_default_uid_to_clipboard()
Definition: MainWindowSlotFunction.cpp:163
QAction * browser_act_
Action to open file browser.
Definition: MainWindow.h:459
QAction * zoom_in_act_
Action to zoom in.
Definition: MainWindow.h:504
QAction * new_tab_act_
Action to create new tab.
Definition: MainWindow.h:455
void close_attachment_dock()
Definition: MainWindow.cpp:225
QAction * open_act_
Action to open file.
Definition: MainWindow.h:458
void slot_import_key_from_edit()
Definition: MainWindowSlotUI.cpp:52
int get_restart_needed() const
return true, if restart is needed
Definition: MainWindowSlotUI.cpp:186
void SlotFileDecrypt(const QString &path)
Definition: MainWindowFileSlotFunction.cpp:275
QAction * find_act_
Action to find text.
Definition: MainWindow.h:501
QAction * paste_act_
Action to paste text.
Definition: MainWindow.h:499
QAction * check_update_act_
Action to open about dialog.
Definition: MainWindow.h:507
QMenu * edit_menu_
Submenu for text-operations.
Definition: MainWindow.h:431
QAction * zoom_out_act_
Action to zoom out.
Definition: MainWindow.h:505
QAction * decrypt_verify_act_
Action to encrypt and sign text.
Definition: MainWindow.h:467
QAction * copy_act_
Action to copy text.
Definition: MainWindow.h:496
void slot_append_selected_keys()
Definition: MainWindowSlotFunction.cpp:62
QAction * gnupg_act_
Action to open about dialog.
Definition: MainWindow.h:509
TextEdit * edit_
Tabwidget holding the edit-windows.
Definition: MainWindow.h:429
void SlotDecryptVerify()
Definition: MainWindowGpgOperaFunction.cpp:351
void slot_cut_pgp_header()
Definition: MainWindowSlotUI.cpp:157
void slot_add_pgp_header()
Definition: MainWindowSlotUI.cpp:143
QToolButton * import_button_
Tool button for import dropdown menu in toolbar.
Definition: MainWindow.h:450
void slot_open_settings_dialog()
Definition: MainWindowSlotUI.cpp:106
QAction * switch_tab_down_act_
Action to switch tab down.
Definition: MainWindow.h:457
void SlotFileEncrypt(const QString &)
Definition: MainWindowFileSlotFunction.cpp:45
QMenu * help_menu_
Submenu for help-operations.
Definition: MainWindow.h:434
QAction * switch_tab_up_act_
Action to switch tab up.
Definition: MainWindow.h:456
QMenu * import_key_menu_
Submenu for import operations.
Definition: MainWindow.h:437
void SlotArchiveDecryptVerify(const QString &path)
Definition: MainWindowFileSlotFunction.cpp:810
QAction * print_act_
Action to print.
Definition: MainWindow.h:462
QAction * add_pgp_header_act_
Action for adding the PGP header.
Definition: MainWindow.h:514
QAction * about_act_
Action to open about dialog.
Definition: MainWindow.h:506
void slot_copy_key_id_to_clipboard()
Definition: MainWindowSlotFunction.cpp:176
void create_menus()
Definition: MainWindowUI.cpp:539
void SlotFileSign(const QString &path)
Definition: MainWindowFileSlotFunction.cpp:376
void SlotSign()
Definition: MainWindowGpgOperaFunction.cpp:141
QAction * undo_act_
Action to undo last action.
Definition: MainWindow.h:502
QAction * decrypt_act_
Action to decrypt text.
Definition: MainWindow.h:468
void create_tool_bars()
Definition: MainWindowUI.cpp:613
void slot_start_wizard()
Definition: MainWindowSlotUI.cpp:46
QToolBar * crypt_tool_bar_
Toolbar holding crypt actions.
Definition: MainWindow.h:443
QAction * start_wizard_act_
Action to open the wizard.
Definition: MainWindow.h:512
QAction * save_act_
Action to save file.
Definition: MainWindow.h:460
QToolBar * edit_tool_bar_
Toolbar holding edit actions.
Definition: MainWindow.h:445
QAction * append_selected_keys_act_
Action to append selected keys to edit.
Definition: MainWindow.h:481
void SlotArchiveDecrypt(const QString &path)
Definition: MainWindowFileSlotFunction.cpp:326
void SlotUpdateCryptoMenuStatus(unsigned int type)
Definition: MainWindowSlotUI.cpp:188
QAction * quit_act_
Action to quit application.
Definition: MainWindow.h:464
QAction * redo_act_
Action to redo last action.
Definition: MainWindow.h:503
void SlotRaisePinentry(QSharedPointer< GpgPassphraseContext >)
Definition: MainWindowSlotUI.cpp:221
QAction * select_all_act_
Action to select whole text.
Definition: MainWindow.h:500
void SlotVerify()
Definition: MainWindowGpgOperaFunction.cpp:230
void SlotEncryptSign()
Definition: MainWindowGpgOperaFunction.cpp:260
QAction * show_key_details_act_
Action to open key-details dialog.
Definition: MainWindow.h:511
void upload_key_to_server()
Definition: MainWindowSlotFunction.cpp:236
void SlotOpenFile(const QString &path)
Definition: MainWindowSlotFunction.cpp:243
QAction * encrypt_act_
Action to encrypt text.
Definition: MainWindow.h:465
QAction * open_key_management_act_
Action to open key management.
Definition: MainWindow.h:495
QDockWidget * key_list_dock_
Encrypt Dock.
Definition: MainWindow.h:451
QAction * translate_act_
Action to open about dialog.
Definition: MainWindow.h:508
void refresh_keys_from_key_server()
Definition: MainWindowSlotFunction.cpp:221
void slot_find()
Definition: MainWindowSlotFunction.cpp:47
void SlotFileVerify(const QString &path)
Definition: MainWindowFileSlotFunction.cpp:450
void slot_clean_double_line_breaks()
Definition: MainWindowSlotUI.cpp:133
QMenu * file_menu_
Submenu for file-operations.
Definition: MainWindow.h:430
QToolBar * special_edit_tool_bar_
Toolbar holding special edit actions.
Definition: MainWindow.h:447
QMenu * steganography_menu_
Submenu for steganography operations.
Definition: MainWindow.h:442
QAction * copy_mail_address_to_clipboard_act_
Definition: MainWindow.h:486
void slot_copy_mail_address_to_clipboard()
Definition: MainWindowSlotFunction.cpp:150
QAction * quote_act_
Action to quote text.
Definition: MainWindow.h:497
void SlotDirectoryEncryptSign(const QString &path)
Definition: MainWindowFileSlotFunction.cpp:637
QAction * open_settings_act_
Action to open settings dialog.
Definition: MainWindow.h:510
void SlotFileEncryptSign(const QString &path)
Definition: MainWindowFileSlotFunction.cpp:534
QDockWidget * attachment_dock_
Attachment Dock.
Definition: MainWindow.h:452
void SlotFileDecryptVerify(const QString &path)
Definition: MainWindowFileSlotFunction.cpp:741
TextEdit class.
Definition: TextEdit.h:40
Definition: FileReadTask.cpp:31
Definition: app.cpp:39
Definition: MainWindow.h:54