diff options
36 files changed, 301 insertions, 310 deletions
diff --git a/src/ui/KeyMgmt.cpp b/src/ui/KeyMgmt.cpp index ed62ff18..a06c61ce 100755 --- a/src/ui/KeyMgmt.cpp +++ b/src/ui/KeyMgmt.cpp @@ -33,11 +33,12 @@ #include "gpg/function/GpgKeyGetter.h" #include "gpg/function/GpgKeyImportExporter.h" #include "gpg/function/GpgKeyOpera.h" -#include "import_export/ExportKeyPackageDialog.h" +#include "ui/import_export/ExportKeyPackageDialog.h" #include "ui/SignalStation.h" #include "ui/UserInterfaceUtils.h" #include "ui/key_generate/SubkeyGenerateDialog.h" #include "ui/settings/GlobalSettingStation.h" +#include "ui/main_window/MainWindow.h" namespace GpgFrontend::UI { KeyMgmt::KeyMgmt(QWidget* parent) : QMainWindow(parent) { @@ -95,8 +96,9 @@ KeyMgmt::KeyMgmt(QWidget* parent) : QMainWindow(parent) { create_actions(); create_menus(); create_tool_bars(); - connect(this, SIGNAL(SignalStatusBarChanged(QString)), this->parent(), - SLOT(slotSetStatusBarText(QString))); + + connect(this, &KeyMgmt::SignalStatusBarChanged, qobject_cast<MainWindow*>(this->parent()) , + &MainWindow::SlotSetStatusBarText); auto& settings = GlobalSettingStation::GetInstance().GetUISettings(); @@ -153,8 +155,8 @@ KeyMgmt::KeyMgmt(QWidget* parent) : QMainWindow(parent) { key_list_->AddMenuAction(delete_selected_keys_act_); key_list_->AddMenuAction(show_key_details_act_); - connect(this, SIGNAL(SignalKeyStatusUpdated()), SignalStation::GetInstance(), - SIGNAL(KeyDatabaseRefresh())); + connect(this, &KeyMgmt::SignalKeyStatusUpdated, SignalStation::GetInstance(), + &SignalStation::SignalKeyDatabaseRefresh); connect(SignalStation::GetInstance(), &SignalStation::SignalRefreshStatusBar, this, [=](const QString& message, int timeout) { statusBar()->showMessage(message, timeout); @@ -165,28 +167,28 @@ void KeyMgmt::create_actions() { open_key_file_act_ = new QAction(_("Open"), this); open_key_file_act_->setShortcut(QKeySequence(_("Ctrl+O"))); open_key_file_act_->setToolTip(_("Open Key File")); - connect(import_key_from_file_act_, &QAction::triggered, this, + connect(open_key_file_act_, &QAction::triggered, this, [&]() { CommonUtils::GetInstance()->SlotImportKeyFromFile(this); }); close_act_ = new QAction(_("Close"), this); close_act_->setShortcut(QKeySequence(_("Ctrl+Q"))); close_act_->setIcon(QIcon(":exit.png")); close_act_->setToolTip(_("Close")); - connect(close_act_, SIGNAL(triggered()), this, SLOT(close())); + connect(close_act_, &QAction::triggered, this, &KeyMgmt::close); generate_key_pair_act_ = new QAction(_("New Keypair"), this); generate_key_pair_act_->setShortcut(QKeySequence(_("Ctrl+N"))); generate_key_pair_act_->setIcon(QIcon(":key_generate.png")); generate_key_pair_act_->setToolTip(_("Generate KeyPair")); - connect(generate_key_pair_act_, SIGNAL(triggered()), this, - SLOT(SlotGenerateKeyDialog())); + connect(generate_key_pair_act_, &QAction::triggered, this, + &KeyMgmt::SlotGenerateKeyDialog); generate_subkey_act_ = new QAction(_("New Subkey"), this); generate_subkey_act_->setShortcut(QKeySequence(_("Ctrl+Shift+N"))); generate_subkey_act_->setIcon(QIcon(":key_generate.png")); generate_subkey_act_->setToolTip(_("Generate Subkey For Selected KeyPair")); - connect(generate_subkey_act_, SIGNAL(triggered()), this, - SLOT(SlotGenerateSubKey())); + connect(generate_subkey_act_, &QAction::triggered, this, + &KeyMgmt::SlotGenerateSubKey); import_key_from_file_act_ = new QAction(_("File"), this); import_key_from_file_act_->setIcon(QIcon(":import_key_from_file.png")); @@ -223,38 +225,38 @@ void KeyMgmt::create_actions() { export_key_to_clipboard_act_->setIcon(QIcon(":export_key_to_clipboard.png")); export_key_to_clipboard_act_->setToolTip( _("Export Selected Key(s) To Clipboard")); - connect(export_key_to_clipboard_act_, SIGNAL(triggered()), this, - SLOT(SlotExportKeyToClipboard())); + connect(export_key_to_clipboard_act_, &QAction::triggered, this, + &KeyMgmt::SlotExportKeyToClipboard); export_key_to_file_act_ = new QAction(_("Export To Key Package"), this); export_key_to_file_act_->setIcon(QIcon(":key_package.png")); export_key_to_file_act_->setToolTip( _("Export Checked Key(s) To a Key Package")); - connect(export_key_to_file_act_, SIGNAL(triggered()), this, - SLOT(SlotExportKeyToKeyPackage())); + connect(export_key_to_file_act_, &QAction::triggered, this, + &KeyMgmt::SlotExportKeyToKeyPackage); export_key_as_open_ssh_format_ = new QAction(_("Export As OpenSSH"), this); export_key_as_open_ssh_format_->setIcon(QIcon(":ssh-key.png")); export_key_as_open_ssh_format_->setToolTip( _("Export Selected Key(s) As OpenSSH Format to File")); - connect(export_key_as_open_ssh_format_, SIGNAL(triggered()), this, - SLOT(SlotExportAsOpenSSHFormat())); + connect(export_key_as_open_ssh_format_, &QAction::triggered, this, + &KeyMgmt::SlotExportAsOpenSSHFormat); delete_selected_keys_act_ = new QAction(_("Delete Selected Key(s)"), this); delete_selected_keys_act_->setToolTip(_("Delete the Selected keys")); - connect(delete_selected_keys_act_, SIGNAL(triggered()), this, - SLOT(SlotDeleteSelectedKeys())); + connect(delete_selected_keys_act_, &QAction::triggered, this, + &KeyMgmt::SlotDeleteSelectedKeys); delete_checked_keys_act_ = new QAction(_("Delete Checked Key(s)"), this); delete_checked_keys_act_->setToolTip(_("Delete the Checked keys")); delete_checked_keys_act_->setIcon(QIcon(":button_delete.png")); - connect(delete_checked_keys_act_, SIGNAL(triggered()), this, - SLOT(SlotDeleteCheckedKeys())); + connect(delete_checked_keys_act_, &QAction::triggered, this, + &KeyMgmt::SlotDeleteCheckedKeys); 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(SlotShowKeyDetails())); + connect(show_key_details_act_, &QAction::triggered, this, + &KeyMgmt::SlotShowKeyDetails); } void KeyMgmt::create_menus() { diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp index 94b42c87..52a8d4c0 100644 --- a/src/ui/UserInterfaceUtils.cpp +++ b/src/ui/UserInterfaceUtils.cpp @@ -135,8 +135,8 @@ void process_result_analyse(TextEdit* edit, InfoBoardWidget* info_board, void process_operation(QWidget* parent, const std::string& waiting_title, const std::function<void()>& func) { auto thread = QThread::create(func); - QApplication::connect(thread, SIGNAL(finished()), thread, - SLOT(deleteLater())); + QApplication::connect(thread, &QThread::finished, thread, + &QThread::deleteLater); thread->start(); auto* dialog = @@ -155,8 +155,8 @@ CommonUtils* CommonUtils::GetInstance() { } CommonUtils::CommonUtils() : QWidget(nullptr) { - connect(this, SIGNAL(SignalKeyStatusUpdated()), SignalStation::GetInstance(), - SIGNAL(KeyDatabaseRefresh())); + connect(this, &CommonUtils::SignalKeyStatusUpdated, SignalStation::GetInstance(), + &SignalStation::SignalKeyDatabaseRefresh); connect(this, &CommonUtils::SignalGnupgNotInstall, this, []() { QMessageBox::critical( nullptr, _("ENV Loading Failed"), diff --git a/src/ui/details/VerifyDetailsDialog.cpp b/src/ui/details/VerifyDetailsDialog.cpp index acd829ee..14407396 100644 --- a/src/ui/details/VerifyDetailsDialog.cpp +++ b/src/ui/details/VerifyDetailsDialog.cpp @@ -52,7 +52,7 @@ void VerifyDetailsDialog::slot_refresh() { // Button Box for close button button_box_ = new QDialogButtonBox(QDialogButtonBox::Close); - connect(button_box_, SIGNAL(rejected()), this, SLOT(close())); + connect(button_box_, &QDialogButtonBox::rejected, this, &VerifyDetailsDialog::close); mVboxLayout->addWidget(new QLabel(QString::fromStdString( std::string(_("Status")) + ": " + gpgme_strerror(error_)))); diff --git a/src/ui/dialog/QuitDialog.cpp b/src/ui/dialog/QuitDialog.cpp index 3fa64b6b..da0be488 100755 --- a/src/ui/dialog/QuitDialog.cpp +++ b/src/ui/dialog/QuitDialog.cpp @@ -108,10 +108,10 @@ QuitDialog::QuitDialog(QWidget* parent, const QHash<int, QString>& unsavedDocs) auto* buttonBox = new QDialogButtonBox(QDialogButtonBox::Discard | QDialogButtonBox::Save | QDialogButtonBox::Cancel); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::accepted, this, &QuitDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QuitDialog::reject); QPushButton* btnNoKey = buttonBox->button(QDialogButtonBox::Discard); - connect(btnNoKey, SIGNAL(clicked()), SLOT(slot_my_discard())); + connect(btnNoKey, &QPushButton::clicked, this,&QuitDialog::slot_my_discard); /* * Set the layout diff --git a/src/ui/dialog/Wizard.cpp b/src/ui/dialog/Wizard.cpp index 0716d3f8..8d6d6890 100644 --- a/src/ui/dialog/Wizard.cpp +++ b/src/ui/dialog/Wizard.cpp @@ -56,7 +56,7 @@ Wizard::Wizard(QWidget* parent) : QWizard(parent) { } setStartId(next_page_id); - connect(this, SIGNAL(accepted()), this, SLOT(slot_wizard_accepted())); + connect(this, &Wizard::accepted, this, &Wizard::slot_wizard_accepted); } void Wizard::slot_wizard_accepted() { @@ -204,10 +204,6 @@ KeyGenPage::KeyGenPage(QWidget* parent) : QWizardPage(parent) { "docu_keygen.html#content" ">" + QString(_("Offline tutorial")) + "</a>"); - // linkLabel->setOpenExternalLinks(true); - - // connect(linkLabel, SIGNAL(linkActivated(QString)), - // parentWidget()->parentWidget(), SLOT(openHelp(QString))); auto* createKeyButtonBox = new QWidget(this); auto* createKeyButtonBoxLayout = new QHBoxLayout(createKeyButtonBox); @@ -218,8 +214,8 @@ KeyGenPage::KeyGenPage(QWidget* parent) : QWizardPage(parent) { layout->addWidget(topLabel); layout->addWidget(linkLabel); layout->addWidget(createKeyButtonBox); - connect(createKeyButton, SIGNAL(clicked(bool)), this, - SLOT(slot_generate_key_dialog())); + connect(createKeyButton, &QPushButton::clicked, this, + &KeyGenPage::slot_generate_key_dialog); setLayout(layout); } diff --git a/src/ui/help/AboutDialog.cpp b/src/ui/help/AboutDialog.cpp index e0d8f099..53917217 100644 --- a/src/ui/help/AboutDialog.cpp +++ b/src/ui/help/AboutDialog.cpp @@ -54,7 +54,7 @@ AboutDialog::AboutDialog(int defaultIndex, QWidget* parent) : QDialog(parent) { } auto* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(close())); + connect(buttonBox, &QDialogButtonBox::accepted, this, &AboutDialog::close); auto* mainLayout = new QVBoxLayout; mainLayout->addWidget(tabWidget); @@ -194,8 +194,8 @@ void UpdateTab::getLatestVersion() { auto version_thread = new VersionCheckThread(); - connect(version_thread, SIGNAL(finished()), version_thread, - SLOT(deleteLater())); + connect(version_thread, &VersionCheckThread::finished, version_thread, + &VersionCheckThread::deleteLater); connect(version_thread, &VersionCheckThread::SignalUpgradeVersion, this, &UpdateTab::slot_show_version_status); diff --git a/src/ui/import_export/KeyImportDetailDialog.cpp b/src/ui/import_export/KeyImportDetailDialog.cpp index 52f3472c..1cc8e400 100644 --- a/src/ui/import_export/KeyImportDetailDialog.cpp +++ b/src/ui/import_export/KeyImportDetailDialog.cpp @@ -197,6 +197,6 @@ QString KeyImportDetailDialog::get_status_string(int keyStatus) { void KeyImportDetailDialog::create_button_box() { button_box_ = new QDialogButtonBox(QDialogButtonBox::Ok); - connect(button_box_, SIGNAL(accepted()), this, SLOT(close())); + connect(button_box_, &QDialogButtonBox::accepted, this, &KeyImportDetailDialog::close); } } // namespace GpgFrontend::UI diff --git a/src/ui/import_export/KeyServerImportDialog.cpp b/src/ui/import_export/KeyServerImportDialog.cpp index 62622d14..a5fabf8d 100644 --- a/src/ui/import_export/KeyServerImportDialog.cpp +++ b/src/ui/import_export/KeyServerImportDialog.cpp @@ -45,16 +45,20 @@ KeyServerImportDialog::KeyServerImportDialog(bool automatic, QWidget* parent) setWindowFlags(Qt::Window | Qt::WindowTitleHint | Qt::CustomizeWindowHint); } else { // Buttons - close_button_ = create_button(_("Close"), SLOT(close())); - import_button_ = create_button(_("Import ALL"), SLOT(slot_import())); + + close_button_ = new QPushButton(_("Close")); + connect(close_button_, &QPushButton::clicked, this, &KeyServerImportDialog::close); + import_button_ = new QPushButton(_("Import ALL")); + connect(import_button_, &QPushButton::clicked, this, &KeyServerImportDialog::slot_import); import_button_->setDisabled(true); - search_button_ = create_button(_("Search"), SLOT(slot_search())); + search_button_ = new QPushButton(_("Search")); + connect(search_button_, &QPushButton::clicked, this, &KeyServerImportDialog::slot_search); - // Line edit for search string + // Line edits for search string search_label_ = new QLabel(QString(_("Search String")) + _(": ")); search_line_edit_ = new QLineEdit(); - // combobox for keyserverlist + // combobox for keyserver list key_server_label_ = new QLabel(QString(_("Key Server")) + _(": ")); key_server_combo_box_ = create_comboBox(); @@ -135,18 +139,11 @@ KeyServerImportDialog::KeyServerImportDialog(bool automatic, QWidget* parent) this->setModal(true); - connect(this, SIGNAL(SignalKeyImported()), SignalStation::GetInstance(), - SIGNAL(KeyDatabaseRefresh())); + connect(this, &KeyServerImportDialog::SignalKeyImported, SignalStation::GetInstance(), + &SignalStation::SignalKeyDatabaseRefresh); // save window pos and size to configure file - connect(this, SIGNAL(finished(int)), this, SLOT(slot_save_window_state())); -} - -QPushButton* KeyServerImportDialog::create_button(const QString& text, - const char* member) { - auto* button = new QPushButton(text); - connect(button, SIGNAL(clicked()), this, member); - return button; + connect(this, &KeyServerImportDialog::finished, this, &KeyServerImportDialog::slot_save_window_state); } QComboBox* KeyServerImportDialog::create_comboBox() { @@ -195,8 +192,8 @@ void KeyServerImportDialog::create_keys_table() { keys_table_->setHorizontalHeaderLabels(labels); keys_table_->verticalHeader()->hide(); - connect(keys_table_, SIGNAL(cellActivated(int, int)), this, - SLOT(slot_import())); + connect(keys_table_, &QTableWidget::cellActivated, this, + &KeyServerImportDialog::slot_import); } void KeyServerImportDialog::set_message(const QString& text, bool error) { @@ -225,7 +222,7 @@ void KeyServerImportDialog::slot_search() { QNetworkReply* reply = network_access_manager_->get(QNetworkRequest(url_from_remote)); - connect(reply, SIGNAL(finished()), this, SLOT(slot_search_finished())); + connect(reply, &QNetworkReply::finished, this, &KeyServerImportDialog::slot_search_finished); set_loading(true); this->search_button_->setDisabled(true); @@ -245,7 +242,7 @@ void KeyServerImportDialog::slot_search() { } void KeyServerImportDialog::slot_search_finished() { - LOG(INFO) << "KeyServerImportDialog::slot_search_finished Called"; + LOG(INFO) << "Called"; auto* reply = qobject_cast<QNetworkReply*>(sender()); @@ -255,7 +252,8 @@ void KeyServerImportDialog::slot_search_finished() { auto error = reply->error(); if (error != QNetworkReply::NoError) { - qDebug() << "Error From Reply" << reply->errorString(); + LOG(INFO) << "Error From Reply" << reply->errorString().toStdString(); + switch (error) { case QNetworkReply::ContentNotFoundError: set_message(_("Not Key Found"), true); diff --git a/src/ui/import_export/KeyUploadDialog.cpp b/src/ui/import_export/KeyUploadDialog.cpp index ebb7e565..db12a9ac 100644 --- a/src/ui/import_export/KeyUploadDialog.cpp +++ b/src/ui/import_export/KeyUploadDialog.cpp @@ -109,7 +109,7 @@ void KeyUploadDialog::slot_upload_key_to_server( // Send Post Data QNetworkReply* reply = qnam->post(request, postData); - connect(reply, SIGNAL(finished()), this, SLOT(slot_upload_finished())); + connect(reply, &QNetworkReply::finished, this, &KeyUploadDialog::slot_upload_finished); // Keep Waiting while (reply->isRunning()) { diff --git a/src/ui/key_generate/KeygenDialog.cpp b/src/ui/key_generate/KeygenDialog.cpp index fe9ef9c6..cbbe7145 100644 --- a/src/ui/key_generate/KeygenDialog.cpp +++ b/src/ui/key_generate/KeygenDialog.cpp @@ -58,8 +58,8 @@ KeyGenDialog::KeyGenDialog(QWidget* parent) : QDialog(parent) { this->setWindowTitle(_("Generate Key")); this->setModal(true); - connect(this, SIGNAL(SignalKeyGenerated()), SignalStation::GetInstance(), - SIGNAL(KeyDatabaseRefresh())); + connect(this, &KeyGenDialog::SignalKeyGenerated, SignalStation::GetInstance(), + &SignalStation::SignalKeyDatabaseRefresh); generate_key_dialog(); } @@ -309,23 +309,25 @@ void KeyGenDialog::refresh_widgets_state() { } void KeyGenDialog::set_signal_slot() { - connect(button_box_, SIGNAL(accepted()), this, SLOT(slot_key_gen_accept())); - connect(button_box_, SIGNAL(rejected()), this, SLOT(reject())); - - connect(expire_check_box_, SIGNAL(stateChanged(int)), this, - SLOT(slot_expire_box_changed())); - - connect(key_usage_check_boxes_[0], SIGNAL(stateChanged(int)), this, - SLOT(slot_encryption_box_changed(int))); - connect(key_usage_check_boxes_[1], SIGNAL(stateChanged(int)), this, - SLOT(slot_signing_box_changed(int))); - connect(key_usage_check_boxes_[2], SIGNAL(stateChanged(int)), this, - SLOT(slot_certification_box_changed(int))); - connect(key_usage_check_boxes_[3], SIGNAL(stateChanged(int)), this, - SLOT(slot_authentication_box_changed(int))); - - connect(key_type_combo_box_, SIGNAL(currentIndexChanged(int)), this, - SLOT(slot_activated_key_type(int))); + connect(button_box_, &QDialogButtonBox::accepted, this, + &KeyGenDialog::slot_key_gen_accept); + connect(button_box_, &QDialogButtonBox::rejected, this, + &KeyGenDialog::reject); + + connect(expire_check_box_, &QCheckBox::stateChanged, this, + &KeyGenDialog::slot_expire_box_changed); + + connect(key_usage_check_boxes_[0], &QCheckBox::stateChanged, this, + &KeyGenDialog::slot_encryption_box_changed); + connect(key_usage_check_boxes_[1], &QCheckBox::stateChanged, this, + &KeyGenDialog::slot_signing_box_changed); + connect(key_usage_check_boxes_[2], &QCheckBox::stateChanged, this, + &KeyGenDialog::slot_certification_box_changed); + connect(key_usage_check_boxes_[3], &QCheckBox::stateChanged, this, + &KeyGenDialog::slot_authentication_box_changed); + + connect(key_type_combo_box_, qOverload<int>(&QComboBox::currentIndexChanged), + this, &KeyGenDialog::slot_activated_key_type); connect(no_pass_phrase_check_box_, &QCheckBox::stateChanged, this, [this](int state) -> void { diff --git a/src/ui/key_generate/SubkeyGenerateDialog.cpp b/src/ui/key_generate/SubkeyGenerateDialog.cpp index 94e41f10..49fe0f2d 100644 --- a/src/ui/key_generate/SubkeyGenerateDialog.cpp +++ b/src/ui/key_generate/SubkeyGenerateDialog.cpp @@ -73,8 +73,8 @@ SubkeyGenerateDialog::SubkeyGenerateDialog(const KeyId& key_id, QWidget* parent) this->setLayout(vbox2); this->setModal(true); - connect(this, SIGNAL(SignalSubKeyGenerated()), SignalStation::GetInstance(), - SIGNAL(KeyDatabaseRefresh())); + connect(this, &SubkeyGenerateDialog::SignalSubKeyGenerated, SignalStation::GetInstance(), + &SignalStation::SignalKeyDatabaseRefresh); set_signal_slot(); refresh_widgets_state(); @@ -156,23 +156,23 @@ QGroupBox* SubkeyGenerateDialog::create_basic_info_group_box() { } void SubkeyGenerateDialog::set_signal_slot() { - connect(button_box_, SIGNAL(accepted()), this, SLOT(slot_key_gen_accept())); - connect(button_box_, SIGNAL(rejected()), this, SLOT(reject())); - - connect(expire_check_box_, SIGNAL(stateChanged(int)), this, - SLOT(slot_expire_box_changed())); - - connect(key_usage_check_boxes_[0], SIGNAL(stateChanged(int)), this, - SLOT(slot_encryption_box_changed(int))); - connect(key_usage_check_boxes_[1], SIGNAL(stateChanged(int)), this, - SLOT(slot_signing_box_changed(int))); - connect(key_usage_check_boxes_[2], SIGNAL(stateChanged(int)), this, - SLOT(slot_certification_box_changed(int))); - connect(key_usage_check_boxes_[3], SIGNAL(stateChanged(int)), this, - SLOT(slot_authentication_box_changed(int))); - - connect(key_type_combo_box_, SIGNAL(currentIndexChanged(int)), this, - SLOT(slot_activated_key_type(int))); + connect(button_box_, &QDialogButtonBox::accepted, this, &SubkeyGenerateDialog::slot_key_gen_accept); + connect(button_box_, &QDialogButtonBox::rejected, this, &SubkeyGenerateDialog::reject); + + connect(expire_check_box_, &QCheckBox::stateChanged, this, + &SubkeyGenerateDialog::slot_expire_box_changed); + + connect(key_usage_check_boxes_[0], &QCheckBox::stateChanged, this, + &SubkeyGenerateDialog::slot_encryption_box_changed); + connect(key_usage_check_boxes_[1], &QCheckBox::stateChanged, this, + &SubkeyGenerateDialog::slot_signing_box_changed); + connect(key_usage_check_boxes_[2], &QCheckBox::stateChanged, this, + &SubkeyGenerateDialog::slot_certification_box_changed); + connect(key_usage_check_boxes_[3], &QCheckBox::stateChanged, this, + &SubkeyGenerateDialog::slot_authentication_box_changed); + + connect(key_type_combo_box_, qOverload<int>(&QComboBox::currentIndexChanged), this, + &SubkeyGenerateDialog::slot_activated_key_type); } void SubkeyGenerateDialog::slot_expire_box_changed() { diff --git a/src/ui/keypair_details/KeyNewUIDDialog.cpp b/src/ui/keypair_details/KeyNewUIDDialog.cpp index 5adba833..0e20acd0 100644 --- a/src/ui/keypair_details/KeyNewUIDDialog.cpp +++ b/src/ui/keypair_details/KeyNewUIDDialog.cpp @@ -57,16 +57,16 @@ KeyNewUIDDialog::KeyNewUIDDialog(const KeyId& key_id, QWidget* parent) 0, 1, 2); gridLayout->addWidget(error_label_, 5, 0, 1, 2); - connect(create_button_, SIGNAL(clicked(bool)), this, - SLOT(slot_create_new_uid())); + connect(create_button_, &QPushButton::clicked, this, + &KeyNewUIDDialog::slot_create_new_uid); this->setLayout(gridLayout); this->setWindowTitle(_("Create New UID")); this->setAttribute(Qt::WA_DeleteOnClose, true); this->setModal(true); - connect(this, SIGNAL(SignalUIDCreated()), SignalStation::GetInstance(), - SIGNAL(KeyDatabaseRefresh())); + connect(this, &KeyNewUIDDialog::SignalUIDCreated, SignalStation::GetInstance(), + &SignalStation::SignalKeyDatabaseRefresh); } void KeyNewUIDDialog::slot_create_new_uid() { diff --git a/src/ui/keypair_details/KeyPairOperaTab.cpp b/src/ui/keypair_details/KeyPairOperaTab.cpp index ae3d3044..50b3272b 100644 --- a/src/ui/keypair_details/KeyPairOperaTab.cpp +++ b/src/ui/keypair_details/KeyPairOperaTab.cpp @@ -49,8 +49,8 @@ KeyPairOperaTab::KeyPairOperaTab(const std::string& key_id, QWidget* parent) auto* export_public_button = new QPushButton(_("Export Public Key")); export_h_box_layout->addWidget(export_public_button); - connect(export_public_button, SIGNAL(clicked()), this, - SLOT(slot_export_public_key())); + connect(export_public_button, &QPushButton::clicked, this, + &KeyPairOperaTab::slot_export_public_key); if (m_key_.IsPrivateKey()) { auto* export_private_button = new QPushButton(_("Export Private Key")); @@ -61,11 +61,11 @@ KeyPairOperaTab::KeyPairOperaTab(const std::string& key_id, QWidget* parent) if (m_key_.IsHasMasterKey()) { auto* edit_expires_button = new QPushButton(_("Modify Expiration Datetime (Primary Key)")); - connect(edit_expires_button, SIGNAL(clicked()), this, - SLOT(slot_modify_edit_datetime())); + connect(edit_expires_button, &QPushButton::clicked, this, + &KeyPairOperaTab::slot_modify_edit_datetime); auto* edit_password_button = new QPushButton(_("Modify Password")); - connect(edit_password_button, SIGNAL(clicked()), this, - SLOT(slot_modify_password())); + connect(edit_password_button, &QPushButton::clicked, this, + &KeyPairOperaTab::slot_modify_password); vbox_p_k->addWidget(edit_expires_button); vbox_p_k->addWidget(edit_password_button); @@ -82,14 +82,14 @@ KeyPairOperaTab::KeyPairOperaTab(const std::string& key_id, QWidget* parent) if (m_key_.IsPrivateKey() && m_key_.IsHasMasterKey()) { auto* revoke_cert_gen_button = new QPushButton(_("Generate Revoke Certificate")); - connect(revoke_cert_gen_button, SIGNAL(clicked()), this, - SLOT(slot_gen_revoke_cert())); + connect(revoke_cert_gen_button, &QPushButton::clicked, this, + &KeyPairOperaTab::slot_gen_revoke_cert); advance_h_box_layout->addWidget(revoke_cert_gen_button); } auto* modify_tofu_button = new QPushButton(_("Modify TOFU Policy")); - connect(modify_tofu_button, SIGNAL(clicked()), this, - SLOT(slot_modify_tofu_policy())); + connect(modify_tofu_button, &QPushButton::clicked, this, + &KeyPairOperaTab::slot_modify_tofu_policy); vbox_p_k->addLayout(advance_h_box_layout); opera_key_box->setLayout(vbox_p_k); @@ -104,14 +104,14 @@ void KeyPairOperaTab::CreateOperaMenu() { key_server_opera_menu_ = new QMenu(this); auto* uploadKeyPair = new QAction(_("Upload Key Pair to Key Server"), this); - connect(uploadKeyPair, SIGNAL(triggered()), this, - SLOT(slot_upload_key_to_server())); + connect(uploadKeyPair, &QAction::triggered, this, + &KeyPairOperaTab::slot_upload_key_to_server); if (!(m_key_.IsPrivateKey() && m_key_.IsHasMasterKey())) uploadKeyPair->setDisabled(true); auto* updateKeyPair = new QAction(_("Sync Key Pair From Key Server"), this); - connect(updateKeyPair, SIGNAL(triggered()), this, - SLOT(slot_update_key_from_server())); + connect(updateKeyPair, &QAction::triggered, this, + &KeyPairOperaTab::slot_update_key_from_server); // when a key has primary key, it should always upload to keyserver. if (m_key_.IsHasMasterKey()) { @@ -124,14 +124,14 @@ void KeyPairOperaTab::CreateOperaMenu() { secret_key_export_opera_menu_ = new QMenu(this); auto* exportFullSecretKey = new QAction(_("Export Full Secret Key"), this); - connect(exportFullSecretKey, SIGNAL(triggered()), this, - SLOT(slot_export_private_key())); + connect(exportFullSecretKey, &QAction::triggered, this, + &KeyPairOperaTab::slot_export_private_key); if (!m_key_.IsPrivateKey()) exportFullSecretKey->setDisabled(true); auto* exportShortestSecretKey = new QAction(_("Export Shortest Secret Key"), this); - connect(exportShortestSecretKey, SIGNAL(triggered()), this, - SLOT(slot_export_short_private_key())); + connect(exportShortestSecretKey, &QAction::triggered, this, + &KeyPairOperaTab::slot_export_short_private_key); secret_key_export_opera_menu_->addAction(exportFullSecretKey); secret_key_export_opera_menu_->addAction(exportShortestSecretKey); diff --git a/src/ui/keypair_details/KeyPairSubkeyTab.cpp b/src/ui/keypair_details/KeyPairSubkeyTab.cpp index 67006d6b..41838c94 100644 --- a/src/ui/keypair_details/KeyPairSubkeyTab.cpp +++ b/src/ui/keypair_details/KeyPairSubkeyTab.cpp @@ -117,16 +117,18 @@ KeyPairSubkeyTab::KeyPairSubkeyTab(const std::string& key_id, QWidget* parent) baseLayout->addWidget(detail_box_); baseLayout->addStretch(); - connect(addSubkeyButton, SIGNAL(clicked(bool)), this, - SLOT(slot_add_subkey())); - connect(subkey_list_, SIGNAL(itemSelectionChanged()), this, - SLOT(slot_refresh_subkey_detail())); + connect(addSubkeyButton, &QPushButton::clicked, this, + &KeyPairSubkeyTab::slot_add_subkey); + connect(subkey_list_, &QTableWidget::itemSelectionChanged, this, + &KeyPairSubkeyTab::slot_refresh_subkey_detail); // key database refresh signal - connect(SignalStation::GetInstance(), SIGNAL(KeyDatabaseRefresh()), this, - SLOT(slot_refresh_key_info())); - connect(SignalStation::GetInstance(), SIGNAL(KeyDatabaseRefresh()), this, - SLOT(slot_refresh_subkey_list())); + connect(SignalStation::GetInstance(), + &SignalStation::SignalKeyDatabaseRefresh, this, + &KeyPairSubkeyTab::slot_refresh_key_info); + connect(SignalStation::GetInstance(), + &SignalStation::SignalKeyDatabaseRefresh, this, + &KeyPairSubkeyTab::slot_refresh_subkey_list); baseLayout->setContentsMargins(0, 0, 0, 0); @@ -296,12 +298,10 @@ void KeyPairSubkeyTab::slot_refresh_subkey_detail() { void KeyPairSubkeyTab::create_subkey_opera_menu() { subkey_opera_menu_ = new QMenu(this); - // auto *revokeSubkeyAct = new QAction(_("Revoke Subkey")); auto* editSubkeyAct = new QAction(_("Edit Expire Date")); - connect(editSubkeyAct, SIGNAL(triggered(bool)), this, - SLOT(slot_edit_subkey())); + connect(editSubkeyAct, &QAction::triggered, this, + &KeyPairSubkeyTab::slot_edit_subkey); - // subkeyOperaMenu->addAction(revokeSubkeyAct); subkey_opera_menu_->addAction(editSubkeyAct); } diff --git a/src/ui/keypair_details/KeyPairUIDTab.cpp b/src/ui/keypair_details/KeyPairUIDTab.cpp index e1aa8849..474cb055 100644 --- a/src/ui/keypair_details/KeyPairUIDTab.cpp +++ b/src/ui/keypair_details/KeyPairUIDTab.cpp @@ -93,18 +93,21 @@ KeyPairUIDTab::KeyPairUIDTab(const std::string& key_id, QWidget* parent) vboxLayout->setContentsMargins(0, 0, 0, 0); - connect(addUIDButton, SIGNAL(clicked(bool)), this, SLOT(slot_add_uid())); - connect(uid_list_, SIGNAL(itemSelectionChanged()), this, - SLOT(slot_refresh_tofu_info())); - connect(uid_list_, SIGNAL(itemSelectionChanged()), this, - SLOT(slot_refresh_sig_list())); + connect(addUIDButton, &QPushButton::clicked, this, + &KeyPairUIDTab::slot_add_uid); + connect(uid_list_, &QTableWidget::itemSelectionChanged, this, + &KeyPairUIDTab::slot_refresh_tofu_info); + connect(uid_list_, &QTableWidget::itemSelectionChanged, this, + &KeyPairUIDTab::slot_refresh_sig_list); // Key Database Refresh - connect(SignalStation::GetInstance(), SIGNAL(KeyDatabaseRefresh()), this, - SLOT(slot_refresh_key())); + connect(SignalStation::GetInstance(), + &SignalStation::SignalKeyDatabaseRefresh, this, + &KeyPairUIDTab::slot_refresh_key); - connect(this, SIGNAL(SignalUpdateUIDInfo()), SignalStation::GetInstance(), - SIGNAL(KeyDatabaseRefresh())); + connect(this, &KeyPairUIDTab::SignalUpdateUIDInfo, + SignalStation::GetInstance(), + &SignalStation::SignalKeyDatabaseRefresh); setLayout(vboxLayout); setAttribute(Qt::WA_DeleteOnClose, true); @@ -323,9 +326,9 @@ void KeyPairUIDTab::create_manage_uid_menu() { manage_selected_uid_menu_ = new QMenu(this); auto* signUIDAct = new QAction(_("Sign Selected UID(s)"), this); - connect(signUIDAct, SIGNAL(triggered()), this, SLOT(slot_add_sign())); + connect(signUIDAct, &QAction::triggered, this, &KeyPairUIDTab::slot_add_sign); auto* delUIDAct = new QAction(_("Delete Selected UID(s)"), this); - connect(delUIDAct, SIGNAL(triggered()), this, SLOT(slot_del_uid())); + connect(delUIDAct, &QAction::triggered, this, &KeyPairUIDTab::slot_del_uid); if (m_key_.IsHasMasterKey()) { manage_selected_uid_menu_->addAction(signUIDAct); @@ -335,10 +338,10 @@ void KeyPairUIDTab::create_manage_uid_menu() { void KeyPairUIDTab::slot_add_uid() { auto keyNewUIDDialog = new KeyNewUIDDialog(m_key_.GetId(), this); - connect(keyNewUIDDialog, SIGNAL(finished(int)), this, - SLOT(slot_add_uid_result(int))); - connect(keyNewUIDDialog, SIGNAL(finished(int)), keyNewUIDDialog, - SLOT(deleteLater())); + connect(keyNewUIDDialog, &KeyNewUIDDialog::finished, this, + &KeyPairUIDTab::slot_add_uid_result); + connect(keyNewUIDDialog, &KeyNewUIDDialog::finished, keyNewUIDDialog, + &KeyPairUIDTab::deleteLater); keyNewUIDDialog->show(); } @@ -450,12 +453,14 @@ void KeyPairUIDTab::create_uid_popup_menu() { uid_popup_menu_ = new QMenu(this); auto* serPrimaryUIDAct = new QAction(_("Set As Primary"), this); - connect(serPrimaryUIDAct, SIGNAL(triggered()), this, - SLOT(slot_set_primary_uid())); + connect(serPrimaryUIDAct, &QAction::triggered, this, + &KeyPairUIDTab::slot_set_primary_uid); auto* signUIDAct = new QAction(_("Sign UID"), this); - connect(signUIDAct, SIGNAL(triggered()), this, SLOT(slot_add_sign_single())); + connect(signUIDAct, &QAction::triggered, this, + &KeyPairUIDTab::slot_add_sign_single); auto* delUIDAct = new QAction(_("Delete UID"), this); - connect(delUIDAct, SIGNAL(triggered()), this, SLOT(slot_del_uid_single())); + connect(delUIDAct, &QAction::triggered, this, + &KeyPairUIDTab::slot_del_uid_single); if (m_key_.IsHasMasterKey()) { uid_popup_menu_->addAction(serPrimaryUIDAct); @@ -469,10 +474,6 @@ void KeyPairUIDTab::contextMenuEvent(QContextMenuEvent* event) { sig_list_->selectedItems().isEmpty()) { uid_popup_menu_->exec(event->globalPos()); } - - // if (!sigList->selectedItems().isEmpty()) { - // signPopupMenu->exec(event->globalPos()); - // } } void KeyPairUIDTab::slot_add_sign_single() { @@ -527,7 +528,7 @@ void KeyPairUIDTab::create_sign_popup_menu() { sign_popup_menu_ = new QMenu(this); auto* delSignAct = new QAction(_("Delete(Revoke) Key Signature"), this); - connect(delSignAct, SIGNAL(triggered()), this, SLOT(slot_del_sign())); + connect(delSignAct, &QAction::triggered, this, &KeyPairUIDTab::slot_del_sign); sign_popup_menu_->addAction(delSignAct); } diff --git a/src/ui/keypair_details/KeySetExpireDateDialog.cpp b/src/ui/keypair_details/KeySetExpireDateDialog.cpp index 5e0180b4..2377ff55 100644 --- a/src/ui/keypair_details/KeySetExpireDateDialog.cpp +++ b/src/ui/keypair_details/KeySetExpireDateDialog.cpp @@ -116,12 +116,13 @@ void KeySetExpireDateDialog::init() { ui_->dateEdit->setDateTime(max_date_time); ui_->timeEdit->setDateTime(max_date_time); - connect(ui_->noExpirationCheckBox, SIGNAL(stateChanged(int)), this, - SLOT(slot_non_expired_checked(int))); + connect(ui_->noExpirationCheckBox, &QCheckBox::stateChanged, this, + &KeySetExpireDateDialog::slot_non_expired_checked); connect(ui_->button_box_, &QDialogButtonBox::accepted, this, &KeySetExpireDateDialog::slot_confirm); - connect(this, SIGNAL(SignalKeyExpireDateUpdated()), - SignalStation::GetInstance(), SIGNAL(KeyDatabaseRefresh())); + connect(this, &KeySetExpireDateDialog::SignalKeyExpireDateUpdated, + SignalStation::GetInstance(), + &SignalStation::SignalKeyDatabaseRefresh); ui_->titleLabel->setText(_("Modified Expiration Date (Local Time)")); ui_->label->setText( diff --git a/src/ui/keypair_details/KeyUIDSignDialog.cpp b/src/ui/keypair_details/KeyUIDSignDialog.cpp index b8f10f92..f58d99e0 100644 --- a/src/ui/keypair_details/KeyUIDSignDialog.cpp +++ b/src/ui/keypair_details/KeyUIDSignDialog.cpp @@ -86,8 +86,8 @@ KeyUIDSignDialog::KeyUIDSignDialog(const GpgKey& key, UIDArgsListPtr uid, timeLayout->addWidget(non_expire_check_, 0, 2); layout->addLayout(timeLayout, 1, 0); - connect(sign_key_button_, SIGNAL(clicked(bool)), this, - SLOT(slot_sign_key(bool))); + connect(sign_key_button_, &QPushButton::clicked, this, + &KeyUIDSignDialog::slot_sign_key); this->setLayout(layout); this->setModal(true); @@ -96,8 +96,9 @@ KeyUIDSignDialog::KeyUIDSignDialog(const GpgKey& key, UIDArgsListPtr uid, setAttribute(Qt::WA_DeleteOnClose, true); - connect(this, SIGNAL(SignalKeyUIDSignUpdate()), SignalStation::GetInstance(), - SIGNAL(KeyDatabaseRefresh())); + connect(this, &KeyUIDSignDialog::SignalKeyUIDSignUpdate, + SignalStation::GetInstance(), + &SignalStation::SignalKeyDatabaseRefresh); } void KeyUIDSignDialog::slot_sign_key(bool clicked) { diff --git a/src/ui/mail/RecipientsPicker.cpp b/src/ui/mail/RecipientsPicker.cpp index 88e823a9..d6b8bcc5 100644 --- a/src/ui/mail/RecipientsPicker.cpp +++ b/src/ui/mail/RecipientsPicker.cpp @@ -34,7 +34,7 @@ GpgFrontend::UI::RecipientsPicker::RecipientsPicker( const GpgFrontend::KeyIdArgsListPtr& current_key_ids, QWidget* parent) : QDialog(parent) { auto confirm_button = new QPushButton(_("Confirm")); - connect(confirm_button, SIGNAL(clicked(bool)), this, SLOT(accept())); + connect(confirm_button,&QPushButton::clicked, this, &RecipientsPicker::accept); // Setup KeyList key_list_ = new KeyList(KeyMenuAbility::NONE, this); diff --git a/src/ui/mail/SenderPicker.cpp b/src/ui/mail/SenderPicker.cpp index dce72332..e3563480 100644 --- a/src/ui/mail/SenderPicker.cpp +++ b/src/ui/mail/SenderPicker.cpp @@ -34,7 +34,7 @@ GpgFrontend::UI::SenderPicker::SenderPicker(const KeyId& current_key_id, QWidget* parent) : QDialog(parent) { auto confirm_button = new QPushButton(_("Confirm")); - connect(confirm_button, SIGNAL(clicked(bool)), this, SLOT(accept())); + connect(confirm_button, &QPushButton::clicked, this, &SenderPicker::accept); // Setup KeyList key_list_ = new KeyList(KeyMenuAbility::NONE, this); diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp index 4b9ac854..ee5c1c2c 100644 --- a/src/ui/main_window/MainWindow.cpp +++ b/src/ui/main_window/MainWindow.cpp @@ -62,7 +62,7 @@ void MainWindow::init() noexcept { attachment_dock_created_ = false; /* Variable containing if restart is needed */ - this->slot_set_restart_needed(false); + this->SlotSetRestartNeeded(false); create_actions(); create_menus(); @@ -70,8 +70,8 @@ void MainWindow::init() noexcept { create_status_bar(); create_dock_windows(); - connect(edit_->tab_widget_, SIGNAL(currentChanged(int)), this, - SLOT(slot_disable_tab_actions(int))); + connect(edit_->tab_widget_, &QTabWidget::currentChanged, this, + &MainWindow::slot_disable_tab_actions); connect(SignalStation::GetInstance(), &SignalStation::SignalRefreshStatusBar, this, [=](const QString& message, int timeout) { @@ -124,8 +124,8 @@ void MainWindow::init() noexcept { #ifdef RELEASE auto version_thread = new VersionCheckThread(); - connect(version_thread, SIGNAL(finished()), version_thread, - SLOT(deleteLater())); + connect(version_thread, &VersionCheckThread::finished, version_thread, + &VersionCheckThread::deleteLater); connect(version_thread, &VersionCheckThread::upgradeVersion, this, &MainWindow::slotVersionUpgrade); diff --git a/src/ui/main_window/MainWindow.h b/src/ui/main_window/MainWindow.h index 0063f524..b169a73f 100644 --- a/src/ui/main_window/MainWindow.h +++ b/src/ui/main_window/MainWindow.h @@ -123,6 +123,12 @@ class MainWindow : public QMainWindow { */ void SlotFileDecryptVerify(); + /** + * @details get value of member restartNeeded to needed. + * @param needed true, if application has to be restarted + */ + void SlotSetRestartNeeded(bool needed); + private slots: /** @@ -241,12 +247,6 @@ class MainWindow : public QMainWindow { 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 slot_set_restart_needed(bool needed); - - /** * @details called when need to upgrade. */ void slot_version_upgrade(const SoftwareVersion& version); diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp index 4ab7385e..83ff3b3c 100644 --- a/src/ui/main_window/MainWindowFileSlotFunction.cpp +++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp @@ -435,7 +435,7 @@ void MainWindow::SlotFileEncryptSign() { auto signersPicker = new SignersPicker(this); QEventLoop loop; - connect(signersPicker, SIGNAL(finished(int)), &loop, SLOT(quit())); + connect(signersPicker, &SignersPicker::finished, &loop, &QEventLoop::quit); loop.exec(); auto signer_key_ids = signersPicker->GetCheckedSigners(); diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index c98c43fc..f14598ed 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -306,7 +306,7 @@ void MainWindow::slot_encrypt_sign() { auto signersPicker = new SignersPicker(this); QEventLoop loop; - connect(signersPicker, SIGNAL(finished(int)), &loop, SLOT(quit())); + connect(signersPicker, &SignersPicker::finished, &loop, &QEventLoop::quit); loop.exec(); auto signer_key_ids = signersPicker->GetCheckedSigners(); diff --git a/src/ui/main_window/MainWindowSlotUI.cpp b/src/ui/main_window/MainWindowSlotUI.cpp index 9919b95b..f790c98e 100644 --- a/src/ui/main_window/MainWindowSlotUI.cpp +++ b/src/ui/main_window/MainWindowSlotUI.cpp @@ -186,7 +186,7 @@ void MainWindow::slot_cut_pgp_header() { edit_->SlotFillTextEditWithText(content.trimmed()); } -void MainWindow::slot_set_restart_needed(bool needed) { +void MainWindow::SlotSetRestartNeeded(bool needed) { this->restart_needed_ = needed; } diff --git a/src/ui/main_window/MainWindowUI.cpp b/src/ui/main_window/MainWindowUI.cpp index b209ad9c..cdc1a39a 100644 --- a/src/ui/main_window/MainWindowUI.cpp +++ b/src/ui/main_window/MainWindowUI.cpp @@ -45,74 +45,74 @@ void MainWindow::create_actions() { newTabActShortcutList.append(QKeySequence(Qt::CTRL + Qt::Key_T)); new_tab_act_->setShortcuts(newTabActShortcutList); new_tab_act_->setToolTip(_("Open a new file")); - connect(new_tab_act_, SIGNAL(triggered()), edit_, SLOT(slotNewTab())); + connect(new_tab_act_, &QAction::triggered, edit_, &TextEdit::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())); + connect(open_act_, &QAction::triggered, edit_, &TextEdit::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())); + connect(browser_act_, &QAction::triggered, this, &MainWindow::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())); + connect(save_act_, &QAction::triggered, edit_, &TextEdit::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())); + connect(save_as_act_, &QAction::triggered, edit_, &TextEdit::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())); + connect(print_act_, &QAction::triggered, edit_, &TextEdit::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())); + connect(close_tab_act_, &QAction::triggered, edit_, &TextEdit::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())); + connect(quit_act_, &QAction::triggered, this, &MainWindow::close); /* Edit Menu */ 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())); + connect(undo_act_, &QAction::triggered, edit_, &TextEdit::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())); + connect(redo_act_, &QAction::triggered, edit_, &TextEdit::SlotRedo); zoom_in_act_ = new QAction(_("Zoom In"), this); zoom_in_act_->setShortcut(QKeySequence::ZoomIn); - connect(zoom_in_act_, SIGNAL(triggered()), edit_, SLOT(slotZoomIn())); + connect(zoom_in_act_, &QAction::triggered, edit_, &TextEdit::SlotZoomIn); zoom_out_act_ = new QAction(_("Zoom Out"), this); zoom_out_act_->setShortcut(QKeySequence::ZoomOut); - connect(zoom_out_act_, SIGNAL(triggered()), edit_, SLOT(slotZoomOut())); + connect(zoom_out_act_, &QAction::triggered, edit_, &TextEdit::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())); + connect(paste_act_, &QAction::triggered, edit_, &TextEdit::SlotPaste); cut_act_ = new QAction(_("Cut"), this); cut_act_->setIcon(QIcon(":button_cut.png")); @@ -120,7 +120,7 @@ void MainWindow::create_actions() { cut_act_->setToolTip( _("Cut the current selection's contents to the " "clipboard")); - connect(cut_act_, SIGNAL(triggered()), edit_, SLOT(slotCut())); + connect(cut_act_, &QAction::triggered, edit_, &TextEdit::SlotCut); copy_act_ = new QAction(_("Copy"), this); copy_act_->setIcon(QIcon(":button_copy.png")); @@ -128,23 +128,23 @@ void MainWindow::create_actions() { copy_act_->setToolTip( _("Copy the current selection's contents to the " "clipboard")); - connect(copy_act_, SIGNAL(triggered()), edit_, SLOT(slotCopy())); + connect(copy_act_, &QAction::triggered, edit_, &TextEdit::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())); + connect(quote_act_, &QAction::triggered, edit_, &TextEdit::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())); + connect(select_all_act_, &QAction::triggered, edit_, &TextEdit::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())); + connect(find_act_, &QAction::triggered, this, &MainWindow::slot_find); clean_double_line_breaks_act_ = new QAction(_("Remove spacing"), this); clean_double_line_breaks_act_->setIcon( @@ -152,14 +152,14 @@ void MainWindow::create_actions() { // cleanDoubleLineBreaksAct->setShortcut(QKeySequence::SelectAll); clean_double_line_breaks_act_->setToolTip( _("Remove double linebreaks, e.g. in pasted text from Web Mailer")); - connect(clean_double_line_breaks_act_, SIGNAL(triggered()), this, - SLOT(slot_clean_double_line_breaks())); + connect(clean_double_line_breaks_act_, &QAction::triggered, this, + &MainWindow::slot_clean_double_line_breaks); 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())); + connect(open_settings_act_, &QAction::triggered, this, + &MainWindow::slot_open_settings_dialog); /* Crypt Menu */ @@ -167,41 +167,41 @@ void MainWindow::create_actions() { 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())); + connect(encrypt_act_, &QAction::triggered, this, &MainWindow::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())); + connect(encrypt_sign_act_, &QAction::triggered, this, + &MainWindow::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())); + connect(decrypt_act_, &QAction::triggered, this, &MainWindow::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())); + connect(decrypt_verify_act_, &QAction::triggered, this, + &MainWindow::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())); + connect(sign_act_, &QAction::triggered, this, &MainWindow::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())); + connect(verify_act_, &QAction::triggered, this, &MainWindow::slot_verify); /* Key Menu */ @@ -233,14 +233,14 @@ void MainWindow::create_actions() { 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())); + connect(import_key_from_edit_act_, &QAction::triggered, this, + &MainWindow::slot_import_key_from_edit); 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())); + connect(open_key_management_act_, &QAction::triggered, this, + &MainWindow::slot_open_key_management); /* * About Menu @@ -268,8 +268,8 @@ void MainWindow::create_actions() { 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())); + connect(start_wizard_act_, &QAction::triggered, this, + &MainWindow::slot_start_wizard); /* Popup-Menu-Action for KeyList */ @@ -277,43 +277,43 @@ void MainWindow::create_actions() { new QAction(_("Append Public Key To Text Editor"), this); append_selected_keys_act_->setToolTip( _("Append The Selected Keys To Text in Editor")); - connect(append_selected_keys_act_, SIGNAL(triggered()), this, - SLOT(slot_append_selected_keys())); + connect(append_selected_keys_act_, &QAction::triggered, this, + &MainWindow::slot_append_selected_keys); copy_mail_address_to_clipboard_act_ = new QAction(_("Copy Email"), this); copy_mail_address_to_clipboard_act_->setToolTip( _("Copy selected Email to clipboard")); - connect(copy_mail_address_to_clipboard_act_, SIGNAL(triggered()), this, - SLOT(slot_copy_mail_address_to_clipboard())); + connect(copy_mail_address_to_clipboard_act_, &QAction::triggered, this, + &MainWindow::slot_copy_mail_address_to_clipboard); // TODO: find central place for shared actions, to avoid code-duplication with // keymgmt.cpp 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())); + connect(show_key_details_act_, &QAction::triggered, this, + &MainWindow::slot_show_key_details); /* Key-Shortcuts for Tab-Switchung-Action */ switch_tab_up_act_ = new QAction(this); switch_tab_up_act_->setShortcut(QKeySequence::NextChild); - connect(switch_tab_up_act_, SIGNAL(triggered()), edit_, - SLOT(slotSwitchTabUp())); + connect(switch_tab_up_act_, &QAction::triggered, edit_, + &TextEdit::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())); + connect(switch_tab_down_act_, &QAction::triggered, edit_, + &TextEdit::SlotSwitchTabDown); this->addAction(switch_tab_down_act_); cut_pgp_header_act_ = new QAction(_("Remove PGP Header"), this); - connect(cut_pgp_header_act_, SIGNAL(triggered()), this, - SLOT(slot_cut_pgp_header())); + connect(cut_pgp_header_act_, &QAction::triggered, this, + &MainWindow::slot_cut_pgp_header); add_pgp_header_act_ = new QAction(_("Add PGP Header"), this); - connect(add_pgp_header_act_, SIGNAL(triggered()), this, - SLOT(slot_add_pgp_header())); + connect(add_pgp_header_act_, &QAction::triggered, this, + &MainWindow::slot_add_pgp_header); #ifdef SMTP_SUPPORT send_mail_act_ = new QAction(_("New Message"), this); @@ -392,13 +392,6 @@ void MainWindow::create_menus() { email_menu_->addAction(receive_mail_act_); #endif -#ifdef ADVANCED_SUPPORT - // Hide menu, when steganography menu is disabled in settings - if (!settings.value("advanced/steganography").toBool()) { - this->menuBar()->removeAction(steganoMenu->menuAction()); - } -#endif - view_menu_ = menuBar()->addMenu(_("View")); help_menu_ = menuBar()->addMenu(_("Help")); diff --git a/src/ui/settings/SettingsDialog.cpp b/src/ui/settings/SettingsDialog.cpp index ceaf089b..c633a06e 100644 --- a/src/ui/settings/SettingsDialog.cpp +++ b/src/ui/settings/SettingsDialog.cpp @@ -28,15 +28,16 @@ #include "SettingsDialog.h" -#include "GlobalSettingStation.h" -#include "SettingsAdvanced.h" -#include "SettingsAppearance.h" -#include "SettingsGeneral.h" -#include "SettingsKeyServer.h" -#include "SettingsNetwork.h" +#include "ui/settings/GlobalSettingStation.h" +#include "ui/settings/SettingsAdvanced.h" +#include "ui/settings/SettingsAppearance.h" +#include "ui/settings/SettingsGeneral.h" +#include "ui/settings/SettingsKeyServer.h" +#include "ui/settings/SettingsNetwork.h" +#include "ui/main_window/MainWindow.h" #ifdef SMTP_SUPPORT -#include "SettingsSendMail.h" +#include "ui/settings/SettingsSendMail.h" #endif namespace GpgFrontend::UI { @@ -69,8 +70,8 @@ SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent) { button_box_ = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - connect(button_box_, SIGNAL(accepted()), this, SLOT(SlotAccept())); - connect(button_box_, SIGNAL(rejected()), this, SLOT(reject())); + connect(button_box_, &QDialogButtonBox::accepted, this, &SettingsDialog::SlotAccept); + connect(button_box_, &QDialogButtonBox::rejected, this, &SettingsDialog::reject); auto* mainLayout = new QVBoxLayout; mainLayout->addWidget(tab_widget_); @@ -81,25 +82,11 @@ SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent) { setWindowTitle(_("Settings")); - // slots for handling the restartneeded member + // slots for handling the restart needed member this->slot_set_restart_needed(false); - connect(general_tab_, SIGNAL(SignalRestartNeeded(bool)), this, - SLOT(slot_set_restart_needed(bool))); - connect(appearance_tab_, SIGNAL(SignalRestartNeeded(bool)), this, - SLOT(slot_set_restart_needed(bool))); -#ifdef SMTP_SUPPORT - connect(send_mail_tab_, SIGNAL(SignalRestartNeeded(bool)), this, - SLOT(slot_set_restart_needed(bool))); -#endif - connect(key_server_tab_, SIGNAL(SignalRestartNeeded(bool)), this, - SLOT(slot_set_restart_needed(bool))); -#ifdef ADVANCED_SUPPORT - connect(advancedTab, SIGNAL(signalRestartNeeded(bool)), this, - SLOT(slotSetRestartNeeded(bool))); -#endif - - connect(this, SIGNAL(SignalRestartNeeded(bool)), parent, - SLOT(slot_set_restart_needed(bool))); + connect(general_tab_, &GeneralTab::SignalRestartNeeded, this, + &SettingsDialog::slot_set_restart_needed); + connect(this, &SettingsDialog::SignalRestartNeeded, qobject_cast<MainWindow *>(parent), &MainWindow::SlotSetRestartNeeded); this->setMinimumSize(480, 680); this->adjustSize(); diff --git a/src/ui/settings/SettingsGeneral.cpp b/src/ui/settings/SettingsGeneral.cpp index 5b697fa0..2b5bcfcf 100644 --- a/src/ui/settings/SettingsGeneral.cpp +++ b/src/ui/settings/SettingsGeneral.cpp @@ -66,8 +66,8 @@ GeneralTab::GeneralTab(QWidget* parent) for (const auto& l : lang_) { ui_->langSelectBox->addItem(l); } - connect(ui_->langSelectBox, SIGNAL(currentIndexChanged(int)), this, - SLOT(slot_language_changed())); + connect(ui_->langSelectBox, qOverload<int>(&QComboBox::currentIndexChanged), + this, &GeneralTab::slot_language_changed); #endif SetSettings(); diff --git a/src/ui/struct/SettingsObject.cpp b/src/ui/struct/SettingsObject.cpp index 72ee279e..31e71e46 100644 --- a/src/ui/struct/SettingsObject.cpp +++ b/src/ui/struct/SettingsObject.cpp @@ -30,9 +30,14 @@ nlohmann::json& GpgFrontend::UI::SettingsObject::Check( const std::string& key, nlohmann::json default_value) { - if (!nlohmann::json::contains(key)) - nlohmann::json::operator[](key) = std::move(default_value); - return nlohmann::json::operator[](key); + try { + if (!this->nlohmann::json::contains(key)) + this->nlohmann::json::operator[](key) = std::move(default_value); + return this->nlohmann::json::operator[](key); + } catch (const std::exception& e) { + LOG(ERROR) << e.what(); + throw e; + } } GpgFrontend::UI::SettingsObject GpgFrontend::UI::SettingsObject::Check( diff --git a/src/ui/widgets/FindWidget.cpp b/src/ui/widgets/FindWidget.cpp index c1223475..58ceda7c 100644 --- a/src/ui/widgets/FindWidget.cpp +++ b/src/ui/widgets/FindWidget.cpp @@ -48,11 +48,11 @@ FindWidget::FindWidget(QWidget* parent, PlainTextEditorPage* edit) notificationWidgetLayout->addWidget(closeButton); this->setLayout(notificationWidgetLayout); - connect(find_edit_, SIGNAL(textEdited(QString)), this, SLOT(slot_find())); - connect(find_edit_, SIGNAL(returnPressed()), this, SLOT(slot_find_next())); - connect(nextButton, SIGNAL(clicked()), this, SLOT(slot_find_next())); - connect(previousButton, SIGNAL(clicked()), this, SLOT(slot_find_previous())); - connect(closeButton, SIGNAL(clicked()), this, SLOT(slot_close())); + connect(find_edit_, &QLineEdit::textEdited, this, &FindWidget::slot_find); + connect(find_edit_, &QLineEdit::returnPressed, this, &FindWidget::slot_find_next); + connect(nextButton, &QPushButton::clicked, this, &FindWidget::slot_find_next); + connect(previousButton, &QPushButton::clicked, this, &FindWidget::slot_find_previous); + connect(closeButton, &QPushButton::clicked, this, &FindWidget::slot_close); // The timer is necessary for setting the focus QTimer::singleShot(0, find_edit_, SLOT(setFocus())); diff --git a/src/ui/widgets/HelpPage.cpp b/src/ui/widgets/HelpPage.cpp index 04bf609c..b116df30 100644 --- a/src/ui/widgets/HelpPage.cpp +++ b/src/ui/widgets/HelpPage.cpp @@ -40,8 +40,8 @@ HelpPage::HelpPage(const QString& path, QWidget* parent) : QWidget(parent) { mainLayout->setContentsMargins(0, 0, 0, 0); setLayout(mainLayout); - connect(browser_, SIGNAL(anchorClicked(QUrl)), this, - SLOT(slot_open_url(QUrl))); + connect(browser_, &QTextBrowser::anchorClicked, this, + &HelpPage::slot_open_url); browser_->setOpenLinks(false); browser_->setSource(localized_help(QUrl(path))); browser_->setFocus(); diff --git a/src/ui/widgets/InfoBoardWidget.cpp b/src/ui/widgets/InfoBoardWidget.cpp index 3d5db85c..bedcdf49 100644 --- a/src/ui/widgets/InfoBoardWidget.cpp +++ b/src/ui/widgets/InfoBoardWidget.cpp @@ -99,16 +99,18 @@ void InfoBoardWidget::SlotRefresh(const QString& text, InfoBoardStatus status) { void InfoBoardWidget::AssociateTextEdit(QTextEdit* edit) { if (m_text_page_ != nullptr) - disconnect(m_text_page_, SIGNAL(textChanged()), this, SLOT(SlotReset())); + disconnect(m_text_page_, &QTextEdit::textChanged, this, + &InfoBoardWidget::SlotReset); this->m_text_page_ = edit; - connect(edit, SIGNAL(textChanged()), this, SLOT(SlotReset())); + connect(edit, &QTextEdit::textChanged, this, &InfoBoardWidget::SlotReset); } void InfoBoardWidget::AssociateTabWidget(QTabWidget* tab) { m_text_page_ = nullptr; m_tab_widget_ = tab; - connect(tab, SIGNAL(tabBarClicked(int)), this, SLOT(SlotReset())); - connect(tab, SIGNAL(tabCloseRequested(int)), this, SLOT(SlotReset())); + connect(tab, &QTabWidget::tabBarClicked, this, &InfoBoardWidget::SlotReset); + connect(tab, &QTabWidget::tabCloseRequested, this, + &InfoBoardWidget::SlotReset); // reset this->SlotReset(); } diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp index 37378529..b9cc30d4 100644 --- a/src/ui/widgets/KeyList.cpp +++ b/src/ui/widgets/KeyList.cpp @@ -78,8 +78,9 @@ void KeyList::init() { // register key database refresh signal connect(this, &KeyList::SignalRefreshDatabase, SignalStation::GetInstance(), &SignalStation::SignalKeyDatabaseRefresh); - connect(SignalStation::GetInstance(), SIGNAL(KeyDatabaseRefresh()), this, - SLOT(SlotRefresh())); + connect(SignalStation::GetInstance(), + &SignalStation::SignalKeyDatabaseRefresh, this, + &KeyList::SlotRefresh); connect(ui_->refreshKeyListButton, &QPushButton::clicked, this, &KeyList::SlotRefresh); connect(ui_->uncheckButton, &QPushButton::clicked, this, @@ -342,8 +343,8 @@ void KeyList::dropEvent(QDropEvent* event) { // Buttons for ok and cancel auto* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - connect(buttonBox, SIGNAL(accepted()), dialog, SLOT(accept())); - connect(buttonBox, SIGNAL(rejected()), dialog, SLOT(reject())); + connect(buttonBox, &QDialogButtonBox::accepted, dialog, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, dialog, &QDialog::reject); auto* vbox = new QVBoxLayout(); vbox->addWidget(label); diff --git a/src/ui/widgets/SignersPicker.cpp b/src/ui/widgets/SignersPicker.cpp index b7551c9c..75f6b2ba 100644 --- a/src/ui/widgets/SignersPicker.cpp +++ b/src/ui/widgets/SignersPicker.cpp @@ -34,7 +34,7 @@ namespace GpgFrontend::UI { SignersPicker::SignersPicker(QWidget* parent) : QDialog(parent) { auto confirm_button = new QPushButton(_("Confirm")); - connect(confirm_button, SIGNAL(clicked(bool)), this, SLOT(accept())); + connect(confirm_button, &QPushButton::clicked, this, &SignersPicker::accept); /*Setup KeyList*/ key_list_ = new KeyList(false, this); diff --git a/src/ui/widgets/TextEdit.cpp b/src/ui/widgets/TextEdit.cpp index a0e16081..5556397e 100644 --- a/src/ui/widgets/TextEdit.cpp +++ b/src/ui/widgets/TextEdit.cpp @@ -45,8 +45,8 @@ TextEdit::TextEdit(QWidget* parent) : QWidget(parent) { layout->setSpacing(0); setLayout(layout); - connect(tab_widget_, SIGNAL(tabCloseRequested(int)), this, - SLOT(slot_remove_tab(int))); + connect(tab_widget_, &QTabWidget::tabCloseRequested, this, + &TextEdit::slot_remove_tab); SlotNewTab(); setAcceptDrops(false); } @@ -129,8 +129,8 @@ void TextEdit::SlotOpen() { QApplication::restoreOverrideCursor(); page->GetTextPage()->setFocus(); connect(page->GetTextPage()->document(), - SIGNAL(modificationChanged(bool)), this, - SLOT(SlotShowModified())); + &QTextDocument::modificationChanged, this, + &TextEdit::SlotShowModified); // enableAction(true) file.close(); } else { @@ -508,7 +508,7 @@ QHash<int, QString> TextEdit::UnsavedDocuments() const { return unsavedDocs; } -void TextEdit::slot_cut() const { +void TextEdit::SlotCut() const { if (tab_widget_->count() == 0 || CurTextPage() == nullptr) { return; } @@ -516,7 +516,7 @@ void TextEdit::slot_cut() const { CurTextPage()->GetTextPage()->cut(); } -void TextEdit::slot_copy() const { +void TextEdit::SlotCopy() const { if (tab_widget_->count() == 0) { return; } @@ -526,7 +526,7 @@ void TextEdit::slot_copy() const { } } -void TextEdit::slot_paste() const { +void TextEdit::SlotPaste() const { if (tab_widget_->count() == 0 || CurTextPage() == nullptr) { return; } @@ -534,7 +534,7 @@ void TextEdit::slot_paste() const { CurTextPage()->GetTextPage()->paste(); } -void TextEdit::slot_undo() const { +void TextEdit::SlotUndo() const { if (tab_widget_->count() == 0 || CurTextPage() == nullptr) { return; } @@ -542,7 +542,7 @@ void TextEdit::slot_undo() const { CurTextPage()->GetTextPage()->undo(); } -void TextEdit::slot_redo() const { +void TextEdit::SlotRedo() const { if (tab_widget_->count() == 0 || CurTextPage() == nullptr) { return; } @@ -550,7 +550,7 @@ void TextEdit::slot_redo() const { CurTextPage()->GetTextPage()->redo(); } -void TextEdit::slot_zoom_in() const { +void TextEdit::SlotZoomIn() const { if (tab_widget_->count() == 0) { return; } @@ -560,7 +560,7 @@ void TextEdit::slot_zoom_in() const { } } -void TextEdit::slot_zoom_out() const { +void TextEdit::SlotZoomOut() const { if (tab_widget_->count() == 0) { return; } @@ -570,7 +570,7 @@ void TextEdit::slot_zoom_out() const { } } -void TextEdit::slot_select_all() const { +void TextEdit::SlotSelectAll() const { if (tab_widget_->count() == 0 || CurTextPage() == nullptr) { return; } diff --git a/src/ui/widgets/TextEdit.h b/src/ui/widgets/TextEdit.h index e5b6b0ed..cb32bfb2 100644 --- a/src/ui/widgets/TextEdit.h +++ b/src/ui/widgets/TextEdit.h @@ -221,50 +221,52 @@ class TextEdit : public QWidget { */ void slot_remove_tab(int index); + public slots: + /** * @details Cut selected text in current text page. */ - void slot_cut() const; + void SlotCut() const; /** * @details Copy selected text of current text page to clipboard. */ - void slot_copy() const; + void SlotCopy() const; /** * @details Paste text from clipboard to current text page. */ - void slot_paste() const; + void SlotPaste() const; /** * @details Undo last change in current textpage. * */ - void slot_undo() const; + void SlotUndo() const; /** * @brief redo last change in current text page * */ - void slot_redo() const; + void SlotRedo() const; /** * @brief * */ - void slot_zoom_in() const; + void SlotZoomIn() const; /** * @brief * */ - void slot_zoom_out() const; + void SlotZoomOut() const; /** * @brief select all in current text page * */ - void slot_select_all() const; + void SlotSelectAll() const; protected: /** diff --git a/src/ui/widgets/VerifyKeyDetailBox.cpp b/src/ui/widgets/VerifyKeyDetailBox.cpp index 014072af..bbde591d 100644 --- a/src/ui/widgets/VerifyKeyDetailBox.cpp +++ b/src/ui/widgets/VerifyKeyDetailBox.cpp @@ -41,8 +41,8 @@ VerifyKeyDetailBox::VerifyKeyDetailBox(const GpgSignature& signature, case GPG_ERR_NO_PUBKEY: { this->setTitle("A Error Signature"); auto* importButton = new QPushButton(_("Import from keyserver")); - connect(importButton, SIGNAL(clicked()), this, - SLOT(slot_import_form_key_server())); + connect(importButton,&QPushButton::clicked, this, + &VerifyKeyDetailBox::slot_import_form_key_server); this->setTitle(QString(_("Key not present with id 0x")) + fpr_.c_str()); |