PageSettingsSync.qml 3.86 KB
Newer Older
1
/*
2
 * Copyright (C) 2014-2018 CZ.NIC
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * In addition, as a special exception, the copyright holders give
 * permission to link the code of portions of this program with the
 * OpenSSL library under certain conditions as described in each
 * individual source file, and distribute linked combinations including
 * the two.
 */

import QtQuick 2.7
25 26
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1
27
import cz.nic.mobileDatovka 1.0
28

29 30
Item {
    id: pageSettingsSync
31

32 33 34 35
    /* These properties must be set by caller. */
    property var pageView
    property var statusBar
    property var accountModel: null
36

37
    Component.onCompleted: {
38 39
        downloadOnlyNewMsgs.checked = settings.downloadOnlyNewMsgs()
        downloadCompleteMsgs.checked = settings.downloadCompleteMsgs()
40
    }
41 42 43 44 45

    Component.onDestruction: {
        settings.saveAllSettings(accountModel)
    }

46 47 48
    PageHeader {
        id: headerBar
        title: qsTr("Synchronization settings")
49 50
        onBackClicked: {
            pageView.pop(StackView.Immediate)
51
        }
52
    }
53 54 55 56 57 58 59 60 61 62 63
    Flickable {
        id: flickable
        z: 0
        anchors.top: headerBar.bottom
        anchors.right: parent.right
        anchors.left: parent.left
        anchors.bottom: parent.bottom
        contentHeight: flickContent.implicitHeight
        Pane {
            id: flickContent
            anchors.fill: parent
64
            Column {
65
                anchors.right: parent.right
66
                anchors.left: parent.left
67
                spacing: formItemVerticalSpacing
68
                AccessibleSwitch {
69
                    id: downloadOnlyNewMsgs
70 71 72
                    text: qsTr("Download only newer messages")
                    font.pointSize: defaultTextFont.font.pointSize
                    checked: true
73
                    onClicked: settings.setDownloadOnlyNewMsgs(downloadOnlyNewMsgs.checked)
74
                }
75
                AccessibleText {
76 77
                    id: downloadOnlyNewDescription
                    color: datovkaPalette.mid
78
                    width: parent.width
79
                    text: (downloadOnlyNewMsgs.checked ?
80 81 82 83
                           qsTr("Only messages which are not older than 90 days will be downloaded.") :
                           qsTr("All available messages (including those in the data vault) will be downloaded."))
                    wrapMode: Text.Wrap
                }
84
                AccessibleSwitch {
85 86 87 88
                    id: downloadCompleteMsgs
                    text: qsTr("Download complete messages")
                    font.pointSize: defaultTextFont.font.pointSize
                    onClicked:  settings.setDownloadCompleteMsgs(downloadCompleteMsgs.checked)
89
                }
90
                AccessibleText {
91
                    color: datovkaPalette.mid
92
                    width: parent.width
93
                    text: (downloadCompleteMsgs.checked ?
94 95 96 97 98 99 100 101 102
                           qsTr("Complete messages will be downloaded during account synchronisation. This may be slow.") :
                           qsTr("Only message envelopes will be downloaded during account synchronisation."))
                    wrapMode: Text.Wrap
                }
            } // Column layout
        } // Pane
        ScrollIndicator.vertical: ScrollIndicator {}
    } // Flickable
} // Item