aboutsummaryrefslogtreecommitdiff
path: root/qml/ConfigurePage.qml
blob: 8a5d9d3eea4b1515253468b293950dce564e10e8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import QtQuick 2.12
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import QtQml.Models 2.1
import org.kde.kirigami 2.12 as Kirigami

import DeltaChat 1.0

Kirigami.Page {
    title: qsTr("Configure account")
    id: configurePage

    required property DcContext context
    required property DcAccountsEventEmitter eventEmitter

    Kirigami.FormLayout {
        anchors.fill: parent

        TextField {
            id: addressField

            Kirigami.FormData.label: "Address: "
        }
        TextField {
            id: passwordField

            Kirigami.FormData.label: "Password: "

            echoMode: TextInput.PasswordEchoOnEdit
        }
        ProgressBar {
            id: progressBar
            value: 0.0
        }
        Button {
            text: "Login"
            onClicked: {
                console.log("Login")
                configurePage.context.stopIo()
                configurePage.context.setConfig("addr", addressField.text)
                configurePage.context.setConfig("mail_pw", passwordField.text)
                configurePage.context.configure()
            }
        }
    }

    Connections {
        target: configurePage.eventEmitter
        function onConfigureProgress(accountId, progress, comment) {
            progressBar.value = progress / 1000.0
        }
    }
}