forked from Silverfish/proton-bridge
GODT-1846: remove restart cues, implement restart-less behaviour.
Other: fixed case issue in SSL member function names. Other: removed 'restart' mention in SMTP and IMAP SSL settings. GODT-1846: modified gRPC server to introduce ConnectionMode settings. GODT-1846: implemented connection mode handling in bridge-gui. GODT-1846: implemented error reporting in bridge-gui for connection mode. Other: gathered all IMAP/SMTP server settings. GODT-1846: wired IMAP/SMTP port change errors. Other: Renamed some error events and signals. Other: Fixed crash in IMAP restart when not started. Other: dismiss port error notifications before changing ports. Other: misc. fixes.
This commit is contained in:
committed by
James Houlahan
parent
46c0463e43
commit
1f0312573a
@ -71,7 +71,13 @@ void QMLBackend::init(GRPCConfig const &serviceConfig)
|
||||
app().grpc().goos(goos_);
|
||||
app().grpc().logsPath(logsPath_);
|
||||
app().grpc().licensePath(licensePath_);
|
||||
|
||||
bool sslForIMAP = false, sslForSMTP = false;
|
||||
int imapPort = 0, smtpPort = 0;
|
||||
app().grpc().mailServerSettings(imapPort, smtpPort, sslForIMAP, sslForSMTP);
|
||||
this->setIMAPPort(imapPort);
|
||||
this->setSMTPPort(smtpPort);
|
||||
this->setUseSSLForIMAP(sslForIMAP);
|
||||
this->setUseSSLForSMTP(sslForSMTP);
|
||||
this->retrieveUserList();
|
||||
}
|
||||
|
||||
@ -140,10 +146,14 @@ void QMLBackend::connectGrpcEvents()
|
||||
connect(client, &GRPCClient::updateVersionChanged, this, &QMLBackend::onVersionChanged);
|
||||
|
||||
// mail settings events
|
||||
connect(client, &GRPCClient::portIssueIMAP, this, &QMLBackend::portIssueIMAP);
|
||||
connect(client, &GRPCClient::portIssueSMTP, this, &QMLBackend::portIssueSMTP);
|
||||
connect(client, &GRPCClient::toggleUseSSLFinished, this, &QMLBackend::toggleUseSSLFinished);
|
||||
connect(client, &GRPCClient::changePortFinished, this, &QMLBackend::changePortFinished);
|
||||
connect(client, &GRPCClient::imapPortStartupError, this, &QMLBackend::imapPortStartupError);
|
||||
connect(client, &GRPCClient::smtpPortStartupError, this, &QMLBackend::smtpPortStartupError);
|
||||
connect(client, &GRPCClient::imapPortChangeError, this, &QMLBackend::imapPortChangeError);
|
||||
connect(client, &GRPCClient::smtpPortChangeError, this, &QMLBackend::smtpPortChangeError);
|
||||
connect(client, &GRPCClient::imapConnectionModeChangeError, this, &QMLBackend::imapConnectionModeChangeError);
|
||||
connect(client, &GRPCClient::smtpConnectionModeChangeError, this, &QMLBackend::smtpConnectionModeChangeError);
|
||||
connect(client, &GRPCClient::mailServerSettingsChanged, this, &QMLBackend::onMailServerSettingsChanged);
|
||||
connect(client, &GRPCClient::changeMailServerSettingsFinished, this, &QMLBackend::changeMailServerSettingsFinished);
|
||||
|
||||
// keychain events
|
||||
connect(client, &GRPCClient::changeKeychainFinished, this, &QMLBackend::changeKeychainFinished);
|
||||
@ -320,36 +330,113 @@ void QMLBackend::setDiskCachePath(QUrl const &path) const
|
||||
app().grpc().setDiskCachePath(path);
|
||||
}
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] makeItActive Should SSL for SMTP be enabled.
|
||||
//****************************************************************************************************************************************************
|
||||
void QMLBackend::toggleUseSSLforSMTP(bool makeItActive)
|
||||
{
|
||||
// if call succeed, app will restart. No need to emit a value change signal, because it will trigger a read-back via gRPC that will fail.
|
||||
emit hideMainWindow();
|
||||
app().grpc().setUseSSLForSMTP(makeItActive);
|
||||
}
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] makeItActive Should SSL for IMAP be enabled.
|
||||
/// \return The IMAP port.
|
||||
//****************************************************************************************************************************************************
|
||||
void QMLBackend::toggleUseSSLforIMAP(bool makeItActive)
|
||||
int QMLBackend::imapPort() const
|
||||
{
|
||||
// if call succeed, app will restart. No need to emit a value change signal, because it will trigger a read-back via gRPC that will fail.
|
||||
emit hideMainWindow();
|
||||
app().grpc().setUseSSLForIMAP(makeItActive);
|
||||
return imapPort_;
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] port The IMAP port.
|
||||
//****************************************************************************************************************************************************
|
||||
void QMLBackend::setIMAPPort(int port)
|
||||
{
|
||||
if (port == imapPort_)
|
||||
return;
|
||||
imapPort_ = port;
|
||||
emit imapPortChanged(port);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The SMTP port.
|
||||
//****************************************************************************************************************************************************
|
||||
int QMLBackend::smtpPort() const
|
||||
{
|
||||
return smtpPort_;
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] port The SMTP port.
|
||||
//****************************************************************************************************************************************************
|
||||
void QMLBackend::setSMTPPort(int port)
|
||||
{
|
||||
if (port == smtpPort_)
|
||||
return;
|
||||
smtpPort_ = port;
|
||||
emit smtpPortChanged(port);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The value for the 'Use SSL for IMAP' property.
|
||||
//****************************************************************************************************************************************************
|
||||
bool QMLBackend::useSSLForIMAP() const
|
||||
{
|
||||
return useSSLForIMAP_;
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] value The value for the 'Use SSL for IMAP' property.
|
||||
//****************************************************************************************************************************************************
|
||||
void QMLBackend::setUseSSLForIMAP(bool value)
|
||||
{
|
||||
if (value == useSSLForIMAP_)
|
||||
return;
|
||||
useSSLForIMAP_ = value;
|
||||
emit useSSLForIMAPChanged(value);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The value for the 'Use SSL for SMTP' property.
|
||||
//****************************************************************************************************************************************************
|
||||
bool QMLBackend::useSSLForSMTP() const
|
||||
{
|
||||
return useSSLForSMTP_;
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] value The value for the 'Use SSL for SMTP' property.
|
||||
//****************************************************************************************************************************************************
|
||||
void QMLBackend::setUseSSLForSMTP(bool value)
|
||||
{
|
||||
if (value == useSSLForSMTP_)
|
||||
return;
|
||||
useSSLForSMTP_ = value;
|
||||
emit useSSLForSMTPChanged(value);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] imapPort The IMAP port.
|
||||
/// \param[in] smtpPort The SMTP port.
|
||||
/// \param[in] useSSLForIMAP The value for the 'Use SSL for IMAP' property
|
||||
/// \param[in] useSSLForSMTP The value for the 'Use SSL for SMTP' property
|
||||
//****************************************************************************************************************************************************
|
||||
void QMLBackend::changePorts(int imapPort, int smtpPort)
|
||||
void QMLBackend::setMailServerSettings(int imapPort, int smtpPort, bool useSSLForIMAP, bool useSSLForSMTP)
|
||||
{
|
||||
// if call succeed, app will restart. No need to emit a value change signal, because it will trigger a read-back via gRPC that will fail.
|
||||
emit hideMainWindow();
|
||||
app().grpc().changePorts(imapPort, smtpPort);
|
||||
app().grpc().setMailServerSettings(imapPort, smtpPort, useSSLForIMAP, useSSLForSMTP);
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] useSSLForIMAP The value for the 'Use SSL for IMAP' property
|
||||
/// \param[in] useSSLForSMTP The value for the 'Use SSL for SMTP' property
|
||||
//****************************************************************************************************************************************************
|
||||
void QMLBackend::onMailServerSettingsChanged(int imapPort, int smtpPort, bool useSSLForIMAP, bool useSSLForSMTP)
|
||||
{
|
||||
this->setIMAPPort(imapPort);
|
||||
this->setSMTPPort(smtpPort);
|
||||
this->setUseSSLForIMAP(useSSLForIMAP);
|
||||
this->setUseSSLForSMTP(useSSLForSMTP);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -69,10 +69,10 @@ public: // Qt/QML properties. Note that the NOTIFY-er signal is required even fo
|
||||
Q_PROPERTY(bool isAllMailVisible READ isAllMailVisible NOTIFY isAllMailVisibleChanged) // _ bool `property:"isAllMailVisible"`
|
||||
Q_PROPERTY(QString colorSchemeName READ colorSchemeName NOTIFY colorSchemeNameChanged) // _ string `property:"colorSchemeName"`
|
||||
Q_PROPERTY(QUrl diskCachePath READ diskCachePath NOTIFY diskCachePathChanged) // _ core.QUrl `property:"diskCachePath"`
|
||||
Q_PROPERTY(bool useSSLforSMTP READ useSSLForSMTP NOTIFY useSSLforSMTPChanged) // _ bool `property:"useSSLforSMTP"`
|
||||
Q_PROPERTY(bool useSSLforIMAP READ useSSLForIMAP NOTIFY useSSLforIMAPChanged) // _ bool `property:"useSSLforIMAP"`
|
||||
Q_PROPERTY(int portIMAP READ portIMAP NOTIFY portIMAPChanged) // _ int `property:"portIMAP"`
|
||||
Q_PROPERTY(int portSMTP READ portSMTP NOTIFY portSMTPChanged) // _ int `property:"portSMTP"`
|
||||
Q_PROPERTY(bool useSSLForIMAP READ useSSLForIMAP WRITE setUseSSLForIMAP NOTIFY useSSLForIMAPChanged) // _ bool `property:"useSSLForSMTP"`
|
||||
Q_PROPERTY(bool useSSLForSMTP READ useSSLForSMTP WRITE setUseSSLForSMTP NOTIFY useSSLForSMTPChanged) // _ bool `property:"useSSLForSMTP"`
|
||||
Q_PROPERTY(int imapPort READ imapPort WRITE setIMAPPort NOTIFY imapPortChanged)
|
||||
Q_PROPERTY(int smtpPort READ smtpPort WRITE setSMTPPort NOTIFY smtpPortChanged)
|
||||
Q_PROPERTY(bool isDoHEnabled READ isDoHEnabled NOTIFY isDoHEnabledChanged) // _ bool `property:"isDoHEnabled"`
|
||||
Q_PROPERTY(bool isFirstGUIStart READ isFirstGUIStart) // _ bool `property:"isFirstGUIStart"`
|
||||
Q_PROPERTY(bool isAutomaticUpdateOn READ isAutomaticUpdateOn NOTIFY isAutomaticUpdateOnChanged) // _ bool `property:"isAutomaticUpdateOn"`
|
||||
@ -101,10 +101,14 @@ public: // Qt/QML properties. Note that the NOTIFY-er signal is required even fo
|
||||
bool isAllMailVisible() const { bool v; app().grpc().isAllMailVisible(v); return v; }
|
||||
QString colorSchemeName() const { QString name; app().grpc().colorSchemeName(name); return name; }
|
||||
QUrl diskCachePath() const { QUrl path; app().grpc().diskCachePath(path); return path; }
|
||||
bool useSSLForSMTP() const{ bool useSSL; app().grpc().useSSLForSMTP(useSSL); return useSSL; }
|
||||
bool useSSLForIMAP() const{ bool useSSL; app().grpc().useSSLForIMAP(useSSL); return useSSL; }
|
||||
int portIMAP() const { int port; app().grpc().portIMAP(port); return port; }
|
||||
int portSMTP() const { int port; app().grpc().portSMTP(port); return port; }
|
||||
bool useSSLForIMAP() const;
|
||||
void setUseSSLForIMAP(bool value);
|
||||
bool useSSLForSMTP() const;
|
||||
void setUseSSLForSMTP(bool value);
|
||||
int imapPort() const;
|
||||
void setIMAPPort(int port);
|
||||
int smtpPort() const;
|
||||
void setSMTPPort(int port);
|
||||
bool isDoHEnabled() const { bool isEnabled; app().grpc().isDoHEnabled(isEnabled); return isEnabled;}
|
||||
bool isFirstGUIStart() const { bool v; app().grpc().isFirstGUIStart(v); return v; };
|
||||
bool isAutomaticUpdateOn() const { bool isOn = false; app().grpc().isAutomaticUpdateOn(isOn); return isOn; }
|
||||
@ -119,8 +123,10 @@ signals: // Signal used by the Qt property system. Many of them are unused but r
|
||||
void showOnStartupChanged(bool value);
|
||||
void goosChanged(QString const &value);
|
||||
void diskCachePathChanged(QUrl const &url);
|
||||
void useSSLforSMTPChanged(bool value);
|
||||
void useSSLforIMAPChanged(bool value);
|
||||
void imapPortChanged(int port);
|
||||
void smtpPortChanged(int port);
|
||||
void useSSLForSMTPChanged(bool value);
|
||||
void useSSLForIMAPChanged(bool value);
|
||||
void isAutomaticUpdateOnChanged(bool value);
|
||||
void isBetaEnabledChanged(bool value);
|
||||
void isAllMailVisibleChanged(bool value);
|
||||
@ -139,8 +145,6 @@ signals: // Signal used by the Qt property system. Many of them are unused but r
|
||||
void availableKeychainChanged(QStringList const &keychains);
|
||||
void hostnameChanged(QString const &hostname);
|
||||
void isAutostartOnChanged(bool value);
|
||||
void portIMAPChanged(int port);
|
||||
void portSMTPChanged(int port);
|
||||
void usersChanged(UserList* users);
|
||||
void dockIconVisibleChanged(bool value);
|
||||
|
||||
@ -154,9 +158,6 @@ public slots: // slot for signals received from QML -> To be forwarded to Bridge
|
||||
void login2FA(QString const& username, QString const& code) { app().grpc().login2FA(username, code);} // _ func(username, code string) `slot:"login2FA"`
|
||||
void login2Password(QString const& username, QString const& password) { app().grpc().login2Passwords(username, password);} // _ func(username, password string) `slot:"login2Password"`
|
||||
void loginAbort(QString const& username){ app().grpc().loginAbort(username);} // _ func(username string) `slot:"loginAbort"`
|
||||
void toggleUseSSLforSMTP(bool makeItActive); // _ func(makeItActive bool) `slot:"toggleUseSSLforSMTP"`
|
||||
void toggleUseSSLforIMAP(bool makeItActive); // _ func(makeItActive bool) `slot:"toggleUseSSLforIMAP"`
|
||||
void changePorts(int imapPort, int smtpPort); // _ func(imapPort, smtpPort int) `slot:"changePorts"`
|
||||
void toggleDoH(bool active); // _ func(makeItActive bool) `slot:"toggleDoH"`
|
||||
void toggleAutomaticUpdate(bool makeItActive); // _ func(makeItActive bool) `slot:"toggleAutomaticUpdate"`
|
||||
void updateCurrentMailClient() { emit currentEmailClientChanged(currentEmailClient()); } // _ func() `slot:"updateCurrentMailClient"`
|
||||
@ -172,6 +173,10 @@ public slots: // slot for signals received from QML -> To be forwarded to Bridge
|
||||
app().grpc().reportBug(description, address, emailClient, includeLogs); } // _ func(description, address, emailClient string, includeLogs bool) `slot:"reportBug"`
|
||||
void onResetFinished(); // _ func() `slot:"onResetFinished"`
|
||||
void onVersionChanged(); // _ func() `slot:"onVersionChanged"`
|
||||
void setMailServerSettings(int imapPort, int smtpPort, bool useSSLForIMAP, bool useSSLForSMTP); ///< Forwards to connection mode change request from QML to gRPC
|
||||
|
||||
public slots: // slot for signals received from gRPC that need transformation instead of simple forwarding
|
||||
void onMailServerSettingsChanged(int imapPort, int smtpPort, bool useSSLForIMAP, bool useSSLForSMTP); ///< Slot for the ConnectionModeChanged gRPC event.
|
||||
|
||||
signals: // Signals received from the Go backend, to be forwarded to QML
|
||||
void toggleAutostartFinished(); // _ func() `signal:"toggleAutostartFinished"`
|
||||
@ -199,10 +204,13 @@ signals: // Signals received from the Go backend, to be forwarded to QML
|
||||
void updateSilentError(); // _ func() `signal:"updateSilentError"`
|
||||
void updateIsLatestVersion(); // _ func() `signal:"updateIsLatestVersion"`
|
||||
void checkUpdatesFinished(); // _ func() `signal:"checkUpdatesFinished"`
|
||||
void toggleUseSSLFinished(); // _ func() `signal:"toggleUseSSLFinished"`
|
||||
void changePortFinished(); // _ func() `signal:"changePortFinished"`
|
||||
void portIssueIMAP(); // _ func() `signal:"portIssueIMAP"`
|
||||
void portIssueSMTP(); // _ func() `signal:"portIssueSMTP"`
|
||||
void imapPortStartupError();
|
||||
void smtpPortStartupError();
|
||||
void imapPortChangeError();
|
||||
void smtpPortChangeError();
|
||||
void imapConnectionModeChangeError();
|
||||
void smtpConnectionModeChangeError();
|
||||
void changeMailServerSettingsFinished();
|
||||
void changeKeychainFinished(); // _ func() `signal:"changeKeychainFinished"`
|
||||
void notifyHasNoKeychain(); // _ func() `signal:"notifyHasNoKeychain"`
|
||||
void notifyRebuildKeychain(); // _ func() `signal:"notifyRebuildKeychain"`
|
||||
@ -231,6 +239,10 @@ private: // data members
|
||||
QString goos_; ///< The cached version of the GOOS variable.
|
||||
QUrl logsPath_; ///< The logs path. Retrieved from bridge on startup.
|
||||
QUrl licensePath_; ///< The license path. Retrieved from bridge on startup.
|
||||
int imapPort_ { 0 }; ///< The cached value for the IMAP port.
|
||||
int smtpPort_ { 0 }; ///< The cached value for the SMTP port.
|
||||
bool useSSLForIMAP_ { false }; ///< The cached value for useSSLForIMAP.
|
||||
bool useSSLForSMTP_ { false }; ///< The cached value for useSSLForSMTP.
|
||||
|
||||
friend class AppController;
|
||||
};
|
||||
|
||||
@ -229,20 +229,20 @@ Item {
|
||||
colorScheme: root.colorScheme
|
||||
title: qsTr("IMAP")
|
||||
hostname: Backend.hostname
|
||||
port: Backend.portIMAP.toString()
|
||||
port: Backend.imapPort.toString()
|
||||
username: configuration.currentAddress
|
||||
password: root.user ? root.user.password : ""
|
||||
security : Backend.useSSLforIMAP ? "SSL" : "STARTTLS"
|
||||
security : Backend.useSSLForIMAP ? "SSL" : "STARTTLS"
|
||||
}
|
||||
|
||||
Configuration {
|
||||
colorScheme: root.colorScheme
|
||||
title: qsTr("SMTP")
|
||||
hostname : Backend.hostname
|
||||
port : Backend.portSMTP.toString()
|
||||
port : Backend.smtpPort.toString()
|
||||
username : configuration.currentAddress
|
||||
password : root.user ? root.user.password : ""
|
||||
security : Backend.useSSLforSMTP ? "SSL" : "STARTTLS"
|
||||
security : Backend.useSSLForSMTP ? "SSL" : "STARTTLS"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -696,7 +696,7 @@ Window {
|
||||
}
|
||||
RowLayout {
|
||||
Label {colorScheme: root.colorScheme; text: "SMTP using SSL:"}
|
||||
Toggle {colorScheme: root.colorScheme; checked: root.useSSLforSMTP; onClicked: root.useSSLforSMTP = !root.useSSLforSMTP}
|
||||
Toggle {colorScheme: root.colorScheme; checked: root.useSSLForSMTP; onClicked: root.useSSLForSMTP = !root.useSSLForSMTP}
|
||||
}
|
||||
RowLayout {
|
||||
Label {colorScheme: root.colorScheme; text: "Local cache:"}
|
||||
@ -822,9 +822,9 @@ Window {
|
||||
}
|
||||
|
||||
|
||||
property bool useSSLforSMTP: false
|
||||
function toggleUseSSLforSMTP(makeItActive){
|
||||
console.debug("-> SMTP SSL", makeItActive, root.useSSLforSMTP)
|
||||
property bool useSSLForSMTP: false
|
||||
function toggleUseSSLForSMTP(makeItActive){
|
||||
console.debug("-> SMTP SSL", makeItActive, root.useSSLForSMTP)
|
||||
}
|
||||
signal toggleUseSSLFinished()
|
||||
|
||||
@ -841,8 +841,8 @@ Window {
|
||||
return true
|
||||
}
|
||||
signal changePortFinished()
|
||||
signal portIssueIMAP()
|
||||
signal portIssueSMTP()
|
||||
signal imapPortStartupError()
|
||||
signal smtpPortStartupError()
|
||||
|
||||
function triggerReset() {
|
||||
console.debug("-> trigger reset")
|
||||
|
||||
@ -315,7 +315,7 @@ Item {
|
||||
|
||||
PortSettings { // 4
|
||||
colorScheme: root.colorScheme
|
||||
|
||||
notifications: root.notifications
|
||||
onBack: {
|
||||
rightContent.showGeneralSettings()
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ SettingsView {
|
||||
|
||||
Label {
|
||||
colorScheme: root.colorScheme
|
||||
text: qsTr("Changes require reconfiguration of email client. Bridge will automatically restart.")
|
||||
text: qsTr("Changes require reconfiguration of email client.")
|
||||
type: Label.Body
|
||||
color: root.colorScheme.text_weak
|
||||
Layout.fillWidth: true
|
||||
@ -80,13 +80,13 @@ SettingsView {
|
||||
Button {
|
||||
id: submitButton
|
||||
colorScheme: root.colorScheme
|
||||
text: qsTr("Save and restart")
|
||||
text: qsTr("Save")
|
||||
onClicked: {
|
||||
submitButton.loading = true
|
||||
root.submit()
|
||||
}
|
||||
|
||||
enabled: sslButton.checked !== Backend.useSSLforIMAP
|
||||
enabled: sslButton.checked !== Backend.useSSLForIMAP
|
||||
}
|
||||
|
||||
Button {
|
||||
@ -99,20 +99,21 @@ SettingsView {
|
||||
Connections {
|
||||
target: Backend
|
||||
|
||||
function onToggleUseSSLFinished() {
|
||||
function onChangeMailServerSettingsFinished() {
|
||||
submitButton.loading = false
|
||||
root.back()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function submit(){
|
||||
submitButton.loading = true
|
||||
Backend.toggleUseSSLforIMAP(sslButton.checked)
|
||||
Backend.setMailServerSettings(Backend.imapPort, Backend.smtpPort, sslButton.checked, Backend.useSSLForSMTP)
|
||||
}
|
||||
|
||||
function setDefaultValues(){
|
||||
sslButton.checked = Backend.useSSLforIMAP
|
||||
starttlsButton.checked = !Backend.useSSLforIMAP
|
||||
sslButton.checked = Backend.useSSLForIMAP
|
||||
starttlsButton.checked = !Backend.useSSLForIMAP
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
|
||||
@ -46,8 +46,12 @@ QtObject {
|
||||
|
||||
property var all: [
|
||||
root.noInternet,
|
||||
root.portIssueIMAP,
|
||||
root.portIssueSMTP,
|
||||
root.imapPortStartupError,
|
||||
root.smtpPortStartupError,
|
||||
root.imapPortChangeError,
|
||||
root.smtpPortChangeError,
|
||||
root.imapConnectionModeChangeError,
|
||||
root.smtpConnectionModeChangeError,
|
||||
root.updateManualReady,
|
||||
root.updateManualRestartNeeded,
|
||||
root.updateManualError,
|
||||
@ -98,8 +102,8 @@ QtObject {
|
||||
}
|
||||
}
|
||||
|
||||
property Notification portIssueIMAP: Notification {
|
||||
description: qsTr("The IMAP server could not be started. Please check or change the IMAP port and restart the application.")
|
||||
property Notification imapPortStartupError: Notification {
|
||||
description: qsTr("The IMAP server could not be started. Please check or change the IMAP port.")
|
||||
brief: qsTr("IMAP port error")
|
||||
icon: "./icons/ic-alert.svg"
|
||||
type: Notification.NotificationType.Danger
|
||||
@ -108,14 +112,14 @@ QtObject {
|
||||
Connections {
|
||||
target: Backend
|
||||
|
||||
function onPortIssueIMAP() {
|
||||
root.portIssueIMAP.active = true
|
||||
function onImapPortStartupError() {
|
||||
root.imapPortStartupError.active = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property Notification portIssueSMTP: Notification {
|
||||
description: qsTr("The SMTP server could not be started. Please check or change the SMTP port and restart the application.")
|
||||
property Notification smtpPortStartupError: Notification {
|
||||
description: qsTr("The SMTP server could not be started. Please check or change the SMTP port.")
|
||||
brief: qsTr("SMTP port error")
|
||||
icon: "./icons/ic-alert.svg"
|
||||
type: Notification.NotificationType.Danger
|
||||
@ -124,8 +128,88 @@ QtObject {
|
||||
Connections {
|
||||
target: Backend
|
||||
|
||||
function onPortIssueSMTP() {
|
||||
root.portIssueSMTP.active = true
|
||||
function onSmtpPortStartupError() {
|
||||
root.smtpPortStartupError.active = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property Notification imapPortChangeError: Notification {
|
||||
description: qsTr("The IMAP port could not be changed.")
|
||||
brief: qsTr("IMAP port change error")
|
||||
icon: "./icons/ic-alert.svg"
|
||||
type: Notification.NotificationType.Danger
|
||||
group: Notifications.Group.Connection
|
||||
|
||||
Connections {
|
||||
target: Backend
|
||||
|
||||
function onImapPortChangeError() {
|
||||
root.imapPortChangeError.active = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property Notification smtpPortChangeError: Notification {
|
||||
description: qsTr("The SMTP port could not be changed.")
|
||||
brief: qsTr("SMTP port change error")
|
||||
icon: "./icons/ic-alert.svg"
|
||||
type: Notification.NotificationType.Danger
|
||||
group: Notifications.Group.Connection
|
||||
|
||||
Connections {
|
||||
target: Backend
|
||||
|
||||
function onSmtpPortChangeError() {
|
||||
root.smtpPortChangeError.active = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property Notification imapConnectionModeChangeError: Notification {
|
||||
description: qsTr("The IMAP connection mode could not be changed.")
|
||||
brief: qsTr("IMAP Connection mode change error")
|
||||
icon: "./icons/ic-alert.svg"
|
||||
type: Notification.NotificationType.Danger
|
||||
group: Notifications.Group.Connection
|
||||
|
||||
Connections {
|
||||
target: Backend
|
||||
|
||||
function onImapConnectionModeChangeError() {
|
||||
root.imapConnectionModeChangeError.active = true
|
||||
}
|
||||
}
|
||||
|
||||
action: Action {
|
||||
text: qsTr("OK")
|
||||
|
||||
onTriggered: {
|
||||
root.imapConnectionModeChangeError.active= false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
property Notification smtpConnectionModeChangeError: Notification {
|
||||
description: qsTr("The SMTP connection mode could not be changed.")
|
||||
brief: qsTr("SMTP Connection mode change error")
|
||||
icon: "./icons/ic-alert.svg"
|
||||
type: Notification.NotificationType.Danger
|
||||
group: Notifications.Group.Connection
|
||||
|
||||
Connections {
|
||||
target: Backend
|
||||
|
||||
function onSmtpConnectionModeChangeError() {
|
||||
root.smtpConnectionModeChangeError.active = true
|
||||
}
|
||||
}
|
||||
|
||||
action: Action {
|
||||
text: qsTr("OK")
|
||||
|
||||
onTriggered: {
|
||||
root.smtpConnectionModeChangeError.active= false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,9 +27,11 @@ SettingsView {
|
||||
|
||||
fillHeight: false
|
||||
|
||||
property var notifications
|
||||
|
||||
property bool _valuesChanged: (
|
||||
imapField.text*1 !== Backend.portIMAP ||
|
||||
smtpField.text*1 !== Backend.portSMTP
|
||||
imapField.text*1 !== Backend.imapPort ||
|
||||
smtpField.text*1 !== Backend.smtpPort
|
||||
)
|
||||
|
||||
Label {
|
||||
@ -41,7 +43,7 @@ SettingsView {
|
||||
|
||||
Label {
|
||||
colorScheme: root.colorScheme
|
||||
text: qsTr("Changes require reconfiguration of your email client. Bridge will automatically restart.")
|
||||
text: qsTr("Changes require reconfiguration of your email client.")
|
||||
type: Label.Body
|
||||
color: root.colorScheme.text_weak
|
||||
Layout.fillWidth: true
|
||||
@ -81,7 +83,7 @@ SettingsView {
|
||||
Button {
|
||||
id: submitButton
|
||||
colorScheme: root.colorScheme
|
||||
text: qsTr("Save and restart")
|
||||
text: qsTr("Save")
|
||||
enabled: root._valuesChanged
|
||||
onClicked: {
|
||||
// removing error here because we may have set it manually (port occupied)
|
||||
@ -109,7 +111,13 @@ SettingsView {
|
||||
return
|
||||
}
|
||||
|
||||
Backend.changePorts(imapField.text, smtpField.text)
|
||||
// We turn off all port error notification. They well be restored if problems persist
|
||||
root.notifications.imapPortStartupError.active = false
|
||||
root.notifications.smtpPortStartupError.active = false
|
||||
root.notifications.imapPortChangeError.active = false
|
||||
root.notifications.smtpPortChangeError.active = false
|
||||
|
||||
Backend.setMailServerSettings(imapField.text, smtpField.text, Backend.useSSLForIMAP, Backend.useSSLForSMTP)
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,7 +131,7 @@ SettingsView {
|
||||
Connections {
|
||||
target: Backend
|
||||
|
||||
function onChangePortFinished() {
|
||||
function onChangeMailServerSettingsFinished() {
|
||||
submitButton.loading = false
|
||||
}
|
||||
}
|
||||
@ -148,8 +156,8 @@ SettingsView {
|
||||
|
||||
function isPortFree(field) {
|
||||
var num = field.text*1
|
||||
if (num === Backend.portIMAP) return true
|
||||
if (num === Backend.portSMTP) return true
|
||||
if (num === Backend.imapPort) return true
|
||||
if (num === Backend.smtpPort) return true
|
||||
if (!Backend.isPortFree(num)) {
|
||||
field.error = true
|
||||
field.errorString = qsTr("Port occupied")
|
||||
@ -160,8 +168,8 @@ SettingsView {
|
||||
}
|
||||
|
||||
function setDefaultValues(){
|
||||
imapField.text = Backend.portIMAP
|
||||
smtpField.text = Backend.portSMTP
|
||||
imapField.text = Backend.imapPort
|
||||
smtpField.text = Backend.smtpPort
|
||||
imapField.error = false
|
||||
smtpField.error = false
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ SettingsView {
|
||||
|
||||
Label {
|
||||
colorScheme: root.colorScheme
|
||||
text: qsTr("Changes require reconfiguration of email client. Bridge will automatically restart.")
|
||||
text: qsTr("Changes require reconfiguration of email client.")
|
||||
type: Label.Body
|
||||
color: root.colorScheme.text_weak
|
||||
Layout.fillWidth: true
|
||||
@ -80,13 +80,13 @@ SettingsView {
|
||||
Button {
|
||||
id: submitButton
|
||||
colorScheme: root.colorScheme
|
||||
text: qsTr("Save and restart")
|
||||
text: qsTr("Save")
|
||||
onClicked: {
|
||||
submitButton.loading = true
|
||||
root.submit()
|
||||
}
|
||||
|
||||
enabled: sslButton.checked !== Backend.useSSLforSMTP
|
||||
enabled: sslButton.checked !== Backend.useSSLForSMTP
|
||||
}
|
||||
|
||||
Button {
|
||||
@ -99,20 +99,21 @@ SettingsView {
|
||||
Connections {
|
||||
target: Backend
|
||||
|
||||
function onToggleUseSSLFinished() {
|
||||
function onChangeMailServerSettingsFinished() {
|
||||
submitButton.loading = false
|
||||
root.back()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function submit(){
|
||||
function submit() {
|
||||
submitButton.loading = true
|
||||
Backend.toggleUseSSLforSMTP(sslButton.checked)
|
||||
Backend.setMailServerSettings(Backend.imapPort, Backend.smtpPort, Backend.useSSLForIMAP, sslButton.checked)
|
||||
}
|
||||
|
||||
function setDefaultValues(){
|
||||
sslButton.checked = Backend.useSSLforSMTP
|
||||
starttlsButton.checked = !Backend.useSSLforSMTP
|
||||
sslButton.checked = Backend.useSSLForSMTP
|
||||
starttlsButton.checked = !Backend.useSSLForSMTP
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
|
||||
Reference in New Issue
Block a user