aboutsummaryrefslogtreecommitdiff
path: root/qml/main.qml
blob: 73abec6bdc1c422bf6007447b6bd6e61253492f9 (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
54
55
56
57
import QtQuick 2.12
import QtQuick.Controls 2.12 as Controls
import org.kde.kirigami 2.12 as Kirigami

import DeltaChat 1.0


Kirigami.ApplicationWindow {
    id: root

    property DcAccountsEventEmitter eventEmitter

    title: qsTr("Delta Chat")

    pageStack.initialPage: AccountsPage {}

    globalDrawer: Kirigami.GlobalDrawer {
        header: Controls.Switch {
            text: "Start IO"
            onCheckedChanged: {
                if (checked) {
                    accountsModel.startIo()
                } else {
                    accountsModel.stopIo()
                }
            }
        }

        actions: [
            Kirigami.Action {
                text: "Maybe network"
                iconName: "view-refresh"
                onTriggered: accountsModel.maybeNetwork()
            }
        ]
    }

    contextDrawer: Kirigami.ContextDrawer {
        id: contextDrawer
    }

    AccountsModel {
        id: accountsModel
    }

    Component.onCompleted: {
        console.log('starting')
        eventEmitter = accountsModel.getEventEmitter()
        eventEmitter.start();
    }

    onClosing: {
        console.log('stopping')
        pageStack.pop(null)
        delete root.accountsModel
    }
}