diff -r 59984e68247d -r 6abfb1094884 phonebookui/cntcommonui/core/cntviewnavigator.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/phonebookui/cntcommonui/core/cntviewnavigator.h Tue Sep 21 17:07:25 2010 +0300 @@ -0,0 +1,81 @@ +/* +* 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: +* +*/ + +#ifndef CNTVIEWNAVIGATOR_H_ +#define CNTVIEWNAVIGATOR_H_ +#include +#include +#include +#include "cntglobal.h" +/*! + * Navigator keeps track on view history, the path that user has + * gone throug. If back() is called, one step back view id + * given, unless exception is set to current view id. In case of + * exception, navigator goes back in history until the exception + * value is found. Note the difference between "back with exeception" vs. + * "launching given view id" (next()). + * + * Next goes one step forward and stores history. + * Navigator is implemented as stack of view ids. + * + */ +class QTPBK_EXPORT CntViewNavigator : public QObject +{ + Q_OBJECT + friend class T_NavigatorTest; + +public: + CntViewNavigator( QObject* aParent ); + ~CntViewNavigator(); + +public: + /*! + * Next view puts the given id as current view + */ + void next( const int& aId, QFlags &flags ); + + /*! + * Back view returns the previous view + */ + const int& back( QFlags &flags, bool toRoot ); + + /*! + * Add exceptions to next/back mechanism. Function will use the aBack argument + * for previous view when aCurrent is the active view. + */ + void addException( const int& aCurrent, const int& aBack ); + void removeException( const int& aCurrent ); + + /*! + * Add special view switching effects for some of the views. + */ + void addEffect( const int& aCurrent, const int& aBack ); + void removeEffect( const int& aCurrent ); + + /*! + * Set a view as a root view. + */ + void addRoot( const int& aCurrent ); + +private: + QStack iViewStack; + QMap< int, int > iExceptions; + QMap< int, int > iEffects; + QList iRoots; + int iTop; +}; +#endif /* CNTVIEWNAVIGATOR_H_ */