|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implements the wizard activation and interactions. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "searchsettingsstate.h" |
|
19 |
|
20 #include <hbdocumentloader.h> |
|
21 #include <hbview.h> |
|
22 #include <hblabel.h> |
|
23 #include <hbstackedwidget.h> |
|
24 #include <hbicon.h> |
|
25 #include <hbinstance.h> |
|
26 #include <hbaction.h> |
|
27 #include <hbgridview.h> |
|
28 #include <qstandarditemmodel.h> |
|
29 #include <qdebug.h> |
|
30 #include <qgraphicswidget.h> |
|
31 #include <qdir.h> |
|
32 #include"settingswidget.h" |
|
33 |
|
34 const char *WIZARD_VIEW = "tocView"; |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // SearchSettingsState::SearchSettingsState |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 SearchSettingsState::SearchSettingsState(QState *parent) : |
|
41 QState(parent), mDocumentLoader(NULL) |
|
42 { |
|
43 minitialCount = true; |
|
44 mWidget = new SettingsWidget(); |
|
45 |
|
46 connect(mWidget, SIGNAL(settingsEvent(bool)), this, SLOT(handleBackEvent(bool))); |
|
47 |
|
48 connect(mWidget, SIGNAL(selectedItemCategory(int, bool)), this, |
|
49 SLOT(getItemCategory(int, bool))); |
|
50 |
|
51 } |
|
52 // --------------------------------------------------------------------------- |
|
53 // SearchSettingsState::_selectedcategory |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 void SearchSettingsState::getItemCategory(int str, bool avalue) |
|
57 { |
|
58 emit publishSelectedCategory(str, avalue); |
|
59 } |
|
60 |
|
61 // --------------------------------------------------------------------------- |
|
62 // SearchSettingsState::~SearchSettingsState |
|
63 // --------------------------------------------------------------------------- |
|
64 // |
|
65 SearchSettingsState::~SearchSettingsState() |
|
66 { |
|
67 delete mDocumentLoader; |
|
68 // delete mWidget; |
|
69 |
|
70 } |
|
71 |
|
72 // --------------------------------------------------------------------------- |
|
73 // SearchSettingsState::onEntry |
|
74 // --------------------------------------------------------------------------- |
|
75 // |
|
76 void SearchSettingsState::onEntry(QEvent *event) |
|
77 { |
|
78 qDebug() << "search:SearchSettingsState::onEntry"; |
|
79 QState::onEntry(event); |
|
80 if (minitialCount) |
|
81 { |
|
82 mWidget->loadSettingsFrominiFile(); |
|
83 isInternetOn(); |
|
84 minitialCount = false; |
|
85 emit backEventTriggered(); |
|
86 } |
|
87 else |
|
88 { |
|
89 |
|
90 mWidget->launchSettingWidget(); |
|
91 } |
|
92 } |
|
93 |
|
94 // --------------------------------------------------------------------------- |
|
95 // SearchSettingsState::onExit |
|
96 // --------------------------------------------------------------------------- |
|
97 // |
|
98 void SearchSettingsState::onExit(QEvent *event) |
|
99 { |
|
100 QState::onExit(event); |
|
101 |
|
102 } |
|
103 |
|
104 void SearchSettingsState::handleBackEvent(bool aStatus) |
|
105 { |
|
106 emit backEventTriggered(); |
|
107 if (mWidget) |
|
108 { |
|
109 isInternetOn(); |
|
110 emit clickstatus(aStatus); |
|
111 } |
|
112 } |
|
113 // --------------------------------------------------------------------------- |
|
114 // SearchSettingsState::isInternetOn |
|
115 // --------------------------------------------------------------------------- |
|
116 // |
|
117 void SearchSettingsState::isInternetOn() |
|
118 { |
|
119 if (mWidget->isInternetSearchOptionSelected()) |
|
120 { |
|
121 emit customizeGoButton(true); |
|
122 } |
|
123 else |
|
124 { |
|
125 emit customizeGoButton(false); |
|
126 } |
|
127 } |
|
128 |