qtinternetradio/ui/src/ircategoryview.cpp
changeset 15 065198191975
parent 14 896e9dbc5f19
child 16 5723da102db1
equal deleted inserted replaced
14:896e9dbc5f19 15:065198191975
    37                                  iLastSelectItem(0)
    37                                  iLastSelectItem(0)
    38 {	
    38 {	
    39     setViewParameter(EIRViewPara_Genre);
    39     setViewParameter(EIRViewPara_Genre);
    40     setFlag(EViewFlag_ClearStackWhenActivate|EViewFlag_StickyViewEnabled);
    40     setFlag(EViewFlag_ClearStackWhenActivate|EViewFlag_StickyViewEnabled);
    41     
    41     
    42     //if this view is not starting view, finish all initialization in constructor
    42     iModel = new IRCategoryModel(this);
    43     if (getViewManager()->views().count() > 0)
    43     iListView->setModel(iModel);
    44     {
    44     
    45         normalInit();
    45     connect(iModel, SIGNAL(dataChanged()), this, SLOT(dataChanged()));
    46     }
    46     
       
    47     connect(iNetworkController, SIGNAL(networkRequestNotified(IRQNetworkEvent)), this,
       
    48         SLOT(networkRequestNotified(IRQNetworkEvent)));
       
    49 
    47 }
    50 }
    48 
    51 
    49 /*
    52 /*
    50  * Description : destructor
    53  * Description : destructor
    51  */
    54  */
    58  *               handle view commands
    61  *               handle view commands
    59  * 
    62  * 
    60  * see also    : IRBaseView::handleCommand
    63  * see also    : IRBaseView::handleCommand
    61  */
    64  */
    62 TIRHandleResult IRCategoryView::handleCommand(TIRViewCommand aCommand, TIRViewCommandReason aReason)
    65 TIRHandleResult IRCategoryView::handleCommand(TIRViewCommand aCommand, TIRViewCommandReason aReason)
    63 {
    66 {    
    64     if (!initCompleted())
       
    65     {
       
    66         return EIR_DoDefault;
       
    67     }
       
    68     
       
    69     Q_UNUSED(aReason);
    67     Q_UNUSED(aReason);
    70     TIRHandleResult ret = IrAbstractListViewBase::handleCommand(aCommand, aReason);
    68     TIRHandleResult ret = IrAbstractListViewBase::handleCommand(aCommand, aReason);
    71     
    69     
    72     switch (aCommand)
    70     switch (aCommand)
    73     {
    71     {
   448             (*it)->setChecked(false);
   446             (*it)->setChecked(false);
   449         }
   447         }
   450     }
   448     }
   451 }
   449 }
   452 
   450 
   453 void IRCategoryView::lazyInit()
       
   454 {  
       
   455     if (!initCompleted())
       
   456     {
       
   457         normalInit();
       
   458 
       
   459         //initialization from handleCommand()
       
   460         handleCommand(EIR_ViewCommand_TOBEACTIVATED, EIR_ViewCommandReason_Show);
       
   461         handleCommand(EIR_ViewCommand_ACTIVATED, EIR_ViewCommandReason_Show);
       
   462         
       
   463         emit applicationReady();
       
   464     }
       
   465 }
       
   466 
       
   467 void IRCategoryView::normalInit()
       
   468 {
       
   469     if (!initCompleted())
       
   470     {
       
   471         IrAbstractListViewBase::lazyInit();
       
   472         iModel = new IRCategoryModel(this);
       
   473         iListView->setModel(iModel);
       
   474 
       
   475         connect(iModel, SIGNAL(dataChanged()), this, SLOT(dataChanged()));
       
   476 
       
   477         connect(iNetworkController, SIGNAL(networkRequestNotified(IRQNetworkEvent)), this,
       
   478                 SLOT(networkRequestNotified(IRQNetworkEvent)));
       
   479     
       
   480         setInitCompleted(true);
       
   481     }
       
   482 }