author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Thu, 27 Aug 2009 07:43:07 +0300 | |
changeset 10 | fc9cf246af83 |
parent 5 | 989d2f495d90 |
permissions | -rw-r--r-- |
5 | 1 |
/* |
2 |
* Copyright (c) 2007 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: |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
#include "calendarcallback.h" |
|
19 |
#include "calendarconstants.h" |
|
20 |
#include "calendarinterface.h" |
|
21 |
||
22 |
// --------------------------------------------------------------------------- |
|
23 |
// Two-phase Constructor |
|
24 |
// --------------------------------------------------------------------------- |
|
25 |
// |
|
10
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
26 |
CCalCallbackCalEntryList* CCalCallbackCalEntryList::NewL( CCalendarInterface& aCalendarInterface, MLiwNotifyCallback *aPtrNotifyCallback, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
27 |
const TDesC& aCalendarName, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
28 |
TInt32 aTransactionId, TBool aIsEntryArray) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
29 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
30 |
CCalCallbackCalEntryList* self = new(ELeave) CCalCallbackCalEntryList( aCalendarInterface, aPtrNotifyCallback, aTransactionId, aIsEntryArray ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
31 |
CleanupStack::PushL( self ) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
32 |
self->ConstructL(aCalendarName); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
33 |
CleanupStack::Pop(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
34 |
return self; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
35 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
36 |
// return new (ELeave) CCalCallbackCalEntryList( aCalendarInterface, aPtrNotifyCallback, aCalendarName, aTransactionId, aIsEntryArray ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
37 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
38 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
39 |
// Two-Phase constructor |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
40 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
41 |
// |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
42 |
void CCalCallbackCalEntryList::ConstructL( const TDesC& aCalendarName ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
43 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
44 |
if( aCalendarName.Length() ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
45 |
iCalendarName = aCalendarName.AllocL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
46 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
47 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
48 |
// Constructor |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
49 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
50 |
// |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
51 |
CCalCallbackCalEntryList::CCalCallbackCalEntryList( CCalendarInterface& aCalendarInterface, MLiwNotifyCallback *aPtrNotifyCallback, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
52 |
TInt32 aTransactionId, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
53 |
TBool aIsEntryArray ):iInterface( aCalendarInterface ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
54 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
55 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
56 |
iPtrNotifyCallback = aPtrNotifyCallback; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
57 |
iTransactionId = aTransactionId; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
58 |
iIsEntryArray = aIsEntryArray; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
59 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
60 |
CCalCallbackCalEntryList::~CCalCallbackCalEntryList() |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
61 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
62 |
delete iCalendarName; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
63 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
64 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
65 |
// ----------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
66 |
// CCalendarCallback::GetTransactionId |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
67 |
// Gets transaction id for ongoing asynchronous method execution. |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
68 |
// ----------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
69 |
// |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
70 |
/*TInt32 CCalCallbackCalEntryList::GetTransactionID() |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
71 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
72 |
return iTransactionId; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
73 |
}*/ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
74 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
75 |
// Gives the result of asynchronous SAPI for Export |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
76 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
77 |
// |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
78 |
void CCalCallbackCalEntryList::NotifyResultL( TInt aErrCode, TAny* aResult ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
79 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
80 |
CleanupStack::PushL( this ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
81 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
82 |
CLiwGenericParamList* outParams = CLiwGenericParamList::NewL(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
83 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
84 |
CleanupStack::PushL( outParams ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
85 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
86 |
TPtrC calendarName( iCalendarName ? iCalendarName->Des() : TPtrC() ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
87 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
88 |
outParams->AppendL( TLiwGenericParam(KErrorCode, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
89 |
TLiwVariant(CCalendarInterface::ErrCodeConversion(aErrCode)))); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
90 |
if( aResult ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
91 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
92 |
if(iIsEntryArray) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
93 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
94 |
iInterface.SetCalEntryOutputL( *(RPointerArray<CCalEntry>*)( aResult ), *outParams, calendarName ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
95 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
96 |
else |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
97 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
98 |
iInterface.SetCalInstanceOutputL(*(RPointerArray<CCalInstance>*)( aResult ), *outParams, calendarName); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
99 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
100 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
101 |
TInt event = KLiwEventInProgress; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
102 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
103 |
if ( aErrCode == KErrCancel ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
104 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
105 |
event = KLiwEventCanceled; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
106 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
107 |
else if ( aErrCode != KErrNone ) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
108 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
109 |
event = KLiwEventStopped; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
110 |
outParams->AppendL( TLiwGenericParam(KErrorMessage, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
111 |
TLiwVariant(_L("Calendar:GetList:Error fetching entries")))); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
112 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
113 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
114 |
((MLiwNotifyCallback*)iPtrNotifyCallback)->HandleNotifyL( iTransactionId, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
115 |
event, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
116 |
*outParams, |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
117 |
*((CLiwGenericParamList*)iPtrInParamList) ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
118 |
CleanupStack::PopAndDestroy( 2,this ); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
119 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
120 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
121 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
122 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
123 |
// Two-phase Constructor |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
124 |
// --------------------------------------------------------------------------- |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
125 |
// |
5 | 126 |
CCalCallbackBaseBuffer* CCalCallbackBaseBuffer::NewL( MLiwNotifyCallback *aPtrNotifyCallback, |
127 |
const CLiwGenericParamList& aPtrInParamList, |
|
128 |
TInt32 aTransactionId ) |
|
129 |
{ |
|
130 |
return new (ELeave) CCalCallbackBaseBuffer( aPtrNotifyCallback, aPtrInParamList, aTransactionId ); |
|
131 |
} |
|
132 |
||
133 |
// --------------------------------------------------------------------------- |
|
134 |
// Constructor |
|
135 |
// --------------------------------------------------------------------------- |
|
136 |
// |
|
137 |
CCalCallbackBaseBuffer::CCalCallbackBaseBuffer( MLiwNotifyCallback *aPtrNotifyCallback, |
|
138 |
const CLiwGenericParamList& aPtrInParamList, |
|
139 |
TInt32 aTransactionId ) |
|
140 |
{ |
|
141 |
iPtrNotifyCallback = aPtrNotifyCallback; |
|
142 |
iPtrInParamList = &aPtrInParamList; |
|
143 |
iTransactionId = aTransactionId; |
|
144 |
} |
|
145 |
||
146 |
// --------------------------------------------------------------------------- |
|
147 |
// Gives the result of asynchronous SAPI for Export |
|
148 |
// --------------------------------------------------------------------------- |
|
149 |
// |
|
150 |
void CCalCallbackBaseBuffer::NotifyResultL( TInt aErrCode, TAny* aResult ) |
|
151 |
{ |
|
152 |
CleanupStack::PushL( this ); |
|
153 |
||
154 |
CLiwGenericParamList* outParams = CLiwGenericParamList::NewL(); |
|
155 |
||
156 |
CleanupStack::PushL( outParams ); |
|
157 |
||
158 |
outParams->AppendL( TLiwGenericParam(KErrorCode, |
|
159 |
TLiwVariant(CCalendarInterface::ErrCodeConversion(aErrCode)))); |
|
160 |
||
161 |
// Will be NULL if exported to file |
|
162 |
if ( aResult ) |
|
163 |
{ |
|
164 |
outParams->AppendL( TLiwGenericParam( KReturnValue, TLiwVariant( *(HBufC8*)aResult ) ) ); |
|
165 |
} |
|
166 |
||
167 |
TInt event = KLiwEventCompleted; |
|
168 |
||
169 |
if ( aErrCode == KErrCancel ) |
|
170 |
{ |
|
171 |
event = KLiwEventCanceled; |
|
172 |
} |
|
173 |
else if ( aErrCode != KErrNone ) |
|
174 |
{ |
|
175 |
event = KLiwEventStopped; |
|
176 |
outParams->AppendL( TLiwGenericParam(KErrorMessage, |
|
177 |
TLiwVariant(_L("Calendar:Export:Error exporting entries")))); |
|
178 |
} |
|
179 |
||
180 |
((MLiwNotifyCallback*)iPtrNotifyCallback)->HandleNotifyL( iTransactionId, |
|
181 |
event, |
|
182 |
*outParams, |
|
183 |
*((CLiwGenericParamList*)iPtrInParamList) ); |
|
184 |
||
185 |
CleanupStack::PopAndDestroy( 2, this ); |
|
186 |
} |
|
187 |
||
188 |
||
189 |
// --------------------------------------------------------------------------- |
|
190 |
// Two-phase Constructor |
|
191 |
// --------------------------------------------------------------------------- |
|
192 |
// |
|
193 |
CCalCallbackBaseUIDSet* CCalCallbackBaseUIDSet::NewL( MLiwNotifyCallback *aPtrNotifyCallback, |
|
194 |
const CLiwGenericParamList& aPtrInParamList, |
|
195 |
TInt32 aTransactionId ) |
|
196 |
{ |
|
197 |
return new (ELeave) CCalCallbackBaseUIDSet( aPtrNotifyCallback, aPtrInParamList, aTransactionId ); |
|
198 |
} |
|
199 |
||
200 |
// --------------------------------------------------------------------------- |
|
201 |
// Constructor |
|
202 |
// --------------------------------------------------------------------------- |
|
203 |
// |
|
204 |
CCalCallbackBaseUIDSet::CCalCallbackBaseUIDSet( MLiwNotifyCallback *aPtrNotifyCallback, |
|
205 |
const CLiwGenericParamList& aPtrInParamList, |
|
206 |
TInt32 aTransactionId ) |
|
207 |
{ |
|
208 |
iPtrNotifyCallback = aPtrNotifyCallback; |
|
209 |
iPtrInParamList = &aPtrInParamList; |
|
210 |
iTransactionId = aTransactionId; |
|
211 |
} |
|
212 |
||
213 |
// --------------------------------------------------------------------------- |
|
214 |
// Gives the result of asynchronous SAPI for Import |
|
215 |
// --------------------------------------------------------------------------- |
|
216 |
// |
|
217 |
void CCalCallbackBaseUIDSet::NotifyResultL( TInt aErrCode, TAny* aResult ) |
|
218 |
{ |
|
219 |
CleanupStack::PushL( this ); |
|
220 |
||
221 |
CLiwGenericParamList* outParams = CLiwGenericParamList::NewL(); |
|
222 |
||
223 |
CleanupStack::PushL( outParams ); |
|
224 |
||
225 |
outParams->AppendL(TLiwGenericParam(KErrorCode, |
|
226 |
TLiwVariant(CCalendarInterface::ErrCodeConversion(aErrCode)))); |
|
227 |
||
228 |
CCalendarInterface::SetImportOutputL( *(RPointerArray<TUIDSet>*)( aResult ), *outParams ); |
|
229 |
||
230 |
TInt event = KLiwEventCompleted; |
|
231 |
||
232 |
if ( aErrCode == KErrCancel ) |
|
233 |
{ |
|
234 |
event = KLiwEventCanceled; |
|
235 |
} |
|
236 |
else if ( aErrCode != KErrNone ) |
|
237 |
{ |
|
238 |
event = KLiwEventStopped; |
|
239 |
outParams->AppendL( TLiwGenericParam(KErrorMessage, |
|
240 |
TLiwVariant(_L("Calendar:Import:Error importing entries")))); |
|
241 |
} |
|
242 |
||
243 |
((MLiwNotifyCallback*)iPtrNotifyCallback)->HandleNotifyL( iTransactionId, |
|
244 |
event, |
|
245 |
*outParams, |
|
246 |
*((CLiwGenericParamList*)iPtrInParamList) ); |
|
247 |
||
248 |
CleanupStack::PopAndDestroy( 2, this ); |
|
249 |
} |
|
250 |
||
251 |
||
252 |
// --------------------------------------------------------------------------- |
|
253 |
// Two-phase Constructor |
|
254 |
// --------------------------------------------------------------------------- |
|
255 |
// |
|
256 |
CCalCallbackInt* CCalCallbackInt::NewL( MLiwNotifyCallback *aPtrNotifyCallback, |
|
257 |
const CLiwGenericParamList& aPtrInParamList, |
|
258 |
TInt32 aTransactionId ) |
|
259 |
{ |
|
260 |
return new (ELeave) CCalCallbackInt( aPtrNotifyCallback, aPtrInParamList, aTransactionId ); |
|
261 |
} |
|
262 |
||
263 |
// --------------------------------------------------------------------------- |
|
264 |
// Constructor |
|
265 |
// --------------------------------------------------------------------------- |
|
266 |
// |
|
267 |
CCalCallbackInt::CCalCallbackInt( MLiwNotifyCallback *aPtrNotifyCallback, |
|
268 |
const CLiwGenericParamList& aPtrInParamList, |
|
269 |
TInt32 aTransactionId ) |
|
270 |
{ |
|
271 |
iPtrNotifyCallback = aPtrNotifyCallback; |
|
272 |
iPtrInParamList = &aPtrInParamList; |
|
273 |
iTransactionId = aTransactionId; |
|
274 |
} |
|
275 |
||
276 |
// --------------------------------------------------------------------------- |
|
277 |
// Gives the result of asynchronous SAPI for Delete |
|
278 |
// --------------------------------------------------------------------------- |
|
279 |
// |
|
280 |
void CCalCallbackInt::NotifyResultL( TInt aErrCode, TAny* /*aResult*/ ) |
|
281 |
{ |
|
282 |
CleanupStack::PushL( this ); |
|
283 |
||
284 |
CLiwGenericParamList* outParams = CLiwGenericParamList::NewL(); |
|
285 |
||
286 |
CleanupStack::PushL( outParams ); |
|
287 |
||
288 |
outParams->AppendL( TLiwGenericParam( KErrorCode, |
|
289 |
TLiwVariant( CCalendarInterface::ErrCodeConversion( aErrCode )))); |
|
290 |
||
291 |
TInt event = KLiwEventCompleted; |
|
292 |
||
293 |
if ( aErrCode == KErrCancel ) |
|
294 |
{ |
|
295 |
event = KLiwEventCanceled; |
|
296 |
} |
|
297 |
else if ( aErrCode != KErrNone ) |
|
298 |
{ |
|
299 |
event = KLiwEventStopped; |
|
300 |
outParams->AppendL( TLiwGenericParam(KErrorMessage, |
|
301 |
TLiwVariant(_L("Calendar:Delete:Error deleting entries")))); |
|
302 |
} |
|
303 |
||
304 |
((MLiwNotifyCallback*)iPtrNotifyCallback)->HandleNotifyL( iTransactionId, |
|
305 |
event, |
|
306 |
*outParams, |
|
307 |
*((CLiwGenericParamList*)iPtrInParamList) ); |
|
308 |
||
309 |
CleanupStack::PopAndDestroy( 2, this ); |
|
310 |
} |
|
311 |
||
312 |
||
313 |
// --------------------------------------------------------------------------- |
|
314 |
// Two-phase Constructor |
|
315 |
// --------------------------------------------------------------------------- |
|
316 |
// |
|
317 |
CCalCallbackChangeNotify* CCalCallbackChangeNotify::NewL( MLiwNotifyCallback *aPtrNotifyCallback, |
|
318 |
const CLiwGenericParamList& aPtrInParamList, |
|
319 |
TInt32 aTransactionId ) |
|
320 |
{ |
|
321 |
return new (ELeave) CCalCallbackChangeNotify( aPtrNotifyCallback, aPtrInParamList, aTransactionId ); |
|
322 |
} |
|
323 |
||
324 |
// --------------------------------------------------------------------------- |
|
325 |
// Constructor |
|
326 |
// --------------------------------------------------------------------------- |
|
327 |
// |
|
328 |
CCalCallbackChangeNotify::CCalCallbackChangeNotify( MLiwNotifyCallback *aPtrNotifyCallback, |
|
329 |
const CLiwGenericParamList& aPtrInParamList, |
|
330 |
TInt32 aTransactionId ) |
|
331 |
{ |
|
332 |
iPtrNotifyCallback = aPtrNotifyCallback; |
|
333 |
iPtrInParamList = &aPtrInParamList; |
|
334 |
iTransactionId = aTransactionId; |
|
335 |
} |
|
336 |
||
337 |
// --------------------------------------------------------------------------- |
|
338 |
// Gives the result of asynchronous SAPI for Change Notification |
|
339 |
// --------------------------------------------------------------------------- |
|
340 |
// |
|
341 |
void CCalCallbackChangeNotify::NotifyResultL( TInt aErrCode, TAny* aResult ) |
|
342 |
{ |
|
343 |
CleanupStack::PushL( this ); |
|
344 |
||
345 |
CLiwGenericParamList* outParams = CLiwGenericParamList::NewL(); |
|
346 |
||
347 |
CleanupStack::PushL( outParams ); |
|
348 |
||
349 |
outParams->AppendL( TLiwGenericParam(KErrorCode, |
|
350 |
TLiwVariant( CCalendarInterface::ErrCodeConversion( aErrCode )))); |
|
351 |
||
352 |
if ( aResult ) |
|
353 |
{ |
|
354 |
RArray<TCalChangeEntry>& outputChangeSet = *((RArray<TCalChangeEntry>*)aResult); |
|
355 |
CCalendarInterface::SetNotifyOutputL( outputChangeSet, *outParams ); |
|
356 |
} |
|
357 |
||
358 |
TInt event = KLiwEventInProgress; |
|
359 |
||
360 |
if ( aErrCode == KErrCancel ) |
|
361 |
{ |
|
362 |
event = KLiwEventCanceled; |
|
363 |
} |
|
364 |
else if ( aErrCode != KErrNone ) |
|
365 |
{ |
|
366 |
event = KLiwEventCompleted; |
|
367 |
outParams->AppendL( TLiwGenericParam(KErrorMessage, |
|
368 |
TLiwVariant(_L("Calendar:RequestNotification:Notification stopped")))); |
|
369 |
} |
|
370 |
||
371 |
((MLiwNotifyCallback*)iPtrNotifyCallback)->HandleNotifyL( iTransactionId, |
|
372 |
event, |
|
373 |
*outParams, |
|
374 |
*((CLiwGenericParamList*)iPtrInParamList) ); |
|
375 |
||
376 |
CleanupStack::PopAndDestroy( outParams ); |
|
377 |
||
378 |
// Only in case of cancel the object is no more required |
|
379 |
if ( aErrCode == KErrCancel || event == KLiwEventCompleted ) |
|
380 |
{ |
|
381 |
CleanupStack::PopAndDestroy( this ); |
|
382 |
} |
|
383 |
else |
|
384 |
{ |
|
385 |
CleanupStack::Pop( this ); |
|
386 |
} |
|
387 |
} |
|
388 |
||
389 |