36 #include <qdir.h> |
37 #include <qdir.h> |
37 #include <qsql.h> |
38 #include <qsql.h> |
38 #include <qsqldatabase.h> |
39 #include <qsqldatabase.h> |
39 #include <qsqlquery.h> |
40 #include <qsqlquery.h> |
40 #include <cpixcontentinfocommon.h> |
41 #include <cpixcontentinfocommon.h> |
41 #include "onlinehandler.h" |
42 |
42 const char *DELIMETER_DOCML = ":/xml/delimeterscreen.docml"; |
43 const char *DELIMETER_DOCML = ":/xml/delimeterscreen.docml"; |
43 const char *DIALOG = "dialog"; |
44 const char *DIALOG = "dialog"; |
44 const char *DATAFORM = "dataForm"; |
45 const char *DATAFORM = "dataForm"; |
45 |
46 |
46 //---------------------------------------------------------------------------------------------------------------------------- |
47 //---------------------------------------------------------------------------------------------------------------------------- |
54 { |
55 { |
55 for (int i = 0; i < 8; i++) |
56 for (int i = 0; i < 8; i++) |
56 { |
57 { |
57 mDeviceMapping.append(false); |
58 mDeviceMapping.append(false); |
58 } |
59 } |
59 |
|
60 mDeviceCategoryRefList = (QStringList() << "first" << "second" << "third" |
60 mDeviceCategoryRefList = (QStringList() << "first" << "second" << "third" |
61 << "fourth" << "fifth" << "sixth" << "seventh" << "eigth"); |
61 << "fourth" << "fifth" << "sixth" << "seventh" << "eigth"); |
62 |
62 |
63 mchangestate = true; |
63 mchangestate = true; |
64 mInstialize = true; |
64 mInstialize = true; |
65 isInternetSelected = false; |
65 isInternetSelected = false; |
66 |
|
67 storeDefaultSettings(); |
66 storeDefaultSettings(); |
68 } |
67 } |
69 //---------------------------------------------------------------------------------------------------------------------------- |
68 //---------------------------------------------------------------------------------------------------------------------------- |
70 //SettingsWidget::intialize() |
69 //SettingsWidget::intialize() |
71 // |
70 // |
234 = static_cast<HbRadioButtonList*> (formItem->dataItemContentWidget()); |
231 = static_cast<HbRadioButtonList*> (formItem->dataItemContentWidget()); |
235 |
232 |
236 connect(mradiolist, SIGNAL(itemSelected(int)), this, |
233 connect(mradiolist, SIGNAL(itemSelected(int)), this, |
237 SLOT(slotitemSelected(int))); |
234 SLOT(slotitemSelected(int))); |
238 } |
235 } |
|
236 setActionVisibility(); |
239 } |
237 } |
240 //---------------------------------------------------------------------------------------------------------------------------- |
238 //---------------------------------------------------------------------------------------------------------------------------- |
241 //SettingsWidget::preparecategories() |
239 //SettingsWidget::preparecategories() |
242 // |
240 // |
243 //---------------------------------------------------------------------------------------------------------------------------- |
241 //---------------------------------------------------------------------------------------------------------------------------- |
244 void SettingsWidget::preparecategories() |
242 void SettingsWidget::preparecategories() |
245 { |
243 { |
246 // read form database |
244 // read form database |
247 QString mConnectionName("cpixcontentinfo.sq"); |
245 |
248 QString mDatabaseName("c:\\Private\\2001f6fb\\cpixcontentinfo.sq"); |
246 mDeviceListDisplay.clear(); |
|
247 mCategoryList.clear(); |
|
248 mDeviceMapping.clear(); |
|
249 for (int i = 0; i < 8; i++) |
|
250 { |
|
251 mDeviceMapping.append(false); |
|
252 } |
|
253 mCategoryDbMapping.clear(); |
|
254 |
|
255 QString mConnectionName(QString::fromUtf16(KContentInfoFileName().Ptr(), |
|
256 KContentInfoFileName().Length())); |
|
257 QString mDatabaseName(QString::fromUtf16(KCIDBPath().Ptr(), |
|
258 KCIDBPath().Length()) + "\\" + mConnectionName); |
249 |
259 |
250 QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", mConnectionName); |
260 QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE", mConnectionName); |
251 db.setDatabaseName(mDatabaseName); |
261 db.setDatabaseName(mDatabaseName); |
252 |
262 |
253 QSqlQuery query(QSqlDatabase::database(mConnectionName)); |
263 QSqlQuery query(QSqlDatabase::database(mConnectionName)); |
254 QString statement = "SELECT NAME FROM table1"; |
264 QString statement = QString("SELECT * FROM ") + QString::fromUtf16( |
255 |
265 KContentInfoTableName().Ptr(), KContentInfoTableName().Length()); |
256 query.prepare(statement); |
266 query.prepare(statement); |
257 query.exec(); |
267 query.exec(); |
258 while (query.next()) |
268 while (query.next()) |
259 { |
269 { |
260 QString category_name = query.value(0).toString(); |
270 QString category_name = query.value(0).toString(); |
281 mCategoryDbMapping.insert("Notes", true); |
290 mCategoryDbMapping.insert("Notes", true); |
282 mCategoryDbMapping.insert("Applications", true); |
291 mCategoryDbMapping.insert("Applications", true); |
283 mCategoryDbMapping.insert("Bookmarks", true); |
292 mCategoryDbMapping.insert("Bookmarks", true); |
284 mCategoryDbMapping.insert("Files", true); */ |
293 mCategoryDbMapping.insert("Files", true); */ |
285 |
294 |
286 // mCategoryDbMapping.insert("email", true); // to remove once email starts working |
|
287 |
|
288 mDeviceListDisplay.append(hbTrId("txt_search_list_select_all")); |
295 mDeviceListDisplay.append(hbTrId("txt_search_list_select_all")); |
289 mDeviceMapping.insert(0, true); |
296 mDeviceMapping.insert(0, true); |
290 |
297 |
291 if (mCategoryDbMapping.value("Contacts")) |
298 if (mCategoryDbMapping.value("Contacts")) |
292 { |
299 { |
293 mDeviceMapping.insert(1, true); |
300 mDeviceMapping.insert(1, true); |
294 mDeviceListDisplay.append(hbTrId("txt_search_list_contatcs")); |
301 mDeviceListDisplay.append(hbTrId("txt_search_list_contatcs")); |
295 } |
302 } |
296 |
|
297 if (mCategoryDbMapping.value("Audios") || mCategoryDbMapping.value( |
303 if (mCategoryDbMapping.value("Audios") || mCategoryDbMapping.value( |
298 "Images") || mCategoryDbMapping.value("Videos")) |
304 "Images") || mCategoryDbMapping.value("Videos")) |
299 { |
305 { |
300 mDeviceListDisplay.append(hbTrId("txt_search_list_media")); |
306 mDeviceListDisplay.append(hbTrId("txt_search_list_media")); |
301 mDeviceMapping.insert(2, true); |
307 mDeviceMapping.insert(2, true); |
302 } |
308 } |
303 |
|
304 if (mCategoryDbMapping.value("Messages") || mCategoryDbMapping.value( |
309 if (mCategoryDbMapping.value("Messages") || mCategoryDbMapping.value( |
305 "email")) |
310 "email")) |
306 { |
311 { |
307 mDeviceListDisplay.append(hbTrId("txt_search_list_messagemail")); |
312 mDeviceListDisplay.append(hbTrId("txt_search_list_messagemail")); |
308 mDeviceMapping.insert(3, true); |
313 mDeviceMapping.insert(3, true); |
309 } |
314 } |
310 |
|
311 if (mCategoryDbMapping.value("Calendar") || mCategoryDbMapping.value( |
315 if (mCategoryDbMapping.value("Calendar") || mCategoryDbMapping.value( |
312 "Notes")) |
316 "Notes")) |
313 { |
317 { |
314 mDeviceListDisplay.append(hbTrId("txt_search_list_calendarnotes")); |
318 mDeviceListDisplay.append(hbTrId("txt_search_list_calendarnotes")); |
315 mDeviceMapping.insert(4, true); |
319 mDeviceMapping.insert(4, true); |
316 } |
320 } |
317 |
|
318 if (mCategoryDbMapping.value("Applications")) |
321 if (mCategoryDbMapping.value("Applications")) |
319 { |
322 { |
320 mDeviceListDisplay.append(hbTrId("txt_search_list_applications")); |
323 mDeviceListDisplay.append(hbTrId("txt_search_list_applications")); |
321 mDeviceMapping.insert(5, true); |
324 mDeviceMapping.insert(5, true); |
322 } |
325 } |
323 |
|
324 if (mCategoryDbMapping.value("Bookmarks")) |
326 if (mCategoryDbMapping.value("Bookmarks")) |
325 { |
327 { |
326 mDeviceListDisplay.append(hbTrId("txt_search_list_bookmarks")); |
328 mDeviceListDisplay.append(hbTrId("txt_search_list_bookmarks")); |
327 mDeviceMapping.insert(6, true); |
329 mDeviceMapping.insert(6, true); |
328 } |
330 } |
329 |
|
330 if (mCategoryDbMapping.value("Files")) |
331 if (mCategoryDbMapping.value("Files")) |
331 { |
332 { |
332 mDeviceListDisplay.append(hbTrId("txt_search_list_all_other_files")); |
333 mDeviceListDisplay.append(hbTrId("txt_search_list_all_other_files")); |
333 mDeviceMapping.insert(7, true); |
334 mDeviceMapping.insert(7, true); |
334 } |
335 } |
335 // internetCategoryList = (QStringList() << "Google" << "Bing" << "Yahoo"); |
|
336 |
336 |
337 if (mServiceProviders.count()) |
337 if (mServiceProviders.count()) |
338 { |
338 { |
339 mCategoryList = (QStringList() << hbTrId("txt_search_list_device") |
339 mCategoryList = (QStringList() << hbTrId("txt_search_list_device") |
340 << hbTrId("txt_search_list_internet")); |
340 << hbTrId("txt_search_list_internet")); |
342 else |
342 else |
343 { |
343 { |
344 mCategoryList = (QStringList() << hbTrId("txt_search_list_device")); |
344 mCategoryList = (QStringList() << hbTrId("txt_search_list_device")); |
345 } |
345 } |
346 } |
346 } |
347 |
|
348 //---------------------------------------------------------------------------------------------------------------------------- |
347 //---------------------------------------------------------------------------------------------------------------------------- |
349 //SettingsWidget::~SettingsWidget() |
348 //SettingsWidget::~SettingsWidget() |
350 // |
349 // |
351 //---------------------------------------------------------------------------------------------------------------------------- |
350 //---------------------------------------------------------------------------------------------------------------------------- |
352 SettingsWidget::~SettingsWidget() |
351 SettingsWidget::~SettingsWidget() |
353 { |
352 { |
354 delete signalMapper; |
353 delete signalMapper; |
355 //delete popup; |
|
356 //delete dataform; |
|
357 delete mModel; |
354 delete mModel; |
358 //delete mradiolist; |
|
359 mDeviceCheckBoxList.clear(); |
355 mDeviceCheckBoxList.clear(); |
360 mInternetCheckBoxList.clear(); |
356 mInternetCheckBoxList.clear(); |
361 mModelItemList.clear(); |
357 mModelItemList.clear(); |
362 mActions.clear(); |
358 mActions.clear(); |
363 delete mDocumentLoader; |
359 delete mDocumentLoader; |
364 delete mInternetHandler; |
360 delete mInternetHandler; |
365 //delete popup; |
|
366 } |
361 } |
367 //---------------------------------------------------------------------------------------------------------------------------- |
362 //---------------------------------------------------------------------------------------------------------------------------- |
368 //SettingsWidget::launchSettingWidget() |
363 //SettingsWidget::launchSettingWidget() |
369 // |
364 // |
370 //---------------------------------------------------------------------------------------------------------------------------- |
365 //---------------------------------------------------------------------------------------------------------------------------- |
390 for (int i = 0; i < mDeviceCheckBoxList.count(); i++) |
396 for (int i = 0; i < mDeviceCheckBoxList.count(); i++) |
391 { |
397 { |
392 if (mDeviceCheckBoxList.at(i)->checkState() == Qt::Checked) |
398 if (mDeviceCheckBoxList.at(i)->checkState() == Qt::Checked) |
393 { |
399 { |
394 noItemSelected = false; |
400 noItemSelected = false; |
|
401 break; |
395 } |
402 } |
396 } |
403 } |
397 if (!isInternetSelected) |
404 if (!isInternetSelected) |
398 { |
405 { |
399 mActions.at(0)->setVisible(true); |
406 mActions.at(0)->setVisible(true); |
400 |
|
401 if (noItemSelected) |
407 if (noItemSelected) |
402 { |
408 { |
403 mActions.at(0)->setVisible(false); |
409 mActions.at(0)->setVisible(false); |
404 } |
410 } |
|
411 } |
|
412 else |
|
413 { |
|
414 mActions.at(0)->setVisible(true); |
405 } |
415 } |
406 } |
416 } |
407 //---------------------------------------------------------------------------------------------------------------------------- |
417 //---------------------------------------------------------------------------------------------------------------------------- |
408 //SettingsWidget::itemChecked( int selectedIndex) |
418 //SettingsWidget::itemChecked( int selectedIndex) |
409 // |
419 // |
592 appSettings.setValue("devicecount", mDeviceCategoryRefList.count()); |
597 appSettings.setValue("devicecount", mDeviceCategoryRefList.count()); |
593 for (int i = 0; i < mDeviceCategoryRefList.count(); i++) |
598 for (int i = 0; i < mDeviceCategoryRefList.count(); i++) |
594 appSettings.setValue(mDeviceCategoryRefList.at(i), 1); |
599 appSettings.setValue(mDeviceCategoryRefList.at(i), 1); |
595 } |
600 } |
596 } |
601 } |
|
602 //---------------------------------------------------------------------------------------------------------------------------- |
|
603 //void SettingsWidget::slotproviderDetails() |
|
604 // |
|
605 //---------------------------------------------------------------------------------------------------------------------------- |
597 void SettingsWidget::slotproviderDetails(QString name, HbIcon icon, int id) |
606 void SettingsWidget::slotproviderDetails(QString name, HbIcon icon, int id) |
598 { |
607 { |
599 mServiceProviders.insert(id, name); |
608 mServiceProviders.insert(id, name); |
600 emit ISProvidersIcon(icon, id); |
609 emit ISProvidersIcon(icon, id); |
601 } |
610 } |
|
611 //---------------------------------------------------------------------------------------------------------------------------- |
|
612 //void SettingsWidget::slotdefaultProvider() |
|
613 // |
|
614 //---------------------------------------------------------------------------------------------------------------------------- |
602 void SettingsWidget::slotdefaultProvider(const int value) |
615 void SettingsWidget::slotdefaultProvider(const int value) |
603 { |
616 { |
604 mSelectedProvider = value; |
617 mSelectedProvider = value; |
605 } |
618 } |
|
619 //---------------------------------------------------------------------------------------------------------------------------- |
|
620 //void SettingsWidget::slotitemSelected() |
|
621 // |
|
622 //---------------------------------------------------------------------------------------------------------------------------- |
606 void SettingsWidget::slotitemSelected(int value) |
623 void SettingsWidget::slotitemSelected(int value) |
607 { |
624 { |
608 QMapIterator<int, QString> i(mServiceProviders); |
625 QMapIterator<int, QString> i(mServiceProviders); |
609 int selectedindex = 0; |
626 int selectedindex = 0; |
610 while (i.hasNext()) |
627 while (i.hasNext()) |