|
1 /* |
|
2 * Copyright (c) 2006-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: Image Composer's listener for changes in db location relations |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef LOCATIONRELATIONOBSERVER_H |
|
20 #define LOCATIONRELATIONOBSERVER_H |
|
21 |
|
22 #include "mdeharvestersession.h" |
|
23 #include "mdequery.h" |
|
24 |
|
25 // forward declarations |
|
26 class CMdENamespaceDef; |
|
27 class CComposerImagePlugin; |
|
28 |
|
29 /** |
|
30 * CLocationRelationObserver |
|
31 * |
|
32 */ |
|
33 class CLocationRelationObserver : public CBase, public MMdERelationObserver, public MMdEQueryObserver |
|
34 { |
|
35 public: |
|
36 // Constructors and destructor |
|
37 |
|
38 /** |
|
39 * Destructor. |
|
40 */ |
|
41 ~CLocationRelationObserver(); |
|
42 |
|
43 /** |
|
44 * Two-phased constructor. |
|
45 */ |
|
46 static CLocationRelationObserver* NewL( CMdESession* aSession, CComposerImagePlugin* aComposer ); |
|
47 |
|
48 protected: |
|
49 |
|
50 /** |
|
51 * Called to notify the observer that new relations has been |
|
52 * added/modified/removed in the metadata engine database. |
|
53 * |
|
54 * @param aSession session |
|
55 * @param aType defines if relation was added/modified/remove |
|
56 * @param aRelationIdArray IDs of relations |
|
57 */ |
|
58 |
|
59 void HandleRelationNotification(CMdESession& aSession, |
|
60 TObserverNotificationType aType, |
|
61 const RArray<TItemId>& aRelationIdArray); |
|
62 |
|
63 /** |
|
64 * Called to notify the observer that new results have been received |
|
65 * in the query. |
|
66 * From MMdEQueryObserver. |
|
67 * |
|
68 * @param aQuery Query instance that received new results. |
|
69 * @param aFirstNewItemIndex Index of the first new item that was added |
|
70 * to the result item array. |
|
71 * @param aNewItemCount Number of items added to the result item |
|
72 * array. |
|
73 * |
|
74 * No implementation needed! |
|
75 */ |
|
76 void HandleQueryNewResults( CMdEQuery& /*aQuery*/, |
|
77 TInt /*aFirstNewItemIndex*/, TInt /*aNewItemCount*/ ); |
|
78 |
|
79 /** |
|
80 * Handle query results. |
|
81 * From MMdEQueryObserver. |
|
82 * |
|
83 * @param aQuery Query instance that received new results. |
|
84 * @param aError Error code. |
|
85 */ |
|
86 void HandleQueryCompleted( CMdEQuery& aQuery, TInt aError ); |
|
87 |
|
88 private: |
|
89 |
|
90 /** |
|
91 * Constructor for performing 1st stage construction |
|
92 */ |
|
93 CLocationRelationObserver(); |
|
94 |
|
95 /** |
|
96 * EPOC default constructor for performing 2nd stage construction |
|
97 */ |
|
98 void ConstructL( CMdESession* aSession, CComposerImagePlugin* aComposer ); |
|
99 |
|
100 /** |
|
101 * Query the related image object ids from MdE database. |
|
102 * @param aObjectIdArray Array of Location object database ids. |
|
103 */ |
|
104 void QueryRelationItemsL( ); |
|
105 |
|
106 |
|
107 private: |
|
108 |
|
109 /** |
|
110 * Pointer to default Mde namespace. |
|
111 */ |
|
112 CMdENamespaceDef* iDefaultNamespace; |
|
113 |
|
114 /** |
|
115 * Pointer to Mde session. |
|
116 */ |
|
117 CMdESession* iSession; |
|
118 |
|
119 /** |
|
120 * Pointer to a composer. |
|
121 */ |
|
122 CComposerImagePlugin* iComposer; |
|
123 |
|
124 /** |
|
125 * MdE query object to use for querying relations |
|
126 */ |
|
127 CMdERelationQuery* iQuery; |
|
128 |
|
129 TBool iQueryStarted; |
|
130 |
|
131 RArray<TItemId> iRelationIdArray; |
|
132 |
|
133 }; |
|
134 |
|
135 #endif // LOCATIONRELATIONOBSERVER_H |
|
136 |