21 |
21 |
22 // --------------------------------------------------------------------------- |
22 // --------------------------------------------------------------------------- |
23 // Two-phase Constructor |
23 // Two-phase Constructor |
24 // --------------------------------------------------------------------------- |
24 // --------------------------------------------------------------------------- |
25 // |
25 // |
|
26 CCalCallbackCalEntryList* CCalCallbackCalEntryList::NewL( CCalendarInterface& aCalendarInterface, MLiwNotifyCallback *aPtrNotifyCallback, |
|
27 const TDesC& aCalendarName, |
|
28 TInt32 aTransactionId, TBool aIsEntryArray) |
|
29 { |
|
30 CCalCallbackCalEntryList* self = new(ELeave) CCalCallbackCalEntryList( aCalendarInterface, aPtrNotifyCallback, aTransactionId, aIsEntryArray ); |
|
31 CleanupStack::PushL( self ) ; |
|
32 self->ConstructL(aCalendarName); |
|
33 CleanupStack::Pop(); |
|
34 return self; |
|
35 |
|
36 // return new (ELeave) CCalCallbackCalEntryList( aCalendarInterface, aPtrNotifyCallback, aCalendarName, aTransactionId, aIsEntryArray ); |
|
37 } |
|
38 // --------------------------------------------------------------------------- |
|
39 // Two-Phase constructor |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 void CCalCallbackCalEntryList::ConstructL( const TDesC& aCalendarName ) |
|
43 { |
|
44 if( aCalendarName.Length() ) |
|
45 iCalendarName = aCalendarName.AllocL(); |
|
46 } |
|
47 // --------------------------------------------------------------------------- |
|
48 // Constructor |
|
49 // --------------------------------------------------------------------------- |
|
50 // |
|
51 CCalCallbackCalEntryList::CCalCallbackCalEntryList( CCalendarInterface& aCalendarInterface, MLiwNotifyCallback *aPtrNotifyCallback, |
|
52 TInt32 aTransactionId, |
|
53 TBool aIsEntryArray ):iInterface( aCalendarInterface ) |
|
54 |
|
55 { |
|
56 iPtrNotifyCallback = aPtrNotifyCallback; |
|
57 iTransactionId = aTransactionId; |
|
58 iIsEntryArray = aIsEntryArray; |
|
59 } |
|
60 CCalCallbackCalEntryList::~CCalCallbackCalEntryList() |
|
61 { |
|
62 delete iCalendarName; |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // CCalendarCallback::GetTransactionId |
|
67 // Gets transaction id for ongoing asynchronous method execution. |
|
68 // ----------------------------------------------------------------------------- |
|
69 // |
|
70 /*TInt32 CCalCallbackCalEntryList::GetTransactionID() |
|
71 { |
|
72 return iTransactionId; |
|
73 }*/ |
|
74 // --------------------------------------------------------------------------- |
|
75 // Gives the result of asynchronous SAPI for Export |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 void CCalCallbackCalEntryList::NotifyResultL( TInt aErrCode, TAny* aResult ) |
|
79 { |
|
80 CleanupStack::PushL( this ); |
|
81 |
|
82 CLiwGenericParamList* outParams = CLiwGenericParamList::NewL(); |
|
83 |
|
84 CleanupStack::PushL( outParams ); |
|
85 |
|
86 TPtrC calendarName( iCalendarName ? iCalendarName->Des() : TPtrC() ); |
|
87 |
|
88 outParams->AppendL( TLiwGenericParam(KErrorCode, |
|
89 TLiwVariant(CCalendarInterface::ErrCodeConversion(aErrCode)))); |
|
90 if( aResult ) |
|
91 { |
|
92 if(iIsEntryArray) |
|
93 { |
|
94 iInterface.SetCalEntryOutputL( *(RPointerArray<CCalEntry>*)( aResult ), *outParams, calendarName ); |
|
95 } |
|
96 else |
|
97 { |
|
98 iInterface.SetCalInstanceOutputL(*(RPointerArray<CCalInstance>*)( aResult ), *outParams, calendarName); |
|
99 } |
|
100 } |
|
101 TInt event = KLiwEventInProgress; |
|
102 |
|
103 if ( aErrCode == KErrCancel ) |
|
104 { |
|
105 event = KLiwEventCanceled; |
|
106 } |
|
107 else if ( aErrCode != KErrNone ) |
|
108 { |
|
109 event = KLiwEventStopped; |
|
110 outParams->AppendL( TLiwGenericParam(KErrorMessage, |
|
111 TLiwVariant(_L("Calendar:GetList:Error fetching entries")))); |
|
112 } |
|
113 |
|
114 ((MLiwNotifyCallback*)iPtrNotifyCallback)->HandleNotifyL( iTransactionId, |
|
115 event, |
|
116 *outParams, |
|
117 *((CLiwGenericParamList*)iPtrInParamList) ); |
|
118 CleanupStack::PopAndDestroy( 2,this ); |
|
119 |
|
120 } |
|
121 |
|
122 // --------------------------------------------------------------------------- |
|
123 // Two-phase Constructor |
|
124 // --------------------------------------------------------------------------- |
|
125 // |
26 CCalCallbackBaseBuffer* CCalCallbackBaseBuffer::NewL( MLiwNotifyCallback *aPtrNotifyCallback, |
126 CCalCallbackBaseBuffer* CCalCallbackBaseBuffer::NewL( MLiwNotifyCallback *aPtrNotifyCallback, |
27 const CLiwGenericParamList& aPtrInParamList, |
127 const CLiwGenericParamList& aPtrInParamList, |
28 TInt32 aTransactionId ) |
128 TInt32 aTransactionId ) |
29 { |
129 { |
30 return new (ELeave) CCalCallbackBaseBuffer( aPtrNotifyCallback, aPtrInParamList, aTransactionId ); |
130 return new (ELeave) CCalCallbackBaseBuffer( aPtrNotifyCallback, aPtrInParamList, aTransactionId ); |