qtinternetradio/ui/src/irsearchchannelsview.cpp
branchGCC_SURGE
changeset 13 c9471d26c7f2
parent 12 608f67c22514
child 14 896e9dbc5f19
equal deleted inserted replaced
9:bfc95e24a059 13:c9471d26c7f2
    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> 
       
    24 #include <hbiconitem.h>
       
    25 #include <hbiconanimator.h>
       
    26 #include <hblabel.h> 
       
    27 #include <hbiconanimationmanager.h>
       
    28 #include <HbGroupBox>
    23 
    29 
    24 #include "irsearchchannelsview.h"
    30 #include "irsearchchannelsview.h"
    25 #include "iruidefines.h"
    31 #include "iruidefines.h"
    26 #include "irqisdsclient.h"
    32 #include "irqisdsclient.h"
    27 #include "irapplication.h"
    33 #include "irapplication.h"
    29 #include "irqnetworkcontroller.h"
    35 #include "irqnetworkcontroller.h"
    30 #include "irchannelmodel.h"
    36 #include "irchannelmodel.h"
    31 #include "irqisdsdatastructure.h"
    37 #include "irqisdsdatastructure.h"
    32 #include "irplaycontroller.h"
    38 #include "irplaycontroller.h"
    33  
    39  
    34 const uint KBitmapSize = 59; 
    40 const uint KBitmapSize = 59;
    35 
    41 
    36 IRSearchChannelsView::IRSearchChannelsView(IRApplication* aApplication,
    42 IRSearchChannelsView::IRSearchChannelsView(IRApplication* aApplication,
    37         TIRViewId aViewId): IRBaseView(aApplication, aViewId),
    43         TIRViewId aViewId): IRBaseView(aApplication, aViewId),
    38         iListView(NULL),iSearchPanelWidget(NULL),
    44         iListView(NULL),iSearchPanelWidget(NULL),iSearchState(ESearch_init),
    39         iSearchState(ESearch_init),iChannelModel(NULL),iSearchingDialog(NULL),
    45         iChannelModel(NULL),iPreset(NULL),iLogoPreset(NULL),
    40         iPreset(NULL),iLogoPreset(NULL),iConvertTimer(NULL)
    46         iConvertTimer(NULL) 
    41 {
    47 {
    42     //if this view is not starting view, finish all initialization in constructor
    48     //if this view is not starting view, finish all initialization in constructor
    43     if (getViewManager()->views().count() > 0)
    49     if (getViewManager()->views().count() > 0)
    44     {
    50     {
    45         if (!initCompleted())
    51         if (!initCompleted())
    71     }
    77     }
    72 }
    78 }
    73 
    79 
    74 void IRSearchChannelsView::initMenu()
    80 void IRSearchChannelsView::initMenu()
    75 {
    81 {
    76 
    82     HbMenu *viewMenu = menu();
       
    83     QObject *exitAction = iLoader.findObject(EXIT_ACTION);
       
    84     connect(exitAction, SIGNAL(triggered()), iApplication, SIGNAL(quit()));
    77 }
    85 }
    78 
    86 
    79 void IRSearchChannelsView::initTimer()
    87 void IRSearchChannelsView::initTimer()
    80 {     
    88 {     
    81     iConvertTimer = new QTimer(this);
    89     iConvertTimer = new QTimer(this);
    82     iConvertTimer->setInterval(10); 
    90     iConvertTimer->setInterval(10); 
    83     
    91     
    84     connect(iConvertTimer, SIGNAL(timeout()), this, SLOT(convertAnother()));
    92     connect(iConvertTimer, SIGNAL(timeout()), this, SLOT(convertAnother()));
    85 }
    93 }
    86 
    94 
       
    95  
       
    96 
    87 IRSearchChannelsView::~IRSearchChannelsView()
    97 IRSearchChannelsView::~IRSearchChannelsView()
    88 {
    98 {   
    89     if( iSearchingDialog != NULL )
       
    90     {
       
    91         iSearchingDialog->close();
       
    92         delete iSearchingDialog;
       
    93         iSearchingDialog = NULL;
       
    94     }
       
    95     
       
    96     if( iPreset != NULL )
    99     if( iPreset != NULL )
    97     {
   100     {
    98         delete iPreset;
   101         delete iPreset;
    99         iPreset = NULL;
   102         iPreset = NULL;
   100     }
   103     }
   102     if( iLogoPreset != NULL )
   105     if( iLogoPreset != NULL )
   103     {
   106     {
   104         delete iLogoPreset;
   107         delete iLogoPreset;
   105         iLogoPreset = NULL;
   108         iLogoPreset = NULL;
   106     }
   109     }
       
   110     
       
   111     if( NULL != iChannelModel )
       
   112     {
       
   113         iChannelModel->save2Cache();
       
   114     }
       
   115  
   107 }
   116 }
   108 
   117 
   109 void IRSearchChannelsView::loadLayout()
   118 void IRSearchChannelsView::loadLayout()
   110 {
   119 {
   111     // Create widget hierarchy
   120     // Create widget hierarchy
   112     setObjectName( SEARCH_CHANNELS_VIEW_OBJECT_VIEW );
   121     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 
   122     // List existing root elements - this allows us to refer to objects in the XML 
   115     // which are created outside the document.
   123     // which are created outside the document.
   116     QObjectList roots;
   124     QObjectList roots;
   117     roots.append( this );
   125     roots.append( this );
   118     iLoader.setObjectTree( roots );
   126     iLoader.setObjectTree( roots );
   119     iLoader.load(SEARCH_CHANNELS_VIEW_LAYOUT_FILENAME);
   127     iLoader.load(SEARCH_CHANNELS_VIEW_LAYOUT_FILENAME);   
       
   128     
   120     iSearchPanelWidget = qobject_cast<HbSearchPanel *>(iLoader.findWidget(SEARCH_CHANNELS_VIEW_SEARCHPANEL_WIDGET));    
   129     iSearchPanelWidget = qobject_cast<HbSearchPanel *>(iLoader.findWidget(SEARCH_CHANNELS_VIEW_SEARCHPANEL_WIDGET));    
   121     iListView = qobject_cast<HbListView *>(iLoader.findWidget(SEARCH_CHANNELS_VIEW_SEARCHLISTVIEW_WIDGET));     
   130     
   122     iListView->setModel(iChannelModel);
   131     iListView = qobject_cast<HbListView *>(iLoader.findWidget(SEARCH_CHANNELS_VIEW_SEARCHLISTVIEW_WIDGET));   
       
   132     iListView->setFlag(ItemIsFocusable);
       
   133     HbScrollBar *scrollbar = iListView->verticalScrollBar();
       
   134     scrollbar->setVisible(true);
       
   135     scrollbar->setInteractive(true);
       
   136     iListView->setVerticalScrollBarPolicy(HbScrollArea::ScrollBarAsNeeded);
       
   137     
       
   138     iChannelModel = new IrChannelModel(this);
       
   139     iChannelModel->initWithCache();
       
   140     iListView->setModel(iChannelModel);     
   123 }
   141 }
   124 
   142 
   125 void IRSearchChannelsView::connectWidget()
   143 void IRSearchChannelsView::connectWidget()
   126 {     
   144 {     
   127     connect(iListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(clickItem(const QModelIndex&)));
   145     connect(iListView, SIGNAL(activated(const QModelIndex&)), this, SLOT(clickItem(const QModelIndex&)));
   128     connect(iChannelModel, SIGNAL(dataAvailable()), this, SLOT(dataChanged()));
   146     connect(iChannelModel, SIGNAL(dataAvailable()), this, SLOT(dataChanged()));
   129     connect(iNetworkController, SIGNAL(networkRequestNotified(IRQNetworkEvent)), this, SLOT(networkRequestNotified(IRQNetworkEvent)));     
   147     connect(iNetworkController, SIGNAL(networkRequestNotified(IRQNetworkEvent)), this, SLOT(networkRequestNotified(IRQNetworkEvent)));     
   130     connect(iSearchPanelWidget,SIGNAL(criteriaChanged(const QString&)),this,SLOT(searchTextAlready(const QString&)));
   148     connect(iSearchPanelWidget,SIGNAL(criteriaChanged(const QString&)),this,SLOT(searchTextAlready(const QString&)));
       
   149     connect(iSearchPanelWidget, SIGNAL(exitClicked()), this, SLOT(minimizeSearchPanel()));
   131 }
   150 }
   132 
   151 
   133 void IRSearchChannelsView::connectIsdsClient()
   152 void IRSearchChannelsView::connectIsdsClient()
   134 {
   153 {
   135     connect(iIsdsClient, SIGNAL(channelItemsChanged(QList<IRQChannelItem *> *)),
   154     connect(iIsdsClient, SIGNAL(channelItemsChanged(QList<IRQChannelItem *> *)),
   158                        this, SLOT(presetLogoDownload(IRQPreset* )));
   177                        this, SLOT(presetLogoDownload(IRQPreset* )));
   159     disconnect(iIsdsClient, SIGNAL(presetLogoDownloadError()),
   178     disconnect(iIsdsClient, SIGNAL(presetLogoDownloadError()),
   160                        this, SLOT(presetLogoDownloadError()));  
   179                        this, SLOT(presetLogoDownloadError()));  
   161 }
   180 }
   162 
   181 
   163 
       
   164 void IRSearchChannelsView::switch2InitState()
   182 void IRSearchChannelsView::switch2InitState()
   165 {
   183 {    
   166     iLoader.load(SEARCH_CHANNELS_VIEW_LAYOUT_FILENAME,SEARCH_CHANNELS_VIEW_NO_LISTVIEW_SECTION);    
       
   167     iSearchState = ESearch_init;     
   184     iSearchState = ESearch_init;     
   168 }
   185     iApplication->stopLoadingAnimation();
   169 
   186 } 
   170 void IRSearchChannelsView::switch2SearchedState()
   187 
   171 {
   188 void IRSearchChannelsView::switch2LoadingState()
   172     iLoader.load(SEARCH_CHANNELS_VIEW_LAYOUT_FILENAME,SEARCH_CHANNELS_VIEW_LISTVIEW_SECTION);    
   189 {   
   173     iSearchState = ESearch_Searched;     
   190     iSearchPanelWidget->clearFocus();
   174 }
   191     iListView->setFocus();
   175 void IRSearchChannelsView::switch2SearchingState()
   192     iSearchState = ESearch_Loading; 
   176 {    
   193     iApplication->startLoadingAnimation(this, SLOT(minimizeSearchPanel()));
   177     iSearchState = ESearch_Searching;     
   194 }
   178     startSearchingAnimation();
       
   179 }
       
   180  
       
   181 void IRSearchChannelsView::createSearchingDialog()
       
   182 {
       
   183     if ( NULL == iSearchingDialog)
       
   184     {
       
   185         //needs to add this , otherwise memory leak
       
   186         iSearchingDialog = new HbProgressDialog(HbProgressDialog::WaitDialog);
       
   187         iSearchingDialog->setModal(true);
       
   188         iSearchingDialog->setTimeout(HbPopup::NoTimeout);
       
   189         QAction *cancelAction = iSearchingDialog->actions().at(0);
       
   190         cancelAction->setText(hbTrId("txt_common_button_cancel"));
       
   191         connect(cancelAction, SIGNAL(triggered()), this, SLOT(cancelRequest()));
       
   192     }
       
   193     
       
   194     iSearchingDialog->setText(hbTrId("txt_common_info_searching"));
       
   195     iSearchingDialog->show();
       
   196 }
       
   197 
       
   198 void IRSearchChannelsView::closeSearchingDialog()
       
   199 {
       
   200     if( iSearchingDialog )
       
   201     {
       
   202         iSearchingDialog->close();
       
   203         iSearchingDialog->deleteLater();
       
   204         iSearchingDialog = NULL;
       
   205     }
       
   206 }
       
   207 
       
   208 void IRSearchChannelsView::startSearchingAnimation()
       
   209 {
       
   210     
       
   211 }
       
   212 
       
   213 void IRSearchChannelsView::stopSearchingAnimation()
       
   214 {
       
   215     
       
   216 }
       
   217 
       
   218 
   195 
   219 void IRSearchChannelsView::handleItemSelected()
   196 void IRSearchChannelsView::handleItemSelected()
   220 {
   197 {
   221     if (iListView)
   198     if (iListView)
   222     {
   199     {
   223         int index = iListView->currentIndex().row();
   200         int index = iListView->currentIndex().row();
   224         if (index != -1)  
   201         IRQChannelItem* aItem = iChannelModel->getChannelItemByIndex(index);
       
   202         if( NULL != aItem )
   225         {
   203         {
   226             if (iIsdsClient)
   204             iIsdsClient->isdsListenRequest(aItem->channelID,true);
   227             {              
   205         }        
   228                 //once an item is selected, we show a dialog to prevent user from clicking the
   206     }
   229                 //item again
   207  
   230                 iPlayController->createBufferingDialog(this, SLOT(cancelRequest()));
       
   231                 
       
   232                 if (iIsdsClient->isdsIsChannelBanner())
       
   233                 {
       
   234                     iIsdsClient->isdsListenRequest(index + 1);
       
   235                 }
       
   236                 else
       
   237                 {
       
   238                     iIsdsClient->isdsListenRequest(index);
       
   239                 }
       
   240             }
       
   241         }
       
   242     }
       
   243 }
   208 }
   244 
   209 
   245 void IRSearchChannelsView::cancelRequest()
   210 void IRSearchChannelsView::cancelRequest()
   246 {
   211 {     
   247     iSearchState = ESearch_init;
       
   248     iIsdsClient->isdsCancelRequest();    
   212     iIsdsClient->isdsCancelRequest();    
   249     stopSearchingAnimation();    
   213     switch2InitState(); 
   250     //the following will remove into the stopSearchingAnimation() function
       
   251     closeSearchingDialog();
       
   252 } 
   214 } 
   253 
   215 
   254 void IRSearchChannelsView::networkRequestNotified(IRQNetworkEvent aEvent)
   216 void IRSearchChannelsView::networkRequestNotified(IRQNetworkEvent aEvent)
   255 {        
   217 {        
   256     if (getViewManager()->currentView() != this)
   218     if (getViewManager()->currentView() != this)
   263     case EIRQNetworkConnectionEstablished:
   225     case EIRQNetworkConnectionEstablished:
   264          
   226          
   265         if(EIR_UseNetwork_StartSearch == getUseNetworkReason())
   227         if(EIR_UseNetwork_StartSearch == getUseNetworkReason())
   266         {
   228         {
   267             Q_ASSERT( !iKeyText.isEmpty() );
   229             Q_ASSERT( !iKeyText.isEmpty() );
   268             iIsdsClient->isdsSearchRequest(iKeyText);
   230             iIsdsClient->isdsSearchRequest(iKeyText);             
   269         }
   231         }
   270         else if( EIR_UseNetwork_SelectItem == getUseNetworkReason() )
   232         else if( EIR_UseNetwork_SelectItem == getUseNetworkReason() )
   271         {            
   233         {            
   272             handleItemSelected();
   234             handleItemSelected();
   273         }
   235         }
   274         setUseNetworkReason(EIR_UseNetwork_NoReason);
   236         setUseNetworkReason(EIR_UseNetwork_NoReason);
   275         break;        
   237         break;        
   276      
   238      
   277     default:             
   239     default:             
   278         stopSearchingAnimation();
   240         switch2InitState();         
   279         //the following will remove into the stopSearchingAnimation() function
   241         setUseNetworkReason(EIR_UseNetwork_NoReason);        
   280         closeSearchingDialog();
       
   281         setUseNetworkReason(EIR_UseNetwork_NoReason);
       
   282         iSearchState = ESearch_init;
       
   283         break;
   242         break;
   284     }   
   243     }   
   285 } 
   244 } 
   286 
   245 
   287 void IRSearchChannelsView::searchTextAlready(const QString& aSearchCriteria)
   246 void IRSearchChannelsView::searchTextAlready(const QString& aSearchCriteria)
   292     {
   251     {
   293         //show some error info here to let user input some criteria
   252         //show some error info here to let user input some criteria
   294         return;
   253         return;
   295     }  
   254     }  
   296     
   255     
   297     setUseNetworkReason(EIR_UseNetwork_StartSearch);
   256     setUseNetworkReason(EIR_UseNetwork_StartSearch);     
   298     if (false == iApplication->verifyNetworkConnectivity(hbTrId("txt_common_info_searching")))
   257     if (false == iApplication->verifyNetworkConnectivity())
   299     {        
   258     {        
   300         switch2SearchingState();
   259         switch2LoadingState();
   301         return;
   260         return;
   302     }
   261     }
   303     
   262     
       
   263     //if previouse request is in progress, cancel it
       
   264     if( ESearch_Loading == iSearchState )
       
   265     {
       
   266         iIsdsClient->isdsCancelRequest();            
       
   267         iConvertTimer->stop();
       
   268         iIsdsClient->isdsLogoDownCancelTransaction();
       
   269     }
       
   270  
       
   271     
   304     setUseNetworkReason(EIR_UseNetwork_NoReason);    
   272     setUseNetworkReason(EIR_UseNetwork_NoReason);    
   305     switch2SearchingState();
   273     switch2LoadingState();
   306     iIsdsClient->isdsSearchRequest(iKeyText);     
   274     iIsdsClient->isdsSearchRequest(iKeyText);    
   307     createSearchingDialog();
   275 }
   308 }
       
   309 
       
   310 
       
   311 
   276 
   312 void IRSearchChannelsView::operationException(IRQError aError)
   277 void IRSearchChannelsView::operationException(IRQError aError)
   313 {    
   278 {        
   314     iApplication->closeConnectingDialog();
   279     switch2InitState();
   315     iPlayController->closeBufferingDialog();    
   280     
   316     closeSearchingDialog();
   281     QString errStr;    
   317     stopSearchingAnimation();     
       
   318     iSearchState = ESearch_init;
       
   319     
       
   320     QString errStr;
       
   321     
       
   322     switch(aError)
   282     switch(aError)
   323     {
   283     {
   324     case EIRQErrorNotFound:
   284     case EIRQErrorNotFound:
   325         errStr = hbTrId("txt_irad_info_no_matching_stations_found");
   285 #ifdef SUBTITLE_STR_BY_LOCID 
       
   286         errStr = hbTrId("txt_irad_info_no_matching_station_found");
       
   287 #else
       
   288         errStr = hbTrId("No matching station found");        
       
   289 #endif
   326         break;
   290         break;
   327     default:
   291     default:
       
   292 #ifdef SUBTITLE_STR_BY_LOCID
   328         errStr = hbTrId("txt_irad_info_failed_to_connect");
   293         errStr = hbTrId("txt_irad_info_failed_to_connect");
       
   294 #else
       
   295         errStr = hbTrId("Connecting failed");        
       
   296 #endif
   329         break;   
   297         break;   
   330     }
   298     }
       
   299     
   331     popupNote(errStr, HbMessageBox::MessageTypeWarning);     
   300     popupNote(errStr, HbMessageBox::MessageTypeWarning);     
       
   301     iChannelModel->cleanupDatabase();
   332 }
   302 }
   333 
   303 
   334 void IRSearchChannelsView::clickItem(const QModelIndex&)
   304 void IRSearchChannelsView::clickItem(const QModelIndex&)
   335 {
   305 {
   336     setUseNetworkReason(EIR_UseNetwork_SelectItem);
   306     setUseNetworkReason(EIR_UseNetwork_SelectItem);
       
   307 #ifdef HS_WIDGET_ENABLED	
       
   308     int index = iListView->currentIndex().row();
       
   309     IRQChannelItem* currentItem = iChannelModel->getChannelItemByIndex(index);    
       
   310     iPlayController->setConnectingStationName(currentItem->channelName,true);
       
   311 #endif	
   337     if (false == iApplication->verifyNetworkConnectivity())
   312     if (false == iApplication->verifyNetworkConnectivity())
   338     {
   313     {
       
   314         switch2LoadingState();
   339         return;
   315         return;
   340     }
   316     }
   341     setUseNetworkReason(EIR_UseNetwork_NoReason);
   317     setUseNetworkReason(EIR_UseNetwork_NoReason);
       
   318     
       
   319     switch2LoadingState();
   342     handleItemSelected();
   320     handleItemSelected();
   343 }
   321 }
   344 
   322 
   345 
   323 
   346 void IRSearchChannelsView::presetResponse(IRQPreset *aPreset)
   324 void IRSearchChannelsView::presetResponse(IRQPreset *aPreset)
   362     if( leftCount > 0 )
   340     if( leftCount > 0 )
   363     { 
   341     { 
   364         startConvert(iIconIndexArray[0]);   
   342         startConvert(iIconIndexArray[0]);   
   365     }
   343     }
   366 }
   344 }
   367 
   345  
   368 void IRSearchChannelsView::dataChanged()
   346 void IRSearchChannelsView::dataChanged()
   369 {
   347 {
   370     iApplication->closeConnectingDialog();     
   348     switch2InitState();      
   371     stopSearchingAnimation();
       
   372     
       
   373     //the following will remove into the stopSearchingAnimation() function
       
   374     closeSearchingDialog();    
       
   375     switch2SearchedState(); 
       
   376     iListView->reset();
   349     iListView->reset();
   377     iListView->setCurrentIndex(iChannelModel->index(0));
   350     if( iChannelModel->rowCount() )
   378     iListView->scrollTo(iChannelModel->index(0)); 
   351     {
   379     GraphicsItemFlags  flags = iListView->flags();
   352         iListView->setCurrentIndex(iChannelModel->index(0));
   380     bool focusEnable = flags & QGraphicsItem::ItemIsFocusable;
   353         iListView->scrollTo(iChannelModel->index(0));         
   381     if( focusEnable )
   354     }
   382     {
   355     
   383         //we move the focus to the listview and the search panel will
   356     //we move the focus to the listview and the search panel will
   384         //hide the virtual keyboard at the same time
   357     //hide the virtual keyboard at the same time
   385         iListView->setFocus(Qt::OtherFocusReason);            
   358     iListView->setFocus();            
   386     }
       
   387     
   359     
   388     iIconIndexArray.clear();
   360     iIconIndexArray.clear();
   389     //initialize the iconindices
   361     //initialize the iconindices
   390     for (int i = 0; i < iChannelModel->rowCount(); ++i)
   362     for (int i = 0; i < iChannelModel->rowCount(); ++i)
   391     {
   363     {
   396     }
   368     }
   397     
   369     
   398     if( iIconIndexArray.count() > 0 )
   370     if( iIconIndexArray.count() > 0 )
   399     {
   371     {
   400         iConvertTimer->start();        
   372         iConvertTimer->start();        
   401     } 
   373     }   
   402 }
   374 }
   403 
   375 
   404 void IRSearchChannelsView::startConvert(int aIndex)
   376 void IRSearchChannelsView::startConvert(int aIndex)
   405 {
   377 {
   406     QString url = iChannelModel->imageUrl(aIndex);
   378     QString url = iChannelModel->imageUrl(aIndex);
   473     {
   445     {
   474         iConvertTimer->start();
   446         iConvertTimer->start();
   475     }     
   447     }     
   476 }
   448 }
   477 
   449 
   478 TIRHandleResult IRSearchChannelsView::handleCommand(TIRViewCommand aCommand, TIRViewCommandReason aReason)
   450 void IRSearchChannelsView::minimizeSearchPanel()
       
   451 {
       
   452     if( ESearch_Loading == iSearchState )
       
   453     {
       
   454         iPlayController->cancelBuffering(); 
       
   455         iIsdsClient->isdsCancelRequest();
       
   456         iConvertTimer->stop();
       
   457         iIsdsClient->isdsLogoDownCancelTransaction();
       
   458         switch2InitState();      
       
   459     }
       
   460     
       
   461     int count = iChannelModel->rowCount();
       
   462     if (0 == count)
       
   463     {         
       
   464         iSearchPanelWidget->clearFocus();
       
   465         iListView->setFocus();        
       
   466         getViewManager()->backToPreviousView();
       
   467     }
       
   468     else
       
   469     {
       
   470         iSearchPanelWidget->clearFocus();
       
   471         iListView->setFocus();        
       
   472     }
       
   473 }
       
   474  
       
   475 
       
   476 TIRHandleResult IRSearchChannelsView::handleCommand(TIRViewCommand aCommand,
       
   477         TIRViewCommandReason aReason)
   479 {
   478 {
   480     TIRHandleResult ret = IRBaseView::handleCommand(aCommand, aReason);
   479     TIRHandleResult ret = IRBaseView::handleCommand(aCommand, aReason);
   481     
   480     
   482     switch (aCommand)
   481     switch (aCommand)
   483     {   
   482     {   
   484     case EIR_ViewCommand_ACTIVATED:
   483     case EIR_ViewCommand_ACTIVATED:         
   485         //wether to start logo downloading when activated needs more discussing and testing, future.
   484         iIconIndexArray.clear();        
   486         iIconIndexArray.clear();
   485         iListView->clearFocus();
   487         connectIsdsClient(); 
   486         iSearchPanelWidget->setFocus();        
       
   487         connectIsdsClient();
   488         break;
   488         break;
   489         
   489         
   490     case EIR_ViewCommand_DEACTIVATE:     
   490     case EIR_ViewCommand_DEACTIVATE:     
   491         disconnectIsdsClient();
   491         disconnectIsdsClient();
   492         iIsdsClient->isdsCancelRequest();            
   492         iIsdsClient->isdsCancelRequest();            
   493         iConvertTimer->stop();
   493         iConvertTimer->stop();
   494         iIsdsClient->isdsLogoDownCancelTransaction(); 
   494         iIsdsClient->isdsLogoDownCancelTransaction();
       
   495         switch2InitState();
   495         break;
   496         break;
   496 
   497 
   497     default:
   498     default:
   498         break;
   499         break;
   499     }
   500     }