19import QtQuick.Controls.Suru 2.2
20import Lomiri.Components 1.3
22import Dekko.Lomiri.Components 1.0
23import "../../components"
33 property string serviceType:
"imap"
34 property QtObject accountConfig: null
40 "servicetype" : serviceType,
41 "hostname" : server.text,
43 "encryption": encryption.selectedMethod,
44 "username": username.text,
45 "password": password.text,
46 "authentication": authentication.selectedMethod,
47 "allowUntrusted": allowUntrustedSwitch.checked
52 function showInvalidFields(result) {
53 server.requiredField = result.indexOf(
"hostname") > -1
54 port.requiredField = result.indexOf(
"port") > -1
55 username.requiredField = result.indexOf(
"username") > -1
69 objectName:
"serverInputField"
70 title: qsTr(
"Hostname")
71 placeholderText: serviceType+
".example.org"
72 inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhEmailCharactersOnly
73 text: accountConfig ? accountConfig.server :
""
78 objectName:
"portInputField"
80 placeholderText:
"993"
81 inputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhDigitsOnly
82 text: accountConfig ? accountConfig.port :
""
91 Component.onCompleted: {
93 setEncryptionType(accountConfig.encryption)
100 objectName:
"usernameInputField"
101 title: qsTr(
"Username")
102 inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText | Qt.ImhEmailCharactersOnly
103 placeholderText:
"user@example.org"
104 text: accountConfig ? ((serviceType ===
"smtp") ? accountConfig.username : accountConfig.email) :
""
109 objectName:
"userInputPasswordField"
110 title: qsTr(
"Password")
111 inputMethodHints: Qt.ImhHiddenText | Qt.ImhNoAutoUppercase | Qt.ImhNoPredictiveText
112 echoMode: showPassword.checked ? TextInput.Normal : TextInput.Password
113 placeholderText: qsTr(
"Password")
114 text: accountConfig ? accountConfig.password :
""
119 objectName:
"showPwdCheckBox"
120 text: qsTr(
"Show password")
121 textColor: Suru.secondaryForegroundColor
130 visible: serviceType !==
"pop3"
131 Component.onCompleted: {
132 if (visible && accountConfig) {
133 setAuthType(accountConfig.saslMechanism)
139 id: allowUntrustedSwitch
140 checked: accountConfig ? accountConfig.acceptUntrustedCertificates :
false
141 text: qsTr(
"Allow untrusted certificates")