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 int fontSizeMed: 24
16 property int fontSizeSmall: 20
18 //property bool updateOnSavedNetworksOnly
19 property string rssURL: "http://finance.yahoo.com/rss/topfinstories"
20 signal logRequest(string strMessage)
27 Component.onCompleted: {
28 DBUtility.initialize();
32 Component.onDestruction:{
33 logRequest("Saving settings");
37 function loadSettings(){
39 value = DBUtility.getSetting("UpdateFreqency");
40 if (!value || value === "0.0" || value === "" || isNaN(value)){
41 configParametersComponent.updateFreqEnabled = false;
44 configParametersComponent.updateFreqEnabled = true;
45 configParametersComponent.updateFreqMin = parseInt(value);
47 value = DBUtility.getSetting("UpdateWeekdaysOnly");
48 if (!value || value === "0.0" || value === ""|| !configParametersComponent.updateFreqEnabled){
49 configParametersComponent.updateWeekdaysOnly = false;
52 configParametersComponent.updateWeekdaysOnly = true;
56 value = DBUtility.getSetting("UpdateOnSavedNetworksOnly");
57 if (!value || value == "0.0" || value === ""){
58 configParametersComponent.updateOnSavedNetworksOnly = false;
61 configParametersComponent.updateOnSavedNetworksOnly = true;
65 value = DBUtility.getSetting("RSSURL");
66 if (!value || value === "Unknown" || value === ""){
67 //configParametersComponent.rssURL = configParametersComponent.defaultRSSFeed;
70 configParametersComponent.rssURL = value;
74 function saveSettings(){
75 if (isNaN(configParametersComponent.updateFreqMin))
76 DBUtility.setSetting("UpdateFreqency","");
78 DBUtility.setSetting("UpdateFreqency",configParametersComponent.updateFreqMin);
80 DBUtility.setSetting("UpdateWeekdaysOnly",(configParametersComponent.updateWeekdaysOnly?1:0));
81 //DBUtility.setSetting("UpdateOnSavedNetworksOnly",(configParametersComponent.updateOnSavedNetworksOnly?1:0));
82 DBUtility.setSetting("RSSURL",configParametersComponent.rssURL);
87 anchors.top: parent.top
88 anchors.left: parent.left
89 anchors.leftMargin: 35
91 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
92 font.pixelSize: fontSizeMed; font.bold: true; elide: Text.ElideRight; color: "#B8B8B8"; style: Text.Raised; styleColor: "black"
99 border.color: "#BFBFBF"
101 anchors.top: newsSectionLabel.bottom
102 anchors.topMargin: 10
103 anchors.left: parent.left
104 anchors.leftMargin: 30
105 anchors.right: parent.right
106 anchors.rightMargin: 30
112 //anchors.top: parent.top
113 //anchors.topMargin: 5
114 anchors.verticalCenter: parent.verticalCenter
115 anchors.left: parent.left
116 anchors.leftMargin: 5
117 anchors.right: parent.right
123 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
124 font.pixelSize: fontSizeSmall; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
131 //updateConfig.width > updateConfig.height?
132 width: parent.width*3/4
133 BorderImage { source: "Library/images/lineedit.sci"; anchors.fill: parent }
136 height: parent.height
137 anchors.left: parent.left
138 anchors.leftMargin: 10
139 anchors.right: parent.right
140 anchors.verticalCenter: parent.verticalCenter
142 text: configParametersComponent.rssURL
143 horizontalAlignment: Text.AlignLeft
145 inputMethodHints: Qt.ImhNoAutoUppercase | Qt.ImhPreferLowercase
147 configParametersComponent.rssURL = txtRSSURL.text;
155 id: autoUpdateSectionLabel
156 anchors.top: newsSection.bottom
157 anchors.topMargin: 20
158 anchors.left: parent.left
159 anchors.leftMargin: 35
161 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
162 font.pixelSize: fontSizeMed; font.bold: true; elide: Text.ElideRight; color: "#B8B8B8"; style: Text.Raised; styleColor: "black"
163 text: "Auto-Update *"
167 id: autoUpdateSection
169 border.color: "#BFBFBF"
171 anchors.top: autoUpdateSectionLabel.bottom
172 anchors.topMargin: 10
173 anchors.left: parent.left
174 anchors.leftMargin: 30
175 anchors.right: parent.right
176 anchors.rightMargin: 30
182 anchors.top: parent.top
184 anchors.left: parent.left
185 anchors.leftMargin: 5
186 anchors.right: parent.right
191 id: checkboxUpdateFreqImg
192 source: configParametersComponent.updateFreqEnabled? "Library/images/checkbox_checked.png":"Library/images/checkbox_unchecked.png"
193 width: 32; height: 32
195 anchors.fill: parent;
197 configParametersComponent.updateFreqEnabled = !configParametersComponent.updateFreqEnabled;
198 if (!configParametersComponent.updateFreqEnabled){
199 txtUpdateFreqMin.text = "";
200 configParametersComponent.updateWeekdaysOnly = false;
208 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
209 font.pixelSize: fontSizeSmall; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
211 color: configParametersComponent.updateFreqEnabled? "#ffffff" :"#B8B8B8";
216 BorderImage { source: "Library/images/lineedit.sci"; anchors.fill: parent }
221 text: configParametersComponent.updateFreqMin
222 horizontalAlignment: Text.AlignHCenter
224 inputMethodHints: Qt.ImhDigitsOnly | Qt.ImhNoPredictiveText
226 configParametersComponent.updateFreqMin = txtUpdateFreqMin.text;
232 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
233 font.pixelSize: fontSizeSmall; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
235 color: configParametersComponent.updateFreqEnabled? "#ffffff" :"#B8B8B8";
240 anchors.top: rowUpdateFreq.bottom
242 anchors.left: parent.left
243 anchors.leftMargin: 5
244 anchors.right: parent.right
249 id: checkboxUpdateWeekdays
250 source: configParametersComponent.updateWeekdaysOnly? "Library/images/checkbox_checked.png":"Library/images/checkbox_unchecked.png"
251 width: 32; height: 32
253 anchors.fill: parent;
255 configParametersComponent.updateWeekdaysOnly = !configParametersComponent.updateWeekdaysOnly;
262 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
263 font.pixelSize: fontSizeSmall; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
264 text: "Only on weekdays"
265 color: configParametersComponent.updateWeekdaysOnly? "#ffffff" :"#B8B8B8";
270 id: rowUpdateConnections
271 anchors.top: rowUpdateDays.bottom
273 anchors.left: parent.left
274 anchors.leftMargin: 5
275 anchors.right: parent.right
280 id: checkboxUpdateKnownConnections
281 source: configParametersComponent.updateOnSavedNetworksOnly? "Library/images/checkbox_checked.png":"Library/images/checkbox_unchecked.png"
282 width: 32; height: 32
284 anchors.fill: parent;
286 configParametersComponent.updateOnSavedNetworksOnly = !configParametersComponent.updateOnSavedNetworksOnly;
293 horizontalAlignment: Text.AlignLeft; verticalAlignment: Text.AlignVCenter
294 font.pixelSize: fontSizeSmall; font.bold: false; elide: Text.ElideRight; style: Text.Raised; styleColor: "black"
295 text: "Only on saved Wifi connections"
296 color: configParametersComponent.updateOnSavedNetworksOnly? "#ffffff" :"#B8B8B8";
307 anchors.bottom: parent.bottom
311 text: "* Quotes will be auto-updated only when the application/widget is running."
312 horizontalAlignment: Text.AlignRight; verticalAlignment: Text.AlignVCenter
313 width: parent.width; font.pixelSize: 12; elide: Text.ElideRight;
315 style: Text.Raised; styleColor: "black"