phonebookui/pbkcommonui/src/cntfavoritesview.cpp
changeset 24 0ba2181d7c28
child 25 76a2435edfd4
equal deleted inserted replaced
0:e686773b3f54 24:0ba2181d7c28
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 
       
    18 #include "cntfavoritesview.h"
       
    19 
       
    20 /*!
       
    21 \class CntFavoritesView
       
    22 \brief
       
    23 
       
    24 This is the namesview class that shows list of contacts for the user. View contains banner for OVI and a listview that shows actual contacts.
       
    25 There is also toolbar and menu for navigating between different views. Instance of this class is created by our viewmanager but view itself is
       
    26 owned by the mainwindow which will also delete it in the end.
       
    27 
       
    28 */
       
    29 
       
    30 /*!
       
    31 Constructor, initialize member variables.
       
    32 \a viewManager is the parent that creates this view. \a parent is a pointer to parent QGraphicsItem (by default this is 0)
       
    33 
       
    34 */
       
    35 CntFavoritesView::CntFavoritesView(CntViewManager *viewManager, QGraphicsItem *parent)
       
    36     : CntBaseListView(viewManager, parent)
       
    37 
       
    38 {
       
    39 setBannerName(hbTrId("txt_phob_subtitle_favorites"));
       
    40 }
       
    41 
       
    42 /*!
       
    43 Destructor
       
    44 */
       
    45 CntFavoritesView::~CntFavoritesView()
       
    46 {
       
    47 
       
    48 }
       
    49 
       
    50 void CntFavoritesView::openFetch()
       
    51 {
       
    52     CntViewParameters viewParameters(CntViewParameters::collectionFavoritesSelectionView);
       
    53     viewManager()->onActivateView(viewParameters);
       
    54 }
       
    55 
       
    56 void CntFavoritesView::openNamesList()
       
    57 {
       
    58     CntViewParameters viewParameters(CntViewParameters::namesView);
       
    59     viewManager()->onActivateView(viewParameters);
       
    60 }
       
    61 
       
    62 void CntFavoritesView::aboutToCloseView()
       
    63 {
       
    64     CntViewParameters viewParameters(CntViewParameters::collectionView);
       
    65     viewManager()->onActivateView(viewParameters);
       
    66 }
       
    67 
       
    68 /*!
       
    69 Add actions also to toolbar
       
    70 */
       
    71 void CntFavoritesView::addActionsToToolBar()
       
    72 {
       
    73     //Add Action to the toolbar
       
    74     actions()->clearActionList();
       
    75     actions()->actionList() << actions()->baseAction("cnt:nameslist") << actions()->baseAction("cnt:collections")
       
    76         << actions()->baseAction("cnt:addfavorites");
       
    77     actions()->addActionsToToolBar(toolBar());
       
    78     
       
    79     connect(actions()->baseAction("cnt:nameslist"), SIGNAL(triggered()),
       
    80             this, SLOT(openNamesList()));
       
    81 
       
    82     connect(actions()->baseAction("cnt:collections"), SIGNAL(triggered()),
       
    83             this, SLOT(aboutToCloseView()));
       
    84 
       
    85     connect(actions()->baseAction("cnt:addfavorites"), SIGNAL(triggered()),
       
    86             this, SLOT(openFetch()));
       
    87 }
       
    88 
       
    89 // end of file