Dekko
Loading...
Searching...
No Matches
AuthenticationSelector.qml
1import QtQuick 2.4
2import Lomiri.Components 1.3
3import Lomiri.Components.ListItems 1.3 as AreTheseStillValid
4import Dekko.Mail.Accounts 1.0
6Item {
7
8 property var selectedMethod: authMethodModel.count ? authMethodModel.get(selectedIndex).method : AccountConfig.PLAIN
9 property alias selectedIndex: authSelector.selectedIndex
10 height: col.height
11 anchors {
12 left: parent.left
13 right: parent.right
14 }
15
16 function setAuthType(type) {
17 authMethodModel.loadCryptModel()
18 var idx = 0;
19 switch(type) {
20 case AccountConfig.PLAIN:
21 break
22 case AccountConfig.LOGIN:
23 idx = 1
24 break
25 case AccountConfig.CRAM_MD5:
26 idx = 2
27 break
28 }
29 authSelector.selectedIndex = idx
30 }
31 Column {
32 id: col
33 anchors {
34 left: parent.left
35 top: parent.top
36 right: parent.right
37 }
38 spacing: units.gu(1)
39
40 Label {
41 anchors {
42 left: parent.left
43 right: parent.right
44 }
45 text: qsTr("Authentication")
46 }
47 AreTheseStillValid.ItemSelector {
48 id: authSelector
49 objectName: "encryptionSelector"
50
51 model: authMethodModel
52 delegate: OptionSelectorDelegate {
53 text: model.description
54 }
55
56 ListModel {
57 id: authMethodModel
58
59 function loadCryptModel() {
60 authMethodModel.append({ "description": qsTr("PLAIN"), "method": AccountConfig.PLAIN })
61 authMethodModel.append({ "description": qsTr("LOGIN"), "method": AccountConfig.LOGIN })
62 authMethodModel.append({ "description": qsTr("CRAM-MD5"), "method": AccountConfig.CRAM_MD5 })
63 }
64 }
65// Component.onCompleted: authMethodModel.loadCryptModel()
66 }
67 }
68}