author | Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com> |
Mon, 30 Mar 2009 12:51:10 +0300 | |
changeset 0 | 14df0fbfcc4e |
permissions | -rw-r--r-- |
0
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
1 |
/* |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
8 |
* |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
11 |
* |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
13 |
* |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
14 |
* Description: |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
15 |
* |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
17 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
18 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
19 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
20 |
#include <calchangecallback.h> |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
21 |
#include <calsession.h> |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
22 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
23 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
24 |
#include "Calendarheader.h" |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
25 |
#include "Calendarnotify.h" |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
26 |
#include "asyncreqobserver.h" |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
27 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
28 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
29 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
30 |
// two-phased constructor |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
31 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
32 |
CCalendarObserver* CCalendarObserver::NewL( CCalendarSessionInfo* aSessionInfo, |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
33 |
CCalendarFilter* aFilter, |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
34 |
CAsyncRequestObserver* aAsyncRequestObserver, |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
35 |
MCalCallbackBase* aNotifyCallback ) |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
36 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
37 |
CCalendarObserver* self = new(ELeave) CCalendarObserver( aSessionInfo, aAsyncRequestObserver, aNotifyCallback ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
38 |
CleanupStack::PushL( self ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
39 |
self->ConstructL( aFilter ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
40 |
CleanupStack::Pop( self ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
41 |
return self; |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
42 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
43 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
44 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
45 |
// destructor |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
46 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
47 |
CCalendarObserver::~CCalendarObserver() |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
48 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
49 |
delete iFilter; |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
50 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
51 |
if ( iSession ) |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
52 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
53 |
iSession->StopChangeNotification(); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
54 |
delete iSession; |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
55 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
56 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
57 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
58 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
59 |
// default constructor |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
60 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
61 |
CCalendarObserver::CCalendarObserver( CCalendarSessionInfo* aSessionInfo, |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
62 |
CAsyncRequestObserver* aAsyncRequestObserver, |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
63 |
MCalCallbackBase* aNotifyCallback ) : |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
64 |
// CActive( EPriorityStandard ), |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
65 |
iSessionInfo( aSessionInfo ), |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
66 |
iNotifyCallback( aNotifyCallback ), |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
67 |
iAsyncRequestObserver( aAsyncRequestObserver ), |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
68 |
iIsInProgress(EFalse) |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
69 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
70 |
CActiveScheduler::Add( this ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
71 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
72 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
73 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
74 |
// second phase constructor |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
75 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
76 |
void CCalendarObserver::ConstructL( CCalendarFilter* aFilter ) |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
77 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
78 |
iFilter = CCalendarFilter::NewL(); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
79 |
*iFilter = *aFilter; |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
80 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
81 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
82 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
83 |
// Initiates the Notification process |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
84 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
85 |
void CCalendarObserver::StartChangeNotificationL() |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
86 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
87 |
iSession = CCalSession::NewL(); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
88 |
iSession->OpenL( iSessionInfo->Calendar() ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
89 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
90 |
TBool includeUndateToDo = ( iFilter->Filter() & EFlagUnDateToDo ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
91 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
92 |
CalCommon::TCalTimeRange range = iFilter->TimeRange(); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
93 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
94 |
if( range.EndTime().TimeLocalL() != Time::NullTTime() && |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
95 |
range.StartTime().TimeLocalL() != Time::NullTTime() ) |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
96 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
97 |
if( range.EndTime().TimeLocalL() < range.StartTime().TimeLocalL() ) |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
98 |
User::Leave( KErrArgument ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
99 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
100 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
101 |
// Create notification filter object specifying that notification for all entry types is required |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
102 |
CCalChangeNotificationFilter* filter = CCalChangeNotificationFilter::NewL( MCalChangeCallBack2::EChangeEntryAll, |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
103 |
includeUndateToDo, |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
104 |
iFilter->TimeRange() ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
105 |
iSession->StartChangeNotification( *this, *filter ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
106 |
delete filter; |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
107 |
ActivateRequest( KErrNone ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
108 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
109 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
110 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
111 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
112 |
// MCalChangeCallBack2::CalChangeNotification |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
113 |
// Indicates the event of arrival of change in calendar. |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
114 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
115 |
void CCalendarObserver::CalChangeNotification(RArray< TCalChangeEntry > &aChangeItems) |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
116 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
117 |
iIsInProgress = ETrue; |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
118 |
if ( iFilter->Filter() & EFilterLUid ) |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
119 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
120 |
RArray< TCalChangeEntry > filteredItems; |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
121 |
TInt count = aChangeItems.Count(); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
122 |
TInt uidCount = iFilter->LocalUidList().Count(); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
123 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
124 |
for ( TInt index = 0; index < count; index++ ) |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
125 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
126 |
for ( TInt i = 0; i < uidCount; i++ ) |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
127 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
128 |
// Filter only those entries having local uids specified |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
129 |
if ( aChangeItems[index].iEntryId == iFilter->LocalUidList()[i] ) |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
130 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
131 |
filteredItems.Append( aChangeItems[index] ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
132 |
break; |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
133 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
134 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
135 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
136 |
// Notify the user of the changed entries |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
137 |
TRAPD(err, iNotifyCallback->NotifyResultL( KErrNone, (TAny*)(&filteredItems) )); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
138 |
filteredItems.Reset(); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
139 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
140 |
else |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
141 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
142 |
TRAPD(err, iNotifyCallback->NotifyResultL( KErrNone, (TAny*)(&aChangeItems) )); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
143 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
144 |
iIsInProgress = EFalse; |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
145 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
146 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
147 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
148 |
// Inherited from CActive class |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
149 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
150 |
// |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
151 |
void CCalendarObserver::DoCancel() |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
152 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
153 |
TRequestStatus* temp = &iStatus; |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
154 |
User::RequestComplete( temp, KErrCancel ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
155 |
// Stop the notificaton operation |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
156 |
iSession->StopChangeNotification(); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
157 |
iAsyncRequestObserver->RequestComplete( iNotifyCallback->iTransactionId ); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
158 |
TRAPD( err, iNotifyCallback->NotifyResultL( KErrCancel, NULL )); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
159 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
160 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
161 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
162 |
// Inherited from CActive class |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
163 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
164 |
// |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
165 |
void CCalendarObserver::RunL() |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
166 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
167 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
168 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
169 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
170 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
171 |
// Activates the asynchronous request |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
172 |
// --------------------------------------------------------------------------- |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
173 |
// |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
174 |
void CCalendarObserver::ActivateRequest( TInt /*aReason*/ ) |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
175 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
176 |
iStatus = KRequestPending; |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
177 |
SetActive(); |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
178 |
} |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
179 |
|
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
180 |
TBool CCalendarObserver::IsInProgress() |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
181 |
{ |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
182 |
return iIsInProgress; |
14df0fbfcc4e
Revision: 200912
Kiiskinen Klaus (Nokia-D-MSW/Tampere) <klaus.kiiskinen@nokia.com>
parents:
diff
changeset
|
183 |
} |