Warning, /pim/kube/accounts/generic/qml/AccountSettings.qml is written in an unsupported language. File is not indexed.

0001 /*
0002   Copyright (C) 2016 Michael Bohlender, <michael.bohlender@kdemail.net>
0003   Copyright (C) 2017 Christian Mollekopf, <mollekopf@kolabsys.com>
0004 
0005   This program is free software; you can redistribute it and/or modify
0006   it under the terms of the GNU General Public License as published by
0007   the Free Software Foundation; either version 2 of the License, or
0008   (at your option) any later version.
0009 
0010   This program is distributed in the hope that it will be useful,
0011   but WITHOUT ANY WARRANTY; without even the implied warranty of
0012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0013   GNU General Public License for more details.
0014 
0015   You should have received a copy of the GNU General Public License along
0016   with this program; if not, write to the Free Software Foundation, Inc.,
0017   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0018 */
0019 
0020 import QtQuick 2.4
0021 import QtQuick.Layouts 1.1
0022 import org.kube.framework 1.0 as Kube
0023 import org.kube.accounts.generic 1.0 as GenericAccount
0024 
0025 Item {
0026 
0027     property string accountId
0028     property string heading: qsTr("Connect your account")
0029     property string subheadline: qsTr("To let Kube access your account, fill in email address, username and the relevant server addresses. For information about the server details, please contact your email provider.")
0030     property bool valid: true
0031     implicitHeight: grid.implicitHeight
0032 
0033     GenericAccount.Settings {
0034         id: settings
0035         accountIdentifier: accountId
0036         accountType: "generic"
0037     }
0038 
0039     function save(){
0040         settings.save()
0041     }
0042 
0043     function remove(){
0044         settings.remove()
0045     }
0046     GridLayout {
0047         id: grid
0048         anchors.fill: parent
0049         columns: 2
0050         columnSpacing: Kube.Units.largeSpacing
0051         rowSpacing: Kube.Units.largeSpacing
0052 
0053         Kube.Label {
0054             text: qsTr("Name")
0055             Layout.alignment: Qt.AlignRight
0056         }
0057         Kube.RequiredTextField {
0058             Layout.fillWidth: true
0059             placeholderText: qsTr("Your name")
0060             text: settings.userName
0061             onTextChanged: {
0062                 settings.userName = text
0063             }
0064         }
0065 
0066         Kube.Label {
0067             text: qsTr("Email address")
0068             Layout.alignment: Qt.AlignRight
0069         }
0070         Kube.RequiredTextField {
0071             Layout.fillWidth: true
0072 
0073             text: settings.emailAddress
0074             onTextChanged: {
0075                 settings.emailAddress = text
0076                 settings.accountName = text
0077             }
0078             placeholderText: qsTr("Your email address")
0079         }
0080         Kube.Label {
0081             text: qsTr("Username")
0082             Layout.alignment: Qt.AlignRight
0083         }
0084         Kube.RequiredTextField {
0085             Layout.fillWidth: true
0086 
0087             text: settings.imapUsername
0088             onTextChanged: {
0089                 settings.imapUsername = text
0090                 settings.smtpUsername = text
0091                 settings.carddavUsername = text
0092                 settings.caldavUsername = text
0093             }
0094             placeholderText: qsTr("Your username for server access.")
0095         }
0096 
0097         Kube.Label {
0098             text: qsTr("IMAP address")
0099             Layout.alignment: Qt.AlignRight
0100         }
0101         Kube.RequiredTextField {
0102             id: imapServer
0103 
0104             Layout.fillWidth: true
0105 
0106             placeholderText: "imaps://mainserver.example.net:993"
0107             text: settings.imapServer
0108             onTextChanged: {
0109                 settings.imapServer = text
0110             }
0111             validator: settings.imapServerValidator
0112         }
0113 
0114         Kube.Label {
0115             text: qsTr("Use Starttls")
0116             Layout.alignment: Qt.AlignRight
0117         }
0118         Kube.CheckBox {
0119             Layout.fillWidth: true
0120             checked: settings.imapStarttls
0121             onToggled: settings.imapStarttls = checked
0122         }
0123 
0124         Kube.Label {
0125             text: qsTr("Authentication Method")
0126             Layout.alignment: Qt.AlignRight
0127         }
0128         Kube.ComboBox {
0129             Layout.fillWidth: true
0130             model: ["CLEARTEXT", "LOGIN", "PLAIN"]
0131 
0132             function getCurrentIndex(mode) {
0133                 var index = find(mode)
0134                 if (index < 0) {
0135                     //Default to PLAIN
0136                     return 2
0137                 }
0138                 return index
0139             }
0140 
0141             currentIndex: getCurrentIndex(settings.imapAuthenticationMode)
0142             onCurrentIndexChanged: settings.imapAuthenticationMode = textAt(currentIndex)
0143         }
0144 
0145         Kube.Label {
0146             text: qsTr("SMTP address")
0147             Layout.alignment: Qt.AlignRight
0148         }
0149         Kube.RequiredTextField {
0150             Layout.fillWidth: true
0151 
0152             placeholderText: "smtps://mainserver.example.net:587"
0153             text: settings.smtpServer
0154             onTextChanged: {
0155                 settings.smtpServer = text
0156             }
0157             validator: settings.smtpServerValidator
0158         }
0159 
0160         Kube.Label {
0161             text: qsTr("CardDAV address")
0162             Layout.alignment: Qt.AlignRight
0163         }
0164         Kube.RequiredTextField {
0165             Layout.fillWidth: true
0166 
0167             placeholderText: "https://mainserver.example.net"
0168             text: settings.carddavServer
0169             onTextChanged: {
0170                 settings.carddavServer = text
0171             }
0172         }
0173 
0174         Kube.Label {
0175             text: qsTr("CalDAV address")
0176             Layout.alignment: Qt.AlignRight
0177         }
0178         Kube.RequiredTextField {
0179             Layout.fillWidth: true
0180 
0181             placeholderText: "https://mainserver.example.net"
0182             text: settings.caldavServer
0183             onTextChanged: {
0184                 settings.caldavServer = text
0185             }
0186         }
0187     }
0188 }