Debian Codegraph @

plugins/cache-manager-plugin/qml/CacheSettingsPage.qml

raw
1 /* Copyright (C) 2016 - 2017 Dan Chapman <[email protected]>
2
3 This file is part of Dekko email client for Ubuntu devices
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License as
7 published by the Free Software Foundation; either version 2 of
8 the License or (at your option) version 3
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 import QtQuick 2.4
19 import Lomiri.Components 1.3
20 import Dekko.Mail.API 1.0
21 import Dekko.Mail.Stores.Settings 1.0
22 import PlugMan 1.0
23 import Dekko.Lomiri.Components 1.0
24
25 DekkoPage {
26 pageHeader.title: qsTr("Manage cache: %1").arg(SettingsStore.selectedAccount.name)
27 pageHeader.backAction: Action {
28 iconName: "back"
29 onTriggered: {
30 ViewActions.popStageArea(ViewKeys.settingsStack1)
31 }
32 }
33
34 readonly property var periods: [
35 qsTr("One Week"),
36 qsTr("Fortnight"),
37 qsTr("One Month"),
38 qsTr("Three Months"),
39 qsTr("Six Months")
40 ]
41
42 PageFlickable {
43 margins: 0
44 ListItemLayout {
45 title.text: qsTr("Clear messages from cache")
46 summary.text: qsTr("This will clear messages older than the given period")
47 summary.color: theme.palette.normal.negative
48 summary.wrapMode: Text.WordWrap
49 }
50
51 OptionSelector {
52 id: selector
53 anchors {
54 left: parent.left
55 right: parent.right
56 leftMargin: units.gu(1)
57 rightMargin: units.gu(1)
58 }
59 model: periods
60 delegate: OptionSelectorDelegate {
61 text: modelData
62 }
63 }
64
65 Item {
66 width: parent.width
67 height: units.gu(5)
68 Button {
69 anchors {
70 right: parent.right
71 rightMargin: units.gu(1)
72 verticalCenter: parent.verticalCenter
73 }
74 color: theme.palette.normal.negative
75 text: qsTr("Clear now")
76 onClicked: service.sendMessage("cache-manager", "prune:%1".arg(SettingsStore.selectedAccountId), selector.selectedIndex);
77 }
78 }
79 }
80 }