forked from Silverfish/proton-bridge
GODT-1910: use a single view for IMAP & SMTP SSL options.
This commit is contained in:
committed by
James Houlahan
parent
d1f140ebcb
commit
a95eb759ca
@ -99,8 +99,7 @@
|
|||||||
<file>qml/SettingsView.qml</file>
|
<file>qml/SettingsView.qml</file>
|
||||||
<file>qml/SetupGuide.qml</file>
|
<file>qml/SetupGuide.qml</file>
|
||||||
<file>qml/SignIn.qml</file>
|
<file>qml/SignIn.qml</file>
|
||||||
<file>qml/SMTPSettings.qml</file>
|
<file>qml/ConnectionModeSettings.qml</file>
|
||||||
<file>qml/IMAPSettings.qml</file>
|
|
||||||
<file>qml/SplashScreen.qml</file>
|
<file>qml/SplashScreen.qml</file>
|
||||||
<file>qml/Status.qml</file>
|
<file>qml/Status.qml</file>
|
||||||
<file>qml/StatusWindow.qml</file>
|
<file>qml/StatusWindow.qml</file>
|
||||||
|
|||||||
@ -29,14 +29,14 @@ SettingsView {
|
|||||||
|
|
||||||
Label {
|
Label {
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
text: qsTr("IMAP connection mode")
|
text: qsTr("Connection mode")
|
||||||
type: Label.Heading
|
type: Label.Heading
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
colorScheme: root.colorScheme
|
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
|
type: Label.Body
|
||||||
color: root.colorScheme.text_weak
|
color: root.colorScheme.text_weak
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@ -46,24 +46,55 @@ SettingsView {
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: 16
|
spacing: 16
|
||||||
|
|
||||||
ButtonGroup{ id: protocolSelection }
|
ButtonGroup{ id: imapProtocolSelection }
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
text: qsTr("IMAP connection security")
|
text: qsTr("IMAP connection")
|
||||||
}
|
}
|
||||||
|
|
||||||
RadioButton {
|
RadioButton {
|
||||||
id: sslButton
|
id: imapSSLButton
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
ButtonGroup.group: protocolSelection
|
ButtonGroup.group: imapProtocolSelection
|
||||||
text: qsTr("SSL")
|
text: qsTr("SSL")
|
||||||
}
|
}
|
||||||
|
|
||||||
RadioButton {
|
RadioButton {
|
||||||
id: starttlsButton
|
id: imapSTARTTLSButton
|
||||||
colorScheme: root.colorScheme
|
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")
|
text: qsTr("STARTTLS")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -86,7 +117,7 @@ SettingsView {
|
|||||||
root.submit()
|
root.submit()
|
||||||
}
|
}
|
||||||
|
|
||||||
enabled: sslButton.checked !== Backend.useSSLForIMAP
|
enabled: (imapSSLButton.checked !== Backend.useSSLForIMAP) || (smtpSSLButton.checked !== Backend.useSSLForSMTP)
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
@ -108,12 +139,14 @@ SettingsView {
|
|||||||
|
|
||||||
function submit(){
|
function submit(){
|
||||||
submitButton.loading = true
|
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(){
|
function setDefaultValues(){
|
||||||
sslButton.checked = Backend.useSSLForIMAP
|
imapSSLButton.checked = Backend.useSSLForIMAP
|
||||||
starttlsButton.checked = !Backend.useSSLForIMAP
|
imapSTARTTLSButton.checked = !Backend.useSSLForIMAP
|
||||||
|
smtpSSLButton.checked = Backend.useSSLForSMTP
|
||||||
|
smtpSTARTTLSButton.checked = !Backend.useSSLForSMTP
|
||||||
}
|
}
|
||||||
|
|
||||||
onVisibleChanged: {
|
onVisibleChanged: {
|
||||||
@ -321,7 +321,7 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SMTPSettings { // 5
|
ConnectionModeSettings { // 5
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
|
|
||||||
onBack: {
|
onBack: {
|
||||||
@ -365,14 +365,6 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IMAPSettings { // 9
|
|
||||||
colorScheme: root.colorScheme
|
|
||||||
|
|
||||||
onBack: {
|
|
||||||
rightContent.showGeneralSettings()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function showAccount(index) {
|
function showAccount(index) {
|
||||||
if (index !== undefined && index >= 0){
|
if (index !== undefined && index >= 0){
|
||||||
accounts.currentIndex = index
|
accounts.currentIndex = index
|
||||||
@ -380,15 +372,14 @@ Item {
|
|||||||
rightContent.currentIndex = 0
|
rightContent.currentIndex = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSignIn () { rightContent.currentIndex = 1; signIn.focus = true }
|
function showSignIn () { rightContent.currentIndex = 1; signIn.focus = true }
|
||||||
function showGeneralSettings () { rightContent.currentIndex = 2 }
|
function showGeneralSettings () { rightContent.currentIndex = 2 }
|
||||||
function showKeychainSettings () { rightContent.currentIndex = 3 }
|
function showKeychainSettings () { rightContent.currentIndex = 3 }
|
||||||
function showPortSettings () { rightContent.currentIndex = 4 }
|
function showPortSettings () { rightContent.currentIndex = 4 }
|
||||||
function showSMTPSettings () { rightContent.currentIndex = 5 }
|
function showConnectionModeSettings() { rightContent.currentIndex = 5 }
|
||||||
function showLocalCacheSettings () { rightContent.currentIndex = 6 }
|
function showLocalCacheSettings () { rightContent.currentIndex = 6 }
|
||||||
function showHelpView () { rightContent.currentIndex = 7 }
|
function showHelpView () { rightContent.currentIndex = 7 }
|
||||||
function showBugReport () { rightContent.currentIndex = 8 }
|
function showBugReport () { rightContent.currentIndex = 8 }
|
||||||
function showIMAPSettings () { rightContent.currentIndex = 9 }
|
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: Backend
|
target: Backend
|
||||||
|
|||||||
@ -186,24 +186,11 @@ SettingsView {
|
|||||||
id: imap
|
id: imap
|
||||||
visible: root._isAdvancedShown
|
visible: root._isAdvancedShown
|
||||||
colorScheme: root.colorScheme
|
colorScheme: root.colorScheme
|
||||||
text: qsTr("IMAP connection mode")
|
text: qsTr("Connection mode")
|
||||||
actionText: qsTr("Change")
|
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
|
type: SettingsItem.Button
|
||||||
onClicked: root.parent.showIMAPSettings()
|
onClicked: root.parent.showConnectionModeSettings()
|
||||||
|
|
||||||
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()
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user