18 #include <qtimer.h> |
18 #include <qtimer.h> |
19 #include <hblistview.h> |
19 #include <hblistview.h> |
20 #include <hbsearchpanel.h> |
20 #include <hbsearchpanel.h> |
21 #include <hbaction.h> |
21 #include <hbaction.h> |
22 #include <hbprogressdialog.h> |
22 #include <hbprogressdialog.h> |
|
23 #include <hbscrollbar.h> |
23 |
24 |
24 #include "irsearchchannelsview.h" |
25 #include "irsearchchannelsview.h" |
25 #include "iruidefines.h" |
26 #include "iruidefines.h" |
26 #include "irqisdsclient.h" |
27 #include "irqisdsclient.h" |
27 #include "irapplication.h" |
28 #include "irapplication.h" |
108 |
109 |
109 void IRSearchChannelsView::loadLayout() |
110 void IRSearchChannelsView::loadLayout() |
110 { |
111 { |
111 // Create widget hierarchy |
112 // Create widget hierarchy |
112 setObjectName( SEARCH_CHANNELS_VIEW_OBJECT_VIEW ); |
113 setObjectName( SEARCH_CHANNELS_VIEW_OBJECT_VIEW ); |
113 iChannelModel = new IrChannelModel(this); |
|
114 // List existing root elements - this allows us to refer to objects in the XML |
114 // List existing root elements - this allows us to refer to objects in the XML |
115 // which are created outside the document. |
115 // which are created outside the document. |
116 QObjectList roots; |
116 QObjectList roots; |
117 roots.append( this ); |
117 roots.append( this ); |
118 iLoader.setObjectTree( roots ); |
118 iLoader.setObjectTree( roots ); |
119 iLoader.load(SEARCH_CHANNELS_VIEW_LAYOUT_FILENAME); |
119 iLoader.load(SEARCH_CHANNELS_VIEW_LAYOUT_FILENAME); |
|
120 |
120 iSearchPanelWidget = qobject_cast<HbSearchPanel *>(iLoader.findWidget(SEARCH_CHANNELS_VIEW_SEARCHPANEL_WIDGET)); |
121 iSearchPanelWidget = qobject_cast<HbSearchPanel *>(iLoader.findWidget(SEARCH_CHANNELS_VIEW_SEARCHPANEL_WIDGET)); |
121 iListView = qobject_cast<HbListView *>(iLoader.findWidget(SEARCH_CHANNELS_VIEW_SEARCHLISTVIEW_WIDGET)); |
122 |
|
123 iListView = qobject_cast<HbListView *>(iLoader.findWidget(SEARCH_CHANNELS_VIEW_SEARCHLISTVIEW_WIDGET)); |
|
124 iListView->setFlag(ItemIsFocusable); |
|
125 HbScrollBar *scrollbar = iListView->verticalScrollBar(); |
|
126 scrollbar->setVisible(true); |
|
127 scrollbar->setInteractive(true); |
|
128 iListView->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded); |
|
129 |
|
130 iChannelModel = new IrChannelModel(this); |
122 iListView->setModel(iChannelModel); |
131 iListView->setModel(iChannelModel); |
123 } |
132 } |
124 |
133 |
125 void IRSearchChannelsView::connectWidget() |
134 void IRSearchChannelsView::connectWidget() |
126 { |
135 { |
158 this, SLOT(presetLogoDownload(IRQPreset* ))); |
167 this, SLOT(presetLogoDownload(IRQPreset* ))); |
159 disconnect(iIsdsClient, SIGNAL(presetLogoDownloadError()), |
168 disconnect(iIsdsClient, SIGNAL(presetLogoDownloadError()), |
160 this, SLOT(presetLogoDownloadError())); |
169 this, SLOT(presetLogoDownloadError())); |
161 } |
170 } |
162 |
171 |
163 |
|
164 void IRSearchChannelsView::switch2InitState() |
172 void IRSearchChannelsView::switch2InitState() |
165 { |
173 { |
166 iLoader.load(SEARCH_CHANNELS_VIEW_LAYOUT_FILENAME,SEARCH_CHANNELS_VIEW_NO_LISTVIEW_SECTION); |
174 iLoader.load(SEARCH_CHANNELS_VIEW_LAYOUT_FILENAME,SEARCH_CHANNELS_VIEW_NO_LISTVIEW_SECTION); |
167 iSearchState = ESearch_init; |
175 iSearchState = ESearch_init; |
168 } |
176 } |
169 |
177 |
170 void IRSearchChannelsView::switch2SearchedState() |
178 void IRSearchChannelsView::switch2SearchedState() |
171 { |
179 { |
172 iLoader.load(SEARCH_CHANNELS_VIEW_LAYOUT_FILENAME,SEARCH_CHANNELS_VIEW_LISTVIEW_SECTION); |
|
173 iSearchState = ESearch_Searched; |
180 iSearchState = ESearch_Searched; |
174 } |
181 } |
|
182 |
175 void IRSearchChannelsView::switch2SearchingState() |
183 void IRSearchChannelsView::switch2SearchingState() |
176 { |
184 { |
|
185 iLoader.load(SEARCH_CHANNELS_VIEW_LAYOUT_FILENAME,SEARCH_CHANNELS_VIEW_LISTVIEW_SECTION); |
|
186 iSearchPanelWidget->clearFocus(); |
|
187 iListView->setFocus(); |
177 iSearchState = ESearch_Searching; |
188 iSearchState = ESearch_Searching; |
178 startSearchingAnimation(); |
189 startSearchingAnimation(); |
179 } |
190 } |
180 |
191 |
181 void IRSearchChannelsView::createSearchingDialog() |
192 void IRSearchChannelsView::createSearchingDialog() |
225 { |
236 { |
226 if (iIsdsClient) |
237 if (iIsdsClient) |
227 { |
238 { |
228 //once an item is selected, we show a dialog to prevent user from clicking the |
239 //once an item is selected, we show a dialog to prevent user from clicking the |
229 //item again |
240 //item again |
230 iPlayController->createBufferingDialog(this, SLOT(cancelRequest())); |
241 iApplication->createLoadingDialog(this, SLOT(cancelRequest())); |
231 |
242 |
232 if (iIsdsClient->isdsIsChannelBanner()) |
243 if (iIsdsClient->isdsIsChannelBanner()) |
233 { |
244 { |
234 iIsdsClient->isdsListenRequest(index + 1); |
245 iIsdsClient->isdsListenRequest(index + 1); |
235 } |
246 } |
264 |
275 |
265 if(EIR_UseNetwork_StartSearch == getUseNetworkReason()) |
276 if(EIR_UseNetwork_StartSearch == getUseNetworkReason()) |
266 { |
277 { |
267 Q_ASSERT( !iKeyText.isEmpty() ); |
278 Q_ASSERT( !iKeyText.isEmpty() ); |
268 iIsdsClient->isdsSearchRequest(iKeyText); |
279 iIsdsClient->isdsSearchRequest(iKeyText); |
|
280 iApplication->createLoadingDialog(this, SLOT(cancelRequest())); |
269 } |
281 } |
270 else if( EIR_UseNetwork_SelectItem == getUseNetworkReason() ) |
282 else if( EIR_UseNetwork_SelectItem == getUseNetworkReason() ) |
271 { |
283 { |
272 handleItemSelected(); |
284 handleItemSelected(); |
273 } |
285 } |
305 switch2SearchingState(); |
317 switch2SearchingState(); |
306 iIsdsClient->isdsSearchRequest(iKeyText); |
318 iIsdsClient->isdsSearchRequest(iKeyText); |
307 createSearchingDialog(); |
319 createSearchingDialog(); |
308 } |
320 } |
309 |
321 |
310 |
|
311 |
|
312 void IRSearchChannelsView::operationException(IRQError aError) |
322 void IRSearchChannelsView::operationException(IRQError aError) |
313 { |
323 { |
314 iApplication->closeConnectingDialog(); |
324 iApplication->closeLoadingDialog(); |
315 iPlayController->closeBufferingDialog(); |
|
316 closeSearchingDialog(); |
325 closeSearchingDialog(); |
317 stopSearchingAnimation(); |
326 stopSearchingAnimation(); |
318 iSearchState = ESearch_init; |
327 iSearchState = ESearch_init; |
319 |
328 |
320 QString errStr; |
329 QString errStr; |
365 } |
374 } |
366 } |
375 } |
367 |
376 |
368 void IRSearchChannelsView::dataChanged() |
377 void IRSearchChannelsView::dataChanged() |
369 { |
378 { |
370 iApplication->closeConnectingDialog(); |
379 iApplication->closeLoadingDialog(); |
371 stopSearchingAnimation(); |
380 stopSearchingAnimation(); |
372 |
381 |
373 //the following will remove into the stopSearchingAnimation() function |
382 //the following will remove into the stopSearchingAnimation() function |
374 closeSearchingDialog(); |
383 closeSearchingDialog(); |
375 switch2SearchedState(); |
384 switch2SearchedState(); |
376 iListView->reset(); |
385 iListView->reset(); |
377 iListView->setCurrentIndex(iChannelModel->index(0)); |
386 iListView->setCurrentIndex(iChannelModel->index(0)); |
378 iListView->scrollTo(iChannelModel->index(0)); |
387 iListView->scrollTo(iChannelModel->index(0)); |
379 GraphicsItemFlags flags = iListView->flags(); |
388 |
380 bool focusEnable = flags & QGraphicsItem::ItemIsFocusable; |
389 //we move the focus to the listview and the search panel will |
381 if( focusEnable ) |
390 //hide the virtual keyboard at the same time |
382 { |
391 iListView->setFocus(); |
383 //we move the focus to the listview and the search panel will |
|
384 //hide the virtual keyboard at the same time |
|
385 iListView->setFocus(Qt::OtherFocusReason); |
|
386 } |
|
387 |
392 |
388 iIconIndexArray.clear(); |
393 iIconIndexArray.clear(); |
389 //initialize the iconindices |
394 //initialize the iconindices |
390 for (int i = 0; i < iChannelModel->rowCount(); ++i) |
395 for (int i = 0; i < iChannelModel->rowCount(); ++i) |
391 { |
396 { |