diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ui/MainWindow.cpp | 72 | ||||
-rw-r--r-- | src/ui/MainWindow.h | 262 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowFileSlotFunction.cpp | 46 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowSlotFunction.cpp | 120 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowSlotUI.cpp | 117 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowUI.cpp | 710 | ||||
-rw-r--r-- | src/ui/widgets/FilePage.cpp | 12 |
7 files changed, 668 insertions, 671 deletions
diff --git a/src/ui/MainWindow.cpp b/src/ui/MainWindow.cpp index 2cab0f38..3ec7214e 100644 --- a/src/ui/MainWindow.cpp +++ b/src/ui/MainWindow.cpp @@ -41,56 +41,54 @@ MainWindow::MainWindow() { void MainWindow::init() noexcept { try { - networkAccessManager = new QNetworkAccessManager(this); - /* get path where app was started */ setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); - edit = new TextEdit(this); - setCentralWidget(edit); + edit_ = new TextEdit(this); + setCentralWidget(edit_); /* the list of Keys available*/ - mKeyList = new KeyList( + m_key_list_ = new KeyList( KeyMenuAbility::REFRESH | KeyMenuAbility::UNCHECK_ALL, this); - infoBoard = new InfoBoardWidget(this); + info_board_ = new InfoBoardWidget(this); /* List of binary Attachments */ - attachmentDockCreated = false; + attachment_dock_created_ = false; /* Variable containing if restart is needed */ - this->slotSetRestartNeeded(false); + this->slot_set_restart_needed(false); - createActions(); - createMenus(); - createToolBars(); - createStatusBar(); - createDockWindows(); + create_actions(); + create_menus(); + create_tool_bars(); + create_status_bar(); + create_dock_windows(); - connect(edit->tabWidget, SIGNAL(currentChanged(int)), this, - SLOT(slotDisableTabActions(int))); + connect(edit_->tabWidget, SIGNAL(currentChanged(int)), this, + SLOT(slot_disable_tab_actions(int))); connect(SignalStation::GetInstance(), &SignalStation::signalRefreshStatusBar, this, [=](const QString& message, int timeout) { statusBar()->showMessage(message, timeout); }); - mKeyList->addMenuAction(appendSelectedKeysAct); - mKeyList->addMenuAction(copyMailAddressToClipboardAct); - mKeyList->addSeparator(); - mKeyList->addMenuAction(showKeyDetailsAct); + m_key_list_->addMenuAction(append_selected_keys_act_); + m_key_list_->addMenuAction(copy_mail_address_to_clipboard_act_); + m_key_list_->addSeparator(); + m_key_list_->addMenuAction(show_key_details_act_); - restoreSettings(); + restore_settings(); // open filename if provided as first command line parameter QStringList args = qApp->arguments(); if (args.size() > 1) { if (!args[1].startsWith("-")) { - if (QFile::exists(args[1])) edit->loadFile(args[1]); + if (QFile::exists(args[1])) edit_->loadFile(args[1]); } } - edit->curTextPage()->setFocus(); + edit_->curTextPage()->setFocus(); auto& settings = GlobalSettingStation::GetInstance().GetUISettings(); @@ -112,10 +110,10 @@ void MainWindow::init() noexcept { LOG(INFO) << "wizard show_wizard" << show_wizard; if (show_wizard) { - slotStartWizard(); + slot_start_wizard(); } - emit loaded(); + emit Loaded(); // if not prohibit update checking if (!prohibit_update_checking_) { @@ -140,7 +138,7 @@ void MainWindow::init() noexcept { } } -void MainWindow::restoreSettings() { +void MainWindow::restore_settings() { LOG(INFO) << _("Called"); try { @@ -183,11 +181,11 @@ void MainWindow::restoreSettings() { main_windows_state.Check("icon_style", Qt::ToolButtonTextUnderIcon); auto icon_style = static_cast<Qt::ToolButtonStyle>(s_icon_style); this->setToolButtonStyle(icon_style); - importButton->setToolButtonStyle(icon_style); + import_button_->setToolButtonStyle(icon_style); // icons ize this->setIconSize(QSize(width, height)); - importButton->setIconSize(QSize(width, height)); + import_button_->setIconSize(QSize(width, height)); SettingsObject key_server_json("key_server"); @@ -231,7 +229,7 @@ void MainWindow::restoreSettings() { LOG(INFO) << "get checked key id" << key_id; key_ids_ptr->push_back(key_id); } - mKeyList->setChecked(std::move(key_ids_ptr)); + m_key_list_->setChecked(std::move(key_ids_ptr)); } } catch (...) { LOG(ERROR) << "restore default_key_checked failed"; @@ -256,7 +254,7 @@ void MainWindow::restoreSettings() { GlobalSettingStation::GetInstance().SyncSettings(); } -void MainWindow::saveSettings() { +void MainWindow::save_settings() { auto& settings = GlobalSettingStation::GetInstance().GetUISettings(); try { @@ -274,7 +272,7 @@ void MainWindow::saveSettings() { // keyid-list of private checked keys if (save_key_checked) { - auto key_ids_need_to_store = mKeyList->getChecked(); + auto key_ids_need_to_store = m_key_list_->getChecked(); SettingsObject default_key_checked("default_key_checked"); default_key_checked.clear(); @@ -291,13 +289,13 @@ void MainWindow::saveSettings() { GlobalSettingStation::GetInstance().SyncSettings(); } -void MainWindow::closeAttachmentDock() { - if (!attachmentDockCreated) { +void MainWindow::close_attachment_dock() { + if (!attachment_dock_created_) { return; } - attachmentDock->close(); - attachmentDock->deleteLater(); - attachmentDockCreated = false; + attachment_dock_->close(); + attachment_dock_->deleteLater(); + attachment_dock_created_ = false; } void MainWindow::closeEvent(QCloseEvent* event) { @@ -305,8 +303,8 @@ void MainWindow::closeEvent(QCloseEvent* event) { * ask to save changes, if there are * modified documents in any tab */ - if (edit->maybeSaveAnyTab()) { - saveSettings(); + if (edit_->maybeSaveAnyTab()) { + save_settings(); event->accept(); } else { event->ignore(); diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 9c4d5a1c..5dcd5cb5 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -56,16 +56,23 @@ class MainWindow : public QMainWindow { MainWindow(); /** - * ONLY Called from main() + * @details ONLY Called from main() */ void init() noexcept; signals: - void loaded(); + + /** + * @brief + */ + void Loaded(); public slots: - void slotSetStatusBarText(const QString& text); + /** + * @brief + */ + void SlotSetStatusBarText(const QString& text); protected: /** @@ -80,37 +87,37 @@ class MainWindow : public QMainWindow { /** * @details Open a new tab for path */ - void slotOpenFile(QString& path); + void SlotOpenFile(QString& path); /** * @details Open dialog for encrypting file. */ - void slotFileEncrypt(); + void SlotFileEncrypt(); /** * @details Open dialog for decrypting file. */ - void slotFileDecrypt(); + void SlotFileDecrypt(); /** * @details Open dialog for signing file. */ - void slotFileSign(); + void SlotFileSign(); /** * @details Open dialog for verifying file. */ - void slotFileVerify(); + void SlotFileVerify(); /** * @details Open dialog for signing file. */ - void slotFileEncryptSign(); + void SlotFileEncryptSign(); /** * @details Open dialog for verifying file. */ - void slotFileDecryptVerify(); + void SlotFileDecryptVerify(); private slots: @@ -118,288 +125,267 @@ class MainWindow : public QMainWindow { * @details encrypt the text of currently active textedit-page * with the currently checked keys */ - void slotEncrypt(); + void slot_encrypt(); /** * @details encrypt and sign the text of currently active textedit-page * with the currently checked keys */ - void slotEncryptSign(); + void slot_encrypt_sign(); /** * @details Show a passphrase dialog and decrypt the text of currently active * tab. */ - void slotDecrypt(); + void slot_decrypt(); /** * @details Sign the text of currently active tab with the checked private * keys */ - void slotSign(); + void slot_sign(); /** * @details Verify the text of currently active tab and show verify * information. If document is signed with a key, which is not in keylist, * show import missing key from keyserver in Menu of verifynotification. */ - void slotVerify(); + void slot_verify(); /** * @details decrypt and verify the text of currently active textedit-page * with the currently checked keys */ - void slotDecryptVerify(); + void slot_decrypt_verify(); /** * @details Show the details of the first of the first of selected keys */ - void slotShowKeyDetails(); + void slot_show_key_details(); /** * @details Refresh key information of selected keys from default keyserver */ - void refreshKeysFromKeyserver(); + void refresh_keys_from_key_server(); /** * @details upload the selected key to the keyserver */ - void uploadKeyToServer(); + void upload_key_to_server(); /** * @details Open find widget. */ - void slotFind(); + void slot_find(); /** * @details start the wizard */ - void slotStartWizard(); + void slot_start_wizard(); /** * @details Import keys from currently active tab to keylist if possible. */ - void slotImportKeyFromEdit(); + void slot_import_key_from_edit(); /** * @details Append the selected keys to currently active textedit. */ - void slotAppendSelectedKeys(); + void slot_append_selected_keys(); /** * @details Copy the mailaddress of selected key to clipboard. * Method for keylists contextmenu. */ - void slotCopyMailAddressToClipboard(); + void slot_copy_mail_address_to_clipboard(); /** * @details Open key management dialog. */ - void slotOpenKeyManagement(); + void slot_open_key_management(); /** * @details Open File Opera Tab */ - void slotOpenFileTab(); + void slot_open_file_tab(); /** * @details Open settings-dialog. */ - void slotOpenSettingsDialog(); - - // /** - // * @details Show a warn message in status bar, if there are files in - // * attachment folder. - // */ - // void slotCheckAttachmentFolder(); + void slot_open_settings_dialog(); /** * @details Replace double linebreaks by single linebreaks in currently active * tab. */ - void slotCleanDoubleLinebreaks(); + void slot_clean_double_line_breaks(); /** * @details Cut the existing PGP header and footer from current tab. */ - void slotCutPgpHeader(); + void slot_cut_pgp_header(); /** * @details Add PGP header and footer to current tab. */ - void slotAddPgpHeader(); + void slot_add_pgp_header(); /** * @details Disable tab related actions, if number of tabs is 0. * @param number number of the opened tabs and -1, if no tab is opened */ - void slotDisableTabActions(int number); + void slot_disable_tab_actions(int number); /** * @details get value of member restartNeeded to needed. * @param needed true, if application has to be restarted */ - void slotSetRestartNeeded(bool needed); + void slot_set_restart_needed(bool needed); /** * @details called when need to upgrade. */ - void slotVersionUpgrade(const SoftwareVersion& version); + void slot_version_upgrade(const SoftwareVersion& version); private: /** * @details Create actions for the main-menu and the context-menu of the * keylist. */ - void createActions(); + void create_actions(); /** * @details create the menu of the main-window. */ - void createMenus(); + void create_menus(); /** * @details Create edit-, crypt- and key-toolbars. */ - void createToolBars(); + void create_tool_bars(); /** * @details Create statusbar of mainwindow. */ - void createStatusBar(); + void create_status_bar(); /** * @details Create keylist- and attachment-dockwindows. */ - void createDockWindows(); + void create_dock_windows(); /** * @details Create attachment-dockwindow. */ - void createAttachmentDock(); + void create_attachment_dock(); /** * @details close attachment-dockwindow. */ - void closeAttachmentDock(); + void close_attachment_dock(); /** * @details Load settings from ini-file. */ - void restoreSettings(); + void restore_settings(); /** * @details Save settings to ini-file. */ - void saveSettings(); - -#ifdef ADVANCE_SUPPORT - - /** - * @details Get full crypto text - */ - QString getCryptText(const QString& shortenCryptoText); - - /** - * @details Shorten crypto text - */ - void shortenCryptText(); - -#endif + void save_settings(); /** * @brief return true, if restart is needed */ - [[nodiscard]] bool getRestartNeeded() const; + [[nodiscard]] bool get_restart_needed() const; - TextEdit* edit{}; /** Tabwidget holding the edit-windows */ - QMenu* fileMenu{}; /** Submenu for file-operations*/ - QMenu* editMenu{}; /** Submenu for text-operations*/ - QMenu* cryptMenu{}; /** Submenu for crypt-operations */ - QMenu* helpMenu{}; /** Submenu for help-operations */ - QMenu* keyMenu{}; /** Submenu for key-operations */ - QMenu* viewMenu{}; /** Submenu for view operations */ - QMenu* importKeyMenu{}; /** Sumenu for import operations */ + TextEdit* edit_{}; ///< Tabwidget holding the edit-windows + QMenu* file_menu_{}; ///< Submenu for file-operations + QMenu* edit_menu_{}; ///< Submenu for text-operations + QMenu* crypt_menu_{}; ///< Submenu for crypt-operations + QMenu* help_menu_{}; ///< Submenu for help-operations + QMenu* key_menu_{}; ///< Submenu for key-operations + QMenu* view_menu_{}; ///< Submenu for view operations + QMenu* import_key_menu_{}; ///< Submenu for import operations #ifdef SMTP_SUPPORT - QMenu* emailMenu{}; /** Sumenu for email operations */ + QMenu* email_menu_{}; ///< Submenu for email operations #endif - QMenu* steganoMenu{}; /** Submenu for steganographic operations*/ - QToolBar* cryptToolBar{}; /** Toolbar holding crypt actions */ - QToolBar* fileToolBar{}; /** Toolbar holding file actions */ - QToolBar* editToolBar{}; /** Toolbar holding edit actions */ - QToolBar* specialEditToolBar{}; /** Toolbar holding special edit actions */ - QToolBar* keyToolBar{}; /** Toolbar holding key operations */ - QToolBar* emailToolBar{}; /** Toolbar holding key operations */ + QMenu* steganography_menu_{}; ///< Submenu for steganography operations + QToolBar* crypt_tool_bar_{}; ///< Toolbar holding crypt actions + QToolBar* file_tool_bar_{}; ///< Toolbar holding file actions + QToolBar* edit_tool_bar_{}; ///< Toolbar holding edit actions + QToolBar* + special_edit_tool_bar_{}; ///< Toolbar holding special edit actions + QToolBar* key_tool_bar_{}; ///< Toolbar holding key operations + QToolBar* email_tool_bar_{}; ///< Toolbar holding key operations QToolButton* - importButton{}; /** Toolbutton for import dropdown menu in toolbar */ - QDockWidget* keyListDock{}; /** Encrypt Dock*/ - QDockWidget* attachmentDock{}; /** Attachment Dock */ - QDockWidget* infoBoardDock{}; - - QAction* newTabAct{}; /** Action to create new tab */ - QAction* switchTabUpAct{}; /** Action to switch tab up*/ - QAction* switchTabDownAct{}; /** Action to switch tab down */ - QAction* openAct{}; /** Action to open file */ - QAction* browserAct{}; /** Action to open file browser*/ - QAction* saveAct{}; /** Action to save file */ - QAction* saveAsAct{}; /** Action to save file as */ - QAction* printAct{}; /** Action to print */ - QAction* closeTabAct{}; /** Action to print */ - QAction* quitAct{}; /** Action to quit application */ - QAction* encryptAct{}; /** Action to encrypt text */ - QAction* encryptSignAct{}; /** Action to encrypt and sign text */ - QAction* decryptVerifyAct{}; /** Action to encrypt and sign text */ - QAction* decryptAct{}; /** Action to decrypt text */ - QAction* signAct{}; /** Action to sign text */ - QAction* verifyAct{}; /** Action to verify text */ - QAction* importKeyFromEditAct{}; /** Action to import key from edit */ - QAction* - cleanDoubleLinebreaksAct{}; /** Action to remove double line breaks */ + import_button_{}; ///< Tool button for import dropdown menu in toolbar + QDockWidget* key_list_dock_{}; ///< Encrypt Dock + QDockWidget* attachment_dock_{}; ///< Attachment Dock + QDockWidget* info_board_dock_{}; + + QAction* new_tab_act_{}; ///< Action to create new tab + QAction* switch_tab_up_act_{}; ///< Action to switch tab up + QAction* switch_tab_down_act_{}; ///< Action to switch tab down + QAction* open_act_{}; ///< Action to open file + QAction* browser_act_{}; ///< Action to open file browser + QAction* save_act_{}; ///< Action to save file + QAction* save_as_act_{}; ///< Action to save file as + QAction* print_act_{}; ///< Action to print + QAction* close_tab_act_{}; ///< Action to print + QAction* quit_act_{}; ///< Action to quit application + QAction* encrypt_act_{}; ///< Action to encrypt text + QAction* encrypt_sign_act_{}; ///< Action to encrypt and sign text + QAction* decrypt_verify_act_{}; ///< Action to encrypt and sign text + QAction* decrypt_act_{}; ///< Action to decrypt text + QAction* sign_act_{}; ///< Action to sign text + QAction* verify_act_{}; ///< Action to verify text + QAction* import_key_from_edit_act_{}; ///< Action to import key from edit + QAction* clean_double_line_breaks_act_{}; ///< Action to remove double line + ///< breaks QAction* - appendSelectedKeysAct{}; /** Action to append selected keys to edit */ - QAction* - copyMailAddressToClipboardAct{}; /** Action to copy mail to clipboard */ - QAction* openKeyManagementAct{}; /** Action to open key management */ - QAction* copyAct{}; /** Action to copy text */ - QAction* quoteAct{}; /** Action to quote text */ - QAction* cutAct{}; /** Action to cut text */ - QAction* pasteAct{}; /** Action to paste text */ - QAction* selectAllAct{}; /** Action to select whole text */ - QAction* findAct{}; /** Action to find text */ - QAction* undoAct{}; /** Action to undo last action */ - QAction* redoAct{}; /** Action to redo last action */ - QAction* zoomInAct{}; /** Action to zoom in */ - QAction* zoomOutAct{}; /** Action to zoom out */ - QAction* aboutAct{}; /** Action to open about dialog */ - QAction* checkUpdateAct{}; /** Action to open about dialog */ - QAction* translateAct{}; /** Action to open about dialog */ - QAction* openSettingsAct{}; /** Action to open settings dialog */ - QAction* showKeyDetailsAct{}; /** Action to open key-details dialog */ - QAction* startWizardAct{}; /** Action to open the wizard */ - QAction* cutPgpHeaderAct{}; /** Action for cutting the PGP header */ - QAction* addPgpHeaderAct{}; /** Action for adding the PGP header */ + append_selected_keys_act_{}; ///< Action to append selected keys to edit + QAction* copy_mail_address_to_clipboard_act_{}; ///< Action to copy mail to + ///< clipboard + QAction* open_key_management_act_{}; ///< Action to open key management + QAction* copy_act_{}; ///< Action to copy text + QAction* quote_act_{}; ///< Action to quote text + QAction* cut_act_{}; ///< Action to cut text + QAction* paste_act_{}; ///< Action to paste text + QAction* select_all_act_{}; ///< Action to select whole text + QAction* find_act_{}; ///< Action to find text + QAction* undo_act_{}; ///< Action to undo last action + QAction* redo_act_{}; ///< Action to redo last action + QAction* zoom_in_act_{}; ///< Action to zoom in + QAction* zoom_out_act_{}; ///< Action to zoom out + QAction* about_act_{}; ///< Action to open about dialog + QAction* check_update_act_{}; ///< Action to open about dialog + QAction* translate_act_{}; ///< Action to open about dialog + QAction* open_settings_act_{}; ///< Action to open settings dialog + QAction* show_key_details_act_{}; ///< Action to open key-details dialog + QAction* start_wizard_act_{}; ///< Action to open the wizard + QAction* cut_pgp_header_act_{}; ///< Action for cutting the PGP header + QAction* add_pgp_header_act_{}; ///< Action for adding the PGP header #ifdef SMTP_SUPPORT - QAction* sendMailAct{}; /** Action for sending a email */ - QAction* receiveMailAct{}; /** Action for receive emails */ + QAction* send_mail_act_{}; ///< Action for sending a email + QAction* receive_mail_act_{}; ///< Action for receive emails #endif - QAction* importKeyFromFileAct{}; - QAction* importKeyFromClipboardAct{}; - QAction* importKeyFromKeyServerAct{}; - - QLabel* statusBarIcon{}; + QAction* import_key_from_file_act_{}; ///< + QAction* import_key_from_clipboard_act_{}; ///< + QAction* import_key_from_key_server_act_{}; ///< - KeyList* mKeyList{}; - InfoBoardWidget* infoBoard{}; + QLabel* status_bar_icon_{}; ///< - QNetworkAccessManager* networkAccessManager{}; + KeyList* m_key_list_{}; ///< + InfoBoardWidget* info_board_{}; ///< - bool attachmentDockCreated{}; - bool restartNeeded{}; - bool prohibit_update_checking_ = false; + bool attachment_dock_created_{}; ///< + bool restart_needed_{}; ///< + bool prohibit_update_checking_ = false; ///< }; } // namespace GpgFrontend::UI diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp index adf762d8..29ff1d30 100644 --- a/src/ui/main_window/MainWindowFileSlotFunction.cpp +++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp @@ -52,14 +52,14 @@ bool file_pre_check(QWidget* parent, const QString& path) { return true; } -void MainWindow::slotFileEncrypt() { - auto fileTreeView = edit->slotCurPageFileTreeView(); +void MainWindow::SlotFileEncrypt() { + auto fileTreeView = edit_->slotCurPageFileTreeView(); auto path = fileTreeView->getSelected(); if (!file_pre_check(this, path)) return; // check selected keys - auto key_ids = mKeyList->getChecked(); + auto key_ids = m_key_list_->getChecked(); GpgEncrResult result = nullptr; GpgError error; bool if_error = false; @@ -143,7 +143,7 @@ void MainWindow::slotFileEncrypt() { if (!if_error) { auto resultAnalyse = EncryptResultAnalyse(error, std::move(result)); resultAnalyse.Analyse(); - process_result_analyse(edit, infoBoard, resultAnalyse); + process_result_analyse(edit_, info_board_, resultAnalyse); fileTreeView->update(); } else { QMessageBox::critical(this, _("Error"), @@ -152,8 +152,8 @@ void MainWindow::slotFileEncrypt() { } } -void MainWindow::slotFileDecrypt() { - auto fileTreeView = edit->slotCurPageFileTreeView(); +void MainWindow::SlotFileDecrypt() { + auto fileTreeView = edit_->slotCurPageFileTreeView(); auto path = fileTreeView->getSelected(); if (!file_pre_check(this, path)) return; @@ -190,7 +190,7 @@ void MainWindow::slotFileDecrypt() { if (!if_error) { auto resultAnalyse = DecryptResultAnalyse(error, std::move(result)); resultAnalyse.Analyse(); - process_result_analyse(edit, infoBoard, resultAnalyse); + process_result_analyse(edit_, info_board_, resultAnalyse); fileTreeView->update(); } else { @@ -200,13 +200,13 @@ void MainWindow::slotFileDecrypt() { } } -void MainWindow::slotFileSign() { - auto fileTreeView = edit->slotCurPageFileTreeView(); +void MainWindow::SlotFileSign() { + auto fileTreeView = edit_->slotCurPageFileTreeView(); auto path = fileTreeView->getSelected(); if (!file_pre_check(this, path)) return; - auto key_ids = mKeyList->getChecked(); + auto key_ids = m_key_list_->getChecked(); auto keys = GpgKeyGetter::GetInstance().GetKeys(key_ids); if (keys->empty()) { @@ -274,7 +274,7 @@ void MainWindow::slotFileSign() { if (!if_error) { auto resultAnalyse = SignResultAnalyse(error, std::move(result)); resultAnalyse.Analyse(); - process_result_analyse(edit, infoBoard, resultAnalyse); + process_result_analyse(edit_, info_board_, resultAnalyse); fileTreeView->update(); @@ -287,8 +287,8 @@ void MainWindow::slotFileSign() { fileTreeView->update(); } -void MainWindow::slotFileVerify() { - auto fileTreeView = edit->slotCurPageFileTreeView(); +void MainWindow::SlotFileVerify() { + auto fileTreeView = edit_->slotCurPageFileTreeView(); auto path = fileTreeView->getSelected(); boost::filesystem::path in_path = path.toStdString(); @@ -355,13 +355,13 @@ void MainWindow::slotFileVerify() { if (!if_error) { auto result_analyse = VerifyResultAnalyse(error, result); result_analyse.Analyse(); - process_result_analyse(edit, infoBoard, result_analyse); + process_result_analyse(edit_, info_board_, result_analyse); if (result_analyse.GetStatus() == -2) import_unknown_key_from_keyserver(this, result_analyse); if (result_analyse.GetStatus() >= 0) - show_verify_details(this, infoBoard, error, result); + show_verify_details(this, info_board_, error, result); fileTreeView->update(); } else { @@ -371,14 +371,14 @@ void MainWindow::slotFileVerify() { } } -void MainWindow::slotFileEncryptSign() { - auto fileTreeView = edit->slotCurPageFileTreeView(); +void MainWindow::SlotFileEncryptSign() { + auto fileTreeView = edit_->slotCurPageFileTreeView(); auto path = fileTreeView->getSelected(); if (!file_pre_check(this, path)) return; // check selected keys - auto key_ids = mKeyList->getChecked(); + auto key_ids = m_key_list_->getChecked(); auto p_keys = GpgKeyGetter::GetInstance().GetKeys(key_ids); if (p_keys->empty()) { @@ -458,7 +458,7 @@ void MainWindow::slotFileEncryptSign() { auto sign_res = SignResultAnalyse(error, std::move(sign_result)); encrypt_result.Analyse(); sign_res.Analyse(); - process_result_analyse(edit, infoBoard, encrypt_result, sign_res); + process_result_analyse(edit_, info_board_, encrypt_result, sign_res); fileTreeView->update(); @@ -469,8 +469,8 @@ void MainWindow::slotFileEncryptSign() { } } -void MainWindow::slotFileDecryptVerify() { - auto fileTreeView = edit->slotCurPageFileTreeView(); +void MainWindow::SlotFileDecryptVerify() { + auto fileTreeView = edit_->slotCurPageFileTreeView(); auto path = fileTreeView->getSelected(); if (!file_pre_check(this, path)) return; @@ -513,13 +513,13 @@ void MainWindow::slotFileDecryptVerify() { auto verify_res = VerifyResultAnalyse(error, v_result); decrypt_res.Analyse(); verify_res.Analyse(); - process_result_analyse(edit, infoBoard, decrypt_res, verify_res); + process_result_analyse(edit_, info_board_, decrypt_res, verify_res); if (verify_res.GetStatus() == -2) import_unknown_key_from_keyserver(this, verify_res); if (verify_res.GetStatus() >= 0) - show_verify_details(this, infoBoard, error, v_result); + show_verify_details(this, info_board_, error, v_result); fileTreeView->update(); } else { diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index fe0408e0..a33d836d 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -47,10 +47,10 @@ namespace GpgFrontend::UI { /** * Encrypt Entry(Text & File) */ -void MainWindow::slotEncrypt() { - if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) return; +void MainWindow::slot_encrypt() { + if (edit_->tabCount() == 0 || edit_->slotCurPageTextEdit() == nullptr) return; - auto key_ids = mKeyList->getChecked(); + auto key_ids = m_key_list_->getChecked(); GpgEncrResult result = nullptr; GpgError error; @@ -70,7 +70,7 @@ void MainWindow::slotEncrypt() { process_operation(this, _("Symmetrically Encrypting"), [&]() { try { auto buffer = - edit->curTextPage()->getTextPage()->toPlainText().toStdString(); + edit_->curTextPage()->getTextPage()->toPlainText().toStdString(); error = GpgFrontend::BasicOperator::GetInstance().EncryptSymmetric( buffer, tmp, result); } catch (const std::runtime_error& e) { @@ -96,7 +96,7 @@ void MainWindow::slotEncrypt() { process_operation(this, _("Encrypting"), [&]() { try { auto buffer = - edit->curTextPage()->getTextPage()->toPlainText().toStdString(); + edit_->curTextPage()->getTextPage()->toPlainText().toStdString(); error = GpgFrontend::BasicOperator::GetInstance().Encrypt( std::move(keys), buffer, tmp, result); } catch (const std::runtime_error& e) { @@ -109,15 +109,15 @@ void MainWindow::slotEncrypt() { LOG(INFO) << "result" << result.get(); auto resultAnalyse = EncryptResultAnalyse(error, std::move(result)); resultAnalyse.Analyse(); - process_result_analyse(edit, infoBoard, resultAnalyse); + process_result_analyse(edit_, info_board_, resultAnalyse); if (check_gpg_error_2_err_code(error) == GPG_ERR_NO_ERROR) - edit->slotFillTextEditWithText(QString::fromStdString(*tmp)); - infoBoard->resetOptionActionsMenu(); + edit_->slotFillTextEditWithText(QString::fromStdString(*tmp)); + info_board_->resetOptionActionsMenu(); #ifdef SMTP_SUPPORT if (check_gpg_error_2_err_code(error) == GPG_ERR_NO_ERROR) - send_an_email(this, infoBoard, - edit->curTextPage()->getTextPage()->toPlainText()); + send_an_email(this, info_board_, + edit_->curTextPage()->getTextPage()->toPlainText()); #endif } else { QMessageBox::critical(this, _("Error"), @@ -126,10 +126,10 @@ void MainWindow::slotEncrypt() { } } -void MainWindow::slotSign() { - if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) return; +void MainWindow::slot_sign() { + if (edit_->tabCount() == 0 || edit_->slotCurPageTextEdit() == nullptr) return; - auto key_ids = mKeyList->getPrivateChecked(); + auto key_ids = m_key_list_->getPrivateChecked(); if (key_ids->empty()) { QMessageBox::critical( @@ -160,7 +160,7 @@ void MainWindow::slotSign() { process_operation(this, _("Signing"), [&]() { try { - auto buffer = edit->curTextPage() + auto buffer = edit_->curTextPage() ->getTextPage() ->toPlainText() .toUtf8() @@ -175,10 +175,10 @@ void MainWindow::slotSign() { if (!if_error) { auto resultAnalyse = SignResultAnalyse(error, std::move(result)); resultAnalyse.Analyse(); - process_result_analyse(edit, infoBoard, resultAnalyse); + process_result_analyse(edit_, info_board_, resultAnalyse); if (check_gpg_error_2_err_code(error) == GPG_ERR_NO_ERROR) - edit->slotFillTextEditWithText(QString::fromStdString(*tmp)); + edit_->slotFillTextEditWithText(QString::fromStdString(*tmp)); } else { QMessageBox::critical(this, _("Error"), _("An error occurred during operation.")); @@ -186,11 +186,11 @@ void MainWindow::slotSign() { } } -void MainWindow::slotDecrypt() { - if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) return; +void MainWindow::slot_decrypt() { + if (edit_->tabCount() == 0 || edit_->slotCurPageTextEdit() == nullptr) return; auto decrypted = std::make_unique<ByteArray>(); - QByteArray text = edit->curTextPage()->getTextPage()->toPlainText().toUtf8(); + QByteArray text = edit_->curTextPage()->getTextPage()->toPlainText().toUtf8(); if (text.trimmed().startsWith(GpgConstants::GPG_FRONTEND_SHORT_CRYPTO_HEAD)) { QMessageBox::critical( @@ -215,10 +215,10 @@ void MainWindow::slotDecrypt() { if (!if_error) { auto resultAnalyse = DecryptResultAnalyse(error, std::move(result)); resultAnalyse.Analyse(); - process_result_analyse(edit, infoBoard, resultAnalyse); + process_result_analyse(edit_, info_board_, resultAnalyse); if (check_gpg_error_2_err_code(error) == GPG_ERR_NO_ERROR) - edit->slotFillTextEditWithText(QString::fromStdString(*decrypted)); + edit_->slotFillTextEditWithText(QString::fromStdString(*decrypted)); } else { QMessageBox::critical(this, _("Error"), _("An error occurred during operation.")); @@ -226,22 +226,22 @@ void MainWindow::slotDecrypt() { } } -void MainWindow::slotFind() { - if (edit->tabCount() == 0 || edit->curTextPage() == nullptr) { +void MainWindow::slot_find() { + if (edit_->tabCount() == 0 || edit_->curTextPage() == nullptr) { return; } // At first close verifynotification, if existing - edit->slotCurPageTextEdit()->closeNoteByClass("findwidget"); + edit_->slotCurPageTextEdit()->closeNoteByClass("findwidget"); - auto* fw = new FindWidget(this, edit->curTextPage()); - edit->slotCurPageTextEdit()->showNotificationWidget(fw, "findWidget"); + auto* fw = new FindWidget(this, edit_->curTextPage()); + edit_->slotCurPageTextEdit()->showNotificationWidget(fw, "findWidget"); } -void MainWindow::slotVerify() { - if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) return; +void MainWindow::slot_verify() { + if (edit_->tabCount() == 0 || edit_->slotCurPageTextEdit() == nullptr) return; - auto text = edit->curTextPage()->getTextPage()->toPlainText().toUtf8(); + auto text = edit_->curTextPage()->getTextPage()->toPlainText().toUtf8(); // TODO(Saturneric) PreventNoDataErr auto sig_buffer = std::make_unique<ByteArray>(); @@ -263,20 +263,20 @@ void MainWindow::slotVerify() { if (!if_error) { auto result_analyse = VerifyResultAnalyse(error, result); result_analyse.Analyse(); - process_result_analyse(edit, infoBoard, result_analyse); + process_result_analyse(edit_, info_board_, result_analyse); if (result_analyse.GetStatus() == -2) import_unknown_key_from_keyserver(this, result_analyse); if (result_analyse.GetStatus() >= 0) - show_verify_details(this, infoBoard, error, result); + show_verify_details(this, info_board_, error, result); } } -void MainWindow::slotEncryptSign() { - if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) return; +void MainWindow::slot_encrypt_sign() { + if (edit_->tabCount() == 0 || edit_->slotCurPageTextEdit() == nullptr) return; - auto key_ids = mKeyList->getChecked(); + auto key_ids = m_key_list_->getChecked(); if (key_ids->empty()) { QMessageBox::critical( @@ -324,7 +324,7 @@ void MainWindow::slotEncryptSign() { auto tmp = std::make_unique<ByteArray>(); process_operation(this, _("Encrypting and Signing"), [&]() { try { - auto buffer = edit->curTextPage() + auto buffer = edit_->curTextPage() ->getTextPage() ->toPlainText() .toUtf8() @@ -356,15 +356,15 @@ void MainWindow::slotEncryptSign() { auto sign_res = SignResultAnalyse(error, std::move(sign_result)); encrypt_res.Analyse(); sign_res.Analyse(); - process_result_analyse(edit, infoBoard, encrypt_res, sign_res); + process_result_analyse(edit_, info_board_, encrypt_res, sign_res); if (check_gpg_error_2_err_code(error) == GPG_ERR_NO_ERROR) - edit->slotFillTextEditWithText(QString::fromStdString(*tmp)); + edit_->slotFillTextEditWithText(QString::fromStdString(*tmp)); - infoBoard->resetOptionActionsMenu(); + info_board_->resetOptionActionsMenu(); #ifdef SMTP_SUPPORT if (check_gpg_error_2_err_code(error) == GPG_ERR_NO_ERROR) - send_an_email(this, infoBoard, - edit->curTextPage()->getTextPage()->toPlainText(), false); + send_an_email(this, info_board_, + edit_->curTextPage()->getTextPage()->toPlainText(), false); #endif #ifdef ADVANCE_SUPPORT @@ -385,10 +385,10 @@ void MainWindow::slotEncryptSign() { } } -void MainWindow::slotDecryptVerify() { - if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) return; +void MainWindow::slot_decrypt_verify() { + if (edit_->tabCount() == 0 || edit_->slotCurPageTextEdit() == nullptr) return; - QString plainText = edit->curTextPage()->getTextPage()->toPlainText(); + QString plainText = edit_->curTextPage()->getTextPage()->toPlainText(); #ifdef ADVANCE_SUPPORT if (plainText.trimmed().startsWith( @@ -436,15 +436,15 @@ void MainWindow::slotDecryptVerify() { auto verify_res = VerifyResultAnalyse(error, v_result); decrypt_res.Analyse(); verify_res.Analyse(); - process_result_analyse(edit, infoBoard, decrypt_res, verify_res); + process_result_analyse(edit_, info_board_, decrypt_res, verify_res); if (check_gpg_error_2_err_code(error) == GPG_ERR_NO_ERROR) - edit->slotFillTextEditWithText(QString::fromStdString(*decrypted)); + edit_->slotFillTextEditWithText(QString::fromStdString(*decrypted)); if (verify_res.GetStatus() == -2) import_unknown_key_from_keyserver(this, verify_res); if (verify_res.GetStatus() >= 0) - show_verify_details(this, infoBoard, error, v_result); + show_verify_details(this, info_board_, error, v_result); } else { QMessageBox::critical(this, _("Error"), @@ -456,21 +456,21 @@ void MainWindow::slotDecryptVerify() { /* * Append the selected (not checked!) Key(s) To Textedit */ -void MainWindow::slotAppendSelectedKeys() { - if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) { +void MainWindow::slot_append_selected_keys() { + if (edit_->tabCount() == 0 || edit_->slotCurPageTextEdit() == nullptr) { return; } auto exported = std::make_unique<ByteArray>(); - auto key_ids = mKeyList->getSelected(); + auto key_ids = m_key_list_->getSelected(); GpgKeyImportExporter::GetInstance().ExportKeys(key_ids, exported); - edit->curTextPage()->getTextPage()->appendPlainText( + edit_->curTextPage()->getTextPage()->appendPlainText( QString::fromStdString(*exported)); } -void MainWindow::slotCopyMailAddressToClipboard() { - auto key_ids = mKeyList->getSelected(); +void MainWindow::slot_copy_mail_address_to_clipboard() { + auto key_ids = m_key_list_->getSelected(); if (key_ids->empty()) return; auto key = GpgKeyGetter::GetInstance().GetKey(key_ids->front()); @@ -482,8 +482,8 @@ void MainWindow::slotCopyMailAddressToClipboard() { cb->setText(QString::fromStdString(key.GetEmail())); } -void MainWindow::slotShowKeyDetails() { - auto key_ids = mKeyList->getSelected(); +void MainWindow::slot_show_key_details() { + auto key_ids = m_key_list_->getSelected(); if (key_ids->empty()) return; auto key = GpgKeyGetter::GetInstance().GetKey(key_ids->front()); @@ -494,8 +494,8 @@ void MainWindow::slotShowKeyDetails() { } } -void MainWindow::refreshKeysFromKeyserver() { - auto key_ids = mKeyList->getSelected(); +void MainWindow::refresh_keys_from_key_server() { + auto key_ids = m_key_list_->getSelected(); if (key_ids->empty()) return; auto* dialog = new KeyServerImportDialog(this); @@ -503,16 +503,16 @@ void MainWindow::refreshKeysFromKeyserver() { dialog->slotImport(key_ids); } -void MainWindow::uploadKeyToServer() { - auto key_ids = mKeyList->getSelected(); +void MainWindow::upload_key_to_server() { + auto key_ids = m_key_list_->getSelected(); auto* dialog = new KeyUploadDialog(key_ids, this); dialog->show(); dialog->slotUpload(); } -void MainWindow::slotOpenFile(QString& path) { edit->slotOpenFile(path); } +void MainWindow::SlotOpenFile(QString& path) { edit_->slotOpenFile(path); } -void MainWindow::slotVersionUpgrade(const SoftwareVersion& version) { +void MainWindow::slot_version_upgrade(const SoftwareVersion& version) { LOG(INFO) << _("called"); if (version.NeedUpgrade()) { statusBar()->showMessage( diff --git a/src/ui/main_window/MainWindowSlotUI.cpp b/src/ui/main_window/MainWindowSlotUI.cpp index 9f40ec9d..64337122 100644 --- a/src/ui/main_window/MainWindowSlotUI.cpp +++ b/src/ui/main_window/MainWindowSlotUI.cpp @@ -28,31 +28,31 @@ namespace GpgFrontend::UI { -void MainWindow::slotSetStatusBarText(const QString& text) { +void MainWindow::SlotSetStatusBarText(const QString& text) { statusBar()->showMessage(text, 20000); } -void MainWindow::slotStartWizard() { +void MainWindow::slot_start_wizard() { auto* wizard = new Wizard(this); wizard->show(); wizard->setModal(true); } -void MainWindow::slotImportKeyFromEdit() { - if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) return; +void MainWindow::slot_import_key_from_edit() { + if (edit_->tabCount() == 0 || edit_->slotCurPageTextEdit() == nullptr) return; CommonUtils::GetInstance()->slotImportKeys( - this, edit->curTextPage()->getTextPage()->toPlainText().toStdString()); + this, edit_->curTextPage()->getTextPage()->toPlainText().toStdString()); } -void MainWindow::slotOpenKeyManagement() { +void MainWindow::slot_open_key_management() { auto* dialog = new KeyMgmt(this); dialog->show(); dialog->raise(); } -void MainWindow::slotOpenFileTab() { edit->slotNewFileTab(); } +void MainWindow::slot_open_file_tab() { edit_->slotNewFileTab(); } -void MainWindow::slotDisableTabActions(int number) { +void MainWindow::slot_disable_tab_actions(int number) { bool disable; if (number == -1) @@ -60,41 +60,41 @@ void MainWindow::slotDisableTabActions(int number) { else disable = false; - if (edit->curFilePage() != nullptr) { + if (edit_->curFilePage() != nullptr) { disable = true; } - printAct->setDisabled(disable); - saveAct->setDisabled(disable); - saveAsAct->setDisabled(disable); - quoteAct->setDisabled(disable); - cutAct->setDisabled(disable); - copyAct->setDisabled(disable); - pasteAct->setDisabled(disable); - closeTabAct->setDisabled(disable); - selectAllAct->setDisabled(disable); - findAct->setDisabled(disable); - verifyAct->setDisabled(disable); - signAct->setDisabled(disable); - encryptAct->setDisabled(disable); - encryptSignAct->setDisabled(disable); - decryptAct->setDisabled(disable); - decryptVerifyAct->setDisabled(disable); - - redoAct->setDisabled(disable); - undoAct->setDisabled(disable); - zoomOutAct->setDisabled(disable); - zoomInAct->setDisabled(disable); - cleanDoubleLinebreaksAct->setDisabled(disable); - quoteAct->setDisabled(disable); - appendSelectedKeysAct->setDisabled(disable); - importKeyFromEditAct->setDisabled(disable); - - cutPgpHeaderAct->setDisabled(disable); - addPgpHeaderAct->setDisabled(disable); + print_act_->setDisabled(disable); + save_act_->setDisabled(disable); + save_as_act_->setDisabled(disable); + quote_act_->setDisabled(disable); + cut_act_->setDisabled(disable); + copy_act_->setDisabled(disable); + paste_act_->setDisabled(disable); + close_tab_act_->setDisabled(disable); + select_all_act_->setDisabled(disable); + find_act_->setDisabled(disable); + verify_act_->setDisabled(disable); + sign_act_->setDisabled(disable); + encrypt_act_->setDisabled(disable); + encrypt_sign_act_->setDisabled(disable); + decrypt_act_->setDisabled(disable); + decrypt_verify_act_->setDisabled(disable); + + redo_act_->setDisabled(disable); + undo_act_->setDisabled(disable); + zoom_out_act_->setDisabled(disable); + zoom_in_act_->setDisabled(disable); + clean_double_line_breaks_act_->setDisabled(disable); + quote_act_->setDisabled(disable); + append_selected_keys_act_->setDisabled(disable); + import_key_from_edit_act_->setDisabled(disable); + + cut_pgp_header_act_->setDisabled(disable); + add_pgp_header_act_->setDisabled(disable); } -void MainWindow::slotOpenSettingsDialog() { +void MainWindow::slot_open_settings_dialog() { auto dialog = new SettingsDialog(this); connect(dialog, &SettingsDialog::finished, this, [&]() -> void { @@ -106,19 +106,19 @@ void MainWindow::slotOpenSettingsDialog() { int icon_height = settings["window"]["icon_size"]["height"]; this->setIconSize(QSize(icon_width, icon_height)); - importButton->setIconSize(QSize(icon_width, icon_height)); + import_button_->setIconSize(QSize(icon_width, icon_height)); // Iconstyle int icon_style = settings["window"]["icon_style"]; auto button_style = static_cast<Qt::ToolButtonStyle>(icon_style); this->setToolButtonStyle(button_style); - importButton->setToolButtonStyle(button_style); + import_button_->setToolButtonStyle(button_style); // restart mainwindow if necessary - if (getRestartNeeded()) { - if (edit->maybeSaveAnyTab()) { - saveSettings(); + if (get_restart_needed()) { + if (edit_->maybeSaveAnyTab()) { + save_settings(); qApp->exit(RESTART_CODE); } } @@ -134,35 +134,36 @@ void MainWindow::slotOpenSettingsDialog() { }); } -void MainWindow::slotCleanDoubleLinebreaks() { - if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) { +void MainWindow::slot_clean_double_line_breaks() { + if (edit_->tabCount() == 0 || edit_->slotCurPageTextEdit() == nullptr) { return; } - QString content = edit->curTextPage()->getTextPage()->toPlainText(); + QString content = edit_->curTextPage()->getTextPage()->toPlainText(); content.replace("\n\n", "\n"); - edit->slotFillTextEditWithText(content); + edit_->slotFillTextEditWithText(content); } -void MainWindow::slotAddPgpHeader() { - if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) { +void MainWindow::slot_add_pgp_header() { + if (edit_->tabCount() == 0 || edit_->slotCurPageTextEdit() == nullptr) { return; } - QString content = edit->curTextPage()->getTextPage()->toPlainText().trimmed(); + QString content = + edit_->curTextPage()->getTextPage()->toPlainText().trimmed(); content.prepend("\n\n").prepend(GpgConstants::PGP_CRYPT_BEGIN); content.append("\n").append(GpgConstants::PGP_CRYPT_END); - edit->slotFillTextEditWithText(content); + edit_->slotFillTextEditWithText(content); } -void MainWindow::slotCutPgpHeader() { - if (edit->tabCount() == 0 || edit->slotCurPageTextEdit() == nullptr) { +void MainWindow::slot_cut_pgp_header() { + if (edit_->tabCount() == 0 || edit_->slotCurPageTextEdit() == nullptr) { return; } - QString content = edit->curTextPage()->getTextPage()->toPlainText(); + QString content = edit_->curTextPage()->getTextPage()->toPlainText(); int start = content.indexOf(GpgConstants::PGP_CRYPT_BEGIN); int end = content.indexOf(GpgConstants::PGP_CRYPT_END); @@ -178,13 +179,13 @@ void MainWindow::slotCutPgpHeader() { end = content.indexOf(GpgConstants::PGP_CRYPT_END); content.remove(end, QString(GpgConstants::PGP_CRYPT_END).size()); - edit->slotFillTextEditWithText(content.trimmed()); + edit_->slotFillTextEditWithText(content.trimmed()); } -void MainWindow::slotSetRestartNeeded(bool needed) { - this->restartNeeded = needed; +void MainWindow::slot_set_restart_needed(bool needed) { + this->restart_needed_ = needed; } -bool MainWindow::getRestartNeeded() const { return this->restartNeeded; } +bool MainWindow::get_restart_needed() const { return this->restart_needed_; } } // namespace GpgFrontend::UI diff --git a/src/ui/main_window/MainWindowUI.cpp b/src/ui/main_window/MainWindowUI.cpp index 3d1e45b8..b143c985 100644 --- a/src/ui/main_window/MainWindowUI.cpp +++ b/src/ui/main_window/MainWindowUI.cpp @@ -31,349 +31,361 @@ namespace GpgFrontend::UI { -void MainWindow::createActions() { +void MainWindow::create_actions() { /* Main Menu */ - newTabAct = new QAction(_("New"), this); - newTabAct->setIcon(QIcon(":misc_doc.png")); + new_tab_act_ = new QAction(_("New"), this); + new_tab_act_->setIcon(QIcon(":misc_doc.png")); QList<QKeySequence> newTabActShortcutList; newTabActShortcutList.append(QKeySequence(Qt::CTRL + Qt::Key_N)); newTabActShortcutList.append(QKeySequence(Qt::CTRL + Qt::Key_T)); - newTabAct->setShortcuts(newTabActShortcutList); - newTabAct->setToolTip(_("Open a new file")); - connect(newTabAct, SIGNAL(triggered()), edit, SLOT(slotNewTab())); - - openAct = new QAction(_("Open..."), this); - openAct->setIcon(QIcon(":fileopen.png")); - openAct->setShortcut(QKeySequence::Open); - openAct->setToolTip(_("Open an existing file")); - connect(openAct, SIGNAL(triggered()), edit, SLOT(slotOpen())); - - browserAct = new QAction(_("File Browser"), this); - browserAct->setIcon(QIcon(":file-browser.png")); - browserAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); - browserAct->setToolTip(_("Open a file browser")); - connect(browserAct, SIGNAL(triggered()), this, SLOT(slotOpenFileTab())); - - saveAct = new QAction(_("Save File"), this); - saveAct->setIcon(QIcon(":filesave.png")); - saveAct->setShortcut(QKeySequence::Save); - saveAct->setToolTip(_("Save the current File")); - connect(saveAct, SIGNAL(triggered()), edit, SLOT(slotSave())); - - saveAsAct = new QAction(QString(_("Save As")) + "...", this); - saveAsAct->setIcon(QIcon(":filesaveas.png")); - saveAsAct->setShortcut(QKeySequence::SaveAs); - saveAsAct->setToolTip(_("Save the current File as...")); - connect(saveAsAct, SIGNAL(triggered()), edit, SLOT(slotSaveAs())); - - printAct = new QAction(_("Print"), this); - printAct->setIcon(QIcon(":fileprint.png")); - printAct->setShortcut(QKeySequence::Print); - printAct->setToolTip(_("Print Document")); - connect(printAct, SIGNAL(triggered()), edit, SLOT(slotPrint())); - - closeTabAct = new QAction(_("Close"), this); - closeTabAct->setShortcut(QKeySequence::Close); - closeTabAct->setToolTip(_("Close file")); - connect(closeTabAct, SIGNAL(triggered()), edit, SLOT(slotCloseTab())); - - quitAct = new QAction(_("Quit"), this); - quitAct->setShortcut(QKeySequence::Quit); - quitAct->setIcon(QIcon(":exit.png")); - quitAct->setToolTip(_("Quit Program")); - connect(quitAct, SIGNAL(triggered()), this, SLOT(close())); + new_tab_act_->setShortcuts(newTabActShortcutList); + new_tab_act_->setToolTip(_("Open a new file")); + connect(new_tab_act_, SIGNAL(triggered()), edit_, SLOT(slotNewTab())); + + open_act_ = new QAction(_("Open..."), this); + open_act_->setIcon(QIcon(":fileopen.png")); + open_act_->setShortcut(QKeySequence::Open); + open_act_->setToolTip(_("Open an existing file")); + connect(open_act_, SIGNAL(triggered()), edit_, SLOT(slotOpen())); + + browser_act_ = new QAction(_("File Browser"), this); + browser_act_->setIcon(QIcon(":file-browser.png")); + browser_act_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); + browser_act_->setToolTip(_("Open a file browser")); + connect(browser_act_, SIGNAL(triggered()), this, SLOT(slot_open_file_tab())); + + save_act_ = new QAction(_("Save File"), this); + save_act_->setIcon(QIcon(":filesave.png")); + save_act_->setShortcut(QKeySequence::Save); + save_act_->setToolTip(_("Save the current File")); + connect(save_act_, SIGNAL(triggered()), edit_, SLOT(slotSave())); + + save_as_act_ = new QAction(QString(_("Save As")) + "...", this); + save_as_act_->setIcon(QIcon(":filesaveas.png")); + save_as_act_->setShortcut(QKeySequence::SaveAs); + save_as_act_->setToolTip(_("Save the current File as...")); + connect(save_as_act_, SIGNAL(triggered()), edit_, SLOT(slotSaveAs())); + + print_act_ = new QAction(_("Print"), this); + print_act_->setIcon(QIcon(":fileprint.png")); + print_act_->setShortcut(QKeySequence::Print); + print_act_->setToolTip(_("Print Document")); + connect(print_act_, SIGNAL(triggered()), edit_, SLOT(slotPrint())); + + close_tab_act_ = new QAction(_("Close"), this); + close_tab_act_->setShortcut(QKeySequence::Close); + close_tab_act_->setToolTip(_("Close file")); + connect(close_tab_act_, SIGNAL(triggered()), edit_, SLOT(slotCloseTab())); + + quit_act_ = new QAction(_("Quit"), this); + quit_act_->setShortcut(QKeySequence::Quit); + quit_act_->setIcon(QIcon(":exit.png")); + quit_act_->setToolTip(_("Quit Program")); + connect(quit_act_, SIGNAL(triggered()), this, SLOT(close())); /* Edit Menu */ - undoAct = new QAction(_("Undo"), this); - undoAct->setShortcut(QKeySequence::Undo); - undoAct->setToolTip(_("Undo Last Edit Action")); - connect(undoAct, SIGNAL(triggered()), edit, SLOT(slotUndo())); - - redoAct = new QAction(_("Redo"), this); - redoAct->setShortcut(QKeySequence::Redo); - redoAct->setToolTip(_("Redo Last Edit Action")); - connect(redoAct, SIGNAL(triggered()), edit, SLOT(slotRedo())); - - zoomInAct = new QAction(_("Zoom In"), this); - zoomInAct->setShortcut(QKeySequence::ZoomIn); - connect(zoomInAct, SIGNAL(triggered()), edit, SLOT(slotZoomIn())); - - zoomOutAct = new QAction(_("Zoom Out"), this); - zoomOutAct->setShortcut(QKeySequence::ZoomOut); - connect(zoomOutAct, SIGNAL(triggered()), edit, SLOT(slotZoomOut())); - - pasteAct = new QAction(_("Paste"), this); - pasteAct->setIcon(QIcon(":button_paste.png")); - pasteAct->setShortcut(QKeySequence::Paste); - pasteAct->setToolTip(_("Paste Text From Clipboard")); - connect(pasteAct, SIGNAL(triggered()), edit, SLOT(slotPaste())); - - cutAct = new QAction(_("Cut"), this); - cutAct->setIcon(QIcon(":button_cut.png")); - cutAct->setShortcut(QKeySequence::Cut); - cutAct->setToolTip( + undo_act_ = new QAction(_("Undo"), this); + undo_act_->setShortcut(QKeySequence::Undo); + undo_act_->setToolTip(_("Undo Last Edit Action")); + connect(undo_act_, SIGNAL(triggered()), edit_, SLOT(slotUndo())); + + redo_act_ = new QAction(_("Redo"), this); + redo_act_->setShortcut(QKeySequence::Redo); + redo_act_->setToolTip(_("Redo Last Edit Action")); + connect(redo_act_, SIGNAL(triggered()), edit_, SLOT(slotRedo())); + + zoom_in_act_ = new QAction(_("Zoom In"), this); + zoom_in_act_->setShortcut(QKeySequence::ZoomIn); + connect(zoom_in_act_, SIGNAL(triggered()), edit_, SLOT(slotZoomIn())); + + zoom_out_act_ = new QAction(_("Zoom Out"), this); + zoom_out_act_->setShortcut(QKeySequence::ZoomOut); + connect(zoom_out_act_, SIGNAL(triggered()), edit_, SLOT(slotZoomOut())); + + paste_act_ = new QAction(_("Paste"), this); + paste_act_->setIcon(QIcon(":button_paste.png")); + paste_act_->setShortcut(QKeySequence::Paste); + paste_act_->setToolTip(_("Paste Text From Clipboard")); + connect(paste_act_, SIGNAL(triggered()), edit_, SLOT(slotPaste())); + + cut_act_ = new QAction(_("Cut"), this); + cut_act_->setIcon(QIcon(":button_cut.png")); + cut_act_->setShortcut(QKeySequence::Cut); + cut_act_->setToolTip( _("Cut the current selection's contents to the " "clipboard")); - connect(cutAct, SIGNAL(triggered()), edit, SLOT(slotCut())); + connect(cut_act_, SIGNAL(triggered()), edit_, SLOT(slotCut())); - copyAct = new QAction(_("Copy"), this); - copyAct->setIcon(QIcon(":button_copy.png")); - copyAct->setShortcut(QKeySequence::Copy); - copyAct->setToolTip( + copy_act_ = new QAction(_("Copy"), this); + copy_act_->setIcon(QIcon(":button_copy.png")); + copy_act_->setShortcut(QKeySequence::Copy); + copy_act_->setToolTip( _("Copy the current selection's contents to the " "clipboard")); - connect(copyAct, SIGNAL(triggered()), edit, SLOT(slotCopy())); - - quoteAct = new QAction(_("Quote"), this); - quoteAct->setIcon(QIcon(":quote.png")); - quoteAct->setToolTip(_("Quote whole text")); - connect(quoteAct, SIGNAL(triggered()), edit, SLOT(slotQuote())); - - selectAllAct = new QAction(_("Select All"), this); - selectAllAct->setIcon(QIcon(":edit.png")); - selectAllAct->setShortcut(QKeySequence::SelectAll); - selectAllAct->setToolTip(_("Select the whole text")); - connect(selectAllAct, SIGNAL(triggered()), edit, SLOT(slotSelectAll())); - - findAct = new QAction(_("Find"), this); - findAct->setShortcut(QKeySequence::Find); - findAct->setToolTip(_("Find a word")); - connect(findAct, SIGNAL(triggered()), this, SLOT(slotFind())); - - cleanDoubleLinebreaksAct = new QAction(_("Remove spacing"), this); - cleanDoubleLinebreaksAct->setIcon(QIcon(":format-line-spacing-triple.png")); + connect(copy_act_, SIGNAL(triggered()), edit_, SLOT(slotCopy())); + + quote_act_ = new QAction(_("Quote"), this); + quote_act_->setIcon(QIcon(":quote.png")); + quote_act_->setToolTip(_("Quote whole text")); + connect(quote_act_, SIGNAL(triggered()), edit_, SLOT(slotQuote())); + + select_all_act_ = new QAction(_("Select All"), this); + select_all_act_->setIcon(QIcon(":edit.png")); + select_all_act_->setShortcut(QKeySequence::SelectAll); + select_all_act_->setToolTip(_("Select the whole text")); + connect(select_all_act_, SIGNAL(triggered()), edit_, SLOT(slotSelectAll())); + + find_act_ = new QAction(_("Find"), this); + find_act_->setShortcut(QKeySequence::Find); + find_act_->setToolTip(_("Find a word")); + connect(find_act_, SIGNAL(triggered()), this, SLOT(slot_find())); + + clean_double_line_breaks_act_ = new QAction(_("Remove spacing"), this); + clean_double_line_breaks_act_->setIcon( + QIcon(":format-line-spacing-triple.png")); // cleanDoubleLineBreaksAct->setShortcut(QKeySequence::SelectAll); - cleanDoubleLinebreaksAct->setToolTip( + clean_double_line_breaks_act_->setToolTip( _("Remove double linebreaks, e.g. in pasted text from Web Mailer")); - connect(cleanDoubleLinebreaksAct, SIGNAL(triggered()), this, - SLOT(slotCleanDoubleLinebreaks())); + connect(clean_double_line_breaks_act_, SIGNAL(triggered()), this, + SLOT(slot_clean_double_line_breaks())); - openSettingsAct = new QAction(_("Settings"), this); - openSettingsAct->setToolTip(_("Open settings dialog")); - openSettingsAct->setShortcut(QKeySequence::Preferences); - connect(openSettingsAct, SIGNAL(triggered()), this, - SLOT(slotOpenSettingsDialog())); + open_settings_act_ = new QAction(_("Settings"), this); + open_settings_act_->setToolTip(_("Open settings dialog")); + open_settings_act_->setShortcut(QKeySequence::Preferences); + connect(open_settings_act_, SIGNAL(triggered()), this, + SLOT(slot_open_settings_dialog())); /* Crypt Menu */ - encryptAct = new QAction(_("Encrypt"), this); - encryptAct->setIcon(QIcon(":encrypted.png")); - encryptAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E)); - encryptAct->setToolTip(_("Encrypt Message")); - connect(encryptAct, SIGNAL(triggered()), this, SLOT(slotEncrypt())); - - encryptSignAct = new QAction(_("Encrypt Sign"), this); - encryptSignAct->setIcon(QIcon(":encrypted_signed.png")); - encryptSignAct->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_E)); - encryptSignAct->setToolTip(_("Encrypt and Sign Message")); - connect(encryptSignAct, SIGNAL(triggered()), this, SLOT(slotEncryptSign())); - - decryptAct = new QAction(_("Decrypt"), this); - decryptAct->setIcon(QIcon(":decrypted.png")); - decryptAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D)); - decryptAct->setToolTip(_("Decrypt Message")); - connect(decryptAct, SIGNAL(triggered()), this, SLOT(slotDecrypt())); - - decryptVerifyAct = new QAction(_("Decrypt Verify"), this); - decryptVerifyAct->setIcon(QIcon(":decrypted_verified.png")); - decryptVerifyAct->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D)); - decryptVerifyAct->setToolTip(_("Decrypt and Verify Message")); - connect(decryptVerifyAct, SIGNAL(triggered()), this, - SLOT(slotDecryptVerify())); - - signAct = new QAction(_("Sign"), this); - signAct->setIcon(QIcon(":signature.png")); - signAct->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I)); - signAct->setToolTip(_("Sign Message")); - connect(signAct, SIGNAL(triggered()), this, SLOT(slotSign())); - - verifyAct = new QAction(_("Verify"), this); - verifyAct->setIcon(QIcon(":verify.png")); - verifyAct->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V)); - verifyAct->setToolTip(_("Verify Message")); - connect(verifyAct, SIGNAL(triggered()), this, SLOT(slotVerify())); + encrypt_act_ = new QAction(_("Encrypt"), this); + encrypt_act_->setIcon(QIcon(":encrypted.png")); + encrypt_act_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E)); + encrypt_act_->setToolTip(_("Encrypt Message")); + connect(encrypt_act_, SIGNAL(triggered()), this, SLOT(slot_encrypt())); + + encrypt_sign_act_ = new QAction(_("Encrypt Sign"), this); + encrypt_sign_act_->setIcon(QIcon(":encrypted_signed.png")); + encrypt_sign_act_->setShortcut( + QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_E)); + encrypt_sign_act_->setToolTip(_("Encrypt and Sign Message")); + connect(encrypt_sign_act_, SIGNAL(triggered()), this, + SLOT(slot_encrypt_sign())); + + decrypt_act_ = new QAction(_("Decrypt"), this); + decrypt_act_->setIcon(QIcon(":decrypted.png")); + decrypt_act_->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D)); + decrypt_act_->setToolTip(_("Decrypt Message")); + connect(decrypt_act_, SIGNAL(triggered()), this, SLOT(slot_decrypt())); + + decrypt_verify_act_ = new QAction(_("Decrypt Verify"), this); + decrypt_verify_act_->setIcon(QIcon(":decrypted_verified.png")); + decrypt_verify_act_->setShortcut( + QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_D)); + decrypt_verify_act_->setToolTip(_("Decrypt and Verify Message")); + connect(decrypt_verify_act_, SIGNAL(triggered()), this, + SLOT(slot_decrypt_verify())); + + sign_act_ = new QAction(_("Sign"), this); + sign_act_->setIcon(QIcon(":signature.png")); + sign_act_->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I)); + sign_act_->setToolTip(_("Sign Message")); + connect(sign_act_, SIGNAL(triggered()), this, SLOT(slot_sign())); + + verify_act_ = new QAction(_("Verify"), this); + verify_act_->setIcon(QIcon(":verify.png")); + verify_act_->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_V)); + verify_act_->setToolTip(_("Verify Message")); + connect(verify_act_, SIGNAL(triggered()), this, SLOT(slot_verify())); /* Key Menu */ - importKeyFromFileAct = new QAction(_("File"), this); - importKeyFromFileAct->setIcon(QIcon(":import_key_from_file.png")); - importKeyFromFileAct->setToolTip(_("Import New Key From File")); - connect(importKeyFromFileAct, &QAction::triggered, this, + import_key_from_file_act_ = new QAction(_("File"), this); + import_key_from_file_act_->setIcon(QIcon(":import_key_from_file.png")); + import_key_from_file_act_->setToolTip(_("Import New Key From File")); + connect(import_key_from_file_act_, &QAction::triggered, this, [&]() { CommonUtils::GetInstance()->slotImportKeyFromFile(this); }); - importKeyFromClipboardAct = new QAction(_("Clipboard"), this); - importKeyFromClipboardAct->setIcon(QIcon(":import_key_from_clipboard.png")); - importKeyFromClipboardAct->setToolTip(_("Import New Key From Clipboard")); - connect(importKeyFromClipboardAct, &QAction::triggered, this, [&]() { + import_key_from_clipboard_act_ = new QAction(_("Clipboard"), this); + import_key_from_clipboard_act_->setIcon( + QIcon(":import_key_from_clipboard.png")); + import_key_from_clipboard_act_->setToolTip( + _("Import New Key From Clipboard")); + connect(import_key_from_clipboard_act_, &QAction::triggered, this, [&]() { CommonUtils::GetInstance()->slotImportKeyFromClipboard(this); }); - importKeyFromKeyServerAct = new QAction(_("Keyserver"), this); - importKeyFromKeyServerAct->setIcon(QIcon(":import_key_from_server.png")); - importKeyFromKeyServerAct->setToolTip(_("Import New Key From Keyserver")); - connect(importKeyFromKeyServerAct, &QAction::triggered, this, [&]() { + import_key_from_key_server_act_ = new QAction(_("Keyserver"), this); + import_key_from_key_server_act_->setIcon( + QIcon(":import_key_from_server.png")); + import_key_from_key_server_act_->setToolTip( + _("Import New Key From Keyserver")); + connect(import_key_from_key_server_act_, &QAction::triggered, this, [&]() { CommonUtils::GetInstance()->slotImportKeyFromKeyServer(this); }); - importKeyFromEditAct = new QAction(_("Editor"), this); - importKeyFromEditAct->setIcon(QIcon(":txt.png")); - importKeyFromEditAct->setToolTip(_("Import New Key From Editor")); - connect(importKeyFromEditAct, SIGNAL(triggered()), this, - SLOT(slotImportKeyFromEdit())); + import_key_from_edit_act_ = new QAction(_("Editor"), this); + import_key_from_edit_act_->setIcon(QIcon(":txt.png")); + import_key_from_edit_act_->setToolTip(_("Import New Key From Editor")); + connect(import_key_from_edit_act_, SIGNAL(triggered()), this, + SLOT(slot_import_key_from_edit())); - openKeyManagementAct = new QAction(_("Manage Keys"), this); - openKeyManagementAct->setIcon(QIcon(":keymgmt.png")); - openKeyManagementAct->setToolTip(_("Open Key Management")); - connect(openKeyManagementAct, SIGNAL(triggered()), this, - SLOT(slotOpenKeyManagement())); + open_key_management_act_ = new QAction(_("Manage Keys"), this); + open_key_management_act_->setIcon(QIcon(":keymgmt.png")); + open_key_management_act_->setToolTip(_("Open Key Management")); + connect(open_key_management_act_, SIGNAL(triggered()), this, + SLOT(slot_open_key_management())); /* * About Menu */ - aboutAct = new QAction(_("About"), this); - aboutAct->setIcon(QIcon(":help.png")); - aboutAct->setToolTip(_("Show the application's About box")); - connect(aboutAct, &QAction::triggered, this, + about_act_ = new QAction(_("About"), this); + about_act_->setIcon(QIcon(":help.png")); + about_act_->setToolTip(_("Show the application's About box")); + connect(about_act_, &QAction::triggered, this, [=]() { new AboutDialog(0, this); }); - translateAct = new QAction(_("Translate"), this); - translateAct->setIcon(QIcon(":help.png")); - translateAct->setToolTip(_("Information about translation")); - connect(translateAct, &QAction::triggered, this, + translate_act_ = new QAction(_("Translate"), this); + translate_act_->setIcon(QIcon(":help.png")); + translate_act_->setToolTip(_("Information about translation")); + connect(translate_act_, &QAction::triggered, this, [=]() { new AboutDialog(1, this); }); /* * Check Update Menu */ - checkUpdateAct = new QAction(_("Check for Updates"), this); - checkUpdateAct->setIcon(QIcon(":help.png")); - checkUpdateAct->setToolTip(_("Check for updates")); - connect(checkUpdateAct, &QAction::triggered, this, + check_update_act_ = new QAction(_("Check for Updates"), this); + check_update_act_->setIcon(QIcon(":help.png")); + check_update_act_->setToolTip(_("Check for updates")); + connect(check_update_act_, &QAction::triggered, this, [=]() { new AboutDialog(2, this); }); - startWizardAct = new QAction(_("Open Wizard"), this); - startWizardAct->setToolTip(_("Open the wizard")); - connect(startWizardAct, SIGNAL(triggered()), this, SLOT(slotStartWizard())); + start_wizard_act_ = new QAction(_("Open Wizard"), this); + start_wizard_act_->setToolTip(_("Open the wizard")); + connect(start_wizard_act_, SIGNAL(triggered()), this, + SLOT(slot_start_wizard())); /* Popup-Menu-Action for KeyList */ - appendSelectedKeysAct = + append_selected_keys_act_ = new QAction(_("Append Public Key To Text Editor"), this); - appendSelectedKeysAct->setToolTip( + append_selected_keys_act_->setToolTip( _("Append The Selected Keys To Text in Editor")); - connect(appendSelectedKeysAct, SIGNAL(triggered()), this, - SLOT(slotAppendSelectedKeys())); + connect(append_selected_keys_act_, SIGNAL(triggered()), this, + SLOT(slot_append_selected_keys())); - copyMailAddressToClipboardAct = new QAction(_("Copy Email"), this); - copyMailAddressToClipboardAct->setToolTip( + copy_mail_address_to_clipboard_act_ = new QAction(_("Copy Email"), this); + copy_mail_address_to_clipboard_act_->setToolTip( _("Copy selected Email to clipboard")); - connect(copyMailAddressToClipboardAct, SIGNAL(triggered()), this, - SLOT(slotCopyMailAddressToClipboard())); + connect(copy_mail_address_to_clipboard_act_, SIGNAL(triggered()), this, + SLOT(slot_copy_mail_address_to_clipboard())); // TODO: find central place for shared actions, to avoid code-duplication with // keymgmt.cpp - showKeyDetailsAct = new QAction(_("Show Key Details"), this); - showKeyDetailsAct->setToolTip(_("Show Details for this Key")); - connect(showKeyDetailsAct, SIGNAL(triggered()), this, - SLOT(slotShowKeyDetails())); + show_key_details_act_ = new QAction(_("Show Key Details"), this); + show_key_details_act_->setToolTip(_("Show Details for this Key")); + connect(show_key_details_act_, SIGNAL(triggered()), this, + SLOT(slot_show_key_details())); /* Key-Shortcuts for Tab-Switchung-Action */ - switchTabUpAct = new QAction(this); - switchTabUpAct->setShortcut(QKeySequence::NextChild); - connect(switchTabUpAct, SIGNAL(triggered()), edit, SLOT(slotSwitchTabUp())); - this->addAction(switchTabUpAct); - - switchTabDownAct = new QAction(this); - switchTabDownAct->setShortcut(QKeySequence::PreviousChild); - connect(switchTabDownAct, SIGNAL(triggered()), edit, + switch_tab_up_act_ = new QAction(this); + switch_tab_up_act_->setShortcut(QKeySequence::NextChild); + connect(switch_tab_up_act_, SIGNAL(triggered()), edit_, + SLOT(slotSwitchTabUp())); + this->addAction(switch_tab_up_act_); + + switch_tab_down_act_ = new QAction(this); + switch_tab_down_act_->setShortcut(QKeySequence::PreviousChild); + connect(switch_tab_down_act_, SIGNAL(triggered()), edit_, SLOT(slotSwitchTabDown())); - this->addAction(switchTabDownAct); + this->addAction(switch_tab_down_act_); - cutPgpHeaderAct = new QAction(_("Remove PGP Header"), this); - connect(cutPgpHeaderAct, SIGNAL(triggered()), this, SLOT(slotCutPgpHeader())); + cut_pgp_header_act_ = new QAction(_("Remove PGP Header"), this); + connect(cut_pgp_header_act_, SIGNAL(triggered()), this, + SLOT(slot_cut_pgp_header())); - addPgpHeaderAct = new QAction(_("Add PGP Header"), this); - connect(addPgpHeaderAct, SIGNAL(triggered()), this, SLOT(slotAddPgpHeader())); + add_pgp_header_act_ = new QAction(_("Add PGP Header"), this); + connect(add_pgp_header_act_, SIGNAL(triggered()), this, + SLOT(slot_add_pgp_header())); #ifdef SMTP_SUPPORT - sendMailAct = new QAction(_("New Message"), this); - sendMailAct->setIcon(QIcon(":email.png")); - connect(sendMailAct, &QAction::triggered, this, [=]() { + send_mail_act_ = new QAction(_("New Message"), this); + send_mail_act_->setIcon(QIcon(":email.png")); + connect(send_mail_act_, &QAction::triggered, this, [=]() { auto* dialog = new SendMailDialog({}, this); dialog->show(); }); - receiveMailAct = new QAction(_("Message Inbox"), this); - receiveMailAct->setIcon(QIcon(":receive_email.png")); - connect(receiveMailAct, &QAction::triggered, this, [=]() { + receive_mail_act_ = new QAction(_("Message Inbox"), this); + receive_mail_act_->setIcon(QIcon(":receive_email.png")); + connect(receive_mail_act_, &QAction::triggered, this, [=]() { auto* dialog = new ReceiveMailDialog(this); dialog->show(); }); #endif } -void MainWindow::createMenus() { - fileMenu = menuBar()->addMenu(_("File")); - fileMenu->addAction(newTabAct); - fileMenu->addAction(browserAct); - fileMenu->addAction(openAct); - fileMenu->addSeparator(); - fileMenu->addAction(saveAct); - fileMenu->addAction(saveAsAct); - fileMenu->addSeparator(); - fileMenu->addAction(printAct); - fileMenu->addSeparator(); - fileMenu->addAction(closeTabAct); - fileMenu->addAction(quitAct); - - editMenu = menuBar()->addMenu(_("Edit")); - editMenu->addAction(undoAct); - editMenu->addAction(redoAct); - editMenu->addSeparator(); - editMenu->addAction(zoomInAct); - editMenu->addAction(zoomOutAct); - editMenu->addSeparator(); - editMenu->addAction(copyAct); - editMenu->addAction(cutAct); - editMenu->addAction(pasteAct); - editMenu->addAction(selectAllAct); - editMenu->addAction(findAct); - editMenu->addSeparator(); - editMenu->addAction(quoteAct); - editMenu->addAction(cleanDoubleLinebreaksAct); - editMenu->addSeparator(); - editMenu->addAction(openSettingsAct); - - cryptMenu = menuBar()->addMenu(_("Crypt")); - cryptMenu->addAction(encryptAct); - cryptMenu->addAction(encryptSignAct); - cryptMenu->addAction(decryptAct); - cryptMenu->addAction(decryptVerifyAct); - cryptMenu->addSeparator(); - cryptMenu->addAction(signAct); - cryptMenu->addAction(verifyAct); - cryptMenu->addSeparator(); - - keyMenu = menuBar()->addMenu(_("Keys")); - importKeyMenu = keyMenu->addMenu(_("Import Key")); - importKeyMenu->setIcon(QIcon(":key_import.png")); - importKeyMenu->addAction(importKeyFromFileAct); - importKeyMenu->addAction(importKeyFromEditAct); - importKeyMenu->addAction(importKeyFromClipboardAct); - importKeyMenu->addAction(importKeyFromKeyServerAct); - keyMenu->addAction(openKeyManagementAct); - - steganoMenu = menuBar()->addMenu(_("Steganography")); - steganoMenu->addAction(cutPgpHeaderAct); - steganoMenu->addAction(addPgpHeaderAct); +void MainWindow::create_menus() { + file_menu_ = menuBar()->addMenu(_("File")); + file_menu_->addAction(new_tab_act_); + file_menu_->addAction(browser_act_); + file_menu_->addAction(open_act_); + file_menu_->addSeparator(); + file_menu_->addAction(save_act_); + file_menu_->addAction(save_as_act_); + file_menu_->addSeparator(); + file_menu_->addAction(print_act_); + file_menu_->addSeparator(); + file_menu_->addAction(close_tab_act_); + file_menu_->addAction(quit_act_); + + edit_menu_ = menuBar()->addMenu(_("Edit")); + edit_menu_->addAction(undo_act_); + edit_menu_->addAction(redo_act_); + edit_menu_->addSeparator(); + edit_menu_->addAction(zoom_in_act_); + edit_menu_->addAction(zoom_out_act_); + edit_menu_->addSeparator(); + edit_menu_->addAction(copy_act_); + edit_menu_->addAction(cut_act_); + edit_menu_->addAction(paste_act_); + edit_menu_->addAction(select_all_act_); + edit_menu_->addAction(find_act_); + edit_menu_->addSeparator(); + edit_menu_->addAction(quote_act_); + edit_menu_->addAction(clean_double_line_breaks_act_); + edit_menu_->addSeparator(); + edit_menu_->addAction(open_settings_act_); + + crypt_menu_ = menuBar()->addMenu(_("Crypt")); + crypt_menu_->addAction(encrypt_act_); + crypt_menu_->addAction(encrypt_sign_act_); + crypt_menu_->addAction(decrypt_act_); + crypt_menu_->addAction(decrypt_verify_act_); + crypt_menu_->addSeparator(); + crypt_menu_->addAction(sign_act_); + crypt_menu_->addAction(verify_act_); + crypt_menu_->addSeparator(); + + key_menu_ = menuBar()->addMenu(_("Keys")); + import_key_menu_ = key_menu_->addMenu(_("Import Key")); + import_key_menu_->setIcon(QIcon(":key_import.png")); + import_key_menu_->addAction(import_key_from_file_act_); + import_key_menu_->addAction(import_key_from_edit_act_); + import_key_menu_->addAction(import_key_from_clipboard_act_); + import_key_menu_->addAction(import_key_from_key_server_act_); + key_menu_->addAction(open_key_management_act_); + + steganography_menu_ = menuBar()->addMenu(_("Steganography")); + steganography_menu_->addAction(cut_pgp_header_act_); + steganography_menu_->addAction(add_pgp_header_act_); #ifdef SMTP_SUPPORT - emailMenu = menuBar()->addMenu(_("Email")); - emailMenu->addAction(sendMailAct); - emailMenu->addAction(receiveMailAct); + email_menu_ = menuBar()->addMenu(_("Email")); + email_menu_->addAction(send_mail_act_); + email_menu_->addAction(receive_mail_act_); #endif #ifdef ADVANCED_SUPPORT @@ -383,72 +395,72 @@ void MainWindow::createMenus() { } #endif - viewMenu = menuBar()->addMenu(_("View")); + view_menu_ = menuBar()->addMenu(_("View")); - helpMenu = menuBar()->addMenu(_("Help")); - helpMenu->addAction(startWizardAct); - helpMenu->addSeparator(); - helpMenu->addAction(checkUpdateAct); - helpMenu->addAction(translateAct); - helpMenu->addAction(aboutAct); + help_menu_ = menuBar()->addMenu(_("Help")); + help_menu_->addAction(start_wizard_act_); + help_menu_->addSeparator(); + help_menu_->addAction(check_update_act_); + help_menu_->addAction(translate_act_); + help_menu_->addAction(about_act_); } -void MainWindow::createToolBars() { - fileToolBar = addToolBar(_("File")); - fileToolBar->setObjectName("fileToolBar"); - fileToolBar->addAction(newTabAct); - fileToolBar->addAction(openAct); - fileToolBar->addAction(saveAct); - fileToolBar->addAction(browserAct); - viewMenu->addAction(fileToolBar->toggleViewAction()); - - cryptToolBar = addToolBar(_("Operations")); - cryptToolBar->setObjectName("cryptToolBar"); - cryptToolBar->addAction(encryptAct); - cryptToolBar->addAction(encryptSignAct); - cryptToolBar->addAction(decryptAct); - cryptToolBar->addAction(decryptVerifyAct); - cryptToolBar->addAction(signAct); - cryptToolBar->addAction(verifyAct); - viewMenu->addAction(cryptToolBar->toggleViewAction()); - - keyToolBar = addToolBar(_("Key")); - keyToolBar->setObjectName("keyToolBar"); - keyToolBar->addAction(openKeyManagementAct); - viewMenu->addAction(keyToolBar->toggleViewAction()); - - editToolBar = addToolBar(_("Edit")); - editToolBar->setObjectName("editToolBar"); - editToolBar->addAction(copyAct); - editToolBar->addAction(pasteAct); - editToolBar->addAction(selectAllAct); - editToolBar->hide(); - viewMenu->addAction(editToolBar->toggleViewAction()); - - specialEditToolBar = addToolBar(_("Special Edit")); - specialEditToolBar->setObjectName("specialEditToolBar"); - specialEditToolBar->addAction(quoteAct); - specialEditToolBar->addAction(cleanDoubleLinebreaksAct); - specialEditToolBar->hide(); - viewMenu->addAction(specialEditToolBar->toggleViewAction()); - - emailToolBar = addToolBar(_("Email")); - emailToolBar->setObjectName("emailToolBar"); - emailToolBar->addAction(sendMailAct); - emailToolBar->addAction(receiveMailAct); - viewMenu->addAction(emailToolBar->toggleViewAction()); +void MainWindow::create_tool_bars() { + file_tool_bar_ = addToolBar(_("File")); + file_tool_bar_->setObjectName("fileToolBar"); + file_tool_bar_->addAction(new_tab_act_); + file_tool_bar_->addAction(open_act_); + file_tool_bar_->addAction(save_act_); + file_tool_bar_->addAction(browser_act_); + view_menu_->addAction(file_tool_bar_->toggleViewAction()); + + crypt_tool_bar_ = addToolBar(_("Operations")); + crypt_tool_bar_->setObjectName("cryptToolBar"); + crypt_tool_bar_->addAction(encrypt_act_); + crypt_tool_bar_->addAction(encrypt_sign_act_); + crypt_tool_bar_->addAction(decrypt_act_); + crypt_tool_bar_->addAction(decrypt_verify_act_); + crypt_tool_bar_->addAction(sign_act_); + crypt_tool_bar_->addAction(verify_act_); + view_menu_->addAction(crypt_tool_bar_->toggleViewAction()); + + key_tool_bar_ = addToolBar(_("Key")); + key_tool_bar_->setObjectName("keyToolBar"); + key_tool_bar_->addAction(open_key_management_act_); + view_menu_->addAction(key_tool_bar_->toggleViewAction()); + + edit_tool_bar_ = addToolBar(_("Edit")); + edit_tool_bar_->setObjectName("editToolBar"); + edit_tool_bar_->addAction(copy_act_); + edit_tool_bar_->addAction(paste_act_); + edit_tool_bar_->addAction(select_all_act_); + edit_tool_bar_->hide(); + view_menu_->addAction(edit_tool_bar_->toggleViewAction()); + + special_edit_tool_bar_ = addToolBar(_("Special Edit")); + special_edit_tool_bar_->setObjectName("specialEditToolBar"); + special_edit_tool_bar_->addAction(quote_act_); + special_edit_tool_bar_->addAction(clean_double_line_breaks_act_); + special_edit_tool_bar_->hide(); + view_menu_->addAction(special_edit_tool_bar_->toggleViewAction()); + + email_tool_bar_ = addToolBar(_("Email")); + email_tool_bar_->setObjectName("emailToolBar"); + email_tool_bar_->addAction(send_mail_act_); + email_tool_bar_->addAction(receive_mail_act_); + view_menu_->addAction(email_tool_bar_->toggleViewAction()); // Add dropdown menu for key import to keytoolbar - importButton = new QToolButton(); - importButton->setMenu(importKeyMenu); - importButton->setPopupMode(QToolButton::InstantPopup); - importButton->setIcon(QIcon(":key_import.png")); - importButton->setToolTip(_("Import key from...")); - importButton->setText(_("Import key")); - keyToolBar->addWidget(importButton); + import_button_ = new QToolButton(); + import_button_->setMenu(import_key_menu_); + import_button_->setPopupMode(QToolButton::InstantPopup); + import_button_->setIcon(QIcon(":key_import.png")); + import_button_->setToolTip(_("Import key from...")); + import_button_->setText(_("Import key")); + key_tool_bar_->addWidget(import_button_); } -void MainWindow::createStatusBar() { +void MainWindow::create_status_bar() { auto* statusBarBox = new QWidget(); auto* statusBarBoxLayout = new QHBoxLayout(); // QPixmap* pixmap; @@ -464,17 +476,17 @@ void MainWindow::createStatusBar() { statusBarBox->setLayout(statusBarBoxLayout); } -void MainWindow::createDockWindows() { +void MainWindow::create_dock_windows() { /* KeyList-Dock window */ - keyListDock = new QDockWidget(_("Key ToolBox"), this); - keyListDock->setObjectName("EncryptDock"); - keyListDock->setAllowedAreas(Qt::LeftDockWidgetArea | - Qt::RightDockWidgetArea); - keyListDock->setMinimumWidth(460); - addDockWidget(Qt::RightDockWidgetArea, keyListDock); - - mKeyList->addListGroupTab( + key_list_dock_ = new QDockWidget(_("Key ToolBox"), this); + key_list_dock_->setObjectName("EncryptDock"); + key_list_dock_->setAllowedAreas(Qt::LeftDockWidgetArea | + Qt::RightDockWidgetArea); + key_list_dock_->setMinimumWidth(460); + addDockWidget(Qt::RightDockWidgetArea, key_list_dock_); + + m_key_list_->addListGroupTab( _("Default"), KeyListRow::SECRET_OR_PUBLIC_KEY, KeyListColumn::TYPE | KeyListColumn::NAME | KeyListColumn::EmailAddress | KeyListColumn::Usage | KeyListColumn::Validity, @@ -482,7 +494,7 @@ void MainWindow::createDockWindows() { return !(key.IsRevoked() || key.IsDisabled() || key.IsExpired()); }); - mKeyList->addListGroupTab( + m_key_list_->addListGroupTab( _("Only Public Key"), KeyListRow::SECRET_OR_PUBLIC_KEY, KeyListColumn::TYPE | KeyListColumn::NAME | KeyListColumn::EmailAddress | KeyListColumn::Usage | KeyListColumn::Validity, @@ -491,7 +503,7 @@ void MainWindow::createDockWindows() { !(key.IsRevoked() || key.IsDisabled() || key.IsExpired()); }); - mKeyList->addListGroupTab( + m_key_list_->addListGroupTab( _("Has Private Key"), KeyListRow::SECRET_OR_PUBLIC_KEY, KeyListColumn::TYPE | KeyListColumn::NAME | KeyListColumn::EmailAddress | KeyListColumn::Usage | KeyListColumn::Validity, @@ -500,18 +512,18 @@ void MainWindow::createDockWindows() { !(key.IsRevoked() || key.IsDisabled() || key.IsExpired()); }); - mKeyList->slotRefresh(); + m_key_list_->slotRefresh(); - keyListDock->setWidget(mKeyList); - viewMenu->addAction(keyListDock->toggleViewAction()); + key_list_dock_->setWidget(m_key_list_); + view_menu_->addAction(key_list_dock_->toggleViewAction()); - infoBoardDock = new QDockWidget(_("Information Board"), this); - infoBoardDock->setObjectName("Information Board"); - infoBoardDock->setAllowedAreas(Qt::BottomDockWidgetArea); - addDockWidget(Qt::BottomDockWidgetArea, infoBoardDock); - infoBoardDock->setWidget(infoBoard); - infoBoardDock->widget()->layout()->setContentsMargins(0, 0, 0, 0); - viewMenu->addAction(infoBoardDock->toggleViewAction()); + info_board_dock_ = new QDockWidget(_("Information Board"), this); + info_board_dock_->setObjectName("Information Board"); + info_board_dock_->setAllowedAreas(Qt::BottomDockWidgetArea); + addDockWidget(Qt::BottomDockWidgetArea, info_board_dock_); + info_board_dock_->setWidget(info_board_); + info_board_dock_->widget()->layout()->setContentsMargins(0, 0, 0, 0); + view_menu_->addAction(info_board_dock_->toggleViewAction()); } } // namespace GpgFrontend::UI diff --git a/src/ui/widgets/FilePage.cpp b/src/ui/widgets/FilePage.cpp index 3e140bd4..50607077 100644 --- a/src/ui/widgets/FilePage.cpp +++ b/src/ui/widgets/FilePage.cpp @@ -293,7 +293,7 @@ void FilePage::slotOpenItem() { auto mainWindow = qobject_cast<MainWindow*>(firstParent); LOG(INFO) << "open item" << selectedPath; auto qt_path = QString::fromStdString(selectedPath.string()); - if (mainWindow != nullptr) mainWindow->slotOpenFile(qt_path); + if (mainWindow != nullptr) mainWindow->SlotOpenFile(qt_path); } else { QMessageBox::critical(this, _("Error"), _("The file is unprivileged or unreachable.")); @@ -345,27 +345,27 @@ void FilePage::slotDeleteItem() { void FilePage::slotEncryptItem() { auto mainWindow = qobject_cast<MainWindow*>(firstParent); - if (mainWindow != nullptr) mainWindow->slotFileEncrypt(); + if (mainWindow != nullptr) mainWindow->SlotFileEncrypt(); } void FilePage::slotEncryptSignItem() { auto mainWindow = qobject_cast<MainWindow*>(firstParent); - if (mainWindow != nullptr) mainWindow->slotFileEncryptSign(); + if (mainWindow != nullptr) mainWindow->SlotFileEncryptSign(); } void FilePage::slotDecryptItem() { auto mainWindow = qobject_cast<MainWindow*>(firstParent); - if (mainWindow != nullptr) mainWindow->slotFileDecryptVerify(); + if (mainWindow != nullptr) mainWindow->SlotFileDecryptVerify(); } void FilePage::slotSignItem() { auto mainWindow = qobject_cast<MainWindow*>(firstParent); - if (mainWindow != nullptr) mainWindow->slotFileSign(); + if (mainWindow != nullptr) mainWindow->SlotFileSign(); } void FilePage::slotVerifyItem() { auto mainWindow = qobject_cast<MainWindow*>(firstParent); - if (mainWindow != nullptr) mainWindow->slotFileVerify(); + if (mainWindow != nullptr) mainWindow->SlotFileVerify(); } void FilePage::slotCalculateHash() { |