26 #include <hbmainwindow.h> |
26 #include <hbmainwindow.h> |
27 #include <hbaction.h> |
27 #include <hbaction.h> |
28 #include <hbinstance.h> |
28 #include <hbinstance.h> |
29 #include <tstasksettings.h> |
29 #include <tstasksettings.h> |
30 #include <hbshrinkingvkbhost.h> |
30 #include <hbshrinkingvkbhost.h> |
|
31 #include <qinputcontext.h> |
|
32 |
31 const char *SEARCHSTATEPROVIDER_DOCML = ":/xml/searchstateprovider.docml"; |
33 const char *SEARCHSTATEPROVIDER_DOCML = ":/xml/searchstateprovider.docml"; |
32 const char *TOC_VIEW = "tocView"; |
34 const char *TOC_VIEW = "tocView"; |
33 const char *TUT_SEARCHPANEL_WIDGET = "searchPanel"; |
35 const char *TUT_SEARCHPANEL_WIDGET = "searchPanel"; |
34 const char *TUT_LIST_VIEW = "listView"; |
36 const char *TUT_LIST_VIEW = "listView"; |
35 |
37 |
38 |
40 |
39 // --------------------------------------------------------------------------- |
41 // --------------------------------------------------------------------------- |
40 // SearchUiLoader::SearchUiLoader |
42 // SearchUiLoader::SearchUiLoader |
41 // --------------------------------------------------------------------------- |
43 // --------------------------------------------------------------------------- |
42 SearchUiLoader::SearchUiLoader() : |
44 SearchUiLoader::SearchUiLoader() : |
43 mDocumentLoader(NULL), mView(NULL), mListWidget(NULL), mSearchPanel(NULL),mClient(NULL) |
45 mDocumentLoader(NULL), mView(NULL), mListWidget(NULL), |
|
46 mSearchPanel(NULL), mClient(NULL), mMainWindow(NULL) |
44 { |
47 { |
45 bool ok = false; |
48 bool ok = false; |
46 |
49 |
47 mDocumentLoader = new HbDocumentLoader(); |
50 mDocumentLoader = new HbDocumentLoader(); |
48 |
51 |
94 mSearchPanel->setInputMethodHints(hints); |
97 mSearchPanel->setInputMethodHints(hints); |
95 mSearchPanel->setSearchOptionsEnabled(true); |
98 mSearchPanel->setSearchOptionsEnabled(true); |
96 mSearchPanel->setCancelEnabled(false); |
99 mSearchPanel->setCancelEnabled(false); |
97 } |
100 } |
98 |
101 |
99 mMainWindow = hbInstance->allMainWindows().at(0); |
102 mMainWindow = new SearchMainWindow(); |
|
103 connect(mMainWindow, SIGNAL(bringvkb()), this, SLOT(slotbringvkb())); |
|
104 |
100 HbAction *action = new HbAction(Hb::DoneNaviAction); |
105 HbAction *action = new HbAction(Hb::DoneNaviAction); |
101 connect(action, SIGNAL(triggered()), this, SLOT(slotsendtobackground())); |
106 connect(action, SIGNAL(triggered()), this, SLOT(slotsendtobackground())); |
102 mView->setNavigationAction(action); |
107 mView->setNavigationAction(action); |
|
108 |
103 mVirtualKeyboard = new HbShrinkingVkbHost(mView); |
109 mVirtualKeyboard = new HbShrinkingVkbHost(mView); |
104 QCoreApplication::instance()->installEventFilter(this); |
110 |
|
111 mBringtoForground = true; |
105 } |
112 } |
106 // --------------------------------------------------------------------------- |
113 // --------------------------------------------------------------------------- |
107 // SearchUiLoader::~SearchUiLoader |
114 // SearchUiLoader::~SearchUiLoader |
108 // --------------------------------------------------------------------------- |
115 // --------------------------------------------------------------------------- |
109 SearchUiLoader::~SearchUiLoader() |
116 SearchUiLoader::~SearchUiLoader() |
110 { |
117 { |
111 QCoreApplication::instance()->removeEventFilter(this); |
118 delete mMainWindow; |
112 |
119 delete mDocumentLoader; |
113 if (mDocumentLoader) |
|
114 { |
|
115 delete mDocumentLoader; |
|
116 } |
|
117 delete mClient; |
120 delete mClient; |
118 } |
121 } |
119 // --------------------------------------------------------------------------- |
122 // --------------------------------------------------------------------------- |
120 // SearchUiLoader::slotsendtobackground |
123 // SearchUiLoader::slotsendtobackground |
121 // --------------------------------------------------------------------------- |
124 // --------------------------------------------------------------------------- |
125 mClient = new TsTaskSettings; |
128 mClient = new TsTaskSettings; |
126 mClient->setVisibility(false); |
129 mClient->setVisibility(false); |
127 mListWidget->clear(); |
130 mListWidget->clear(); |
128 mSearchPanel->setCriteria(QString()); |
131 mSearchPanel->setCriteria(QString()); |
129 mMainWindow->lower(); |
132 mMainWindow->lower(); |
|
133 mBringtoForground = true; |
130 } |
134 } |
131 // --------------------------------------------------------------------------- |
135 // --------------------------------------------------------------------------- |
132 // SearchUiLoader::event |
136 // SearchUiLoader::slotbringvkb |
133 // --------------------------------------------------------------------------- |
137 // --------------------------------------------------------------------------- |
134 bool SearchUiLoader::eventFilter(QObject *obj, QEvent *event) |
138 void SearchUiLoader::slotbringvkb() |
135 { |
139 { |
136 if (event->type() == QEvent::ApplicationActivate) |
140 if (mBringtoForground) |
137 { |
141 { |
138 if (!mClient) |
142 if (!mClient) |
139 mClient = new TsTaskSettings; |
143 mClient = new TsTaskSettings; |
140 mClient->setVisibility(true); |
144 mClient->setVisibility(true); |
141 if (!(mListWidget->count())) |
145 mSearchPanel->setFocus(); |
142 mSearchPanel->setFocus(); |
146 QInputContext *ic = qApp->inputContext(); |
143 return true; |
147 if (ic) |
|
148 { |
|
149 mBringtoForground = false; |
|
150 QEvent *event = new QEvent(QEvent::RequestSoftwareInputPanel); |
|
151 ic->filterEvent(event); |
|
152 delete event; |
|
153 } |
144 } |
154 } |
145 return QObject::eventFilter(obj, event); |
|
146 } |
155 } |
|
156 // --------------------------------------------------------------------------- |
|
157 // SearchMainWindow::slotViewReady |
|
158 // --------------------------------------------------------------------------- |
|
159 void SearchMainWindow::slotViewReady() |
|
160 { |
|
161 emit bringvkb(); |
|
162 } |