|
1 /* |
|
2 * Copyright (c) 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 the License "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: Groups messages and sends them to clients.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 #ifndef VCXMYVIDEOSMESSAGELIST_H |
|
21 #define VCXMYVIDEOSMESSAGELIST_H |
|
22 |
|
23 // INCLUDES |
|
24 |
|
25 #include <mpxcollectionmessagedefs.h> |
|
26 #include <vcxmyvideosdefs.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class CVcxMyVideosCollectionPlugin; |
|
30 |
|
31 // CONSTANTS |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * Groups messages and sends them to clients. |
|
37 * |
|
38 * @lib mpxmyvideoscollectionplugin.lib |
|
39 */ |
|
40 NONSHARABLE_CLASS(CVcxMyVideosMessageList) : |
|
41 public CBase |
|
42 { |
|
43 public: // Constructors and destructor |
|
44 |
|
45 /** |
|
46 * Two-phased constructor |
|
47 * |
|
48 * @param aCollection Collection, owner of this object. |
|
49 * @return Object constructed |
|
50 */ |
|
51 static CVcxMyVideosMessageList* NewL ( CVcxMyVideosCollectionPlugin& aCollection ); |
|
52 |
|
53 /** |
|
54 * Destructor |
|
55 */ |
|
56 virtual ~CVcxMyVideosMessageList(); |
|
57 |
|
58 private: |
|
59 |
|
60 /** |
|
61 * Constructor |
|
62 */ |
|
63 CVcxMyVideosMessageList( CVcxMyVideosCollectionPlugin& aCollection ); |
|
64 |
|
65 /** |
|
66 * Symbian 2nd phase constructor. |
|
67 */ |
|
68 void ConstructL (); |
|
69 |
|
70 /** |
|
71 * Creates iMessageList if not created already. |
|
72 */ |
|
73 void CreateMessageListL(); |
|
74 |
|
75 /** |
|
76 * Checks if this event is already on the message list. Used for |
|
77 * optimizing duplicate events. |
|
78 * |
|
79 * @param aId MPX Item ID. |
|
80 * @param aChange Change type. |
|
81 * @param aExtraInfo Event extra info, see TVcxMyVideosEventInfo enum |
|
82 * from vcxmyvideosdefs.h for values. |
|
83 * @return ETrue if the event is already on the list, |
|
84 * EFalse otherwise. |
|
85 */ |
|
86 TBool AlreadyInMessageListL( const TMPXItemId& aId, |
|
87 TMPXChangeEventType aChange, TInt32 aExtraInfo ); |
|
88 public: |
|
89 |
|
90 /** |
|
91 * Creates collection change event and appends it to iMessageList. |
|
92 * |
|
93 * @param aId Context that was changed |
|
94 * @param aChange Change type, see values from mpxcollectionmessagedefs.h. |
|
95 * @param aExtraInfo Extra information about the event, this value is written to |
|
96 * KVcxMediaMyVideosInt32Value attribute. If aExtraInfo |
|
97 * is 0, nothing is written. See TVcxMyVideosEventInfo enum |
|
98 * from vcxmyvideosdefs.h for values. |
|
99 * @param aVideo Video object which is in cache already. |
|
100 */ |
|
101 void AddEventL(const TMPXItemId& aId, TMPXChangeEventType aChange, TInt32 aExtraInfo = 0, CMPXMedia* aVideo = NULL ); |
|
102 |
|
103 /** |
|
104 * Creates My Videos custom event and appends it to iMessageList. |
|
105 * |
|
106 * @param aEvent Event ID, see values from vcxmyvideosdefs.h. |
|
107 */ |
|
108 void AddEventL( TInt aEvent ); |
|
109 |
|
110 /** |
|
111 * Adds message to iMessageList. |
|
112 * |
|
113 * @param aMessage Message to add, may contain media array as a parameter. |
|
114 */ |
|
115 void AddL( CMPXMessage* aMessage ); |
|
116 |
|
117 /** |
|
118 * Sends iMessageList to clients. |
|
119 */ |
|
120 void SendL(); |
|
121 |
|
122 private: |
|
123 |
|
124 /** |
|
125 * Messages are collected here before sending. |
|
126 */ |
|
127 CMPXMessage* iMessageList; |
|
128 |
|
129 /** |
|
130 * Array item of iMessageList, stored as member to speed things up. |
|
131 * Owned by iMessageList. |
|
132 */ |
|
133 CMPXMessageArray* iMessageArray; |
|
134 |
|
135 /** |
|
136 * Count of messages in iMessageList, main object plus items in array. |
|
137 */ |
|
138 TInt iMessageCount; |
|
139 |
|
140 /** |
|
141 * My Videos collection plugin, owner of this object. |
|
142 */ |
|
143 CVcxMyVideosCollectionPlugin& iCollection; |
|
144 |
|
145 public: // Friend classes |
|
146 |
|
147 friend class CCollectionPluginTest; |
|
148 |
|
149 }; |
|
150 |
|
151 #endif // VCXMYVIDEOSMESSAGELIST_H |
|
152 |
|
153 |