aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaturneric <[email protected]>2022-01-23 07:36:55 +0000
committerSaturneric <[email protected]>2022-01-23 07:38:54 +0000
commit247b5b8f7ffb5cf7df5d4bc0e4fb786152934569 (patch)
treedaa5b6f39a1a4c07d4fa10a478d159e17059609c
parent<refactor>(ui): tidy up codes and comments. (diff)
downloadGpgFrontend-247b5b8f7ffb5cf7df5d4bc0e4fb786152934569.tar.gz
GpgFrontend-247b5b8f7ffb5cf7df5d4bc0e4fb786152934569.zip
<refactor>(ui): tidy up codes and comments.
1. tidy up thread.
Diffstat (limited to '')
-rw-r--r--src/ui/help/AboutDialog.cpp2
-rw-r--r--src/ui/settings/SettingsKeyServer.cpp8
-rw-r--r--src/ui/settings/SettingsNetwork.cpp2
-rw-r--r--src/ui/settings/SettingsSendMail.cpp20
-rw-r--r--src/ui/smtp/SendMailDialog.cpp20
-rw-r--r--src/ui/thread/CtxCheckThread.cpp4
-rw-r--r--src/ui/thread/CtxCheckThread.h18
-rw-r--r--src/ui/thread/FileReadThread.cpp8
-rw-r--r--src/ui/thread/FileReadThread.h28
-rw-r--r--src/ui/thread/ListedKeyServerTestThread.cpp (renamed from src/ui/thread/TestListedKeyServerThread.cpp)6
-rw-r--r--src/ui/thread/ListedKeyServerTestThread.h (renamed from src/ui/thread/TestListedKeyServerThread.h)31
-rw-r--r--src/ui/thread/ProxyConnectionTestThread.cpp2
-rw-r--r--src/ui/thread/ProxyConnectionTestThread.h28
-rw-r--r--src/ui/thread/SMTPConnectionTestThread.cpp (renamed from src/ui/thread/SMTPTestThread.cpp)10
-rw-r--r--src/ui/thread/SMTPConnectionTestThread.h (renamed from src/ui/thread/SMTPTestThread.h)56
-rw-r--r--src/ui/thread/SMTPSendMailThread.cpp32
-rw-r--r--src/ui/thread/SMTPSendMailThread.h143
-rw-r--r--src/ui/thread/VersionCheckThread.cpp2
-rw-r--r--src/ui/thread/VersionCheckThread.h23
-rw-r--r--src/ui/widgets/PlainTextEditorPage.cpp4
20 files changed, 318 insertions, 129 deletions
diff --git a/src/ui/help/AboutDialog.cpp b/src/ui/help/AboutDialog.cpp
index 008d9c0c..e0d8f099 100644
--- a/src/ui/help/AboutDialog.cpp
+++ b/src/ui/help/AboutDialog.cpp
@@ -196,7 +196,7 @@ void UpdateTab::getLatestVersion() {
connect(version_thread, SIGNAL(finished()), version_thread,
SLOT(deleteLater()));
- connect(version_thread, &VersionCheckThread::upgradeVersion, this,
+ connect(version_thread, &VersionCheckThread::SignalUpgradeVersion, this,
&UpdateTab::slot_show_version_status);
version_thread->start();
diff --git a/src/ui/settings/SettingsKeyServer.cpp b/src/ui/settings/SettingsKeyServer.cpp
index ca74d3d2..41e749c1 100644
--- a/src/ui/settings/SettingsKeyServer.cpp
+++ b/src/ui/settings/SettingsKeyServer.cpp
@@ -29,7 +29,7 @@
#include "SettingsKeyServer.h"
#include "GlobalSettingStation.h"
-#include "ui/thread/TestListedKeyServerThread.h"
+#include "ui/thread/ListedKeyServerTestThread.h"
#include "ui_KeyServerSettings.h"
namespace GpgFrontend::UI {
@@ -249,10 +249,10 @@ void KeyserverTab::slot_test_listed_key_server() {
urls.push_back(keyserver_url);
}
- auto thread = new TestListedKeyServerThread(urls, timeout, this);
+ auto thread = new ListedKeyServerTestThread(urls, timeout, this);
connect(thread,
- &GpgFrontend::UI::TestListedKeyServerThread::
- signalKeyServerListTestResult,
+ &GpgFrontend::UI::ListedKeyServerTestThread::
+ SignalKeyServerListTestResult,
this, [=](const QStringList& result) {
const auto row_size = ui_->keyServerListTable->rowCount();
if (result.size() != row_size) return;
diff --git a/src/ui/settings/SettingsNetwork.cpp b/src/ui/settings/SettingsNetwork.cpp
index 1a976412..a3cff2cd 100644
--- a/src/ui/settings/SettingsNetwork.cpp
+++ b/src/ui/settings/SettingsNetwork.cpp
@@ -239,7 +239,7 @@ void GpgFrontend::UI::NetworkTab::slot_test_proxy_connection_result() {
auto thread = new ProxyConnectionTestThread(url, 800, this);
connect(thread,
&GpgFrontend::UI::ProxyConnectionTestThread::
- signalProxyConnectionTestResult,
+ SignalProxyConnectionTestResult,
this, [=](const QString &result) {
if (result == "Reachable") {
QMessageBox::information(this, _("Success"),
diff --git a/src/ui/settings/SettingsSendMail.cpp b/src/ui/settings/SettingsSendMail.cpp
index 910c54ec..a99b61a6 100644
--- a/src/ui/settings/SettingsSendMail.cpp
+++ b/src/ui/settings/SettingsSendMail.cpp
@@ -29,8 +29,8 @@
#include "SettingsSendMail.h"
#include "ui/data_struct/SettingsObject.h"
+#include "ui/thread/SMTPConnectionTestThread.h"
#include "ui/thread/SMTPSendMailThread.h"
-#include "ui/thread/SMTPTestThread.h"
#include "ui_SendMailSettings.h"
namespace GpgFrontend::UI {
@@ -176,8 +176,8 @@ void SendMailTab::slot_check_connection() {
auto username = ui_->usernameEdit->text().toStdString();
auto password = ui_->passwordEdit->text().toStdString();
- auto thread = new SMTPTestThread(host, port, connection_type, identity_needed,
- username, password);
+ auto thread = new SMTPConnectionTestThread(
+ host, port, connection_type, identity_needed, username, password);
// Waiting Dialog
auto* waiting_dialog = new QProgressDialog(this);
@@ -190,8 +190,8 @@ void SendMailTab::slot_check_connection() {
waiting_dialog_label->setWordWrap(true);
waiting_dialog->setLabel(waiting_dialog_label);
waiting_dialog->resize(420, 120);
- connect(thread, &SMTPTestThread::signalSMTPTestResult, this,
- &SendMailTab::slot_test_smtp_connection_result);
+ connect(thread, &SMTPConnectionTestThread::SignalSMTPConnectionTestResult,
+ this, &SendMailTab::slot_test_smtp_connection_result);
connect(thread, &QThread::finished, [=]() {
waiting_dialog->finished(0);
waiting_dialog->deleteLater();
@@ -236,7 +236,7 @@ void SendMailTab::slot_send_test_mail() {
waiting_dialog_label->setWordWrap(true);
waiting_dialog->setLabel(waiting_dialog_label);
waiting_dialog->resize(420, 120);
- connect(thread, &SMTPSendMailThread::signalSMTPResult, this,
+ connect(thread, &SMTPSendMailThread::SignalSMTPResult, this,
&SendMailTab::slot_test_smtp_connection_result);
connect(thread, &QThread::finished, [=]() {
waiting_dialog->finished(0);
@@ -247,10 +247,10 @@ void SendMailTab::slot_send_test_mail() {
if (thread->isRunning()) thread->terminate();
});
- thread->setSender(sender_address);
- thread->setRecipient(sender_address);
- thread->setSubject(_("Test Email from GpgFrontend"));
- thread->addTextContent(
+ thread->SetSender(sender_address);
+ thread->SetRecipient(sender_address);
+ thread->SetSubject(_("Test Email from GpgFrontend"));
+ thread->AddTextContent(
_("Hello, this is a test email from GpgFrontend. If you receive this "
"email, it means that you have configured the correct SMTP server "
"parameters."));
diff --git a/src/ui/smtp/SendMailDialog.cpp b/src/ui/smtp/SendMailDialog.cpp
index ce67e08e..408c6d22 100644
--- a/src/ui/smtp/SendMailDialog.cpp
+++ b/src/ui/smtp/SendMailDialog.cpp
@@ -241,12 +241,12 @@ void SendMailDialog::slot_confirm() {
auto thread = new SMTPSendMailThread(
host, port, connection_type, identity_needed, username, password, this);
- thread->setSender(ui_->senderEdit->text());
- thread->setRecipient(ui_->recipientEdit->text());
- thread->setCC(ui_->ccEdit->text());
- thread->setBCC(ui_->bccEdit->text());
- thread->setSubject(ui_->subjectEdit->text());
- thread->addTextContent(ui_->textEdit->toPlainText());
+ thread->SetSender(ui_->senderEdit->text());
+ thread->SetRecipient(ui_->recipientEdit->text());
+ thread->SetCC(ui_->ccEdit->text());
+ thread->SetBCC(ui_->bccEdit->text());
+ thread->SetSubject(ui_->subjectEdit->text());
+ thread->AddTextContent(ui_->textEdit->toPlainText());
if (ui_->contentEncryptCheckBox->checkState() == Qt::Checked) {
if (recipients_key_ids_ == nullptr || recipients_key_ids_->empty()) {
@@ -260,7 +260,7 @@ void SendMailDialog::slot_confirm() {
auto key_ids = std::make_unique<KeyIdArgsList>();
for (const auto& key_id : *recipients_key_ids_)
key_ids->push_back(key_id);
- thread->setEncryptContent(true, std::move(key_ids));
+ thread->SetEncryptContent(true, std::move(key_ids));
}
}
@@ -274,7 +274,7 @@ void SendMailDialog::slot_confirm() {
"operation is prohibited."));
return;
} else {
- thread->setAttachSignatureFile(true, sender_key_id_);
+ thread->SetAttachSignatureFile(true, sender_key_id_);
}
}
@@ -289,7 +289,7 @@ void SendMailDialog::slot_confirm() {
"with your expectations, so the operation is prohibited."));
return;
} else {
- thread->setAttachPublicKey(true, sender_key_id_);
+ thread->SetAttachPublicKey(true, sender_key_id_);
}
}
@@ -304,7 +304,7 @@ void SendMailDialog::slot_confirm() {
waiting_dialog_label->setWordWrap(true);
waiting_dialog->setLabel(waiting_dialog_label);
waiting_dialog->resize(420, 120);
- connect(thread, &SMTPSendMailThread::signalSMTPResult, this,
+ connect(thread, &SMTPSendMailThread::SignalSMTPResult, this,
&SendMailDialog::slot_test_smtp_connection_result);
connect(thread, &QThread::finished, [=]() {
waiting_dialog->finished(0);
diff --git a/src/ui/thread/CtxCheckThread.cpp b/src/ui/thread/CtxCheckThread.cpp
index c0e33a7d..bbcb1503 100644
--- a/src/ui/thread/CtxCheckThread.cpp
+++ b/src/ui/thread/CtxCheckThread.cpp
@@ -32,7 +32,7 @@
#include "ui/UserInterfaceUtils.h"
GpgFrontend::UI::CtxCheckThread::CtxCheckThread() : QThread(nullptr) {
- connect(this, &CtxCheckThread::signalGnupgNotInstall,
+ connect(this, &CtxCheckThread::SignalGnupgNotInstall,
CommonUtils::GetInstance(), &CommonUtils::signalGnupgNotInstall);
}
@@ -42,7 +42,7 @@ void GpgFrontend::UI::CtxCheckThread::run() {
// Create & Check Gnupg Context Status
if (!GpgContext::GetInstance().good()) {
- emit signalGnupgNotInstall();
+ emit SignalGnupgNotInstall();
}
// Try fetching key
else
diff --git a/src/ui/thread/CtxCheckThread.h b/src/ui/thread/CtxCheckThread.h
index d7320f3f..36281525 100644
--- a/src/ui/thread/CtxCheckThread.h
+++ b/src/ui/thread/CtxCheckThread.h
@@ -28,15 +28,31 @@
#define GPGFRONTEND_CTXCHECKTRHEAD_H
#include "ui/GpgFrontendUI.h"
namespace GpgFrontend::UI {
+/**
+ * @brief
+ *
+ */
class CtxCheckThread : public QThread {
Q_OBJECT
public:
+ /**
+ * @brief Construct a new Ctx Check Thread object
+ *
+ */
CtxCheckThread();
signals:
- void signalGnupgNotInstall();
+ /**
+ * @brief
+ *
+ */
+ void SignalGnupgNotInstall();
protected:
+ /**
+ * @brief
+ *
+ */
void run() override;
};
} // namespace GpgFrontend::UI
diff --git a/src/ui/thread/FileReadThread.cpp b/src/ui/thread/FileReadThread.cpp
index 1e991752..1ed9ae60 100644
--- a/src/ui/thread/FileReadThread.cpp
+++ b/src/ui/thread/FileReadThread.cpp
@@ -31,13 +31,13 @@
namespace GpgFrontend::UI {
-FileReadThread::FileReadThread(std::string path) : path(std::move(path)) {
+FileReadThread::FileReadThread(std::string path) : path_(std::move(path)) {
qRegisterMetaType<std::string>("std::string");
}
void FileReadThread::run() {
LOG(INFO) << "started";
- boost::filesystem::path read_file_path(this->path);
+ boost::filesystem::path read_file_path(this->path_);
if (is_regular_file(read_file_path)) {
LOG(INFO) << "read open";
@@ -56,7 +56,7 @@ void FileReadThread::run() {
LOG(INFO) << "block size " << read_size;
std::string buffer_str(buffer, read_size);
- emit sendReadBlock(buffer_str);
+ emit SignalSendReadBlock(buffer_str);
#ifdef RELEASE
QThread::msleep(32);
#else
@@ -64,7 +64,7 @@ void FileReadThread::run() {
#endif
}
fclose(fp);
- emit readDone();
+ emit SignalReadDone();
LOG(INFO) << "thread end reading";
}
}
diff --git a/src/ui/thread/FileReadThread.h b/src/ui/thread/FileReadThread.h
index a1266afc..e7573af8 100644
--- a/src/ui/thread/FileReadThread.h
+++ b/src/ui/thread/FileReadThread.h
@@ -31,23 +31,45 @@
namespace GpgFrontend::UI {
+/**
+ * @brief
+ *
+ */
class FileReadThread : public QThread {
Q_OBJECT
public:
+ /**
+ * @brief Construct a new File Read Thread object
+ *
+ * @param path
+ */
explicit FileReadThread(std::string path);
signals:
- void sendReadBlock(const std::string& block);
+ /**
+ * @brief
+ *
+ * @param block
+ */
+ void SignalSendReadBlock(const std::string& block);
- void readDone();
+ /**
+ * @brief
+ *
+ */
+ void SignalReadDone();
protected:
+ /**
+ * @brief
+ *
+ */
void run() override;
private:
- std::string path;
+ std::string path_; ///<
};
} // namespace GpgFrontend::UI
diff --git a/src/ui/thread/TestListedKeyServerThread.cpp b/src/ui/thread/ListedKeyServerTestThread.cpp
index f95fc729..8c86f0be 100644
--- a/src/ui/thread/TestListedKeyServerThread.cpp
+++ b/src/ui/thread/ListedKeyServerTestThread.cpp
@@ -24,9 +24,9 @@
*
*/
-#include "TestListedKeyServerThread.h"
+#include "ListedKeyServerTestThread.h"
-void GpgFrontend::UI::TestListedKeyServerThread::run() {
+void GpgFrontend::UI::ListedKeyServerTestThread::run() {
for (const auto& url : urls_) {
const auto keyserver_url = url;
@@ -45,5 +45,5 @@ void GpgFrontend::UI::TestListedKeyServerThread::run() {
socket.close();
}
- emit signalKeyServerListTestResult(result_);
+ emit SignalKeyServerListTestResult(result_);
}
diff --git a/src/ui/thread/TestListedKeyServerThread.h b/src/ui/thread/ListedKeyServerTestThread.h
index 85eef2cf..dd7c2fa8 100644
--- a/src/ui/thread/TestListedKeyServerThread.h
+++ b/src/ui/thread/ListedKeyServerTestThread.h
@@ -24,34 +24,47 @@
*
*/
-#ifndef GPGFRONTEND_TESTLISTEDKEYSERVERTHREAD_H
-#define GPGFRONTEND_TESTLISTEDKEYSERVERTHREAD_H
+#ifndef GPGFRONTEND_LISTEDKEYSERVERTESTTHREAD_H
+#define GPGFRONTEND_LISTEDKEYSERVERTESTTHREAD_H
#include "GpgFrontendUI.h"
namespace GpgFrontend::UI {
-class TestListedKeyServerThread : public QThread {
+/**
+ * @brief
+ *
+ */
+class ListedKeyServerTestThread : public QThread {
Q_OBJECT
public:
- explicit TestListedKeyServerThread(const QStringList& urls, int timeout,
+ explicit ListedKeyServerTestThread(const QStringList& urls, int timeout,
QWidget* parent = nullptr)
: QThread(parent), urls_(urls), timeout_(timeout) {}
signals:
- void signalKeyServerListTestResult(const QStringList& result);
+ /**
+ * @brief
+ *
+ * @param result
+ */
+ void SignalKeyServerListTestResult(const QStringList& result);
protected:
+ /**
+ * @brief
+ *
+ */
void run() override;
private:
- QStringList urls_;
- QStringList result_;
- int timeout_ = 500;
+ QStringList urls_; ///<
+ QStringList result_; ///<
+ int timeout_ = 500; ///<
};
} // namespace GpgFrontend::UI
class TestListedKeyServerThread {};
-#endif // GPGFRONTEND_TESTLISTEDKEYSERVERTHREAD_H
+#endif // GPGFRONTEND_LISTEDKEYSERVERTESTTHREAD_H
diff --git a/src/ui/thread/ProxyConnectionTestThread.cpp b/src/ui/thread/ProxyConnectionTestThread.cpp
index 8e465c1b..062f4774 100644
--- a/src/ui/thread/ProxyConnectionTestThread.cpp
+++ b/src/ui/thread/ProxyConnectionTestThread.cpp
@@ -54,5 +54,5 @@ void GpgFrontend::UI::ProxyConnectionTestThread::run() {
_reply->deleteLater();
- emit signalProxyConnectionTestResult(result_);
+ emit SignalProxyConnectionTestResult(result_);
}
diff --git a/src/ui/thread/ProxyConnectionTestThread.h b/src/ui/thread/ProxyConnectionTestThread.h
index da7fc412..70757e03 100644
--- a/src/ui/thread/ProxyConnectionTestThread.h
+++ b/src/ui/thread/ProxyConnectionTestThread.h
@@ -35,23 +35,43 @@ class ProxyConnectionTestThread {};
namespace GpgFrontend::UI {
+/**
+ * @brief
+ *
+ */
class ProxyConnectionTestThread : public QThread {
Q_OBJECT
public:
+ /**
+ * @brief Construct a new Proxy Connection Test Thread object
+ *
+ * @param url
+ * @param timeout
+ * @param parent
+ */
explicit ProxyConnectionTestThread(QString url, int timeout,
QWidget* parent = nullptr)
: QThread(parent), url_(std::move(url)), timeout_(timeout) {}
signals:
- void signalProxyConnectionTestResult(const QString& result);
+ /**
+ * @brief
+ *
+ * @param result
+ */
+ void SignalProxyConnectionTestResult(const QString& result);
protected:
+ /**
+ * @brief
+ *
+ */
void run() override;
private:
- QString url_;
- QString result_;
- int timeout_ = 500;
+ QString url_; ///<
+ QString result_; ///<
+ int timeout_ = 500; ///<
};
} // namespace GpgFrontend::UI
diff --git a/src/ui/thread/SMTPTestThread.cpp b/src/ui/thread/SMTPConnectionTestThread.cpp
index 0338de13..95cc8f72 100644
--- a/src/ui/thread/SMTPTestThread.cpp
+++ b/src/ui/thread/SMTPConnectionTestThread.cpp
@@ -24,25 +24,25 @@
*
*/
-#include "SMTPTestThread.h"
+#include "SMTPConnectionTestThread.h"
namespace GpgFrontend::UI {
-void SMTPTestThread::run() {
+void SMTPConnectionTestThread::run() {
SmtpClient smtp(host_.c_str(), port_, connection_type_);
if (identify_) {
smtp.setUser(username_.c_str());
smtp.setPassword(password_.c_str());
}
if (!smtp.connectToHost()) {
- emit signalSMTPTestResult("Fail to connect SMTP server");
+ emit SignalSMTPConnectionTestResult("Fail to connect SMTP server");
return;
}
if (!smtp.login()) {
- emit signalSMTPTestResult("Fail to login");
+ emit SignalSMTPConnectionTestResult("Fail to login");
return;
}
smtp.quit();
- emit signalSMTPTestResult("Succeed in testing connection");
+ emit SignalSMTPConnectionTestResult("Succeed in testing connection");
}
} // namespace GpgFrontend::UI
diff --git a/src/ui/thread/SMTPTestThread.h b/src/ui/thread/SMTPConnectionTestThread.h
index 3ccb075c..b37cc09c 100644
--- a/src/ui/thread/SMTPTestThread.h
+++ b/src/ui/thread/SMTPConnectionTestThread.h
@@ -24,8 +24,8 @@
*
*/
-#ifndef GPGFRONTEND_SMTPTESTTHREAD_H
-#define GPGFRONTEND_SMTPTESTTHREAD_H
+#ifndef GPGFRONTEND_SMTPCONNECTIONTESTTHREAD_H
+#define GPGFRONTEND_SMTPCONNECTIONTESTTHREAD_H
#include <utility>
@@ -33,13 +33,29 @@
namespace GpgFrontend::UI {
-class SMTPTestThread : public QThread {
+/**
+ * @brief
+ *
+ */
+class SMTPConnectionTestThread : public QThread {
Q_OBJECT
public:
- explicit SMTPTestThread(std::string host, int port,
- SmtpClient::ConnectionType connection_type,
- bool identify, std::string username,
- std::string password, QWidget* parent = nullptr)
+ /**
+ * @brief Construct a new SMTPConnectionTestThread object
+ *
+ * @param host
+ * @param port
+ * @param connection_type
+ * @param identify
+ * @param username
+ * @param password
+ * @param parent
+ */
+ explicit SMTPConnectionTestThread(std::string host, int port,
+ SmtpClient::ConnectionType connection_type,
+ bool identify, std::string username,
+ std::string password,
+ QWidget* parent = nullptr)
: QThread(parent),
host_(std::move(host)),
port_(port),
@@ -49,21 +65,29 @@ class SMTPTestThread : public QThread {
password_(std::move(password)) {}
signals:
- void signalSMTPTestResult(const QString& result);
+ /**
+ * @brief
+ *
+ * @param result
+ */
+ void SignalSMTPConnectionTestResult(const QString& result);
protected:
+ /**
+ * @brief
+ *
+ */
void run() override;
private:
- std::string host_;
- int port_;
- SmtpClient::ConnectionType connection_type_;
-
- bool identify_;
- std::string username_;
- std::string password_;
+ std::string host_; ///<
+ int port_; ///<
+ SmtpClient::ConnectionType connection_type_; ///<
+ bool identify_; ///<
+ std::string username_; ///<
+ std::string password_; ///<
};
} // namespace GpgFrontend::UI
-#endif // GPGFRONTEND_SMTPTESTTHREAD_H
+#endif // GPGFRONTEND_SMTPCONNECTIONTESTTHREAD_H
diff --git a/src/ui/thread/SMTPSendMailThread.cpp b/src/ui/thread/SMTPSendMailThread.cpp
index f31d746f..1d46f4ef 100644
--- a/src/ui/thread/SMTPSendMailThread.cpp
+++ b/src/ui/thread/SMTPSendMailThread.cpp
@@ -70,7 +70,7 @@ void SMTPSendMailThread::run() {
std::move(keys), *in_buffer, out_buffer, result);
if (check_gpg_error_2_err_code(err) != GPG_ERR_NO_ERROR) {
- emit signalSMTPResult("Fail to encrypt with gpg keys");
+ emit SignalSMTPResult("Fail to encrypt with gpg keys");
return;
}
text->setText(out_buffer->c_str());
@@ -133,7 +133,7 @@ void SMTPSendMailThread::run() {
result);
if (check_gpg_error_2_err_code(err) != GPG_ERR_NO_ERROR) {
- emit signalSMTPResult("Fail to sign with gpg keys");
+ emit SignalSMTPResult("Fail to sign with gpg keys");
return;
}
@@ -176,7 +176,7 @@ void SMTPSendMailThread::run() {
auto public_key_file_name =
boost::format("%1%_pubkey.asc") % attached_public_key_ids_;
- addFileContent(public_key_file_name.str().c_str(), out_buffer->c_str());
+ AddFileContent(public_key_file_name.str().c_str(), out_buffer->c_str());
auto& key_file = files_.back();
key_file->setEncoding(MimePart::_7Bit);
key_file->setContentType("application/pgp-keys");
@@ -192,70 +192,70 @@ void SMTPSendMailThread::run() {
// Now we can send the mail
if (!smtp.connectToHost()) {
- emit signalSMTPResult("Fail to connect SMTP server");
+ emit SignalSMTPResult("Fail to connect SMTP server");
return;
}
if (!smtp.login()) {
- emit signalSMTPResult("Fail to login");
+ emit SignalSMTPResult("Fail to login");
return;
}
if (!smtp.sendMail(message)) {
- emit signalSMTPResult("Fail to send mail");
+ emit SignalSMTPResult("Fail to send mail");
return;
}
smtp.quit();
- emit signalSMTPResult("Succeed in sending a test email");
+ emit SignalSMTPResult("Succeed in sending a test email");
}
-void SMTPSendMailThread::setBCC(const QString& bccs) {
+void SMTPSendMailThread::SetBCC(const QString& bccs) {
QStringList bcc_string_list = bccs.split(';');
for (const auto& bcc : bcc_string_list) {
if (!bcc.isEmpty()) message.addBcc(new EmailAddress(bcc.trimmed()));
}
}
-void SMTPSendMailThread::setCC(const QString& ccs) {
+void SMTPSendMailThread::SetCC(const QString& ccs) {
QStringList cc_string_list = ccs.split(';');
for (const auto& cc : cc_string_list) {
if (!cc.isEmpty()) message.addCc(new EmailAddress(cc.trimmed()));
}
}
-void SMTPSendMailThread::setRecipient(const QString& recipients) {
+void SMTPSendMailThread::SetRecipient(const QString& recipients) {
QStringList rcpt_string_list = recipients.split(';');
for (const auto& rcpt : rcpt_string_list) {
if (!rcpt.isEmpty()) message.addRecipient(new EmailAddress(rcpt.trimmed()));
}
}
-void SMTPSendMailThread::setSender(const QString& sender) {
+void SMTPSendMailThread::SetSender(const QString& sender) {
message.setSender(new EmailAddress(sender));
}
-void SMTPSendMailThread::addTextContent(const QString& content) {
+void SMTPSendMailThread::AddTextContent(const QString& content) {
auto text = std::make_unique<MimeText>(content.trimmed());
texts_.push_back(std::move(text));
}
-void SMTPSendMailThread::addFileContent(const QString& file_name,
+void SMTPSendMailThread::AddFileContent(const QString& file_name,
const QByteArray& content) {
auto file = std::make_unique<MimeFile>(content, file_name);
files_.push_back(std::move(file));
}
-void SMTPSendMailThread::setEncryptContent(
+void SMTPSendMailThread::SetEncryptContent(
bool encrypt_content, GpgFrontend::KeyIdArgsListPtr public_key_ids) {
this->encrypt_content_ = encrypt_content;
this->public_key_ids_ = std::move(public_key_ids);
}
-void SMTPSendMailThread::setAttachSignatureFile(
+void SMTPSendMailThread::SetAttachSignatureFile(
bool attach_signature_file, GpgFrontend::KeyId private_key_id) {
this->attach_signature_file_ = attach_signature_file;
this->private_key_id_ = std::move(private_key_id);
}
-void SMTPSendMailThread::setAttachPublicKey(
+void SMTPSendMailThread::SetAttachPublicKey(
bool attach_public_key_file, GpgFrontend::KeyId attached_public_key_ids) {
this->attach_public_key_file_ = attach_public_key_file;
this->attached_public_key_ids_ = std::move(attached_public_key_ids);
diff --git a/src/ui/thread/SMTPSendMailThread.h b/src/ui/thread/SMTPSendMailThread.h
index 882fdb22..58420bf3 100644
--- a/src/ui/thread/SMTPSendMailThread.h
+++ b/src/ui/thread/SMTPSendMailThread.h
@@ -32,9 +32,24 @@
#include "ui/GpgFrontendUI.h"
namespace GpgFrontend::UI {
+/**
+ * @brief
+ *
+ */
class SMTPSendMailThread : public QThread {
Q_OBJECT
public:
+ /**
+ * @brief Construct a new SMTPSendMailThread object
+ *
+ * @param host
+ * @param port
+ * @param connection_type
+ * @param identify
+ * @param username
+ * @param password
+ * @param parent
+ */
explicit SMTPSendMailThread(std::string host, int port,
SmtpClient::ConnectionType connection_type,
bool identify, std::string username,
@@ -47,57 +62,117 @@ class SMTPSendMailThread : public QThread {
username_(std::move(username)),
password_(std::move(password)) {}
- void setSender(const QString& sender);
-
- void setRecipient(const QString& recipients);
-
- void setCC(const QString& ccs);
-
- void setBCC(const QString& bccs);
-
- void setSubject(const QString& subject) { message.setSubject(subject); }
-
- void addTextContent(const QString& content);
-
- void addFileContent(const QString& file_name, const QByteArray& content);
-
- void setEncryptContent(bool encrypt_content,
+ void SetSender(const QString& sender);
+
+ /**
+ * @brief Set the Recipient object
+ *
+ * @param recipients
+ */
+ void SetRecipient(const QString& recipients);
+
+ /**
+ * @brief
+ *
+ * @param ccs
+ */
+ void SetCC(const QString& ccs);
+
+ /**
+ * @brief
+ *
+ * @param bccs
+ */
+ void SetBCC(const QString& bccs);
+
+ /**
+ * @brief Set the Subject object
+ *
+ * @param subject
+ */
+ void SetSubject(const QString& subject) { message.setSubject(subject); }
+
+ /**
+ * @brief
+ *
+ * @param content
+ */
+ void AddTextContent(const QString& content);
+
+ /**
+ * @brief
+ *
+ * @param file_name
+ * @param content
+ */
+ void AddFileContent(const QString& file_name, const QByteArray& content);
+
+ /**
+ * @brief Set the Encrypt Content object
+ *
+ * @param encrypt_content
+ * @param public_key_ids
+ */
+ void SetEncryptContent(bool encrypt_content,
GpgFrontend::KeyIdArgsListPtr public_key_ids);
- void setAttachSignatureFile(bool attach_signature_file,
+ /**
+ * @brief Set the Attach Signature File object
+ *
+ * @param attach_signature_file
+ * @param private_key_id
+ */
+ void SetAttachSignatureFile(bool attach_signature_file,
GpgFrontend::KeyId private_key_id);
- void setAttachPublicKey(bool attach_public_key_file,
+ /**
+ * @brief Set the Attach Public Key object
+ *
+ * @param attach_public_key_file
+ * @param attached_public_key_ids
+ */
+ void SetAttachPublicKey(bool attach_public_key_file,
GpgFrontend::KeyId attached_public_key_ids);
signals:
- void signalSMTPResult(const QString& result);
+ /**
+ * @brief
+ *
+ * @param result
+ */
+ void SignalSMTPResult(const QString& result);
protected:
+ /**
+ * @brief
+ *
+ */
void run() override;
private:
// SMTP Options
- std::string host_;
- int port_;
- SmtpClient::ConnectionType connection_type_;
- bool identify_;
- std::string username_;
- std::string password_;
+ std::string host_; ///<
+ int port_; ///<
+ SmtpClient::ConnectionType connection_type_; ///<
+
+ bool identify_; ///<
+ std::string username_; ///<
+ std::string password_; ///<
- MimeMessage message;
- std::vector<std::unique_ptr<MimeText>> texts_;
- std::vector<std::unique_ptr<MimeText>> send_texts_;
- std::vector<std::unique_ptr<MimeFile>> files_;
+ MimeMessage message; ///<
+ std::vector<std::unique_ptr<MimeText>> texts_; ///<
+ std::vector<std::unique_ptr<MimeText>> send_texts_; ///<
+ std::vector<std::unique_ptr<MimeFile>> files_; ///<
// GPG Options
- bool encrypt_content_ = false;
- GpgFrontend::KeyIdArgsListPtr public_key_ids_;
- bool attach_signature_file_ = false;
- GpgFrontend::KeyId private_key_id_;
- bool attach_public_key_file_ = false;
- GpgFrontend::KeyId attached_public_key_ids_;
+
+ bool encrypt_content_ = false; ///<
+ GpgFrontend::KeyIdArgsListPtr public_key_ids_; ///<
+ bool attach_signature_file_ = false; ///<
+ GpgFrontend::KeyId private_key_id_; ///<
+ bool attach_public_key_file_ = false; ///<
+ GpgFrontend::KeyId attached_public_key_ids_; ///<
};
} // namespace GpgFrontend::UI
diff --git a/src/ui/thread/VersionCheckThread.cpp b/src/ui/thread/VersionCheckThread.cpp
index c1d835d0..6d73417d 100644
--- a/src/ui/thread/VersionCheckThread.cpp
+++ b/src/ui/thread/VersionCheckThread.cpp
@@ -119,7 +119,7 @@ void VersionCheckThread::run() {
LOG(INFO) << "error occurred";
version.load_info_done = false;
}
- emit upgradeVersion(version);
+ emit SignalUpgradeVersion(version);
}
VersionCheckThread::VersionCheckThread() : QThread(nullptr) {
diff --git a/src/ui/thread/VersionCheckThread.h b/src/ui/thread/VersionCheckThread.h
index d457f1fd..3a1cd698 100644
--- a/src/ui/thread/VersionCheckThread.h
+++ b/src/ui/thread/VersionCheckThread.h
@@ -34,21 +34,40 @@
namespace GpgFrontend::UI {
+/**
+ * @brief
+ *
+ */
class VersionCheckThread : public QThread {
Q_OBJECT
public:
+ /**
+ * @brief Construct a new Version Check Thread object
+ *
+ */
explicit VersionCheckThread();
signals:
- void upgradeVersion(SoftwareVersion version);
+ /**
+ * @brief
+ *
+ * @param version
+ */
+ void SignalUpgradeVersion(SoftwareVersion version);
protected:
+ /**
+ * @brief
+
+ *
+ */
void run() override;
private:
- QByteArray latest_reply_bytes_, current_reply_bytes_;
+ QByteArray latest_reply_bytes_; ///<
+ QByteArray current_reply_bytes_; ///<
};
} // namespace GpgFrontend::UI
diff --git a/src/ui/widgets/PlainTextEditorPage.cpp b/src/ui/widgets/PlainTextEditorPage.cpp
index db85f251..ee08fff3 100644
--- a/src/ui/widgets/PlainTextEditorPage.cpp
+++ b/src/ui/widgets/PlainTextEditorPage.cpp
@@ -142,10 +142,10 @@ void PlainTextEditorPage::ReadFile() {
text_page->setReadOnly(true);
auto thread = new FileReadThread(this->full_file_path_.toStdString());
- connect(thread, &FileReadThread::sendReadBlock, this,
+ connect(thread, &FileReadThread::SignalSendReadBlock, this,
&PlainTextEditorPage::slotInsertText);
- connect(thread, &FileReadThread::readDone, this, [=]() {
+ connect(thread, &FileReadThread::SignalReadDone, this, [=]() {
LOG(INFO) << "thread read done";
if (!binary_mode_) {
text_page->setReadOnly(false);