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
98 void SignalRestartApplication(int);
99
103 void SignalUIRefresh();
104
108 void SignalKeyDatabaseRefresh();
109
110 public slots:
111
115 void SlotSetStatusBarText(const QString& text);
116
117 protected:
123 void closeEvent(QCloseEvent* event) override;
124
125 public slots:
126
130 void SlotOpenFile(QString& path);
131
135 void SlotFileEncrypt();
136
140 void SlotFileDecrypt();
141
145 void SlotFileSign();
146
150 void SlotFileVerify();
151
155 void SlotFileEncryptSign();
156
160 void SlotFileDecryptVerify();
161
166 void SlotSetRestartNeeded(int);
167
168 private slots:
169
174 void slot_encrypt();
175
180 void slot_encrypt_sign();
181
186 void slot_decrypt();
187
192 void slot_sign();
193
199 void slot_verify();
200
205 void slot_decrypt_verify();
206
210 void slot_show_key_details();
211
215 void refresh_keys_from_key_server();
216
220 void upload_key_to_server();
221
225 void slot_find();
226
230 void slot_start_wizard();
231
235 void slot_import_key_from_edit();
236
240 void slot_append_selected_keys();
241
246 void slot_append_keys_create_datetime();
247
252 void slot_append_keys_expire_datetime();
253
258 void slot_append_keys_fingerprint();
259
264 void slot_copy_mail_address_to_clipboard();
265
270 void slot_copy_default_uid_to_clipboard();
271
276 void slot_copy_key_id_to_clipboard();
277
281 void slot_open_key_management();
282
286 void slot_open_file_tab();
287
291 void slot_open_settings_dialog();
292
297 void slot_clean_double_line_breaks();
298
302 void slot_cut_pgp_header();
303
307 void slot_add_pgp_header();
308
313 void slot_disable_tab_actions(int number);
314
318 void slot_version_upgrade(const SoftwareVersion& version);
319
323 void slot_add_key_2_favourite();
324
328 void slot_remove_key_from_favourite();
329
333 void slot_set_owner_trust_level_of_key();
334
335 private:
340 void create_actions();
341
345 void create_menus();
346
350 void create_tool_bars();
351
355 void create_status_bar();
356
360 void create_dock_windows();
361
365 void create_attachment_dock();
366
370 void close_attachment_dock();
371
375 void restore_settings();
376
380 void recover_editor_unsaved_pages_from_cache();
381
385 void save_settings();
386
390 [[nodiscard]] int get_restart_needed() const;
391
392 TextEdit* edit_{};
393 QMenu* file_menu_{};
394 QMenu* edit_menu_{};
395 QMenu* crypt_menu_{};
396 QMenu* gpg_menu_{};
397 QMenu* help_menu_{};
398 QMenu* key_menu_{};
399 QMenu* view_menu_{};
400 QMenu* import_key_menu_{};
401 #ifdef SMTP_SUPPORT
402 QMenu* email_menu_{};
403 #endif
404
405 QMenu* steganography_menu_{};
406 QToolBar* crypt_tool_bar_{};
407 QToolBar* file_tool_bar_{};
408 QToolBar* edit_tool_bar_{};
409 QToolBar*
410 special_edit_tool_bar_{};
411 QToolBar* key_tool_bar_{};
412 QToolButton*
413 import_button_{};
414 QDockWidget* key_list_dock_{};
415 QDockWidget* attachment_dock_{};
416 QDockWidget* info_board_dock_{};
417
418 QAction* new_tab_act_{};
419 QAction* switch_tab_up_act_{};
420 QAction* switch_tab_down_act_{};
421 QAction* open_act_{};
422 QAction* browser_act_{};
423 QAction* save_act_{};
424 QAction* save_as_act_{};
425 QAction* print_act_{};
426 QAction* close_tab_act_{};
427 QAction* quit_act_{};
428 QAction* encrypt_act_{};
429 QAction* encrypt_sign_act_{};
430 QAction* decrypt_verify_act_{};
431 QAction* decrypt_act_{};
432 QAction* sign_act_{};
433 QAction* verify_act_{};
434 QAction* import_key_from_edit_act_{};
435 QAction* clean_double_line_breaks_act_{};
437
438 QAction* gnupg_controller_open_act_{};
439 QAction* clean_gpg_password_cache_act_{};
440 QAction* reload_components_act_{};
441 QAction* restart_components_act_{};
442
443 QAction*
444 append_selected_keys_act_{};
445 QAction* append_key_fingerprint_to_editor_act_{};
446 QAction* append_key_create_date_to_editor_act_{};
447 QAction* append_key_expire_date_to_editor_act_{};
448
449 QAction* copy_mail_address_to_clipboard_act_{};
451 QAction* copy_key_id_to_clipboard_act_{};
452 QAction* copy_key_default_uid_to_clipboard_act_{};
453
454 QAction* add_key_2_favourtie_act_{};
455 QAction* remove_key_from_favourtie_act_{};
456 QAction* set_owner_trust_of_key_act_{};
457
458 QAction* open_key_management_act_{};
459 QAction* copy_act_{};
460 QAction* quote_act_{};
461 QAction* cut_act_{};
462 QAction* paste_act_{};
463 QAction* select_all_act_{};
464 QAction* find_act_{};
465 QAction* undo_act_{};
466 QAction* redo_act_{};
467 QAction* zoom_in_act_{};
468 QAction* zoom_out_act_{};
469 QAction* about_act_{};
470 QAction* check_update_act_{};
471 QAction* translate_act_{};
472 QAction* gnupg_act_{};
473 QAction* open_settings_act_{};
474 QAction* show_key_details_act_{};
475 QAction* start_wizard_act_{};
476 QAction* cut_pgp_header_act_{};
477 QAction* add_pgp_header_act_{};
478 QAction* import_key_from_file_act_{};
479 QAction* import_key_from_clipboard_act_{};
480 QAction* import_key_from_key_server_act_{};
481
482 QLabel* status_bar_icon_{};
483
484 KeyList* m_key_list_{};
485 InfoBoardWidget* info_board_{};
486
487 bool attachment_dock_created_{};
488 int restart_needed_{0};
489 bool prohibit_update_checking_ = false;
490 };
491
492 } // namespace GpgFrontend::UI
493
494 #endif // __GPGWIN_H__
GpgFrontend::UI::GeneralMainWindow
Definition: GeneralMainWindow.h:39
GpgFrontend::UI::MainWindow
Definition: MainWindow.h:53
GpgFrontend::UI::MainWindow::import_key_from_edit_act_
QAction * import_key_from_edit_act_
Action to import key from edit.
Definition: MainWindow.h:434
GpgFrontend::UI::MainWindow::slot_show_key_details
void slot_show_key_details()
Definition: MainWindowSlotFunction.cpp:739
GpgFrontend::UI::MainWindow::create_dock_windows
void create_dock_windows()
Definition: MainWindowUI.cpp:604
GpgFrontend::UI::MainWindow::SlotOpenFile
void SlotOpenFile(QString &path)
Definition: MainWindowSlotFunction.cpp:837
GpgFrontend::UI::MainWindow::Init
void Init() noexcept
Definition: MainWindow.cpp:51
GpgFrontend::UI::MainWindow::close_tab_act_
QAction * close_tab_act_
Action to print.
Definition: MainWindow.h:426
GpgFrontend::UI::MainWindow::SlotFileDecrypt
void SlotFileDecrypt()
Definition: MainWindowFileSlotFunction.cpp:287
GpgFrontend::UI::MainWindow::create_actions
void create_actions()
Definition: MainWindowUI.cpp:37
GpgFrontend::UI::MainWindow::clean_double_line_breaks_act_
QAction * clean_double_line_breaks_act_
Definition: MainWindow.h:435
GpgFrontend::UI::MainWindow::sign_act_
QAction * sign_act_
Action to sign text.
Definition: MainWindow.h:432
GpgFrontend::UI::MainWindow::view_menu_
QMenu * view_menu_
Submenu for view operations.
Definition: MainWindow.h:399
GpgFrontend::UI::MainWindow::verify_act_
QAction * verify_act_
Action to verify text.
Definition: MainWindow.h:433
GpgFrontend::UI::MainWindow::key_menu_
QMenu * key_menu_
Submenu for key-operations.
Definition: MainWindow.h:398
GpgFrontend::UI::MainWindow::slot_open_key_management
void slot_open_key_management()
Definition: MainWindowSlotUI.cpp:53
GpgFrontend::UI::MainWindow::closeEvent
void closeEvent(QCloseEvent *event) override
Definition: MainWindow.cpp:322
GpgFrontend::UI::MainWindow::create_status_bar
void create_status_bar()
Definition: MainWindowUI.cpp:588
GpgFrontend::UI::MainWindow::slot_decrypt_verify
void slot_decrypt_verify()
Definition: MainWindowSlotFunction.cpp:517
GpgFrontend::UI::MainWindow::file_tool_bar_
QToolBar * file_tool_bar_
Toolbar holding file actions.
Definition: MainWindow.h:407
GpgFrontend::UI::MainWindow::crypt_menu_
QMenu * crypt_menu_
Submenu for crypt-operations.
Definition: MainWindow.h:395
GpgFrontend::UI::MainWindow::restore_settings
void restore_settings()
Definition: MainWindow.cpp:187
GpgFrontend::UI::MainWindow::save_as_act_
QAction * save_as_act_
Action to save file as.
Definition: MainWindow.h:424
GpgFrontend::UI::MainWindow::encrypt_sign_act_
QAction * encrypt_sign_act_
Action to encrypt and sign text.
Definition: MainWindow.h:429
GpgFrontend::UI::MainWindow::slot_disable_tab_actions
void slot_disable_tab_actions(int number)
Definition: MainWindowSlotUI.cpp:61
GpgFrontend::UI::MainWindow::SlotFileEncryptSign
void SlotFileEncryptSign()
Definition: MainWindowFileSlotFunction.cpp:538
GpgFrontend::UI::MainWindow::SlotSetRestartNeeded
void SlotSetRestartNeeded(int)
Definition: MainWindowSlotUI.cpp:184
GpgFrontend::UI::MainWindow::slot_open_file_tab
void slot_open_file_tab()
Definition: MainWindowSlotUI.cpp:59
GpgFrontend::UI::MainWindow::gpg_menu_
QMenu * gpg_menu_
Submenu for help-operations.
Definition: MainWindow.h:396
GpgFrontend::UI::MainWindow::cut_act_
QAction * cut_act_
Action to cut text.
Definition: MainWindow.h:461
GpgFrontend::UI::MainWindow::slot_encrypt_sign
void slot_encrypt_sign()
Definition: MainWindowSlotFunction.cpp:395
GpgFrontend::UI::MainWindow::cut_pgp_header_act_
QAction * cut_pgp_header_act_
Action for cutting the PGP header.
Definition: MainWindow.h:476
GpgFrontend::UI::MainWindow::key_tool_bar_
QToolBar * key_tool_bar_
Toolbar holding key operations.
Definition: MainWindow.h:411
GpgFrontend::UI::MainWindow::slot_copy_default_uid_to_clipboard
void slot_copy_default_uid_to_clipboard()
Definition: MainWindowSlotFunction.cpp:713
GpgFrontend::UI::MainWindow::browser_act_
QAction * browser_act_
Action to open file browser.
Definition: MainWindow.h:422
GpgFrontend::UI::MainWindow::zoom_in_act_
QAction * zoom_in_act_
Action to zoom in.
Definition: MainWindow.h:467
GpgFrontend::UI::MainWindow::slot_sign
void slot_sign()
Definition: MainWindowSlotFunction.cpp:174
GpgFrontend::UI::MainWindow::new_tab_act_
QAction * new_tab_act_
Action to create new tab.
Definition: MainWindow.h:418
GpgFrontend::UI::MainWindow::close_attachment_dock
void close_attachment_dock()
Definition: MainWindow.cpp:313
GpgFrontend::UI::MainWindow::slot_version_upgrade
void slot_version_upgrade(const SoftwareVersion &version)
Definition: MainWindowSlotFunction.cpp:839
GpgFrontend::UI::MainWindow::open_act_
QAction * open_act_
Action to open file.
Definition: MainWindow.h:421
GpgFrontend::UI::MainWindow::slot_import_key_from_edit
void slot_import_key_from_edit()
Definition: MainWindowSlotUI.cpp:47
GpgFrontend::UI::MainWindow::get_restart_needed
int 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:464
GpgFrontend::UI::MainWindow::paste_act_
QAction * paste_act_
Action to paste text.
Definition: MainWindow.h:462
GpgFrontend::UI::MainWindow::check_update_act_
QAction * check_update_act_
Action to open about dialog.
Definition: MainWindow.h:470
GpgFrontend::UI::MainWindow::edit_menu_
QMenu * edit_menu_
Submenu for text-operations.
Definition: MainWindow.h:394
GpgFrontend::UI::MainWindow::zoom_out_act_
QAction * zoom_out_act_
Action to zoom out.
Definition: MainWindow.h:468
GpgFrontend::UI::MainWindow::decrypt_verify_act_
QAction * decrypt_verify_act_
Action to encrypt and sign text.
Definition: MainWindow.h:430
GpgFrontend::UI::MainWindow::copy_act_
QAction * copy_act_
Action to copy text.
Definition: MainWindow.h:459
GpgFrontend::UI::MainWindow::slot_append_selected_keys
void slot_append_selected_keys()
Definition: MainWindowSlotFunction.cpp:610
GpgFrontend::UI::MainWindow::gnupg_act_
QAction * gnupg_act_
Action to open about dialog.
Definition: MainWindow.h:472
GpgFrontend::UI::MainWindow::save_settings
void save_settings()
Definition: MainWindow.cpp:292
GpgFrontend::UI::MainWindow::edit_
TextEdit * edit_
Tabwidget holding the edit-windows.
Definition: MainWindow.h:392
GpgFrontend::UI::MainWindow::slot_cut_pgp_header
void slot_cut_pgp_header()
Definition: MainWindowSlotUI.cpp:160
GpgFrontend::UI::MainWindow::slot_add_pgp_header
void slot_add_pgp_header()
Definition: MainWindowSlotUI.cpp:146
GpgFrontend::UI::MainWindow::import_button_
QToolButton * import_button_
Tool button for import dropdown menu in toolbar.
Definition: MainWindow.h:413
GpgFrontend::UI::MainWindow::SetCryptoMenuStatus
void SetCryptoMenuStatus(CryptoMenu::OperationType type)
Definition: MainWindowSlotUI.cpp:191
GpgFrontend::UI::MainWindow::slot_open_settings_dialog
void slot_open_settings_dialog()
Definition: MainWindowSlotUI.cpp:103
GpgFrontend::UI::MainWindow::switch_tab_down_act_
QAction * switch_tab_down_act_
Action to switch tab down.
Definition: MainWindow.h:420
GpgFrontend::UI::MainWindow::help_menu_
QMenu * help_menu_
Submenu for help-operations.
Definition: MainWindow.h:397
GpgFrontend::UI::MainWindow::SlotFileSign
void SlotFileSign()
Definition: MainWindowFileSlotFunction.cpp:360
GpgFrontend::UI::MainWindow::switch_tab_up_act_
QAction * switch_tab_up_act_
Action to switch tab up.
Definition: MainWindow.h:419
GpgFrontend::UI::MainWindow::import_key_menu_
QMenu * import_key_menu_
Submenu for import operations.
Definition: MainWindow.h:400
GpgFrontend::UI::MainWindow::print_act_
QAction * print_act_
Action to print.
Definition: MainWindow.h:425
GpgFrontend::UI::MainWindow::create_attachment_dock
void create_attachment_dock()
GpgFrontend::UI::MainWindow::add_pgp_header_act_
QAction * add_pgp_header_act_
Action for adding the PGP header.
Definition: MainWindow.h:477
GpgFrontend::UI::MainWindow::SlotFileVerify
void SlotFileVerify()
Definition: MainWindowFileSlotFunction.cpp:450
GpgFrontend::UI::MainWindow::about_act_
QAction * about_act_
Action to open about dialog.
Definition: MainWindow.h:469
GpgFrontend::UI::MainWindow::slot_copy_key_id_to_clipboard
void slot_copy_key_id_to_clipboard()
Definition: MainWindowSlotFunction.cpp:726
GpgFrontend::UI::MainWindow::SlotFileEncrypt
void SlotFileEncrypt()
Definition: MainWindowFileSlotFunction.cpp:155
GpgFrontend::UI::MainWindow::create_menus
void create_menus()
Definition: MainWindowUI.cpp:465
GpgFrontend::UI::MainWindow::undo_act_
QAction * undo_act_
Action to undo last action.
Definition: MainWindow.h:465
GpgFrontend::UI::MainWindow::decrypt_act_
QAction * decrypt_act_
Action to decrypt text.
Definition: MainWindow.h:431
GpgFrontend::UI::MainWindow::slot_verify
void slot_verify()
Definition: MainWindowSlotFunction.cpp:328
GpgFrontend::UI::MainWindow::create_tool_bars
void create_tool_bars()
Definition: MainWindowUI.cpp:539
GpgFrontend::UI::MainWindow::slot_start_wizard
void slot_start_wizard()
Definition: MainWindowSlotUI.cpp:41
GpgFrontend::UI::MainWindow::crypt_tool_bar_
QToolBar * crypt_tool_bar_
Toolbar holding crypt actions.
Definition: MainWindow.h:406
GpgFrontend::UI::MainWindow::start_wizard_act_
QAction * start_wizard_act_
Action to open the wizard.
Definition: MainWindow.h:475
GpgFrontend::UI::MainWindow::save_act_
QAction * save_act_
Action to save file.
Definition: MainWindow.h:423
GpgFrontend::UI::MainWindow::SlotFileDecryptVerify
void SlotFileDecryptVerify()
Definition: MainWindowFileSlotFunction.cpp:664
GpgFrontend::UI::MainWindow::edit_tool_bar_
QToolBar * edit_tool_bar_
Toolbar holding edit actions.
Definition: MainWindow.h:408
GpgFrontend::UI::MainWindow::append_selected_keys_act_
QAction * append_selected_keys_act_
Action to append selected keys to edit.
Definition: MainWindow.h:444
GpgFrontend::UI::MainWindow::quit_act_
QAction * quit_act_
Action to quit application.
Definition: MainWindow.h:427
GpgFrontend::UI::MainWindow::redo_act_
QAction * redo_act_
Action to redo last action.
Definition: MainWindow.h:466
GpgFrontend::UI::MainWindow::select_all_act_
QAction * select_all_act_
Action to select whole text.
Definition: MainWindow.h:463
GpgFrontend::UI::MainWindow::show_key_details_act_
QAction * show_key_details_act_
Action to open key-details dialog.
Definition: MainWindow.h:474
GpgFrontend::UI::MainWindow::upload_key_to_server
void upload_key_to_server()
Definition: MainWindowSlotFunction.cpp:830
GpgFrontend::UI::MainWindow::encrypt_act_
QAction * encrypt_act_
Action to encrypt text.
Definition: MainWindow.h:428
GpgFrontend::UI::MainWindow::open_key_management_act_
QAction * open_key_management_act_
Action to open key management.
Definition: MainWindow.h:458
GpgFrontend::UI::MainWindow::key_list_dock_
QDockWidget * key_list_dock_
Encrypt Dock.
Definition: MainWindow.h:414
GpgFrontend::UI::MainWindow::translate_act_
QAction * translate_act_
Action to open about dialog.
Definition: MainWindow.h:471
GpgFrontend::UI::MainWindow::refresh_keys_from_key_server
void refresh_keys_from_key_server()
Definition: MainWindowSlotFunction.cpp:771
GpgFrontend::UI::MainWindow::slot_encrypt
void slot_encrypt()
Definition: MainWindowSlotFunction.cpp:52
GpgFrontend::UI::MainWindow::slot_find
void slot_find()
Definition: MainWindowSlotFunction.cpp:595
GpgFrontend::UI::MainWindow::slot_decrypt
void slot_decrypt()
Definition: MainWindowSlotFunction.cpp:260
GpgFrontend::UI::MainWindow::slot_clean_double_line_breaks
void slot_clean_double_line_breaks()
Definition: MainWindowSlotUI.cpp:136
GpgFrontend::UI::MainWindow::file_menu_
QMenu * file_menu_
Submenu for file-operations.
Definition: MainWindow.h:393
GpgFrontend::UI::MainWindow::special_edit_tool_bar_
QToolBar * special_edit_tool_bar_
Toolbar holding special edit actions.
Definition: MainWindow.h:410
GpgFrontend::UI::MainWindow::steganography_menu_
QMenu * steganography_menu_
Submenu for steganography operations.
Definition: MainWindow.h:405
GpgFrontend::UI::MainWindow::copy_mail_address_to_clipboard_act_
QAction * copy_mail_address_to_clipboard_act_
Definition: MainWindow.h:449
GpgFrontend::UI::MainWindow::slot_copy_mail_address_to_clipboard
void slot_copy_mail_address_to_clipboard()
Definition: MainWindowSlotFunction.cpp:700
GpgFrontend::UI::MainWindow::quote_act_
QAction * quote_act_
Action to quote text.
Definition: MainWindow.h:460
GpgFrontend::UI::MainWindow::open_settings_act_
QAction * open_settings_act_
Action to open settings dialog.
Definition: MainWindow.h:473
GpgFrontend::UI::MainWindow::attachment_dock_
QDockWidget * attachment_dock_
Attachment Dock.
Definition: MainWindow.h:415
GpgFrontend::UI::TextEdit
TextEdit class.
Definition: TextEdit.h:41
GpgFrontend::UI
Definition: FileReadTask.cpp:29
GpgFrontend::UI::MainWindow::CryptoMenu
Definition: MainWindow.h:60
GpgFrontend::UI::SoftwareVersion
Definition: SoftwareVersion.h:39