phonebookui/pbkcommonui/src/cntmainwindow.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 02 Sep 2010 20:16:15 +0300
changeset 65 ae724a111993
parent 59 a642906a277a
child 71 7cc7d74059f9
permissions -rw-r--r--
Revision: 201033 Kit: 201035

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:
*
*/

#include "cntmainwindow.h"
#include "cntdefaultviewmanager.h"
#include "cntviewnavigator.h"
#include "cntkeygrabber.h"
#include <cntdebug.h>

CntMainWindow::CntMainWindow(QWidget *parent, int defaultView)
    : HbMainWindow(parent),
    mViewManager(NULL),
    mDefaultView(defaultView)
{
    CNT_ENTRY
    
    CntKeyGrabber *keyGrabber = new CntKeyGrabber(this, this);
    
    if (defaultView != noView)
    {
        CntViewNavigator* navigator = new CntViewNavigator(this);
        navigator->addException( favoritesMemberView, collectionView );
        navigator->addEffect( groupMemberView, groupActionsView );
        navigator->addEffect( groupActionsView, groupMemberView );
        navigator->addEffect( contactCardView, historyView );
        navigator->addEffect( historyView, contactCardView );
        navigator->addRoot( namesView );
        navigator->addRoot( collectionView );
        navigator->addRoot( groupMemberView );
        navigator->addRoot( favoritesMemberView );
                
        mViewManager = new CntDefaultViewManager( this );
        mViewManager->setViewNavigator( navigator );
        
        //activate the view
        CntViewParameters viewParameters;
        viewParameters.insert(EViewId, defaultView);
        mViewManager->changeView( viewParameters );
    }

    CNT_EXIT
}

CntMainWindow::~CntMainWindow()
{
    CNT_ENTRY

    delete mViewManager;
    mViewManager = NULL;

    CNT_EXIT
}

// end of file