3 @author: Sudheer K. <scifi1947 at gmail.com>
4 @license: GNU General Public License
8 import com.nokia.meego 1.0
9 import "Library/js/DBUtility.js" as DBUtility
10 import "file:///usr/lib/qt4/imports/com/meego/UIConstants.js" as UIConstants
11 import "file:///usr/lib/qt4/imports/com/nokia/extras/constants.js" as ExtrasConstants
15 acceptButtonText: qsTr("Done")
16 rejectButtonText: qsTr("Cancel")
18 signal sheetDestroyed()
21 property string numberpattern:""
22 property string gatewaynumber:""
23 property string dtmfformat:""
24 property int numberFormatIndex:0
25 property string dtmfprefix: ""
26 property string dtmfsuffix: ""
28 Component.onCompleted: {
30 var ruleObj = DBUtility.getRuleByID(ruleID);
31 if (ruleObj !== null){
32 numberpattern = ruleObj.numberpattern;
33 gatewaynumber = ruleObj.gatewaynumber;
34 dtmfformat = ruleObj.dtmfformat;
36 for (i = 0; i < numberFormatModel.count; i++){
37 if (numberFormatModel.get(i).name === dtmfformat) {
38 numberFormatIndex = i;
42 dtmfprefix = ruleObj.dtmfprefix;
43 dtmfsuffix = ruleObj.dtmfsuffix;
48 Component.onDestruction: {
49 console.log("OnDestruction");
55 ListElement { name: "<Country Code><Area Code><Phone Number>" }
56 ListElement { name: "+<Country Code><Area Code><Phone Number>" }
57 ListElement { name: "00<Country Code><Area Code><Phone Number>" }
58 ListElement { name: "011<Country Code><Area Code><Phone Number>" }
62 id: numberFormatDialog
63 titleText: "Number Format"
64 width: container.width
65 selectedIndex: numberFormatIndex
66 model: numberFormatModel
72 anchors.leftMargin: UIConstants.DEFAULT_MARGIN
73 anchors.rightMargin: UIConstants.DEFAULT_MARGIN
74 anchors.topMargin: UIConstants.DEFAULT_MARGIN
75 flickableDirection: Flickable.VerticalFlick
76 contentHeight: col.height + UIConstants.DEFAULT_MARGIN
83 text: (ruleID != 0)? qsTr("Edit Rule"):qsTr("Add Rule");
84 font.family: UIConstants.FONT_FAMILY_LIGHT
85 font.pixelSize: UIConstants.FONT_XLARGE
87 Label { text: qsTr("For numbers starting with:") }
89 id: numberStartingWith
90 anchors { left: parent.left; right: parent.right; }
91 inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText
92 text: screen.numberpattern
94 Label { text: qsTr("Route call via:") }
97 anchors { left: parent.left; right: parent.right; }
98 inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText
99 text: screen.gatewaynumber
102 Label { text: qsTr("Dial number in this format (tap to change): ") }
106 height: UIConstants.LIST_ITEM_HEIGHT_SMALL
111 visible: mouseArea.pressed
112 source: theme.inverted ?
113 'image://theme/meegotouch-list-fullwidth-inverted-background-pressed-vertical-center':
114 'image://theme/meegotouch-list-fullwidth-background-pressed-vertical-center'
118 anchors.verticalCenter: parent.verticalCenter
119 verticalAlignment: Text.AlignVCenter
120 text: numberFormatDialog.selectedIndex >= 0 ? numberFormatDialog.model.get(numberFormatDialog.selectedIndex).name : "None"
121 font.family: UIConstants.FONT_FAMILY_LIGHT
122 font.pixelSize: UIConstants.FONT_SMALL
129 numberFormatDialog.open();
134 Label { text: qsTr("Send this tone before dialing:") }
137 anchors { left: parent.left; right: parent.right; }
138 inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText
141 Label { text: qsTr("Send this tone after dialing:") }
144 anchors { left: parent.left; right: parent.right; }
145 inputMethodHints: Qt.ImhDialableCharactersOnly | Qt.ImhNoPredictiveText
150 //id, numberpattern, gatewaynumber, dtmfformat, dtmfprefix, dtmfsuffix
151 var ruleObj = new Object();
153 ruleObj.numberpattern = numberStartingWith.text;
154 ruleObj.gatewaynumber = gatewayNumber.text;
155 ruleObj.dtmfformat = numberFormatDialog.model.get(numberFormatDialog.selectedIndex).name;
156 ruleObj.dtmfprefix = dtmfPrefix.text;
157 ruleObj.dtmfsuffix = dtmfSuffix.text;
159 DBUtility.updateRule(ruleID,ruleObj);
161 DBUtility.addRule(ruleObj);
164 onRejected: destroy();