-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVault.qml
121 lines (104 loc) · 3.39 KB
/
Vault.qml
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 1.4
import Qt.labs.settings 1.0
import QtQuick.Dialogs 1.2
import "Common"
import "Vault"
import "Common/sizes.js" as Size
import "Common/palette.js" as Palette
import "Common/icons.js" as Icons
Page {
id: page
width: 320
height: 480
color: Palette.THEME
property alias openVaultID: keyView.openVaultID
function back(){
return false;
}
ColumnLayout {
spacing: 0
anchors.fill: parent
VToolbar {
theme: Palette.TOOLBAR.THEME
shadow: true
icon: Icons.UI_MENU
text: "Vaults"
// shadow: vaultsList.contentY > 0
Layout.fillHeight: false
VToolbarButton {
icon: Icons.UI_ADD
Layout.alignment: Qt.AlignRight
onClicked: editView.open()
}
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
ListView {
id: vaultsList
anchors.fill: parent
boundsBehavior: Flickable.DragOverBounds
delegate: VListItem {
state: (parent.count - 1) == index? "borderNone": ""
prefix: Icon {
name: page.openVaultID==ID? Icons.UI_LOCK_OFF: Icons.UI_LOCK_ON
size: Size.ICON_32
color: Palette.WHITE
}
VLabel {
text: title
color: Palette.WHITE
}
VLabel {
text: description
color: Palette.ACCENT4
font.pixelSize: Size.FONT_SIZE_SMALL
}
onClicked: keyView.open(ID)
onPressAndHold: editView.edit(ID)
onAction: {
app.msg("Remove " + title, "Are you sure you want to permanently remove this vault and all the associated data?", StandardIcon.Warning, StandardButton.Cancel | StandardButton.Yes, function(accepted){
console.log ("MSG callback");
if (accepted){
vaults.remove(ID);
app.toast("Removed");
}else
deactivate();
});
}
}
model: vaults
// ListModel{
// ListElement {
// name: "Apple"
// description: "A green, yellow, or red fruit"
// }
// ListElement {
// name: "Orange"
// description: "Large orange fruit"
// }
// ListElement {
// name: "Banana"
// description: "Yellow long and sweet grass"
// }
// }
}
}
}
VLabel{
color: Palette.HEAD
font.pixelSize: Size.FONT_SIZE_DISPLAY
anchors.centerIn: parent
text: "No Valuts"
visible: vaultsList.count == 0
}
EditView {
id: editView
}
KeyView {
id: keyView
}
}