aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ui/function/ProxyConnectionTestThread.cpp56
-rw-r--r--src/ui/function/ProxyConnectionTestThread.h57
-rw-r--r--src/ui/function/VersionCheckThread.cpp3
-rw-r--r--src/ui/settings/SettingsDialog.cpp13
-rwxr-xr-xsrc/ui/settings/SettingsDialog.h2
-rw-r--r--src/ui/settings/SettingsKeyServer.cpp2
-rw-r--r--src/ui/settings/SettingsNetwork.cpp321
-rw-r--r--src/ui/settings/SettingsNetwork.h55
-rw-r--r--src/ui/settings/SettingsSendMail.cpp4
-rw-r--r--src/ui/settings/SettingsSendMail.h26
-rw-r--r--src/ui/smtp/SendMailDialog.cpp2
-rw-r--r--ui/NetworkSettings.ui325
12 files changed, 851 insertions, 15 deletions
diff --git a/src/ui/function/ProxyConnectionTestThread.cpp b/src/ui/function/ProxyConnectionTestThread.cpp
new file mode 100644
index 00000000..f644406d
--- /dev/null
+++ b/src/ui/function/ProxyConnectionTestThread.cpp
@@ -0,0 +1,56 @@
+/**
+ * This file is part of GpgFrontend.
+ *
+ * GpgFrontend is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Foobar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from gpg4usb-team.
+ * Their source code version also complies with GNU General Public License.
+ *
+ * The source code version of this software was modified and released
+ * by Saturneric<[email protected]><[email protected]> starting on May 12, 2021.
+ *
+ */
+
+#include "ProxyConnectionTestThread.h"
+
+void GpgFrontend::UI::ProxyConnectionTestThread::run() {
+ QNetworkProxyQuery npq({QUrl(url_)});
+ auto proxies_list = QNetworkProxyFactory::systemProxyForQuery(npq);
+
+ if (proxies_list.isEmpty()) {
+ LOG(INFO) << "no proxy applied";
+ } else {
+ LOG(INFO) << "proxies list hostname"
+ << proxies_list.front().hostName().toStdString();
+ }
+
+ LOG(INFO) << "proxies list size" << proxies_list.size();
+
+ auto manager = std::make_unique<QNetworkAccessManager>(nullptr);
+ QNetworkRequest url_request;
+ url_request.setUrl(QUrl(url_));
+ auto _reply = manager->get(url_request);
+
+ while (_reply->isRunning()) QApplication::processEvents();
+ if (_reply->error() != QNetworkReply::NoError &&
+ !_reply->readAll().isEmpty()) {
+ result_ = "Reachable";
+ } else {
+ result_ = "Not Reachable";
+ }
+
+ _reply->deleteLater();
+
+ emit signalProxyConnectionTestResult(result_);
+}
diff --git a/src/ui/function/ProxyConnectionTestThread.h b/src/ui/function/ProxyConnectionTestThread.h
new file mode 100644
index 00000000..4ef75050
--- /dev/null
+++ b/src/ui/function/ProxyConnectionTestThread.h
@@ -0,0 +1,57 @@
+/**
+ * This file is part of GpgFrontend.
+ *
+ * GpgFrontend is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Foobar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from gpg4usb-team.
+ * Their source code version also complies with GNU General Public License.
+ *
+ * The source code version of this software was modified and released
+ * by Saturneric<[email protected]><[email protected]> starting on May 12, 2021.
+ *
+ */
+
+#ifndef GPGFRONTEND_PROXYCONNECTIONTESTTHREAD_H
+#define GPGFRONTEND_PROXYCONNECTIONTESTTHREAD_H
+
+class ProxyConnectionTestThread {};
+
+#include <utility>
+
+#include "GpgFrontendUI.h"
+
+namespace GpgFrontend::UI {
+
+class ProxyConnectionTestThread : public QThread {
+ Q_OBJECT
+ public:
+ explicit ProxyConnectionTestThread(QString url, int timeout,
+ QWidget* parent = nullptr)
+ : QThread(parent), url_(std::move(url)), timeout_(timeout) {}
+
+ signals:
+ void signalProxyConnectionTestResult(const QString& result);
+
+ protected:
+ void run() override;
+
+ private:
+ QString url_;
+ QString result_;
+ int timeout_ = 500;
+};
+
+} // namespace GpgFrontend::UI
+
+#endif // GPGFRONTEND_PROXYCONNECTIONTESTTHREAD_H
diff --git a/src/ui/function/VersionCheckThread.cpp b/src/ui/function/VersionCheckThread.cpp
index bfd6ea46..2a1cf9af 100644
--- a/src/ui/function/VersionCheckThread.cpp
+++ b/src/ui/function/VersionCheckThread.cpp
@@ -89,6 +89,8 @@ void VersionCheckThread::run() {
version.release_note = release_note;
}
+ _reply->deleteLater();
+
_reply = manager->get(current_request);
while (_reply->isRunning()) QApplication::processEvents();
current_reply_bytes_ = _reply->readAll();
@@ -104,6 +106,7 @@ void VersionCheckThread::run() {
version.latest_prerelease = current_prerelease;
version.latest_draft = current_draft;
}
+ _reply->deleteLater();
// loading done
version.load_info_done = true;
diff --git a/src/ui/settings/SettingsDialog.cpp b/src/ui/settings/SettingsDialog.cpp
index 7b8a8624..01e4094f 100644
--- a/src/ui/settings/SettingsDialog.cpp
+++ b/src/ui/settings/SettingsDialog.cpp
@@ -29,6 +29,7 @@
#include "SettingsAppearance.h"
#include "SettingsGeneral.h"
#include "SettingsKeyServer.h"
+#include "SettingsNetwork.h"
#ifdef SMTP_SUPPORT
#include "SettingsSendMail.h"
@@ -37,13 +38,15 @@
namespace GpgFrontend::UI {
SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent) {
- tabWidget = new QTabWidget;
+
+ tabWidget = new QTabWidget();
generalTab = new GeneralTab();
- appearanceTab = new AppearanceTab;
+ appearanceTab = new AppearanceTab();
#ifdef SMTP_SUPPORT
- sendMailTab = new SendMailTab;
+ sendMailTab = new SendMailTab();
#endif
- keyserverTab = new KeyserverTab;
+ keyserverTab = new KeyserverTab();
+ networkTab = new NetworkTab();
#ifdef ADVANCED_SUPPORT
advancedTab = new AdvancedTab;
#endif
@@ -55,6 +58,7 @@ SettingsDialog::SettingsDialog(QWidget* parent) : QDialog(parent) {
#endif
tabWidget->addTab(keyserverTab, _("Key Server"));
// tabWidget->addTab(gpgPathsTab, _("Gpg paths"));
+ tabWidget->addTab(networkTab, _("Network"));
#ifdef ADVANCED_SUPPORT
tabWidget->addTab(advancedTab, _("Advanced"));
#endif
@@ -114,6 +118,7 @@ void SettingsDialog::slotAccept() {
#endif
appearanceTab->applySettings();
keyserverTab->applySettings();
+ networkTab->applySettings();
#ifdef ADVANCED_SUPPORT
advancedTab->applySettings();
#endif
diff --git a/src/ui/settings/SettingsDialog.h b/src/ui/settings/SettingsDialog.h
index b8277906..da3bdba3 100755
--- a/src/ui/settings/SettingsDialog.h
+++ b/src/ui/settings/SettingsDialog.h
@@ -38,6 +38,7 @@ class SendMailTab;
class AppearanceTab;
class KeyserverTab;
+class NetworkTab;
#ifdef ADVANCED_SUPPORT
class AdvancedTab;
@@ -55,6 +56,7 @@ class SettingsDialog : public QDialog {
#endif
AppearanceTab* appearanceTab;
KeyserverTab* keyserverTab;
+ NetworkTab* networkTab;
#ifdef ADVANCED_SUPPORT
AdvancedTab* advancedTab;
#endif
diff --git a/src/ui/settings/SettingsKeyServer.cpp b/src/ui/settings/SettingsKeyServer.cpp
index ee60b40e..0cba7b51 100644
--- a/src/ui/settings/SettingsKeyServer.cpp
+++ b/src/ui/settings/SettingsKeyServer.cpp
@@ -286,8 +286,6 @@ void KeyserverTab::slotTestListedKeyServer() {
connect(waiting_dialog, &QProgressDialog::canceled, [=]() {
LOG(INFO) << "cancel clicked";
if (thread->isRunning()) thread->terminate();
- QCoreApplication::quit();
- exit(0);
});
// Show Waiting Dialog
diff --git a/src/ui/settings/SettingsNetwork.cpp b/src/ui/settings/SettingsNetwork.cpp
new file mode 100644
index 00000000..a64a9ea9
--- /dev/null
+++ b/src/ui/settings/SettingsNetwork.cpp
@@ -0,0 +1,321 @@
+/**
+ * This file is part of GpgFrontend.
+ *
+ * GpgFrontend is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Foobar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from gpg4usb-team.
+ * Their source code version also complies with GNU General Public License.
+ *
+ * The source code version of this software was modified and released
+ * by Saturneric<[email protected]> starting on May 12, 2021.
+ *
+ */
+
+#include "SettingsNetwork.h"
+
+#include "ui/function/ProxyConnectionTestThread.h"
+#include "ui/settings//GlobalSettingStation.h"
+#include "ui_NetworkSettings.h"
+
+GpgFrontend::UI::NetworkTab::NetworkTab(QWidget *parent)
+ : QWidget(parent), ui(std::make_shared<Ui_NetworkSettings>()) {
+ ui->setupUi(this);
+
+ connect(ui->enableProxyCheckBox, &QCheckBox::stateChanged, this,
+ [=](int state) {
+ ui->proxyServerAddressEdit->setDisabled(state != Qt::Checked);
+ ui->portSpin->setDisabled(state != Qt::Checked);
+ ui->proxyTypeComboBox->setDisabled(state != Qt::Checked);
+
+ ui->usernameEdit->setDisabled(state != Qt::Checked);
+ ui->passwordEdit->setDisabled(state != Qt::Checked);
+
+ ui->checkProxyConnectionButton->setDisabled(state != Qt::Checked);
+
+ proxy_type_ = QNetworkProxy::NoProxy;
+ });
+
+ connect(ui->proxyTypeComboBox, &QComboBox::currentTextChanged, this,
+ [=](const QString &current_text) {
+ if (current_text == "HTTP") {
+ ui->proxyServerAddressEdit->setDisabled(true);
+ ui->portSpin->setDisabled(true);
+ ui->proxyTypeComboBox->setDisabled(true);
+ ui->usernameEdit->setDisabled(true);
+ ui->passwordEdit->setDisabled(true);
+ proxy_type_ = QNetworkProxy::HttpProxy;
+ } else if (current_text == "Socks5") {
+ ui->proxyServerAddressEdit->setDisabled(true);
+ ui->portSpin->setDisabled(true);
+ ui->proxyTypeComboBox->setDisabled(true);
+ ui->usernameEdit->setDisabled(true);
+ ui->passwordEdit->setDisabled(true);
+ proxy_type_ = QNetworkProxy::Socks5Proxy;
+ } else {
+ ui->proxyServerAddressEdit->setDisabled(false);
+ ui->portSpin->setDisabled(false);
+ ui->proxyTypeComboBox->setDisabled(false);
+ ui->usernameEdit->setDisabled(false);
+ ui->passwordEdit->setDisabled(false);
+ proxy_type_ = QNetworkProxy::DefaultProxy;
+ }
+ });
+
+ connect(ui->checkProxyConnectionButton, &QPushButton::clicked, this,
+ &NetworkTab::slotTestProxyConnectionResult);
+
+ ui->proxyGroupBox->setTitle(_("Proxy"));
+ ui->capabilityGroupBox->setTitle(_("Network Capability"));
+ ui->operationsGroupBox->setTitle(_("Operations"));
+
+ ui->enableProxyCheckBox->setText(_("Enable Proxy"));
+ ui->proxyServerPortLabel->setText(_("Port"));
+
+ ui->proxyServerAddressLabel->setText(_("Host Address"));
+ ui->proxyServerPortLabel->setText(_("Port"));
+ ui->proxyTypeLabel->setText(_("Proxy Type"));
+ ui->usernameLabel->setText(_("Username"));
+ ui->passwordLabel->setText(_("Password"));
+
+ ui->forbidALLCheckBox->setText(_("Forbid all network connection."));
+ ui->prohibitUpdateCheck->setText(_("Prohibit checking for updates."));
+ ui->checkProxyConnectionButton->setText(_("Check Proxy Connection"));
+
+ setSettings();
+}
+
+void GpgFrontend::UI::NetworkTab::setSettings() {
+ auto &settings = GlobalSettingStation::GetInstance().GetUISettings();
+
+ try {
+ std::string proxy_host = settings.lookup("proxy.proxy_host");
+ ui->proxyServerAddressEdit->setText(proxy_host.c_str());
+ } catch (...) {
+ LOG(ERROR) << _("Setting Operation Error") << _("proxy_host");
+ }
+
+ try {
+ std::string std_username = settings.lookup("proxy.username");
+ ui->usernameEdit->setText(std_username.c_str());
+ } catch (...) {
+ LOG(ERROR) << _("Setting Operation Error") << _("username");
+ }
+
+ try {
+ std::string std_password = settings.lookup("proxy.password");
+ ui->passwordEdit->setText(std_password.c_str());
+ } catch (...) {
+ LOG(ERROR) << _("Setting Operation Error") << _("password");
+ }
+
+ try {
+ int port = settings.lookup("proxy.port");
+ ui->portSpin->setValue(port);
+ } catch (...) {
+ LOG(ERROR) << _("Setting Operation Error") << _("port");
+ }
+
+ ui->proxyTypeComboBox->setCurrentText("HTTP");
+ try {
+ std::string proxy_type = settings.lookup("proxy.proxy_type");
+ ui->proxyTypeComboBox->setCurrentText(proxy_type.c_str());
+ } catch (...) {
+ LOG(ERROR) << _("Setting Operation Error") << _("proxy_type");
+ }
+
+ ui->enableProxyCheckBox->setCheckState(Qt::Unchecked);
+ try {
+ bool proxy_enable = settings.lookup("proxy.enable");
+ if (proxy_enable)
+ ui->enableProxyCheckBox->setCheckState(Qt::Checked);
+ else
+ ui->enableProxyCheckBox->setCheckState(Qt::Unchecked);
+ } catch (...) {
+ LOG(ERROR) << _("Setting Operation Error") << _("proxy_enable");
+ }
+
+ ui->forbidALLCheckBox->setCheckState(Qt::Unchecked);
+ try {
+ bool forbid_all_connection =
+ settings.lookup("network.forbid_all_connection");
+ if (forbid_all_connection)
+ ui->forbidALLCheckBox->setCheckState(Qt::Checked);
+ else
+ ui->forbidALLCheckBox->setCheckState(Qt::Unchecked);
+ } catch (...) {
+ LOG(ERROR) << _("Setting Operation Error") << _("forbid_all_connection");
+ }
+
+ ui->prohibitUpdateCheck->setCheckState(Qt::Unchecked);
+ try {
+ bool prohibit_update = settings.lookup("network.prohibit_update");
+ if (prohibit_update)
+ ui->prohibitUpdateCheck->setCheckState(Qt::Checked);
+ else
+ ui->prohibitUpdateCheck->setCheckState(Qt::Unchecked);
+ } catch (...) {
+ LOG(ERROR) << _("Setting Operation Error") << _("prohibit_update");
+ }
+}
+
+void GpgFrontend::UI::NetworkTab::applySettings() {
+ auto &settings =
+ GpgFrontend::UI::GlobalSettingStation::GetInstance().GetUISettings();
+
+ if (!settings.exists("proxy") ||
+ settings.lookup("proxy").getType() != libconfig::Setting::TypeGroup)
+ settings.add("proxy", libconfig::Setting::TypeGroup);
+
+ auto &proxy = settings["proxy"];
+
+ if (!proxy.exists("proxy_host"))
+ proxy.add("proxy_host", libconfig::Setting::TypeString) =
+ ui->proxyServerAddressLabel->text().toStdString();
+ else {
+ proxy["proxy_host"] = ui->proxyServerAddressLabel->text().toStdString();
+ }
+
+ if (!proxy.exists("username"))
+ proxy.add("username", libconfig::Setting::TypeString) =
+ ui->usernameEdit->text().toStdString();
+ else {
+ proxy["username"] = ui->usernameEdit->text().toStdString();
+ }
+
+ if (!proxy.exists("password"))
+ proxy.add("password", libconfig::Setting::TypeString) =
+ ui->passwordEdit->text().toStdString();
+ else {
+ proxy["password"] = ui->passwordEdit->text().toStdString();
+ }
+
+ if (!proxy.exists("port"))
+ proxy.add("port", libconfig::Setting::TypeInt) = ui->portSpin->value();
+ else {
+ proxy["port"] = ui->portSpin->value();
+ }
+
+ if (!proxy.exists("proxy_type"))
+ proxy.add("proxy_type", libconfig::Setting::TypeString) =
+ ui->proxyTypeComboBox->currentText().toStdString();
+ else {
+ proxy["proxy_type"] = ui->proxyTypeComboBox->currentText().toStdString();
+ }
+
+ if (!proxy.exists("enable"))
+ proxy.add("enable", libconfig::Setting::TypeBoolean) =
+ ui->enableProxyCheckBox->isChecked();
+ else {
+ proxy["enable"] = ui->enableProxyCheckBox->isChecked();
+ }
+
+ auto &network = settings["network"];
+
+ if (!network.exists("forbid_all_connection"))
+ network.add("forbid_all_connection", libconfig::Setting::TypeBoolean) =
+ ui->forbidALLCheckBox->isChecked();
+ else {
+ network["forbid_all_connection"] = ui->forbidALLCheckBox->isChecked();
+ }
+
+ if (!network.exists("prohibit_update"))
+ network.add("prohibit_update", libconfig::Setting::TypeBoolean) =
+ ui->prohibitUpdateCheck->isChecked();
+ else {
+ network["prohibit_update"] = ui->prohibitUpdateCheck->isChecked();
+ }
+
+ apply_proxy_settings();
+}
+
+void GpgFrontend::UI::NetworkTab::slotTestProxyConnectionResult() {
+ apply_proxy_settings();
+
+ bool ok;
+ auto url = QInputDialog::getText(this, _("Test Server Url Accessibility"),
+ tr("Server Url"), QLineEdit::Normal,
+ "https://", &ok);
+ if (ok && !url.isEmpty()) {
+ auto thread = new ProxyConnectionTestThread(url, 800, this);
+ connect(thread,
+ &GpgFrontend::UI::ProxyConnectionTestThread::
+ signalProxyConnectionTestResult,
+ this, [=](const QString &result) {
+ if (result == "Reachable") {
+ QMessageBox::information(
+ this, _("Success"),
+ _("Successfully connected to the target server"));
+ } else {
+ QMessageBox::information(
+ this, _("Failed"),
+ _("Unable to connect to the target server. Proxy settings "
+ "may be invalid."));
+ }
+ });
+ connect(thread, &QThread::finished, thread, &QThread::deleteLater);
+
+ // Waiting Dialog
+ auto *waiting_dialog = new QProgressDialog(this);
+ waiting_dialog->setMaximum(0);
+ waiting_dialog->setMinimum(0);
+ auto waiting_dialog_label = new QLabel(
+ QString(_("Test Proxy Server Connection...")) + "<br /><br />" +
+ _("Is using your proxy settings to access the url. Note that this test "
+ "operation will apply your proxy settings to the entire software."));
+ waiting_dialog_label->setWordWrap(true);
+ waiting_dialog->setLabel(waiting_dialog_label);
+ waiting_dialog->resize(420, 120);
+ connect(thread, &QThread::finished, [=]() {
+ waiting_dialog->finished(0);
+ waiting_dialog->deleteLater();
+ });
+ connect(waiting_dialog, &QProgressDialog::canceled, [=]() {
+ LOG(INFO) << "cancel clicked";
+ if (thread->isRunning()) thread->terminate();
+ });
+
+ // Show Waiting Dialog
+ waiting_dialog->show();
+ waiting_dialog->setFocus();
+
+ thread->start();
+ QEventLoop loop;
+ connect(thread, &QThread::finished, &loop, &QEventLoop::quit);
+ loop.exec();
+ }
+}
+
+void GpgFrontend::UI::NetworkTab::apply_proxy_settings() {
+ // apply settings
+ QNetworkProxy _proxy;
+ if (ui->enableProxyCheckBox->isChecked() &&
+ proxy_type_ != QNetworkProxy::DefaultProxy) {
+ _proxy.setType(proxy_type_);
+ _proxy.setHostName(ui->proxyServerAddressEdit->text());
+ _proxy.setPort(ui->portSpin->value());
+ if (!ui->usernameEdit->text().isEmpty()) {
+ _proxy.setUser(ui->usernameEdit->text());
+ _proxy.setPassword(ui->passwordEdit->text());
+ }
+ }
+ if (proxy_type_ == QNetworkProxy::DefaultProxy) {
+ ;
+ } else {
+ _proxy.setType(proxy_type_);
+ }
+
+ LOG(INFO) << "proxy" << _proxy.hostName().toStdString() << _proxy.port()
+ << _proxy.type();
+ QNetworkProxy::setApplicationProxy(_proxy);
+}
diff --git a/src/ui/settings/SettingsNetwork.h b/src/ui/settings/SettingsNetwork.h
new file mode 100644
index 00000000..66803970
--- /dev/null
+++ b/src/ui/settings/SettingsNetwork.h
@@ -0,0 +1,55 @@
+/**
+ * This file is part of GpgFrontend.
+ *
+ * GpgFrontend is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Foobar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from gpg4usb-team.
+ * Their source code version also complies with GNU General Public License.
+ *
+ * The source code version of this software was modified and released
+ * by Saturneric<[email protected]> starting on May 12, 2021.
+ *
+ */
+
+#ifndef GPGFRONTEND_SETTINGSNETWORK_H
+#define GPGFRONTEND_SETTINGSNETWORK_H
+
+#include "ui/GpgFrontendUI.h"
+
+class Ui_NetworkSettings;
+
+namespace GpgFrontend::UI {
+class NetworkTab : public QWidget {
+ Q_OBJECT
+
+ public:
+ explicit NetworkTab(QWidget* parent = nullptr);
+
+ void setSettings();
+
+ void applySettings();
+
+ private slots:
+
+ void slotTestProxyConnectionResult();
+
+ private:
+ std::shared_ptr<Ui_NetworkSettings> ui;
+ QNetworkProxy::ProxyType proxy_type_ = QNetworkProxy::HttpProxy;
+
+ void apply_proxy_settings();
+};
+} // namespace GpgFrontend::UI
+
+#endif // GPGFRONTEND_SETTINGSNETWORK_H
diff --git a/src/ui/settings/SettingsSendMail.cpp b/src/ui/settings/SettingsSendMail.cpp
index 21911e0f..e4ab9b0b 100644
--- a/src/ui/settings/SettingsSendMail.cpp
+++ b/src/ui/settings/SettingsSendMail.cpp
@@ -293,8 +293,6 @@ void SendMailTab::slotCheckConnection() {
connect(waiting_dialog, &QProgressDialog::canceled, [=]() {
LOG(INFO) << "cancel clicked";
if (thread->isRunning()) thread->terminate();
- QCoreApplication::quit();
- exit(0);
});
// Show Waiting Dialog
@@ -341,8 +339,6 @@ void SendMailTab::slotSendTestMail() {
connect(waiting_dialog, &QProgressDialog::canceled, [=]() {
LOG(INFO) << "cancel clicked";
if (thread->isRunning()) thread->terminate();
- QCoreApplication::quit();
- exit(0);
});
thread->setSender(sender_address);
diff --git a/src/ui/settings/SettingsSendMail.h b/src/ui/settings/SettingsSendMail.h
index 39ae0b71..2e0302c8 100644
--- a/src/ui/settings/SettingsSendMail.h
+++ b/src/ui/settings/SettingsSendMail.h
@@ -1,6 +1,26 @@
-//
-// Created by saturneric on 2021/11/28.
-//
+/**
+ * This file is part of GpgFrontend.
+ *
+ * GpgFrontend is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Foobar is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Foobar. If not, see <https://www.gnu.org/licenses/>.
+ *
+ * The initial version of the source code is inherited from gpg4usb-team.
+ * Their source code version also complies with GNU General Public License.
+ *
+ * The source code version of this software was modified and released
+ * by Saturneric<[email protected]> starting on May 12, 2021.
+ *
+ */
#ifndef GPGFRONTEND_SETTINGSSENDMAIL_H
#define GPGFRONTEND_SETTINGSSENDMAIL_H
diff --git a/src/ui/smtp/SendMailDialog.cpp b/src/ui/smtp/SendMailDialog.cpp
index f3ec5711..4895d8e4 100644
--- a/src/ui/smtp/SendMailDialog.cpp
+++ b/src/ui/smtp/SendMailDialog.cpp
@@ -309,8 +309,6 @@ void SendMailDialog::slotConfirm() {
connect(waiting_dialog, &QProgressDialog::canceled, [=]() {
LOG(INFO) << "cancel clicked";
if (thread->isRunning()) thread->terminate();
- QCoreApplication::quit();
- exit(0);
});
// Show Waiting Dialog
diff --git a/ui/NetworkSettings.ui b/ui/NetworkSettings.ui
new file mode 100644
index 00000000..a288d440
--- /dev/null
+++ b/ui/NetworkSettings.ui
@@ -0,0 +1,325 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>NetworkSettings</class>
+ <widget class="QWidget" name="NetworkSettings">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>549</width>
+ <height>727</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QGroupBox" name="proxyGroupBox">
+ <property name="title">
+ <string>Proxy</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QCheckBox" name="enableProxyCheckBox">
+ <property name="text">
+ <string>Enable Proxy</string>
+ </property>
+ <property name="tristate">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="horizontalWidget_3" native="true">
+ <layout class="QHBoxLayout" name="horizontalLayout_8">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="proxyTypeLabel">
+ <property name="text">
+ <string>Proxy Type</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="proxyTypeComboBox">
+ <property name="currentText">
+ <string>System Default</string>
+ </property>
+ <item>
+ <property name="text">
+ <string>System Default</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>HTTP</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>Socks5</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="horizontalWidget" native="true">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="proxyServerAddressLabel">
+ <property name="text">
+ <string>Host Address</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="proxyServerAddressEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="horizontalWidget_2" native="true">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="proxyServerPortLabel">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text">
+ <string>Port</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="portSpin">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>65535</number>
+ </property>
+ <property name="value">
+ <number>1080</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="horizontalWidget_4" native="true">
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="usernameLabel">
+ <property name="text">
+ <string>Username</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="usernameEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QWidget" name="horizontalWidget_5" native="true">
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="passwordLabel">
+ <property name="text">
+ <string>Password</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="passwordEdit">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="capabilityGroupBox">
+ <property name="title">
+ <string>Network Capability</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3">
+ <item row="2" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_3">
+ <item>
+ <widget class="QCheckBox" name="forbidALLCheckBox">
+ <property name="text">
+ <string>Forbid all network connection.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="prohibitUpdateCheck">
+ <property name="text">
+ <string>Prohibit checking for updates.</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QGroupBox" name="operationsGroupBox">
+ <property name="title">
+ <string>Operations</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_5">
+ <item row="0" column="0">
+ <layout class="QVBoxLayout" name="verticalLayout_5">
+ <item>
+ <widget class="QPushButton" name="checkProxyConnectionButton">
+ <property name="text">
+ <string>Check Proxy Connection</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>