qtinternetradio/ui/src/ircategoryview.cpp
changeset 14 896e9dbc5f19
parent 12 608f67c22514
child 15 065198191975
equal deleted inserted replaced
12:608f67c22514 14:896e9dbc5f19
    13 *
    13 *
    14 * Description:
    14 * Description:
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include <hbtoolbar.h>
       
    19 #include <hbaction.h>
    18 #include <hbaction.h>
    20 #include <hblistview.h>
    19 #include <hblistview.h>
       
    20 #include <hbscrollbar.h>
    21 
    21 
    22 #include "irapplication.h"
    22 #include "irapplication.h"
    23 #include "irviewmanager.h"
    23 #include "irviewmanager.h"
    24 #include "ircategoryview.h"
    24 #include "ircategoryview.h"
    25 #include "irstationsview.h"
    25 #include "irstationsview.h"
    77             {
    77             {
    78                 if (ABSTRACT_LIST_VIEW_BASE_WITH_TOOLBAR_SECTION != iLoadedSection)
    78                 if (ABSTRACT_LIST_VIEW_BASE_WITH_TOOLBAR_SECTION != iLoadedSection)
    79                 {
    79                 {
    80                     iLoader.load(ABSTRACT_LIST_VIEW_BASE_LAYOUT_FILENAME, ABSTRACT_LIST_VIEW_BASE_WITH_TOOLBAR_SECTION);
    80                     iLoader.load(ABSTRACT_LIST_VIEW_BASE_LAYOUT_FILENAME, ABSTRACT_LIST_VIEW_BASE_WITH_TOOLBAR_SECTION);
    81                     iLoadedSection = ABSTRACT_LIST_VIEW_BASE_WITH_TOOLBAR_SECTION;
    81                     iLoadedSection = ABSTRACT_LIST_VIEW_BASE_WITH_TOOLBAR_SECTION;
    82                     initToolBar();
       
    83                 }
    82                 }
    84             }
    83             }
    85             else
    84             else
    86             {
    85             {
    87                 if (ABSTRACT_LIST_VIEW_BASE_NO_TOOLBAR_SECTION != iLoadedSection)
    86                 if (ABSTRACT_LIST_VIEW_BASE_NO_TOOLBAR_SECTION != iLoadedSection)
   357     iApplication->stopLoadingAnimation();
   356     iApplication->stopLoadingAnimation();
   358 
   357 
   359     iListView->reset();
   358     iListView->reset();
   360     iListView->setCurrentIndex(iModel->index(iLastSelectItem));
   359     iListView->setCurrentIndex(iModel->index(iLastSelectItem));
   361     iListView->scrollTo(iModel->index(iLastSelectItem));
   360     iListView->scrollTo(iModel->index(iLastSelectItem));
       
   361     qreal value = 0.0;
       
   362     if (iListView->model()->rowCount() > 0)
       
   363     {
       
   364         value = iLastSelectItem / iListView->model()->rowCount();
       
   365     }
       
   366     iListView->verticalScrollBar()->setValue(value);
       
   367     
   362     getViewManager()->activateView(this);
   368     getViewManager()->activateView(this);
   363 }
   369 }
   364 
   370 
   365 /*
   371 /*
   366  * Description : slot function for canceling request.
   372  * Description : slot function for canceling request.
   451         normalInit();
   457         normalInit();
   452 
   458 
   453         //initialization from handleCommand()
   459         //initialization from handleCommand()
   454         handleCommand(EIR_ViewCommand_TOBEACTIVATED, EIR_ViewCommandReason_Show);
   460         handleCommand(EIR_ViewCommand_TOBEACTIVATED, EIR_ViewCommandReason_Show);
   455         handleCommand(EIR_ViewCommand_ACTIVATED, EIR_ViewCommandReason_Show);
   461         handleCommand(EIR_ViewCommand_ACTIVATED, EIR_ViewCommandReason_Show);
       
   462         
       
   463         emit applicationReady();
   456     }
   464     }
   457 }
   465 }
   458 
   466 
   459 void IRCategoryView::normalInit()
   467 void IRCategoryView::normalInit()
   460 {
   468 {
   470                 SLOT(networkRequestNotified(IRQNetworkEvent)));
   478                 SLOT(networkRequestNotified(IRQNetworkEvent)));
   471     
   479     
   472         setInitCompleted(true);
   480         setInitCompleted(true);
   473     }
   481     }
   474 }
   482 }
   475 
       
   476 void IRCategoryView::initToolBar()
       
   477 {
       
   478     //add HbActions to the toolbar, the HbActions have been created in IrAbstractListViewBase
       
   479     HbToolBar *viewToolBar = toolBar();
       
   480     viewToolBar->clearActions();
       
   481     viewToolBar->addAction(iGenresAction);
       
   482     viewToolBar->addAction(iCollectionsAction);
       
   483     viewToolBar->addAction(iFavoritesAction);
       
   484     viewToolBar->addAction(iSearchAction);
       
   485     viewToolBar->setVisible(true);
       
   486 }