|
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 #ifndef CNTVIEWNAVIGATOR_H_ |
|
19 #define CNTVIEWNAVIGATOR_H_ |
|
20 #include <QObject> |
|
21 #include <QStack> |
|
22 #include "cntviewparameters.h" |
|
23 |
|
24 /*! |
|
25 * Navigator keeps track on view history, the path that user has |
|
26 * gone throug. If back() is called, one step back view id |
|
27 * given, unless exception is set to current view id. In case of |
|
28 * exception, navigator goes back in history until the exception |
|
29 * value is found. Note the difference between "back with exeception" vs. |
|
30 * "launching given view id" (next()). |
|
31 * |
|
32 * Next goes one step forward and stores history. |
|
33 * Navigator is implemented as stack of view ids. |
|
34 * |
|
35 */ |
|
36 class CntViewNavigator : public QObject |
|
37 { |
|
38 Q_OBJECT |
|
39 |
|
40 public: |
|
41 CntViewNavigator( QObject* aParent ); |
|
42 ~CntViewNavigator(); |
|
43 |
|
44 public: |
|
45 /*! |
|
46 * Next view puts the given id as current view |
|
47 */ |
|
48 void next( const CntViewParameters::ViewId& aId ); |
|
49 |
|
50 /*! |
|
51 * Back view returns the previous view |
|
52 */ |
|
53 const CntViewParameters::ViewId& back(); |
|
54 |
|
55 /*! |
|
56 * Add exceptions to next/back mechanism. Function will use the aBack argument |
|
57 * for previous view when aCurrent is the active view. |
|
58 */ |
|
59 void addException( const CntViewParameters::ViewId& aCurrent, const CntViewParameters::ViewId& aBack ); |
|
60 void removeException( const CntViewParameters::ViewId& aCurrent ); |
|
61 |
|
62 private: |
|
63 QStack<CntViewParameters::ViewId> iViewStack; |
|
64 QMap< CntViewParameters::ViewId, CntViewParameters::ViewId> iExceptions; |
|
65 CntViewParameters::ViewId iTop; |
|
66 }; |
|
67 #endif /* CNTVIEWNAVIGATOR_H_ */ |