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/topfinstories"
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);
84 anchors.top: parent.top
85 anchors.left: parent.left
86 anchors.leftMargin: 35
88 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
89 font.pixelSize: 22; font.bold: true; elide: Text.ElideRight; color: "#B8B8B8"; style: Text.Raised; styleColor: "black"
96 border.color: "#BFBFBF"
98 anchors.top: newsSectionLabel.bottom
100 anchors.left: parent.left
101 anchors.leftMargin: 30
102 anchors.right: parent.right
103 anchors.rightMargin: 30
109 //anchors.top: parent.top
110 //anchors.topMargin: 5
111 anchors.verticalCenter: parent.verticalCenter
112 anchors.left: parent.left
113 anchors.leftMargin: 5
114 anchors.right: parent.right
120 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
121 font.pixelSize: 20; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
128 //updateConfig.width > updateConfig.height?
129 width: parent.width*3/4
130 BorderImage { source: "Library/images/lineedit.sci"; anchors.fill: parent }
133 height: parent.height
134 anchors.left: parent.left
135 anchors.leftMargin: 10
136 anchors.right: parent.right
137 anchors.verticalCenter: parent.verticalCenter
139 text: configParametersComponent.rssURL
140 horizontalAlignment: Text.AlignLeft
142 inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase
144 configParametersComponent.rssURL = txtRSSURL.text;
152 id: autoUpdateSectionLabel
153 anchors.top: newsSection.bottom
154 //anchors.topMargin: 10
155 anchors.left: parent.left
156 anchors.leftMargin: 35
158 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
159 font.pixelSize: 22; font.bold: true; elide: Text.ElideRight; color: "#B8B8B8"; style: Text.Raised; styleColor: "black"
164 id: autoUpdateSection
166 border.color: "#BFBFBF"
168 anchors.top: autoUpdateSectionLabel.bottom
169 anchors.topMargin: 10
170 anchors.left: parent.left
171 anchors.leftMargin: 30
172 anchors.right: parent.right
173 anchors.rightMargin: 30
179 anchors.top: parent.top
181 anchors.left: parent.left
182 anchors.leftMargin: 5
183 anchors.right: parent.right
188 id: checkboxUpdateFreqImg
189 source: configParametersComponent.updateFreqEnabled? "Library/images/checkbox_checked.png":"Library/images/checkbox_unchecked.png"
190 width: 32; height: 32
192 anchors.fill: parent;
194 configParametersComponent.updateFreqEnabled = !configParametersComponent.updateFreqEnabled;
195 if (!configParametersComponent.updateFreqEnabled){
196 txtUpdateFreqMin.text = "";
197 configParametersComponent.updateWeekdaysOnly = false;
205 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
206 font.pixelSize: 20; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
208 color: configParametersComponent.updateFreqEnabled? "#ffffff" :"#B8B8B8";
213 BorderImage { source: "Library/images/lineedit.sci"; anchors.fill: parent }
218 text: configParametersComponent.updateFreqMin
219 horizontalAlignment: Text.AlignHCenter
221 inputMethodHints: Qt.ImhDigitsOnly | Qt.ImhNoPredictiveText
223 configParametersComponent.updateFreqMin = txtUpdateFreqMin.text;
229 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
230 font.pixelSize: 20; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
232 color: configParametersComponent.updateFreqEnabled? "#ffffff" :"#B8B8B8";
237 anchors.top: rowUpdateFreq.bottom
239 anchors.left: parent.left
240 anchors.leftMargin: 5
241 anchors.right: parent.right
246 id: checkboxUpdateWeekdays
247 source: configParametersComponent.updateWeekdaysOnly? "Library/images/checkbox_checked.png":"Library/images/checkbox_unchecked.png"
248 width: 32; height: 32
250 anchors.fill: parent;
252 configParametersComponent.updateWeekdaysOnly = !configParametersComponent.updateWeekdaysOnly;
259 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
260 font.pixelSize: 20; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
261 text: "Only on weekdays"
262 color: configParametersComponent.updateWeekdaysOnly? "#ffffff" :"#B8B8B8";
267 id: rowUpdateConnections
268 anchors.top: rowUpdateDays.bottom
270 anchors.left: parent.left
271 anchors.leftMargin: 5
272 anchors.right: parent.right
277 id: checkboxUpdateKnownConnections
278 source: configParametersComponent.updateOnSavedNetworksOnly? "Library/images/checkbox_checked.png":"Library/images/checkbox_unchecked.png"
279 width: 32; height: 32
281 anchors.fill: parent;
283 configParametersComponent.updateOnSavedNetworksOnly = !configParametersComponent.updateOnSavedNetworksOnly;
290 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
291 font.pixelSize: 20; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
292 text: "Only on saved Wifi connections"
293 color: configParametersComponent.updateOnSavedNetworksOnly? "#ffffff" :"#B8B8B8";