1 /* |
|
2 * Copyright (c) 2006 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: CMnrpNaviModel class definition |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef MNRP_NAVIMODEL_H |
|
20 #define MNRP_NAVIMODEL_H |
|
21 |
|
22 #include <coecntrl.h> |
|
23 #include "mnrppositionrequest.h" |
|
24 |
|
25 class CMnrpEngine; |
|
26 class CPosLandmark; |
|
27 |
|
28 /** Model observer class */ |
|
29 class MNaviModelObserver |
|
30 { |
|
31 public: |
|
32 virtual void HandleModelUpdateL() =0; |
|
33 }; |
|
34 |
|
35 /** Navigation view model. |
|
36 * Prepares data to be shown on navigation view |
|
37 */ |
|
38 class CMnrpNaviModel : public CBase, public MMnrpPositionObserver |
|
39 { |
|
40 public: |
|
41 static CMnrpNaviModel* NewL( MNaviModelObserver& aObserver, CMnrpEngine& aEngine ); |
|
42 |
|
43 /** Called by service class to inform that client has changed |
|
44 * navigation target */ |
|
45 void SetDestinationL( const CPosLandmark& aNewDestination ); |
|
46 |
|
47 /** List item information */ |
|
48 class CListItem : public CBase |
|
49 { |
|
50 public: |
|
51 static CListItem* NewL( |
|
52 const TDesC& aItemHeader, |
|
53 const TDesC& aItemValue ); |
|
54 |
|
55 ~CListItem(); |
|
56 |
|
57 const TDesC& Header() { return *iHeader; }; |
|
58 const TDesC& Value() { return *iValue; }; |
|
59 |
|
60 private: |
|
61 /** List item header */ |
|
62 HBufC* iHeader; |
|
63 /** List item text */ |
|
64 HBufC* iValue; |
|
65 }; |
|
66 |
|
67 /** Returns list items to be shown on Navigation view */ |
|
68 TArray<CListItem*> ListItemsL(); |
|
69 |
|
70 ~CMnrpNaviModel(); |
|
71 |
|
72 public: // from MMnrpPositionObserver |
|
73 |
|
74 /** Informs navigation view that data has been changed */ |
|
75 void HandlePositionRequestCompletedL( TInt aError ); |
|
76 |
|
77 private: |
|
78 |
|
79 void ConstructL(); |
|
80 CMnrpNaviModel( MNaviModelObserver& aObserver, CMnrpEngine& aEngine ); |
|
81 |
|
82 private: |
|
83 CMnrpEngine& iEngine; |
|
84 |
|
85 CMnrpPositionRequest* iPositionRequest; |
|
86 TPositionInfo iPosInfo; |
|
87 |
|
88 CPosLandmark* iDestination; |
|
89 |
|
90 MNaviModelObserver& iObserver; |
|
91 |
|
92 RPointerArray<CListItem> iListItems; |
|
93 }; |
|
94 |
|
95 #endif // MNRP_NAVIMODEL_H |
|
96 |
|