|
1 /* |
|
2 * Copyright (c) 2008-2008 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: ESMR GUI Location plugin handler |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef CESMRLOCATIONPLUGINHANDLER_H |
|
19 #define CESMRLOCATIONPLUGINHANDLER_H |
|
20 |
|
21 #include <e32base.h> |
|
22 #include "mesmrlocationpluginobserver.h" |
|
23 |
|
24 class CESMRLocationPlugin; |
|
25 class MESMRCalEntry; |
|
26 class CESMRUrlParserPlugin; |
|
27 class CESMREditorDialog; |
|
28 class CESMRLocationHistoryManager; |
|
29 class MObjectProvider; |
|
30 |
|
31 /** |
|
32 * CESMRLocationPluginHandler encapsulates the handling of esmr location commands |
|
33 * with ESMR Location Plugin |
|
34 * |
|
35 * @lib esmrgui.lib |
|
36 */ |
|
37 NONSHARABLE_CLASS(CESMRLocationPluginHandler) : public CBase, |
|
38 public MESMRLocationPluginObserver |
|
39 { |
|
40 public: // Construction and destruction |
|
41 /** |
|
42 * Creates new CESMRViewerCmdHandler object. Ownership |
|
43 * is transferred to caller. |
|
44 * @return Pointer to created CESMRViewerCmdHandler object. |
|
45 */ |
|
46 static CESMRLocationPluginHandler* NewL( MObjectProvider& aParent ); |
|
47 |
|
48 /** |
|
49 * C++ destructor |
|
50 */ |
|
51 ~CESMRLocationPluginHandler(); |
|
52 |
|
53 /** |
|
54 * Handles a Location plugin command from editor. |
|
55 * |
|
56 * @param aCommand the command to handle |
|
57 * @param aEntry the entry to handle via command |
|
58 * @param aIgnoreQuery if ETrue |
|
59 * "Replace previous location" query is not shown. |
|
60 * @return ETrue if entry was updated during command processing |
|
61 */ |
|
62 TBool HandleCommandL( TInt aCommand, |
|
63 MESMRCalEntry& aEntry, |
|
64 TBool aIgnoreQuery = EFalse ); |
|
65 |
|
66 /** |
|
67 * Verifies if given command can be handled for given entry. |
|
68 * |
|
69 * @param aCommand the command to verify |
|
70 * @param aEntry the entry for command |
|
71 * @return ETrue if the command can be handled using HandleCommandL |
|
72 * for the entry. |
|
73 */ |
|
74 TBool IsCommandAvailableL( TInt aCommand, const MESMRCalEntry& aEntry ); |
|
75 |
|
76 /** |
|
77 * Stores calendar entry's location into location history. |
|
78 * |
|
79 * @param aEntry calendar entry which's location is stored. |
|
80 */ |
|
81 void StoreLocationToHistoryL( const MESMRCalEntry& aEntry ); |
|
82 |
|
83 /** |
|
84 * Updates entry location field. |
|
85 * @param aEntry entry to update the location field |
|
86 * @param aLocation location text to update into entry |
|
87 * @param aIgnoreQuery if ETrue, "Replace previous location" query is |
|
88 * not displayed. |
|
89 * @return ETrue if aEntry location field was modified. |
|
90 */ |
|
91 static TBool UpdateEntryLocationL( MESMRCalEntry& aEntry, |
|
92 const TDesC& aLocation, |
|
93 TBool aIgnoreQuery ); |
|
94 |
|
95 protected: // From MESMRLocationPluginObserver |
|
96 void SelectFromMapCompleted( TInt aError, |
|
97 CPosLandmark* aLandmark ); |
|
98 |
|
99 private: // Implementaton |
|
100 CESMRLocationPluginHandler( MObjectProvider& aParent ); |
|
101 void ConstructL(); |
|
102 CESMRLocationPlugin& LocationPluginL(); |
|
103 void UpdateEntryFromLandmarkL( MESMRCalEntry& aEntry, |
|
104 const CPosLandmark& aLandmark ); |
|
105 HBufC* CreateAddressFromLandmarkL( const CPosLandmark& aLandmark ); |
|
106 void SearchFromLandmarksL( MObjectProvider* aParent, |
|
107 MESMRCalEntry& aEntry ); |
|
108 void ShowSelectPreviousLocationQueryL( MESMRCalEntry& aEntry ); |
|
109 void UpdateEntryLocationL( MESMRCalEntry& aEntry, const TDesC& aLocation ); |
|
110 void UpdateEntryDescriptionL( MESMRCalEntry& aEntry, |
|
111 const TDesC& aLocationUrl ); |
|
112 CESMRUrlParserPlugin& UrlParserL(); |
|
113 CESMRLocationHistoryManager& LocationHistoryManagerL(); |
|
114 |
|
115 private: // Data |
|
116 |
|
117 /** |
|
118 * Query ignore flag |
|
119 */ |
|
120 TBool iIgnoreQuery; |
|
121 |
|
122 /** |
|
123 * Entry update flag |
|
124 * |
|
125 */ |
|
126 TBool iEntryUpdated; |
|
127 |
|
128 /** |
|
129 * Location plugin. |
|
130 * Own. |
|
131 */ |
|
132 CESMRLocationPlugin* iLocationPlugin; |
|
133 |
|
134 /** |
|
135 * Location Plugin synchronizer. |
|
136 * Own. |
|
137 */ |
|
138 CActiveSchedulerWait* iWait; |
|
139 |
|
140 /** |
|
141 * Location url parser. |
|
142 * Own. |
|
143 */ |
|
144 CESMRUrlParserPlugin* iUrlParser; |
|
145 |
|
146 /** |
|
147 * Pointer to result of landmark fetch. |
|
148 * Own. |
|
149 */ |
|
150 CPosLandmark* iLandmark; |
|
151 |
|
152 /** |
|
153 * Pointer to CLmkLandmarkSelectorDlg parent object. |
|
154 * Ref. |
|
155 */ |
|
156 MObjectProvider* iParent; |
|
157 |
|
158 /** |
|
159 * Location history manager. |
|
160 * Own. |
|
161 */ |
|
162 CESMRLocationHistoryManager* iLocationHistoryManager; |
|
163 |
|
164 }; |
|
165 |
|
166 #endif // CESMRLOCATIONPLUGINHANDLER_H |
|
167 |