diff --git a/internal/frontend/bridge-gui/bridge-gui/Resources.qrc b/internal/frontend/bridge-gui/bridge-gui/Resources.qrc index d8f9d4f6..ae39db15 100644 --- a/internal/frontend/bridge-gui/bridge-gui/Resources.qrc +++ b/internal/frontend/bridge-gui/bridge-gui/Resources.qrc @@ -99,8 +99,7 @@ qml/SettingsView.qml qml/SetupGuide.qml qml/SignIn.qml - qml/SMTPSettings.qml - qml/IMAPSettings.qml + qml/ConnectionModeSettings.qml qml/SplashScreen.qml qml/Status.qml qml/StatusWindow.qml diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/IMAPSettings.qml b/internal/frontend/bridge-gui/bridge-gui/qml/ConnectionModeSettings.qml similarity index 62% rename from internal/frontend/bridge-gui/bridge-gui/qml/IMAPSettings.qml rename to internal/frontend/bridge-gui/bridge-gui/qml/ConnectionModeSettings.qml index f63596d5..45f929ba 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/IMAPSettings.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/ConnectionModeSettings.qml @@ -29,14 +29,14 @@ SettingsView { Label { colorScheme: root.colorScheme - text: qsTr("IMAP connection mode") + text: qsTr("Connection mode") type: Label.Heading Layout.fillWidth: true } Label { colorScheme: root.colorScheme - text: qsTr("Changes require reconfiguration of email client.") + text: qsTr("Change the protocol Bridge and the email client use to connect for IMAP and SMTP.") type: Label.Body color: root.colorScheme.text_weak Layout.fillWidth: true @@ -46,24 +46,55 @@ SettingsView { ColumnLayout { spacing: 16 - ButtonGroup{ id: protocolSelection } + ButtonGroup{ id: imapProtocolSelection } Label { colorScheme: root.colorScheme - text: qsTr("IMAP connection security") + text: qsTr("IMAP connection") } RadioButton { - id: sslButton + id: imapSSLButton colorScheme: root.colorScheme - ButtonGroup.group: protocolSelection + ButtonGroup.group: imapProtocolSelection text: qsTr("SSL") } RadioButton { - id: starttlsButton + id: imapSTARTTLSButton colorScheme: root.colorScheme - ButtonGroup.group: protocolSelection + ButtonGroup.group: imapProtocolSelection + text: qsTr("STARTTLS") + } + } + + Rectangle { + Layout.fillWidth: true + height: 1 + color: root.colorScheme.border_weak + } + + ColumnLayout { + spacing: 16 + + ButtonGroup{ id: smtpProtocolSelection } + + Label { + colorScheme: root.colorScheme + text: qsTr("SMTP connection") + } + + RadioButton { + id: smtpSSLButton + colorScheme: root.colorScheme + ButtonGroup.group: smtpProtocolSelection + text: qsTr("SSL") + } + + RadioButton { + id: smtpSTARTTLSButton + colorScheme: root.colorScheme + ButtonGroup.group: smtpProtocolSelection text: qsTr("STARTTLS") } } @@ -86,7 +117,7 @@ SettingsView { root.submit() } - enabled: sslButton.checked !== Backend.useSSLForIMAP + enabled: (imapSSLButton.checked !== Backend.useSSLForIMAP) || (smtpSSLButton.checked !== Backend.useSSLForSMTP) } Button { @@ -108,12 +139,14 @@ SettingsView { function submit(){ submitButton.loading = true - Backend.setMailServerSettings(Backend.imapPort, Backend.smtpPort, sslButton.checked, Backend.useSSLForSMTP) + Backend.setMailServerSettings(Backend.imapPort, Backend.smtpPort, imapSSLButton.checked, smtpSSLButton.checked) } function setDefaultValues(){ - sslButton.checked = Backend.useSSLForIMAP - starttlsButton.checked = !Backend.useSSLForIMAP + imapSSLButton.checked = Backend.useSSLForIMAP + imapSTARTTLSButton.checked = !Backend.useSSLForIMAP + smtpSSLButton.checked = Backend.useSSLForSMTP + smtpSTARTTLSButton.checked = !Backend.useSSLForSMTP } onVisibleChanged: { diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/ContentWrapper.qml b/internal/frontend/bridge-gui/bridge-gui/qml/ContentWrapper.qml index a04f68c3..1b363c8d 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/ContentWrapper.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/ContentWrapper.qml @@ -321,7 +321,7 @@ Item { } } - SMTPSettings { // 5 + ConnectionModeSettings { // 5 colorScheme: root.colorScheme onBack: { @@ -365,14 +365,6 @@ Item { } } - IMAPSettings { // 9 - colorScheme: root.colorScheme - - onBack: { - rightContent.showGeneralSettings() - } - } - function showAccount(index) { if (index !== undefined && index >= 0){ accounts.currentIndex = index @@ -380,15 +372,14 @@ Item { rightContent.currentIndex = 0 } - function showSignIn () { rightContent.currentIndex = 1; signIn.focus = true } - function showGeneralSettings () { rightContent.currentIndex = 2 } - function showKeychainSettings () { rightContent.currentIndex = 3 } - function showPortSettings () { rightContent.currentIndex = 4 } - function showSMTPSettings () { rightContent.currentIndex = 5 } - function showLocalCacheSettings () { rightContent.currentIndex = 6 } - function showHelpView () { rightContent.currentIndex = 7 } - function showBugReport () { rightContent.currentIndex = 8 } - function showIMAPSettings () { rightContent.currentIndex = 9 } + function showSignIn () { rightContent.currentIndex = 1; signIn.focus = true } + function showGeneralSettings () { rightContent.currentIndex = 2 } + function showKeychainSettings () { rightContent.currentIndex = 3 } + function showPortSettings () { rightContent.currentIndex = 4 } + function showConnectionModeSettings() { rightContent.currentIndex = 5 } + function showLocalCacheSettings () { rightContent.currentIndex = 6 } + function showHelpView () { rightContent.currentIndex = 7 } + function showBugReport () { rightContent.currentIndex = 8 } Connections { target: Backend diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/GeneralSettings.qml b/internal/frontend/bridge-gui/bridge-gui/qml/GeneralSettings.qml index c563f836..b06df70d 100644 --- a/internal/frontend/bridge-gui/bridge-gui/qml/GeneralSettings.qml +++ b/internal/frontend/bridge-gui/bridge-gui/qml/GeneralSettings.qml @@ -186,24 +186,11 @@ SettingsView { id: imap visible: root._isAdvancedShown colorScheme: root.colorScheme - text: qsTr("IMAP connection mode") + text: qsTr("Connection mode") actionText: qsTr("Change") - description: qsTr("Change the protocol Bridge and your client use to connect.") + description: qsTr("Change the protocol Bridge and the email client use to connect for IMAP and SMTP.") type: SettingsItem.Button - onClicked: root.parent.showIMAPSettings() - - Layout.fillWidth: true - } - - SettingsItem { - id: smtp - visible: root._isAdvancedShown - colorScheme: root.colorScheme - text: qsTr("SMTP connection mode") - actionText: qsTr("Change") - description: qsTr("Change the protocol Bridge and your client use to connect.") - type: SettingsItem.Button - onClicked: root.parent.showSMTPSettings() + onClicked: root.parent.showConnectionModeSettings() Layout.fillWidth: true } diff --git a/internal/frontend/bridge-gui/bridge-gui/qml/SMTPSettings.qml b/internal/frontend/bridge-gui/bridge-gui/qml/SMTPSettings.qml deleted file mode 100644 index f9e65b45..00000000 --- a/internal/frontend/bridge-gui/bridge-gui/qml/SMTPSettings.qml +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright (c) 2022 Proton AG -// -// This file is part of Proton Mail Bridge. -// -// Proton Mail Bridge 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. -// -// Proton Mail Bridge 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 Proton Mail Bridge. If not, see . - -import QtQuick -import QtQuick.Layouts -import QtQuick.Controls -import QtQuick.Controls.impl - -import Proton - -SettingsView { - id: root - - fillHeight: false - - Label { - colorScheme: root.colorScheme - text: qsTr("SMTP connection mode") - type: Label.Heading - Layout.fillWidth: true - } - - Label { - colorScheme: root.colorScheme - text: qsTr("Changes require reconfiguration of email client.") - type: Label.Body - color: root.colorScheme.text_weak - Layout.fillWidth: true - wrapMode: Text.WordWrap - } - - ColumnLayout { - spacing: 16 - - ButtonGroup{ id: protocolSelection } - - Label { - colorScheme: root.colorScheme - text: qsTr("SMTP connection security") - } - - RadioButton { - id: sslButton - colorScheme: root.colorScheme - ButtonGroup.group: protocolSelection - text: qsTr("SSL") - } - - RadioButton { - id: starttlsButton - colorScheme: root.colorScheme - ButtonGroup.group: protocolSelection - text: qsTr("STARTTLS") - } - } - - Rectangle { - Layout.fillWidth: true - height: 1 - color: root.colorScheme.border_weak - } - - RowLayout { - spacing: 12 - - Button { - id: submitButton - colorScheme: root.colorScheme - text: qsTr("Save") - onClicked: { - submitButton.loading = true - root.submit() - } - - enabled: sslButton.checked !== Backend.useSSLForSMTP - } - - Button { - colorScheme: root.colorScheme - text: qsTr("Cancel") - onClicked: root.back() - secondary: true - } - - Connections { - target: Backend - - function onChangeMailServerSettingsFinished() { - submitButton.loading = false - root.back() - } - } - } - - function submit() { - submitButton.loading = true - Backend.setMailServerSettings(Backend.imapPort, Backend.smtpPort, Backend.useSSLForIMAP, sslButton.checked) - } - - function setDefaultValues(){ - sslButton.checked = Backend.useSSLForSMTP - starttlsButton.checked = !Backend.useSSLForSMTP - } - - onVisibleChanged: { - root.setDefaultValues() - } -}