3 @author: Sudheer K. <scifi1947 at gmail.com>
4 @license: GNU General Public License
8 import "Library/js/DBUtility.js" as DBUtility
11 id: configParametersComponent
12 property bool updateFreqEnabled
13 property string updateFreqMin
14 property bool updateWeekdaysOnly
15 //property bool updateOnSavedNetworksOnly
16 property string rssURL: "http://finance.yahoo.com/rss/topstories"
17 signal logRequest(string strMessage)
24 Component.onCompleted: {
25 DBUtility.initialize();
29 Component.onDestruction:{
30 logRequest("Saving settings");
34 function loadSettings(){
36 value = DBUtility.getSetting("UpdateFreqency");
37 if (!value || value == "0.0" || value === "" || isNaN(value)){
38 configParametersComponent.updateFreqEnabled = false;
41 configParametersComponent.updateFreqEnabled = true;
42 configParametersComponent.updateFreqMin = parseInt(value);
44 value = DBUtility.getSetting("UpdateWeekdaysOnly");
45 if (!value || value == "0.0" || value === ""){
46 configParametersComponent.updateWeekdaysOnly = false;
49 configParametersComponent.updateWeekdaysOnly = true;
53 value = DBUtility.getSetting("UpdateOnSavedNetworksOnly");
54 if (!value || value == "0.0" || value === ""){
55 configParametersComponent.updateOnSavedNetworksOnly = false;
58 configParametersComponent.updateOnSavedNetworksOnly = true;
62 value = DBUtility.getSetting("RSSURL");
63 if (!value || value == "Unknown" || value === ""){
64 //configParametersComponent.rssURL = configParametersComponent.defaultRSSFeed;
67 configParametersComponent.rssURL = value;
71 function saveSettings(){
72 if (isNaN(configParametersComponent.updateFreqMin))
73 DBUtility.setSetting("UpdateFreqency","");
75 DBUtility.setSetting("UpdateFreqency",configParametersComponent.updateFreqMin);
77 DBUtility.setSetting("UpdateWeekdaysOnly",(configParametersComponent.updateWeekdaysOnly?1:0));
78 //DBUtility.setSetting("UpdateOnSavedNetworksOnly",(configParametersComponent.updateOnSavedNetworksOnly?1:0));
79 DBUtility.setSetting("RSSURL",configParametersComponent.rssURL);
83 id: autoUpdateSectionLabel
84 anchors.top: parent.top
85 //anchors.topMargin: 10
86 anchors.left: parent.left
87 anchors.leftMargin: 45
89 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
90 font.pixelSize: 22; font.bold: true; elide: Text.ElideRight; color: "#B8B8B8"; style: Text.Raised; styleColor: "black"
97 border.color: "#BFBFBF"
99 anchors.top: autoUpdateSectionLabel.bottom
100 anchors.topMargin: 10
101 anchors.left: parent.left
102 anchors.leftMargin: 40
103 anchors.right: parent.right
104 anchors.rightMargin: 40
110 anchors.top: parent.top
112 anchors.left: parent.left
113 anchors.leftMargin: 5
114 anchors.right: parent.right
119 id: checkboxUpdateFreqImg
120 source: configParametersComponent.updateFreqEnabled? "Library/images/checkbox_checked.png":"Library/images/checkbox_unchecked.png"
121 width: 32; height: 32
123 anchors.fill: parent;
125 configParametersComponent.updateFreqEnabled = !configParametersComponent.updateFreqEnabled;
126 if (!configParametersComponent.updateFreqEnabled){
127 txtUpdateFreqMin.text = "";
128 configParametersComponent.updateWeekdaysOnly = false;
136 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
137 font.pixelSize: 20; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
139 color: configParametersComponent.updateFreqEnabled? "#ffffff" :"#B8B8B8";
144 BorderImage { source: "Library/images/lineedit.sci"; anchors.fill: parent }
149 text: configParametersComponent.updateFreqMin
150 horizontalAlignment: Text.AlignHCenter
152 inputMethodHints: Qt.ImhDigitsOnly | Qt.ImhNoPredictiveText
154 configParametersComponent.updateFreqMin = txtUpdateFreqMin.text;
160 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
161 font.pixelSize: 20; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
163 color: configParametersComponent.updateFreqEnabled? "#ffffff" :"#B8B8B8";
168 anchors.top: rowUpdateFreq.bottom
170 anchors.left: parent.left
171 anchors.leftMargin: 5
172 anchors.right: parent.right
177 id: checkboxUpdateWeekdays
178 source: configParametersComponent.updateWeekdaysOnly? "Library/images/checkbox_checked.png":"Library/images/checkbox_unchecked.png"
179 width: 32; height: 32
181 anchors.fill: parent;
183 configParametersComponent.updateWeekdaysOnly = !configParametersComponent.updateWeekdaysOnly;
190 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
191 font.pixelSize: 20; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
192 text: "Only on weekdays"
193 color: configParametersComponent.updateWeekdaysOnly? "#ffffff" :"#B8B8B8";
198 id: rowUpdateConnections
199 anchors.top: rowUpdateDays.bottom
201 anchors.left: parent.left
202 anchors.leftMargin: 5
203 anchors.right: parent.right
208 id: checkboxUpdateKnownConnections
209 source: configParametersComponent.updateOnSavedNetworksOnly? "Library/images/checkbox_checked.png":"Library/images/checkbox_unchecked.png"
210 width: 32; height: 32
212 anchors.fill: parent;
214 configParametersComponent.updateOnSavedNetworksOnly = !configParametersComponent.updateOnSavedNetworksOnly;
221 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
222 font.pixelSize: 20; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
223 text: "Only on saved Wifi connections"
224 color: configParametersComponent.updateOnSavedNetworksOnly? "#ffffff" :"#B8B8B8";
232 anchors.top: autoUpdateSection.bottom
233 //anchors.topMargin: 10
234 anchors.left: parent.left
235 anchors.leftMargin: 45
237 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
238 font.pixelSize: 22; font.bold: true; elide: Text.ElideRight; color: "#B8B8B8"; style: Text.Raised; styleColor: "black"
239 text: "RSS - News Feed"
245 border.color: "#BFBFBF"
247 anchors.top: newsSectionLabel.bottom
248 anchors.topMargin: 10
249 anchors.left: parent.left
250 anchors.leftMargin: 40
251 anchors.right: parent.right
252 anchors.rightMargin: 40
258 anchors.top: parent.top
260 anchors.left: parent.left
261 anchors.leftMargin: 5
262 anchors.right: parent.right
268 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
269 font.pixelSize: 20; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
276 width: parent.width*4/5
277 BorderImage { source: "Library/images/lineedit.sci"; anchors.fill: parent }
280 height: parent.height
281 anchors.left: parent.left
282 anchors.leftMargin: 10
283 anchors.right: parent.right
285 text: configParametersComponent.rssURL
286 horizontalAlignment: Text.AlignLeft
288 inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase
290 configParametersComponent.rssURL = txtRSSURL.text;