20import QtQuick.Controls.Suru 2.2
21import Lomiri.Components 1.3
22import Dekko.Mail.Accounts 1.0
23import Dekko.Mail.API 1.0
24import Dekko.Mail.Stores.Settings 1.0
25import Dekko.Lomiri.Components 1.0
29 pageHeader.title: qsTr(
"Outgoing Server: %1").arg(SettingsStore.selectedAccount.name)
31 property SmtpAccountConfig outgoing: account.outgoing
33 function settingsChanged() {
34 if (outgoing.username !== username.text
35 || outgoing.password !== password.text
36 || outgoing.server !== server.text
37 || outgoing.port !== port.text
38 || outgoing.encryption !== encryption.selectedMethod
39 || outgoing.acceptUntrustedCertificates !== allowUntrustedSwitch.checked
40 || outgoing.saslMechanism !== authentication.selectedMethod
41 || outgoing.authFromCaps !== authFromCaps.checked)
43 Log.logInfo(
"OutgoingServerGroup::determineIfSettingsChanged",
"Settings have changed")
46 Log.logInfo(
"OutgoingServerGroup::determineIfSettingsChanged",
"No changes")
53 type: SettingsKeys.saveCurrentGroup
55 Log.logInfo(
"OutgoingServerGroup::saveCurrentGroup",
"Saving group settings")
56 if (!settingsChanged()) {
59 outgoing.username = username.text
60 outgoing.password = password.text
61 outgoing.server = server.text
62 outgoing.port = port.text
63 outgoing.encryption = encryption.selectedMethod
64 outgoing.saslMechanism = authentication.selectedMethod
65 outgoing.authFromCaps = authFromCaps.checked
66 outgoing.acceptUntrustedCertificates = allowUntrustedSwitch.checked
67 SettingsStore.settingsChanged =
true
68 Log.logInfo(
"OutgoingServerGroup::saveCurrentGroup",
"Saved group settings")
76 title: qsTr(
"Hostname")
77 placeholderText:
"smtp.example.org"
78 inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhEmailCharactersOnly
79 text: outgoing ? outgoing.server :
""
85 placeholderText:
"465"
86 inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhDigitsOnly
87 text: outgoing ? outgoing.port :
""
92 objectName:
"usernameInputField"
93 title: qsTr(
"Username")
94 inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText | Qt.ImhEmailCharactersOnly
95 placeholderText:
"user@example.org"
96 text: outgoing ? outgoing.username :
""
101 title: qsTr(
"Password")
102 inputMethodHints: Qt.ImhHiddenText | Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText
103 echoMode: showPassword.checked ? TextInput.Normal : TextInput.Password
104 placeholderText: qsTr(
"Password")
105 text: outgoing ? outgoing.password :
""
110 objectName:
"showPwdCheckBox"
111 text: qsTr(
"Show password")
112 textColor: suru.secondaryForegroundColor
117 text: qsTr(
"Security settings")
126 Component.onCompleted: {
128 setEncryptionType(outgoing.encryption)
140 Component.onCompleted: {
141 if (visible && outgoing) {
142 setAuthType(outgoing.saslMechanism)
149 checked: outgoing ? outgoing.authFromCaps :
false
150 text: qsTr(
"Authenticate from server capabilities")
154 id: allowUntrustedSwitch
155 checked: outgoing ? outgoing.acceptUntrustedCertificates :
false
156 text: qsTr(
"Allow untrusted certificates")