2 import com.nokia.meego 1.0
3 import "Library/js/DBUtility.js" as DBUtility
7 acceptButtonText: qsTr("Done")
8 rejectButtonText: qsTr("Cancel")
10 signal sheetDestroyed()
13 property string numberpattern:""
14 property string gatewaynumber:""
15 property string dtmfformat:""
16 property int numberFormatIndex:0
17 property string dtmfprefix: ""
18 property string dtmfsuffix: ""
20 Component.onCompleted: {
22 var ruleObj = DBUtility.getRuleByID(ruleID);
23 if (ruleObj !== null){
24 numberpattern = ruleObj.numberpattern;
25 gatewaynumber = ruleObj.gatewaynumber;
26 dtmfformat = ruleObj.dtmfformat;
28 for (i = 0; i < numberFormatModel.count; i++){
29 if (numberFormatModel.get(i).name == dtmfformat) {
30 numberFormatIndex = i;
34 dtmfprefix = ruleObj.dtmfprefix;
35 dtmfsuffix = ruleObj.dtmfsuffix;
40 Component.onDestruction: {
41 console.log("OnDestruction");
47 ListElement { name: "<Country Code><Area Code><Phone Number>" }
48 ListElement { name: "+<Country Code><Area Code><Phone Number>" }
49 ListElement { name: "00<Country Code><Area Code><Phone Number>" }
50 ListElement { name: "011<Country Code><Area Code><Phone Number>" }
54 id: numberFormatDialog
55 titleText: "Number Format"
56 width: container.width
57 selectedIndex: numberFormatIndex
58 model: numberFormatModel
64 anchors.leftMargin: 10
66 flickableDirection: Flickable.VerticalFlick
72 Label { text: (ruleID != 0)? qsTr("Edit Rule"):qsTr("Add Rule"); font.bold: true; }
73 Label { text: qsTr("For numbers starting with:") }
75 id: numberStartingWith
76 anchors { left: parent.left; right: parent.right; }
77 //height: implicitHeight
78 inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText
79 text: screen.numberpattern
81 Label { text: qsTr("Route call via:") }
84 anchors { left: parent.left; right: parent.right; }
85 //height: implicitHeight
86 inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText
87 text: screen.gatewaynumber
90 Label { text: qsTr("Dial number in this format:") }
93 anchors { horizontalCenter: parent.horizontalCenter }
94 //height: implicitHeight
97 numberFormatDialog.open();
106 anchors.horizontalCenter: parent.horizontalCenter
107 text: numberFormatDialog.selectedIndex >= 0 ? numberFormatDialog.model.get(numberFormatDialog.selectedIndex).name : "None"
113 Label { text: qsTr("Include this tone before dialing:") }
116 anchors { left: parent.left; right: parent.right; }
117 height: implicitHeight
118 inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText
121 Label { text: qsTr("Include this tone after dialing:") }
124 anchors { left: parent.left; right: parent.right; }
125 height: implicitHeight
126 inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText
131 //id, numberpattern, gatewaynumber, dtmfformat, dtmfprefix, dtmfsuffix
132 var ruleObj = new Object();
134 ruleObj.numberpattern = numberStartingWith.text;
135 ruleObj.gatewaynumber = gatewayNumber.text;
136 ruleObj.dtmfformat = numberFormatDialog.model.get(numberFormatDialog.selectedIndex).name;
137 ruleObj.dtmfprefix = dtmfPrefix.text;
138 ruleObj.dtmfsuffix = dtmfSuffix.text;
140 DBUtility.updateRule(ruleID,ruleObj);
142 DBUtility.addRule(ruleObj);
145 onRejected: destroy();