GODT-1910: use a single view for IMAP & SMTP SSL options.

This commit is contained in:
Xavier Michelon
2022-11-21 10:57:11 +01:00
committed by James Houlahan
parent d1f140ebcb
commit a95eb759ca
5 changed files with 58 additions and 170 deletions

View File

@ -99,8 +99,7 @@
<file>qml/SettingsView.qml</file>
<file>qml/SetupGuide.qml</file>
<file>qml/SignIn.qml</file>
<file>qml/SMTPSettings.qml</file>
<file>qml/IMAPSettings.qml</file>
<file>qml/ConnectionModeSettings.qml</file>
<file>qml/SplashScreen.qml</file>
<file>qml/Status.qml</file>
<file>qml/StatusWindow.qml</file>

View File

@ -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: {

View File

@ -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

View File

@ -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
}

View File

@ -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 <https://www.gnu.org/licenses/>.
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()
}
}