Warning, /pim/kube/accounts/maildir/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 QtQuick.Dialogs 1.0 as Dialogs
0023 import org.kube.framework 1.0 as Kube
0024 import org.kube.accounts.maildir 1.0 as MaildirAccount
0025 
0026 Item {
0027     property string accountId
0028     property string heading: qsTr("Add your Maildir archive")
0029     property string subheadline: qsTr("To let Kube access your maildir archive, add the path to your archive and give the account a title that will be displayed inside Kube.")
0030     property bool valid: true
0031     implicitHeight: grid.implicitHeight
0032 
0033     MaildirAccount.MaildirSettings {
0034         id: maildirSettings
0035         accountIdentifier: accountId
0036         accountType: "maildir"
0037     }
0038 
0039     function save(){
0040         maildirSettings.save()
0041     }
0042 
0043     function remove(){
0044         maildirSettings.remove()
0045     }
0046 
0047     GridLayout {
0048         id: grid
0049         anchors.fill: parent
0050         columns: 2
0051         columnSpacing: Kube.Units.largeSpacing
0052         rowSpacing: Kube.Units.largeSpacing
0053 
0054         Kube.Label {
0055             text: qsTr("Title of Account")
0056             Layout.alignment: Qt.AlignRight
0057         }
0058         Kube.TextField {
0059             Layout.fillWidth: true
0060             placeholderText: qsTr("E.g. \"Work\", \"Home\" that will be displayed in Kube as name")
0061             text: maildirSettings.accountName
0062             onTextChanged: {
0063                 maildirSettings.accountName = text
0064             }
0065         }
0066 
0067         Kube.Label {
0068             text: qsTr("Path")
0069             Layout.alignment: Qt.AlignRight
0070         }
0071         RowLayout {
0072             Layout.fillWidth: true
0073 
0074             Kube.TextField {
0075                 id: path
0076                 Layout.fillWidth: true
0077                 enabled: false
0078                 text: maildirSettings.path
0079             }
0080 
0081             Kube.Button {
0082                 iconName: Kube.Icons.folder
0083 
0084                 onClicked: {
0085                     fileDialog.open()
0086                 }
0087 
0088                 Dialogs.FileDialog {
0089                     id: fileDialog
0090                     title: qsTr("Choose a maildir folder")
0091                     folder: shortcuts.home
0092                     selectFolder: true
0093                     selectExisting: true
0094                     selectMultiple: false
0095                     onAccepted: {
0096                         maildirSettings.path = fileDialog.fileUrl
0097                     }
0098                 }
0099             }
0100         }
0101     }
0102 }