2 import com.nokia.meego 1.0
3 import "Library/js/DBUtility.js" as DBUtility
4 import "file:///usr/lib/qt4/imports/com/meego/UIConstants.js" as UIConstants
5 import "file:///usr/lib/qt4/imports/com/nokia/extras/constants.js" as ExtrasConstants
9 acceptButtonText: qsTr("Done")
10 rejectButtonText: qsTr("Cancel")
12 signal sheetDestroyed()
15 property string numberpattern:""
16 property string gatewaynumber:""
17 property string dtmfformat:""
18 property int numberFormatIndex:0
19 property string dtmfprefix: ""
20 property string dtmfsuffix: ""
22 Component.onCompleted: {
24 var ruleObj = DBUtility.getRuleByID(ruleID);
25 if (ruleObj !== null){
26 numberpattern = ruleObj.numberpattern;
27 gatewaynumber = ruleObj.gatewaynumber;
28 dtmfformat = ruleObj.dtmfformat;
30 for (i = 0; i < numberFormatModel.count; i++){
31 if (numberFormatModel.get(i).name === dtmfformat) {
32 numberFormatIndex = i;
36 dtmfprefix = ruleObj.dtmfprefix;
37 dtmfsuffix = ruleObj.dtmfsuffix;
42 Component.onDestruction: {
43 console.log("OnDestruction");
49 ListElement { name: "<Country Code><Area Code><Phone Number>" }
50 ListElement { name: "+<Country Code><Area Code><Phone Number>" }
51 ListElement { name: "00<Country Code><Area Code><Phone Number>" }
52 ListElement { name: "011<Country Code><Area Code><Phone Number>" }
56 id: numberFormatDialog
57 titleText: "Number Format"
58 width: container.width
59 selectedIndex: numberFormatIndex
60 model: numberFormatModel
66 anchors.leftMargin: UIConstants.DEFAULT_MARGIN
67 anchors.rightMargin: UIConstants.DEFAULT_MARGIN
68 anchors.topMargin: UIConstants.DEFAULT_MARGIN
69 flickableDirection: Flickable.VerticalFlick
70 contentHeight: col.height + UIConstants.DEFAULT_MARGIN
77 text: (ruleID != 0)? qsTr("Edit Rule"):qsTr("Add Rule");
78 font.family: UIConstants.FONT_FAMILY_LIGHT
79 font.pixelSize: UIConstants.FONT_XLARGE
81 Label { text: qsTr("For numbers starting with:") }
83 id: numberStartingWith
84 anchors { left: parent.left; right: parent.right; }
85 inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText
86 text: screen.numberpattern
88 Label { text: qsTr("Route call via:") }
91 anchors { left: parent.left; right: parent.right; }
92 inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText
93 text: screen.gatewaynumber
96 Label { text: qsTr("Dial number in this format (tap to change): ") }
100 height: UIConstants.LIST_ITEM_HEIGHT_SMALL
105 visible: mouseArea.pressed
106 source: theme.inverted ?
107 'image://theme/meegotouch-list-fullwidth-inverted-background-pressed-vertical-center':
108 'image://theme/meegotouch-list-fullwidth-background-pressed-vertical-center'
112 anchors.verticalCenter: parent.verticalCenter
113 verticalAlignment: Text.AlignVCenter
114 text: numberFormatDialog.selectedIndex >= 0 ? numberFormatDialog.model.get(numberFormatDialog.selectedIndex).name : "None"
115 font.family: UIConstants.FONT_FAMILY_LIGHT
116 font.pixelSize: UIConstants.FONT_SMALL
123 numberFormatDialog.open();
128 Label { text: qsTr("Send this tone before dialing:") }
131 anchors { left: parent.left; right: parent.right; }
132 inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText
135 Label { text: qsTr("Send this tone after dialing:") }
138 anchors { left: parent.left; right: parent.right; }
139 inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText
144 //id, numberpattern, gatewaynumber, dtmfformat, dtmfprefix, dtmfsuffix
145 var ruleObj = new Object();
147 ruleObj.numberpattern = numberStartingWith.text;
148 ruleObj.gatewaynumber = gatewayNumber.text;
149 ruleObj.dtmfformat = numberFormatDialog.model.get(numberFormatDialog.selectedIndex).name;
150 ruleObj.dtmfprefix = dtmfPrefix.text;
151 ruleObj.dtmfsuffix = dtmfSuffix.text;
153 DBUtility.updateRule(ruleID,ruleObj);
155 DBUtility.addRule(ruleObj);
158 onRejected: destroy();