|
1 /* |
|
2 * Copyright (c) 2007-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: represents the notification request |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <xmlengdom.h> |
|
21 #include <hnglobals.h> |
|
22 |
|
23 #include "hnmdnotifyrequest.h" |
|
24 #include "hnmdnotifyrequests.h" |
|
25 |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 void CHnMdNotifyRequests::ConstructL( TXmlEngElement aElement, |
|
32 const CHnItemId & aItemId, |
|
33 THnMdCommonPointers* aCmnPtrs ) |
|
34 { |
|
35 iSent = EFalse; |
|
36 RXmlEngNodeList< TXmlEngElement > entries; |
|
37 CleanupClosePushL( entries ); |
|
38 aElement.GetChildElements( entries ); |
|
39 |
|
40 TInt entriesAmount = entries.Count(); |
|
41 |
|
42 for (TInt j = 0; j < entriesAmount; j++ ) |
|
43 { |
|
44 TXmlEngElement item = entries.Next(); |
|
45 |
|
46 if ( !item.Name().Compare( KNotifyRequestElementName8 ) ) |
|
47 { |
|
48 CHnMdNotifyRequest *request = CHnMdNotifyRequest::NewL( |
|
49 item, aItemId, aCmnPtrs ); |
|
50 AddNotifyRequest( request ); |
|
51 } |
|
52 } |
|
53 |
|
54 CleanupStack::PopAndDestroy( &entries ); |
|
55 } |
|
56 |
|
57 // --------------------------------------------------------------------------- |
|
58 // |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 void CHnMdNotifyRequests::SendAllRequestsL( CLiwGenericParamList& aParams, |
|
62 TInt aCmdOptions ) |
|
63 { |
|
64 for (int i=0; i<Count(); i++) |
|
65 { |
|
66 NotifyRequest(i).RequestNotifyL( aParams, aCmdOptions ); |
|
67 } |
|
68 iSent = ETrue; |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------- |
|
72 // |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 TInt CHnMdNotifyRequests::AddNotifyRequest( CHnMdNotifyRequest* aNotifyRequest ) |
|
76 { |
|
77 return iNotifyRequests.Append( aNotifyRequest ); |
|
78 } |
|
79 |
|
80 // --------------------------------------------------------------------------- |
|
81 // |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 CHnMdNotifyRequest& CHnMdNotifyRequests::NotifyRequest( |
|
85 TInt aPosition ) const |
|
86 { |
|
87 ASSERT( aPosition >=0 && aPosition < iNotifyRequests.Count() ); |
|
88 return *iNotifyRequests[aPosition]; |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 TInt CHnMdNotifyRequests::Count() const |
|
96 { |
|
97 return iNotifyRequests.Count(); |
|
98 } |
|
99 |
|
100 // --------------------------------------------------------------------------- |
|
101 // |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 CHnMdNotifyRequests* CHnMdNotifyRequests::NewL( |
|
105 TXmlEngElement aElement, const CHnItemId & aItemId, |
|
106 THnMdCommonPointers* aCmnPtrs ) |
|
107 { |
|
108 CHnMdNotifyRequests* self = CHnMdNotifyRequests::NewLC( |
|
109 aElement, aItemId, aCmnPtrs); |
|
110 CleanupStack::Pop( self ); |
|
111 return self; |
|
112 } |
|
113 |
|
114 // --------------------------------------------------------------------------- |
|
115 // |
|
116 // --------------------------------------------------------------------------- |
|
117 // |
|
118 CHnMdNotifyRequests* CHnMdNotifyRequests::NewLC( |
|
119 TXmlEngElement aElement, const CHnItemId & aItemId, |
|
120 THnMdCommonPointers* aCmnPtrs ) |
|
121 { |
|
122 CHnMdNotifyRequests* self = new( ELeave ) CHnMdNotifyRequests(); |
|
123 CleanupStack::PushL( self ); |
|
124 self->ConstructL( aElement, aItemId, aCmnPtrs ); |
|
125 return self; |
|
126 } |
|
127 |
|
128 // --------------------------------------------------------------------------- |
|
129 // |
|
130 // --------------------------------------------------------------------------- |
|
131 // |
|
132 CHnMdNotifyRequests::CHnMdNotifyRequests() |
|
133 { |
|
134 } |
|
135 |
|
136 // --------------------------------------------------------------------------- |
|
137 // |
|
138 // --------------------------------------------------------------------------- |
|
139 // |
|
140 CHnMdNotifyRequests::~CHnMdNotifyRequests() |
|
141 { |
|
142 iNotifyRequests.ResetAndDestroy(); |
|
143 } |
|
144 |
|
145 // --------------------------------------------------------------------------- |
|
146 // |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 TBool CHnMdNotifyRequests::Sent() |
|
150 { |
|
151 return iSent; |
|
152 } |
|
153 |