Warning, /plasma-mobile/raven/src/contents/ui/accounts/AddAccountPage.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-FileCopyrightText: 2022 Devin Lin <devin@kde.org> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 import QtQuick 2.15 0005 import QtQuick.Layouts 1.15 0006 import QtQuick.Controls 2.15 as Controls 0007 0008 import org.kde.kirigami 2.19 as Kirigami 0009 import org.kde.kirigamiaddons.labs.mobileform 0.1 as MobileForm 0010 import org.kde.raven 1.0 0011 0012 Kirigami.ScrollablePage { 0013 id: root 0014 title: i18n("Add Account") 0015 0016 Kirigami.Theme.colorSet: Kirigami.Theme.Window 0017 Kirigami.Theme.inherit: false 0018 0019 leftPadding: 0 0020 rightPadding: 0 0021 topPadding: Kirigami.Units.gridUnit 0022 bottomPadding: Kirigami.Units.gridUnit 0023 0024 footer: Controls.Control { 0025 id: footerToolBar 0026 0027 implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, 0028 implicitContentWidth + leftPadding + rightPadding) 0029 implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, 0030 implicitContentHeight + topPadding + bottomPadding) 0031 0032 leftPadding: Kirigami.Units.smallSpacing 0033 rightPadding: Kirigami.Units.smallSpacing 0034 bottomPadding: Kirigami.Units.smallSpacing 0035 topPadding: Kirigami.Units.smallSpacing 0036 0037 contentItem: RowLayout { 0038 spacing: parent.spacing 0039 0040 // footer buttons 0041 Controls.DialogButtonBox { 0042 // we don't explicitly set padding, to let the style choose the padding 0043 id: dialogButtonBox 0044 standardButtons: Controls.DialogButtonBox.Close | Controls.DialogButtonBox.Save 0045 0046 Layout.fillWidth: true 0047 Layout.alignment: dialogButtonBox.alignment 0048 0049 position: Controls.DialogButtonBox.Footer 0050 0051 onAccepted: { 0052 newAccount.addAccount(); 0053 applicationWindow().pageStack.layers.pop(); 0054 } 0055 onRejected: applicationWindow().pageStack.layers.pop() 0056 } 0057 } 0058 0059 background: Rectangle { 0060 color: Kirigami.Theme.backgroundColor 0061 0062 // separator above footer 0063 Kirigami.Separator { 0064 anchors.top: parent.top 0065 anchors.left: parent.left 0066 anchors.right: parent.right 0067 } 0068 } 0069 } 0070 0071 ColumnLayout { 0072 spacing: 0 0073 width: root.width 0074 0075 NewAccount { 0076 id: newAccount 0077 } 0078 0079 MobileForm.FormCard { 0080 Layout.fillWidth: true 0081 0082 contentItem: ColumnLayout { 0083 spacing: 0 0084 0085 FormTextInputDelegate { 0086 id: nameDelegate 0087 text: i18n("Name") 0088 textValue: newAccount.name 0089 onTextSaved: newAccount.name = savedText 0090 } 0091 0092 MobileForm.FormDelegateSeparator { above: nameDelegate; below: emailDelegate } 0093 0094 FormTextInputDelegate { 0095 id: emailDelegate 0096 text: i18n("Email") 0097 textValue: newAccount.email 0098 onTextSaved: newAccount.email = savedText 0099 } 0100 0101 MobileForm.FormDelegateSeparator { above: emailDelegate; below: passwordDelegate } 0102 0103 FormPasswordInputDelegate { 0104 id: passwordDelegate 0105 text: i18n("Password") 0106 textValue: newAccount.password 0107 onTextSaved: newAccount.password = savedText 0108 } 0109 0110 MobileForm.FormDelegateSeparator { above: passwordDelegate; below: autoFillDelegate } 0111 0112 MobileForm.AbstractFormDelegate { 0113 id: autoFillDelegate 0114 Layout.fillWidth: true 0115 contentItem: RowLayout { 0116 Controls.Label { 0117 Layout.fillWidth: true 0118 text: i18n("Auto-fill settings") 0119 } 0120 0121 Controls.Button { 0122 text: i18n("Fill") 0123 icon.name: "search" 0124 onClicked: newAccount.searchIspdbForConfig() 0125 } 0126 } 0127 } 0128 } 0129 } 0130 0131 MobileForm.FormCard { 0132 Layout.fillWidth: true 0133 Layout.topMargin: Kirigami.Units.largeSpacing 0134 0135 contentItem: ColumnLayout { 0136 spacing: 0 0137 0138 MobileForm.FormCardHeader { 0139 title: i18n("Receiving") 0140 } 0141 0142 MobileForm.FormComboBoxDelegate { 0143 id: receiveEmailProtocolDelegate 0144 text: i18n("Protocol") 0145 currentIndex: newAccount.receivingMailProtocol === NewAccount.Imap ? 0 : 1 0146 model: ["IMAP", "POP3"] 0147 onCurrentValueChanged: newAccount.receivingMailProtocol = (receiveEmailProtocolDelegate.currentValue === "IMAP") ? NewAccount.Imap : NewAccount.Pop3 0148 } 0149 0150 MobileForm.FormDelegateSeparator { above: receiveEmailProtocolDelegate; below: receivingHostDelegate } 0151 0152 FormTextInputDelegate { 0153 id: receivingHostDelegate 0154 text: i18n("Host") 0155 textValue: newAccount.receivingMailProtocol === NewAccount.Imap ? newAccount.imapHost : newAccount.pop3Host 0156 onTextSaved: newAccount.receivingMailProtocol === NewAccount.Imap ? newAccount.imapHost = savedText : newAccount.pop3Host = savedText 0157 } 0158 0159 MobileForm.FormDelegateSeparator { above: receivingHostDelegate; below: receivingPortDelegate } 0160 0161 FormTextInputDelegate { 0162 id: receivingPortDelegate 0163 text: i18n("Port") 0164 textValue: newAccount.receivingMailProtocol === NewAccount.Imap ? newAccount.imapPort : newAccount.pop3Port 0165 onTextSaved: newAccount.receivingMailProtocol === NewAccount.Imap ? newAccount.imapPort = savedText : newAccount.pop3Port = savedText 0166 } 0167 0168 MobileForm.FormDelegateSeparator { above: receivingPortDelegate; below: receivingUsernameDelegate } 0169 0170 FormTextInputDelegate { 0171 id: receivingUsernameDelegate 0172 text: i18n("Username") 0173 textValue: newAccount.receivingMailProtocol === NewAccount.Imap ? newAccount.imapUsername : newAccount.pop3Username 0174 onTextSaved: newAccount.receivingMailProtocol === NewAccount.Imap ? newAccount.imapUsername = savedText : newAccount.pop3Username = savedText 0175 } 0176 0177 MobileForm.FormDelegateSeparator { above: receivingUsernameDelegate; below: receivingPasswordDelegate } 0178 0179 FormPasswordInputDelegate { 0180 id: receivingPasswordDelegate 0181 text: i18n("Password") 0182 textValue: newAccount.receivingMailProtocol === NewAccount.Imap ? newAccount.imapPassword : newAccount.pop3Password 0183 onTextSaved: newAccount.receivingMailProtocol === NewAccount.Imap ? newAccount.imapPassword = savedText : newAccount.pop3Password = savedText 0184 } 0185 } 0186 } 0187 0188 MobileForm.FormCard { 0189 Layout.fillWidth: true 0190 Layout.topMargin: Kirigami.Units.largeSpacing 0191 0192 contentItem: ColumnLayout { 0193 spacing: 0 0194 0195 MobileForm.FormCardHeader { 0196 title: i18n("Sending") 0197 } 0198 0199 FormTextInputDelegate { 0200 id: smtpHostDelegate 0201 text: i18n("Host") 0202 textValue: newAccount.smtpHost 0203 onTextSaved: newAccount.smtpHost = savedText 0204 } 0205 0206 MobileForm.FormDelegateSeparator { above: smtpHostDelegate; below: smtpPortDelegate } 0207 0208 FormTextInputDelegate { 0209 id: smtpPortDelegate 0210 text: i18n("Port") 0211 textValue: newAccount.smtpPort 0212 onTextSaved: newAccount.smtpPort = savedText 0213 } 0214 0215 MobileForm.FormDelegateSeparator { above: smtpPortDelegate; below: smtpUsernameDelegate } 0216 0217 FormTextInputDelegate { 0218 id: smtpUsernameDelegate 0219 text: i18n("Username") 0220 textValue: newAccount.smtpUsername 0221 onTextSaved: newAccount.smtpUsername = savedText 0222 } 0223 0224 MobileForm.FormDelegateSeparator { above: smtpUsernameDelegate; below: smtpPasswordDelegate } 0225 0226 FormPasswordInputDelegate { 0227 id: smtpPasswordDelegate 0228 text: i18n("Password") 0229 textValue: newAccount.smtpPassword 0230 onTextSaved: newAccount.smtpPassword = savedText 0231 } 0232 } 0233 } 0234 } 0235 }