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 "KeyMgmt.h"
33 #include "core/GpgConstants.h"
34 #include "core/function/result_analyse/GpgDecryptResultAnalyse.h"
35 #include "core/function/result_analyse/GpgEncryptResultAnalyse.h"
36 #include "core/function/result_analyse/GpgSignResultAnalyse.h"
37 #include "ui/GpgFrontendUI.h"
38 #include "ui/dialog/WaitingDialog.h"
39 #include "ui/dialog/Wizard.h"
40 #include "ui/dialog/help/AboutDialog.h"
41 #include "ui/dialog/import_export/KeyUploadDialog.h"
42 #include "ui/dialog/settings/SettingsDialog.h"
43 #include "ui/main_window/GeneralMainWindow.h"
44 #include "ui/widgets/FindWidget.h"
45 #include "ui/widgets/InfoBoardWidget.h"
46 #include "ui/widgets/TextEdit.h"
47 
48 namespace GpgFrontend::UI {
53 class MainWindow : public GeneralMainWindow {
54  Q_OBJECT
55 
56  public:
60  struct CryptoMenu {
61  using OperationType = unsigned int;
62 
63  static constexpr OperationType None = 0;
64  static constexpr OperationType Encrypt = 1 << 0;
65  static constexpr OperationType Sign = 1 << 1;
66  static constexpr OperationType Decrypt = 1 << 2;
67  static constexpr OperationType Verify = 1 << 3;
68  static constexpr OperationType EncryptAndSign = 1 << 4;
69  static constexpr OperationType DecryptAndVerify = 1 << 5;
70  };
71 
76  MainWindow();
77 
81  void Init() noexcept;
82 
86  void SetCryptoMenuStatus(CryptoMenu::OperationType type);
87 
88  signals:
89 
93  void SignalLoaded();
94 
95  public slots:
96 
100  void SlotSetStatusBarText(const QString& text);
101 
102  protected:
108  void closeEvent(QCloseEvent* event) override;
109 
110  public slots:
111 
115  void SlotOpenFile(QString& path);
116 
120  void SlotFileEncrypt();
121 
125  void SlotFileDecrypt();
126 
130  void SlotFileSign();
131 
135  void SlotFileVerify();
136 
140  void SlotFileEncryptSign();
141 
145  void SlotFileDecryptVerify();
146 
151  void SlotSetRestartNeeded(int);
152 
153  private slots:
154 
159  void slot_encrypt();
160 
165  void slot_encrypt_sign();
166 
171  void slot_decrypt();
172 
177  void slot_sign();
178 
184  void slot_verify();
185 
190  void slot_decrypt_verify();
191 
195  void slot_show_key_details();
196 
201 
205  void upload_key_to_server();
206 
210  void slot_find();
211 
215  void slot_start_wizard();
216 
221 
226 
231  void slot_append_keys_create_datetime();
232 
237  void slot_append_keys_expire_datetime();
238 
243  void slot_append_keys_fingerprint();
244 
250 
256 
262 
267 
271  void slot_open_file_tab();
272 
277 
283 
287  void slot_cut_pgp_header();
288 
292  void slot_add_pgp_header();
293 
298  void slot_disable_tab_actions(int number);
299 
303  void slot_version_upgrade(const SoftwareVersion& version);
304 
305  private:
310  void create_actions();
311 
315  void create_menus();
316 
320  void create_tool_bars();
321 
325  void create_status_bar();
326 
330  void create_dock_windows();
331 
336 
340  void close_attachment_dock();
341 
345  void restore_settings();
346 
350  void save_settings();
351 
355  [[nodiscard]] int get_restart_needed() const;
356 
358  QMenu* file_menu_{};
359  QMenu* edit_menu_{};
360  QMenu* crypt_menu_{};
361  QMenu* gpg_menu_{};
362  QMenu* help_menu_{};
363  QMenu* key_menu_{};
364  QMenu* view_menu_{};
365  QMenu* import_key_menu_{};
366 #ifdef SMTP_SUPPORT
367  QMenu* email_menu_{};
368 #endif
369 
371  QToolBar* crypt_tool_bar_{};
372  QToolBar* file_tool_bar_{};
373  QToolBar* edit_tool_bar_{};
374  QToolBar*
376  QToolBar* key_tool_bar_{};
377  QToolButton*
379  QDockWidget* key_list_dock_{};
380  QDockWidget* attachment_dock_{};
381  QDockWidget* info_board_dock_{};
382 
383  QAction* new_tab_act_{};
384  QAction* switch_tab_up_act_{};
385  QAction* switch_tab_down_act_{};
386  QAction* open_act_{};
387  QAction* browser_act_{};
388  QAction* save_act_{};
389  QAction* save_as_act_{};
390  QAction* print_act_{};
391  QAction* close_tab_act_{};
392  QAction* quit_act_{};
393  QAction* encrypt_act_{};
394  QAction* encrypt_sign_act_{};
395  QAction* decrypt_verify_act_{};
396  QAction* decrypt_act_{};
397  QAction* sign_act_{};
398  QAction* verify_act_{};
402 
403  QAction* clean_gpg_password_cache_act_{};
404  QAction* reload_components_act_{};
405  QAction* restart_components_act_{};
406 
407  QAction*
409  QAction* append_key_fingerprint_to_editor_act_{};
410  QAction* append_key_create_date_to_editor_act_{};
411  QAction* append_key_expire_date_to_editor_act_{};
412 
415  QAction* copy_key_id_to_clipboard_act_{};
416  QAction* copy_key_default_uid_to_clipboard_act_{};
417 
419  QAction* copy_act_{};
420  QAction* quote_act_{};
421  QAction* cut_act_{};
422  QAction* paste_act_{};
423  QAction* select_all_act_{};
424  QAction* find_act_{};
425  QAction* undo_act_{};
426  QAction* redo_act_{};
427  QAction* zoom_in_act_{};
428  QAction* zoom_out_act_{};
429  QAction* about_act_{};
430  QAction* check_update_act_{};
431  QAction* translate_act_{};
432  QAction* gnupg_act_{};
433  QAction* open_settings_act_{};
435  QAction* start_wizard_act_{};
436  QAction* cut_pgp_header_act_{};
437  QAction* add_pgp_header_act_{};
438  QAction* import_key_from_file_act_{};
439  QAction* import_key_from_clipboard_act_{};
440  QAction* import_key_from_key_server_act_{};
441 
442  QLabel* status_bar_icon_{};
443 
444  KeyList* m_key_list_{};
445  InfoBoardWidget* info_board_{};
446 
447  bool attachment_dock_created_{};
448  int restart_needed_{0};
449  bool prohibit_update_checking_ = false;
450 };
451 
452 } // namespace GpgFrontend::UI
453 
454 #endif // __GPGWIN_H__
Definition: GeneralMainWindow.h:39
Definition: MainWindow.h:53
QAction * import_key_from_edit_act_
Action to import key from edit.
Definition: MainWindow.h:399
void slot_show_key_details()
Definition: MainWindowSlotFunction.cpp:738
void create_dock_windows()
Definition: MainWindowUI.cpp:581
void SlotOpenFile(QString &path)
Definition: MainWindowSlotFunction.cpp:766
void Init() noexcept
Definition: MainWindow.cpp:45
QAction * close_tab_act_
Action to print.
Definition: MainWindow.h:391
void SlotFileDecrypt()
Definition: MainWindowFileSlotFunction.cpp:292
void create_actions()
Definition: MainWindowUI.cpp:36
QAction * clean_double_line_breaks_act_
Definition: MainWindow.h:400
QAction * sign_act_
Action to sign text.
Definition: MainWindow.h:397
QMenu * view_menu_
Submenu for view operations.
Definition: MainWindow.h:364
QAction * verify_act_
Action to verify text.
Definition: MainWindow.h:398
QMenu * key_menu_
Submenu for key-operations.
Definition: MainWindow.h:363
void slot_open_key_management()
Definition: MainWindowSlotUI.cpp:53
void closeEvent(QCloseEvent *event) override
Definition: MainWindow.cpp:275
void create_status_bar()
Definition: MainWindowUI.cpp:565
void slot_decrypt_verify()
Definition: MainWindowSlotFunction.cpp:516
QToolBar * file_tool_bar_
Toolbar holding file actions.
Definition: MainWindow.h:372
QMenu * crypt_menu_
Submenu for crypt-operations.
Definition: MainWindow.h:360
void restore_settings()
Definition: MainWindow.cpp:170
QAction * save_as_act_
Action to save file as.
Definition: MainWindow.h:389
QAction * encrypt_sign_act_
Action to encrypt and sign text.
Definition: MainWindow.h:394
void slot_disable_tab_actions(int number)
Definition: MainWindowSlotUI.cpp:61
void SlotFileEncryptSign()
Definition: MainWindowFileSlotFunction.cpp:553
void SlotSetRestartNeeded(int)
Definition: MainWindowSlotUI.cpp:184
void slot_open_file_tab()
Definition: MainWindowSlotUI.cpp:59
QMenu * gpg_menu_
Submenu for help-operations.
Definition: MainWindow.h:361
QAction * cut_act_
Action to cut text.
Definition: MainWindow.h:421
void slot_encrypt_sign()
Definition: MainWindowSlotFunction.cpp:394
QAction * cut_pgp_header_act_
Action for cutting the PGP header.
Definition: MainWindow.h:436
QToolBar * key_tool_bar_
Toolbar holding key operations.
Definition: MainWindow.h:376
void slot_copy_default_uid_to_clipboard()
Definition: MainWindowSlotFunction.cpp:712
QAction * browser_act_
Action to open file browser.
Definition: MainWindow.h:387
QAction * zoom_in_act_
Action to zoom in.
Definition: MainWindow.h:427
void slot_sign()
Definition: MainWindowSlotFunction.cpp:173
QAction * new_tab_act_
Action to create new tab.
Definition: MainWindow.h:383
void close_attachment_dock()
Definition: MainWindow.cpp:266
void slot_version_upgrade(const SoftwareVersion &version)
Definition: MainWindowSlotFunction.cpp:768
QAction * open_act_
Action to open file.
Definition: MainWindow.h:386
void slot_import_key_from_edit()
Definition: MainWindowSlotUI.cpp:47
int get_restart_needed() const
return true, if restart is needed
Definition: MainWindowSlotUI.cpp:189
QAction * find_act_
Action to find text.
Definition: MainWindow.h:424
QAction * paste_act_
Action to paste text.
Definition: MainWindow.h:422
QAction * check_update_act_
Action to open about dialog.
Definition: MainWindow.h:430
QMenu * edit_menu_
Submenu for text-operations.
Definition: MainWindow.h:359
QAction * zoom_out_act_
Action to zoom out.
Definition: MainWindow.h:428
QAction * decrypt_verify_act_
Action to encrypt and sign text.
Definition: MainWindow.h:395
QAction * copy_act_
Action to copy text.
Definition: MainWindow.h:419
void slot_append_selected_keys()
Definition: MainWindowSlotFunction.cpp:609
QAction * gnupg_act_
Action to open about dialog.
Definition: MainWindow.h:432
void save_settings()
Definition: MainWindow.cpp:241
TextEdit * edit_
Tabwidget holding the edit-windows.
Definition: MainWindow.h:357
void slot_cut_pgp_header()
Definition: MainWindowSlotUI.cpp:160
void slot_add_pgp_header()
Definition: MainWindowSlotUI.cpp:146
QToolButton * import_button_
Tool button for import dropdown menu in toolbar.
Definition: MainWindow.h:378
void SetCryptoMenuStatus(CryptoMenu::OperationType type)
Definition: MainWindowSlotUI.cpp:191
void slot_open_settings_dialog()
Definition: MainWindowSlotUI.cpp:103
QAction * switch_tab_down_act_
Action to switch tab down.
Definition: MainWindow.h:385
QMenu * help_menu_
Submenu for help-operations.
Definition: MainWindow.h:362
void SlotFileSign()
Definition: MainWindowFileSlotFunction.cpp:365
QAction * switch_tab_up_act_
Action to switch tab up.
Definition: MainWindow.h:384
QMenu * import_key_menu_
Submenu for import operations.
Definition: MainWindow.h:365
QAction * print_act_
Action to print.
Definition: MainWindow.h:390
QAction * add_pgp_header_act_
Action for adding the PGP header.
Definition: MainWindow.h:437
void SlotFileVerify()
Definition: MainWindowFileSlotFunction.cpp:460
QAction * about_act_
Action to open about dialog.
Definition: MainWindow.h:429
void slot_copy_key_id_to_clipboard()
Definition: MainWindowSlotFunction.cpp:725
void SlotFileEncrypt()
Definition: MainWindowFileSlotFunction.cpp:155
void create_menus()
Definition: MainWindowUI.cpp:444
QAction * undo_act_
Action to undo last action.
Definition: MainWindow.h:425
QAction * decrypt_act_
Action to decrypt text.
Definition: MainWindow.h:396
void slot_verify()
Definition: MainWindowSlotFunction.cpp:327
void create_tool_bars()
Definition: MainWindowUI.cpp:516
void slot_start_wizard()
Definition: MainWindowSlotUI.cpp:41
QToolBar * crypt_tool_bar_
Toolbar holding crypt actions.
Definition: MainWindow.h:371
QAction * start_wizard_act_
Action to open the wizard.
Definition: MainWindow.h:435
QAction * save_act_
Action to save file.
Definition: MainWindow.h:388
void SlotFileDecryptVerify()
Definition: MainWindowFileSlotFunction.cpp:684
QToolBar * edit_tool_bar_
Toolbar holding edit actions.
Definition: MainWindow.h:373
QAction * append_selected_keys_act_
Action to append selected keys to edit.
Definition: MainWindow.h:408
QAction * quit_act_
Action to quit application.
Definition: MainWindow.h:392
QAction * redo_act_
Action to redo last action.
Definition: MainWindow.h:426
QAction * select_all_act_
Action to select whole text.
Definition: MainWindow.h:423
QAction * show_key_details_act_
Action to open key-details dialog.
Definition: MainWindow.h:434
void upload_key_to_server()
Definition: MainWindowSlotFunction.cpp:759
QAction * encrypt_act_
Action to encrypt text.
Definition: MainWindow.h:393
QAction * open_key_management_act_
Action to open key management.
Definition: MainWindow.h:418
QDockWidget * key_list_dock_
Encrypt Dock.
Definition: MainWindow.h:379
QAction * translate_act_
Action to open about dialog.
Definition: MainWindow.h:431
void refresh_keys_from_key_server()
Definition: MainWindowSlotFunction.cpp:750
void slot_encrypt()
Definition: MainWindowSlotFunction.cpp:51
void slot_find()
Definition: MainWindowSlotFunction.cpp:594
void slot_decrypt()
Definition: MainWindowSlotFunction.cpp:259
void slot_clean_double_line_breaks()
Definition: MainWindowSlotUI.cpp:136
QMenu * file_menu_
Submenu for file-operations.
Definition: MainWindow.h:358
QToolBar * special_edit_tool_bar_
Toolbar holding special edit actions.
Definition: MainWindow.h:375
QMenu * steganography_menu_
Submenu for steganography operations.
Definition: MainWindow.h:370
QAction * copy_mail_address_to_clipboard_act_
Definition: MainWindow.h:413
void slot_copy_mail_address_to_clipboard()
Definition: MainWindowSlotFunction.cpp:699
QAction * quote_act_
Action to quote text.
Definition: MainWindow.h:420
QAction * open_settings_act_
Action to open settings dialog.
Definition: MainWindow.h:433
QDockWidget * attachment_dock_
Attachment Dock.
Definition: MainWindow.h:380
TextEdit class.
Definition: TextEdit.h:41
Definition: FileReadTask.cpp:29
Definition: MainWindow.h:60
Definition: SoftwareVersion.h:39