author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Wed, 15 Sep 2010 12:11:35 +0300 | |
branch | RCL_3 |
changeset 78 | 356f28cd5ca0 |
parent 74 | 97232defd20e |
child 86 | ed599363c2d7 |
permissions | -rw-r--r-- |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
2 |
* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
3 |
* All rights reserved. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
8 |
* |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
9 |
* Initial Contributors: |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
11 |
* |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
12 |
* Contributors: |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
13 |
* |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
14 |
* Description: Calendar notifier |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
15 |
* |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
*/ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
17 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
18 |
|
66 | 19 |
|
20 |
#include <aknappui.h> // iavkonappui macro |
|
21 |
#include <bacntf.h> // cenvironmentchangenotifier |
|
22 |
#include <coemain.h> // eactiveprioritylogona |
|
23 |
#include <centralrepository.h> // crepository |
|
24 |
#include <ErrorUI.h> // cerrorui |
|
25 |
#ifndef SYMBIAN_ENABLE_SPLIT_HEADERS // new |
|
26 |
#include <asshdalarm.h> |
|
27 |
#else // new |
|
28 |
#include <asshdalarm.h> |
|
29 |
#include <ASShdAlarmCal.h> |
|
30 |
#endif // new |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
31 |
#include <e32property.h> |
66 | 32 |
#include <calfilechangenotification.h> |
33 |
#include <calenecomwatcher.h> |
|
34 |
#include <calenglobaldata.h> |
|
35 |
#include <calenconstants.h> |
|
36 |
#include <calencontext.h> |
|
37 |
#include <calsession.h> |
|
38 |
#include <calcalendarinfo.h> |
|
39 |
#include <calenmulticaluids.hrh> |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
40 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
41 |
#include "calendarui_debug.h" |
66 | 42 |
#include "calennotifier.h" // CCalenNotifier |
43 |
#include "CalendarPrivateCRKeys.h" // Central Repository keys |
|
44 |
#include "calensetting.h" |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
45 |
#include "calenstatemachine.h" |
66 | 46 |
#include "calencontroller.h" |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
47 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
48 |
const TInt KHashLength = 64; |
66 | 49 |
const TInt KBuffLength = 24; |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
|
78
356f28cd5ca0
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
51 |
_LIT( KCalendarDatabaseFilePath, "c:calendar" ); |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
// ---------------------------------------------------------------------------- |
66 | 53 |
// CCalenNotifier::CCalenNotifier |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
54 |
// C++ default constructor. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
55 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
56 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
57 |
// |
66 | 58 |
CCalenNotifier::CCalenNotifier( CCalenController& aController ) |
59 |
: iController( aController ) |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
{ |
66 | 61 |
TRACE_ENTRY_POINT; |
62 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
64 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
65 |
// ---------------------------------------------------------------------------- |
66 | 66 |
// CCalenNotifier::~CCalenNotifier |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
67 |
// Destructor. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
68 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
69 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
70 |
// |
66 | 71 |
CCalenNotifier::~CCalenNotifier() |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
72 |
{ |
66 | 73 |
TRACE_ENTRY_POINT; |
74 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
75 |
// Reset the handler array. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
76 |
// Before we reset , close hashset for each handler |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
77 |
for(TInt i = 0 ; i < iHandlers.Count() ; i++) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
78 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
79 |
iHandlers[i].iHashSet.Close(); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
81 |
|
66 | 82 |
iHandlers.Close(); |
74
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
83 |
|
66 | 84 |
if( iFilnameDeleted ) |
85 |
{ |
|
86 |
delete iFilnameDeleted; |
|
87 |
iFilnameDeleted = NULL; |
|
88 |
} |
|
89 |
||
90 |
// Stop ECom change notifications |
|
91 |
if( iEComWatcher ) |
|
92 |
{ |
|
93 |
delete iEComWatcher; |
|
94 |
iEComWatcher = NULL; |
|
95 |
} |
|
96 |
||
97 |
// Stop settings change notifications |
|
98 |
if( iCenRepChangeNotifier ) |
|
99 |
{ |
|
100 |
delete iCenRepChangeNotifier; |
|
101 |
iCenRepChangeNotifier = NULL; |
|
102 |
} |
|
103 |
||
104 |
if( iRepository ) |
|
105 |
{ |
|
106 |
delete iRepository; |
|
107 |
iRepository = NULL; |
|
108 |
} |
|
12
38571fd2a704
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
109 |
|
38571fd2a704
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
110 |
// Stop environment change notifications |
38571fd2a704
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
111 |
if( iEnvChangeNotifier ) |
38571fd2a704
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
112 |
{ |
38571fd2a704
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
113 |
iEnvChangeNotifier->Cancel(); |
38571fd2a704
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
114 |
delete iEnvChangeNotifier; |
38571fd2a704
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
5
diff
changeset
|
115 |
} |
66 | 116 |
|
117 |
if( iSetting ) |
|
118 |
{ |
|
119 |
iSetting->Release(); |
|
120 |
} |
|
121 |
||
122 |
// Release the global data |
|
123 |
if( iGlobalData ) |
|
124 |
{ |
|
125 |
// stop listening for calendar file change notifications |
|
126 |
TRAP_IGNORE(iGlobalData->CalSessionL().StopFileChangeNotification()); |
|
127 |
iGlobalData->Release(); |
|
128 |
} |
|
74
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
129 |
|
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
130 |
iBroadcastQueue.Close(); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
131 |
|
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
66
diff
changeset
|
132 |
TRACE_EXIT_POINT; |
66 | 133 |
} |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
134 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
135 |
// ---------------------------------------------------------------------------- |
66 | 136 |
// CCalenNotifier::ConstructL |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
// Symbian 2nd phase of construction. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
138 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
139 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
140 |
// |
66 | 141 |
void CCalenNotifier::ConstructL() |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
142 |
{ |
66 | 143 |
TRACE_ENTRY_POINT; |
144 |
||
145 |
// Get the global data |
|
146 |
iGlobalData = CCalenGlobalData::InstanceL(); |
|
147 |
||
148 |
// Get the setting singleton. We update it when settings change. |
|
149 |
iSetting = CCalenSetting::InstanceL(); |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
150 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
151 |
// Register for system environment changes |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
152 |
TCallBack envCallback( EnvChangeCallbackL, this ); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
153 |
iEnvChangeNotifier = |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
154 |
CEnvironmentChangeNotifier::NewL( EActivePriorityLogonA, envCallback ); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
155 |
iEnvChangeNotifier->Start(); |
66 | 156 |
|
157 |
// Register for changes to Calendar settings from the Central Repository |
|
158 |
iRepository = CRepository::NewL( KCRUidCalendar ); |
|
159 |
iCenRepChangeNotifier = CCenRepNotifyHandler::NewL( *this, *iRepository ); |
|
160 |
iCenRepChangeNotifier->StartListeningL(); |
|
161 |
||
162 |
// Register for changes to the ECom registry |
|
163 |
iEComWatcher = CCalenEComWatcher::NewL( *this ); |
|
164 |
||
165 |
iIgnoreFirstLocaleChange = ETrue; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
166 |
|
66 | 167 |
// start listening for calendar file change notifications |
168 |
iGlobalData->CalSessionL().StartFileChangeNotificationL(*this); |
|
169 |
||
170 |
||
171 |
iFilnameDeleted = NULL; |
|
172 |
||
173 |
TRACE_EXIT_POINT; |
|
174 |
} |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
175 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
176 |
// ---------------------------------------------------------------------------- |
66 | 177 |
// CCalenNotifier::RegisterForNotificationsL |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
178 |
// Adds the passed handler to the handler array. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
179 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
180 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
181 |
// |
66 | 182 |
void CCalenNotifier::RegisterForNotificationsL( MCalenNotificationHandler* aHandler, |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
183 |
TCalenNotification aNotification) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
184 |
{ |
66 | 185 |
TRACE_ENTRY_POINT; |
186 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
187 |
TNotificationHandler handler; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
188 |
handler.iHandler = aHandler; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
189 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
190 |
//Prepare hash |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
191 |
handler.iHashSet.ReserveL(KHashLength); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
192 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
193 |
if(ECalenNotifyAll == aNotification) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
194 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
195 |
//ECalenNotifyAll indicates that all notifications to be registered |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
196 |
//iterate through TCalenNotification enum and add the notifications to iHashSet |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
198 |
for(TCalenNotification notificationIter = TCalenNotification(ECalenNotifyAll + 1); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
199 |
notificationIter < ECalenNotifyLast; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
200 |
notificationIter = TCalenNotification(notificationIter + 1)) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
201 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
202 |
handler.iHashSet.InsertL(notificationIter); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
203 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
204 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
205 |
else |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
206 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
207 |
//Add only single notification. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
208 |
handler.iHashSet.InsertL(aNotification); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
209 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
210 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
211 |
iHandlers.Append( handler ); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
212 |
|
66 | 213 |
TRACE_EXIT_POINT; |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
214 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
215 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
216 |
// ---------------------------------------------------------------------------- |
66 | 217 |
// CCalenNotifier::RegisterForNotificationsL |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
218 |
// Adds the passed handler to the handler array. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
219 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
220 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
221 |
// |
66 | 222 |
void CCalenNotifier::RegisterForNotificationsL( MCalenNotificationHandler* aHandler, |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
223 |
RArray<TCalenNotification>& aNotifications ) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
224 |
{ |
66 | 225 |
TRACE_ENTRY_POINT; |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
226 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
227 |
TNotificationHandler handler; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
228 |
handler.iHandler = aHandler; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
229 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
230 |
//Prepare hash |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
231 |
handler.iHashSet.ReserveL(KHashLength); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
232 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
233 |
if(aNotifications.Find(ECalenNotifyAll) != KErrNotFound) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
234 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
235 |
//ECalenNotifyAll indicates that all notifications to be registered |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
236 |
//If ECalenNotifyAll is found in aNotifications along with other notifications |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
237 |
//iterate through TCalenNotification enum and add the notifications to iHashSet |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
238 |
for(TCalenNotification notificationIter = TCalenNotification(ECalenNotifyAll + 1); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
239 |
notificationIter < ECalenNotifyLast; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
240 |
notificationIter = TCalenNotification(notificationIter + 1)) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
241 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
242 |
handler.iHashSet.InsertL(notificationIter); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
243 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
244 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
245 |
else |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
246 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
247 |
//Add notifocations from Array(aNotifications) into iHashSet member |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
248 |
for(TInt i = 0 ; i < aNotifications.Count() ; i++) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
249 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
250 |
handler.iHashSet.InsertL(aNotifications[i]); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
251 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
252 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
253 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
254 |
iHandlers.Append( handler ); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
255 |
|
66 | 256 |
TRACE_EXIT_POINT; |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
257 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
258 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
259 |
// ---------------------------------------------------------------------------- |
66 | 260 |
// CCalenNotifier::CancelNotifications |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
261 |
// Removes the passed handler from the handler array. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
262 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
263 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
264 |
// |
66 | 265 |
void CCalenNotifier::CancelNotifications( MCalenNotificationHandler* aHandler ) |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
266 |
{ |
66 | 267 |
TRACE_ENTRY_POINT; |
268 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
269 |
for( TInt x = 0; x < iHandlers.Count(); ++x ) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
270 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
271 |
if( iHandlers[x].iHandler == aHandler ) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
272 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
273 |
// Mark the notification for deletion by |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
274 |
// settings the handler to NULL. Actual deletion |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
275 |
// will take place in DoBroadcast |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
276 |
iHandlers[x].iHashSet.Close(); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
277 |
iHandlers[x].iHandler = NULL; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
278 |
TRACE_EXIT_POINT; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
279 |
return; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
280 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
281 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
282 |
|
66 | 283 |
TRACE_EXIT_POINT; |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
284 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
285 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
286 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
287 |
// CCalenNotifier::EnvChangeCallbackL |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
288 |
// CEnvironmentChangeNotifier callback. Calendar is only interested in: |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
289 |
// EChangesLocale - System locale changed |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
290 |
// EChangesMidnightCrossover - System time passed midnight |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
291 |
// EChangesSystemTime - System time changed |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
292 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
293 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
294 |
// |
66 | 295 |
TInt CCalenNotifier::EnvChangeCallbackL( TAny* aThisPtr ) |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
296 |
{ |
66 | 297 |
TRACE_ENTRY_POINT; |
298 |
||
299 |
/* CCalenNotifier* thisPtr = static_cast<CCalenNotifier*>( aThisPtr ); |
|
300 |
||
301 |
if( thisPtr->iEnvChangeNotifier->Change() & EChangesMidnightCrossover ) |
|
302 |
{ |
|
303 |
thisPtr->BroadcastNotification( ECalenNotifySystemTimeChanged ); |
|
304 |
} |
|
305 |
||
306 |
if( thisPtr->iEnvChangeNotifier->Change() & EChangesLocale ) |
|
307 |
{ |
|
308 |
thisPtr->BroadcastNotification( ECalenNotifySystemLocaleChanged ); |
|
309 |
} |
|
310 |
||
311 |
if( thisPtr->iEnvChangeNotifier->Change() & EChangesSystemTime ) |
|
312 |
{ |
|
313 |
thisPtr->BroadcastNotification( ECalenNotifySystemTimeChanged ); |
|
314 |
}*/ |
|
315 |
||
316 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
317 |
// Return value for functions used as TCallBack objects should be EFalse |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
318 |
// unless the function is intended to be called again from a timer. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
319 |
// return EFalse; |
66 | 320 |
return static_cast<CCalenNotifier*>(aThisPtr)->DoEnvChange(); |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
321 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
322 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
323 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
324 |
// CCalenNotifier::DoEnvChange |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
325 |
// EnvChangeCallbackL calls this function |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
326 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
327 |
// |
66 | 328 |
TInt CCalenNotifier::DoEnvChange() |
329 |
{ |
|
330 |
TRACE_ENTRY_POINT; |
|
331 |
||
332 |
if( ((iEnvChangeNotifier->Change() & EChangesMidnightCrossover) |
|
333 |
|| (iEnvChangeNotifier->Change() & EChangesSystemTime)) |
|
334 |
&& !iIgnoreFirstLocaleChange ) |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
335 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
336 |
BroadcastNotification( ECalenNotifySystemTimeChanged ); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
337 |
} |
66 | 338 |
else if( (iEnvChangeNotifier->Change() & EChangesLocale) |
339 |
&& !iIgnoreFirstLocaleChange ) |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
340 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
341 |
BroadcastNotification( ECalenNotifySystemLocaleChanged ); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
342 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
343 |
else |
66 | 344 |
{ |
345 |
iIgnoreFirstLocaleChange = EFalse; |
|
346 |
} |
|
347 |
||
348 |
TRACE_EXIT_POINT; |
|
349 |
return EFalse ; |
|
350 |
} |
|
351 |
// ---------------------------------------------------------------------------- |
|
352 |
// CCalenNotifier::HandleNotifyGeneric |
|
353 |
// From MCenRepNotifyHandlerCallback |
|
354 |
// Generic notification that one of our central repository keys has changed |
|
355 |
// If any keys change we broadcast a settings changed notification |
|
356 |
// (other items were commented in a header). |
|
357 |
// ---------------------------------------------------------------------------- |
|
358 |
// |
|
359 |
void CCalenNotifier::HandleNotifyGeneric( TUint32 /*aId*/ ) |
|
360 |
{ |
|
361 |
TRACE_ENTRY_POINT; |
|
362 |
||
363 |
PIM_TRAPD_HANDLE( iSetting->LoadL() ); |
|
364 |
BroadcastNotification( ECalenNotifySettingsChanged ); |
|
365 |
||
366 |
// Use another trap to make sure we start listening again, regardless |
|
367 |
// of whether the previous function left or not. |
|
368 |
PIM_TRAPD_HANDLE( iCenRepChangeNotifier->StartListeningL() ); |
|
369 |
||
370 |
TRACE_EXIT_POINT; |
|
371 |
} |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
372 |
|
66 | 373 |
// ---------------------------------------------------------------------------- |
374 |
// CCalenNotifier::HandleNotifyError |
|
375 |
// Cenrep watcher error callback |
|
376 |
// (other items were commented in a header). |
|
377 |
// ---------------------------------------------------------------------------- |
|
378 |
// |
|
379 |
void CCalenNotifier::HandleNotifyError( TUint32 /*aId*/, |
|
380 |
TInt /*aError*/, |
|
381 |
CCenRepNotifyHandler* /*aHandler*/ ) |
|
382 |
{ |
|
383 |
TRACE_ENTRY_POINT; |
|
384 |
||
385 |
PIM_TRAPD_HANDLE( iCenRepChangeNotifier->StartListeningL() ); |
|
386 |
||
387 |
TRACE_EXIT_POINT; |
|
388 |
} |
|
389 |
||
390 |
// ---------------------------------------------------------------------------- |
|
391 |
// CCalenNotifier::HandleDBChangeL |
|
392 |
// From MCalenDBChangeObserver |
|
393 |
// Notification that an external CCalSession has modified the database we are |
|
394 |
// using in some way. This notification is limited to a maximum of one per |
|
395 |
// second. This is to avoid multiple notifications when performing large sync |
|
396 |
// operations |
|
397 |
// (other items were commented in a header). |
|
398 |
// ---------------------------------------------------------------------------- |
|
399 |
// |
|
400 |
void CCalenNotifier::HandleDBChangeL() |
|
401 |
{ |
|
402 |
TRACE_ENTRY_POINT; |
|
403 |
||
404 |
BroadcastNotification( ECalenNotifyExternalDatabaseChanged ); |
|
405 |
||
406 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
407 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
408 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
409 |
// ---------------------------------------------------------------------------- |
66 | 410 |
// CCalenNotifier::ContextChanged |
411 |
// From MCalenContextChangeObserver. Called when the context changes. |
|
412 |
// (other items were commented in a header). |
|
413 |
// ---------------------------------------------------------------------------- |
|
414 |
// |
|
415 |
void CCalenNotifier::ContextChanged() |
|
416 |
{ |
|
417 |
TRACE_ENTRY_POINT; |
|
418 |
||
419 |
BroadcastNotification( ECalenNotifyContextChanged ); |
|
420 |
||
421 |
TRACE_EXIT_POINT; |
|
422 |
} |
|
423 |
||
424 |
// ---------------------------------------------------------------------------- |
|
425 |
// CCalenNotifier::EComChanged |
|
426 |
// From MCalenEComChangeObserver. Called when the ECom registry changes |
|
427 |
// (install/uninstall). |
|
428 |
// ---------------------------------------------------------------------------- |
|
429 |
// |
|
430 |
void CCalenNotifier::EComChanged() |
|
431 |
{ |
|
432 |
TRACE_ENTRY_POINT; |
|
433 |
||
434 |
if(!iController.IsFasterAppFlagEnabled()) |
|
435 |
{ |
|
436 |
BroadcastNotification( ECalenNotifyEComRegistryChanged ); |
|
437 |
} |
|
438 |
||
439 |
TRACE_EXIT_POINT; |
|
440 |
} |
|
441 |
||
442 |
// ---------------------------------------------------------------------------- |
|
443 |
// CCalenNotifier::DeferSettingsNotifications |
|
444 |
// After calling this function, any settings changed notifications |
|
445 |
// will not be broadcast until after ResumeSettingsNotifications |
|
446 |
// has been called. |
|
447 |
// (other items were commented in a header). |
|
448 |
// ---------------------------------------------------------------------------- |
|
449 |
// |
|
450 |
void CCalenNotifier::DeferSettingsNotifications() |
|
451 |
{ |
|
452 |
TRACE_ENTRY_POINT; |
|
453 |
||
454 |
iIsSettingsBroadcastDeferred = ETrue; |
|
455 |
||
456 |
TRACE_EXIT_POINT; |
|
457 |
} |
|
458 |
||
459 |
// ---------------------------------------------------------------------------- |
|
460 |
// CCalenNotifier::ResumeSettingsNotifications |
|
461 |
// Resumes settings notifications after they have been paused |
|
462 |
// with DeferSettingsNotifications. |
|
463 |
// (other items were commented in a header). |
|
464 |
// ---------------------------------------------------------------------------- |
|
465 |
// |
|
466 |
void CCalenNotifier::ResumeSettingsNotifications() |
|
467 |
{ |
|
468 |
TRACE_ENTRY_POINT; |
|
469 |
||
470 |
iIsSettingsBroadcastDeferred = EFalse; |
|
471 |
||
472 |
if( iSettingsNeedsBroadcast ) |
|
473 |
{ |
|
474 |
iSettingsNeedsBroadcast = EFalse; |
|
475 |
BroadcastNotification( ECalenNotifySettingsChanged ); |
|
476 |
} |
|
477 |
||
478 |
if( iLocaleNeedsBroadcast ) |
|
479 |
{ |
|
480 |
iLocaleNeedsBroadcast = EFalse; |
|
481 |
BroadcastNotification( ECalenNotifySystemLocaleChanged ); |
|
482 |
} |
|
483 |
||
484 |
TRACE_EXIT_POINT; |
|
485 |
} |
|
486 |
||
487 |
// ---------------------------------------------------------------------------- |
|
488 |
// CCalenNotifier::BroadcastNotification |
|
65
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
489 |
// Issues a notification to all registered handlers |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
490 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
491 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
492 |
// |
66 | 493 |
void CCalenNotifier::BroadcastNotification( TCalenNotification aNotification ) |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
494 |
{ |
66 | 495 |
TRACE_ENTRY_POINT; |
496 |
||
65
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
497 |
// Someone has told us to broadcast, or one of our notifiers completed. |
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
498 |
// We run it past the state machine and that may or may not call the |
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
499 |
// function to really do the broadcast. |
66 | 500 |
iController.StateMachine().HandleNotification( aNotification ); |
65
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
501 |
|
66 | 502 |
TRACE_EXIT_POINT; |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
503 |
} |
65
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
504 |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
505 |
// ---------------------------------------------------------------------------- |
66 | 506 |
// CCalenNotifier::BroadcastApprovedNotification |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
507 |
// Issues a notification to all registered handlers |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
508 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
509 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
510 |
// |
66 | 511 |
void CCalenNotifier::BroadcastApprovedNotification( TCalenNotification aNotification ) |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
512 |
{ |
66 | 513 |
TRACE_ENTRY_POINT; |
514 |
/*if ( aNotification == ECalenNotifySettingsChanged |
|
515 |
&& iIsSettingsBroadcastDeferred ) |
|
516 |
{ |
|
517 |
iSettingsNeedsBroadcast = ETrue; |
|
518 |
} |
|
519 |
else if ( aNotification == ECalenNotifySystemLocaleChanged |
|
520 |
&& iIsSettingsBroadcastDeferred) |
|
521 |
{ |
|
522 |
iLocaleNeedsBroadcast = ETrue; |
|
523 |
} |
|
524 |
else*/ |
|
65
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
525 |
{ |
66 | 526 |
iBroadcastQueue.Append( aNotification ); |
527 |
||
528 |
if( !iBroadcastActive ) |
|
65
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
529 |
{ |
66 | 530 |
iBroadcastActive = ETrue; |
531 |
while( iBroadcastQueue.Count() ) |
|
532 |
{ |
|
533 |
TCalenNotification notification = iBroadcastQueue[0]; |
|
534 |
DoBroadcast( notification ); |
|
535 |
iBroadcastQueue.Remove( 0 ); |
|
536 |
} |
|
537 |
iBroadcastActive = EFalse; |
|
65
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
538 |
} |
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
539 |
} |
66 | 540 |
|
541 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
542 |
} |
65
12af337248b1
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
60
diff
changeset
|
543 |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
544 |
// ---------------------------------------------------------------------------- |
66 | 545 |
// CCalenNotifier::DoBroadcast |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
546 |
// Issues a notification to all registered handlers |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
547 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
548 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
549 |
// |
66 | 550 |
void CCalenNotifier::DoBroadcast( TCalenNotification aNotification ) |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
551 |
{ |
66 | 552 |
TRACE_ENTRY_POINT; |
553 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
554 |
for( TInt x = 0; x < iHandlers.Count(); ++x ) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
555 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
556 |
TNotificationHandler handler = iHandlers[x]; |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
557 |
if( handler.iHandler ) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
558 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
559 |
if( handler.iHashSet.Find(aNotification) ) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
560 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
561 |
handler.iHandler->HandleNotification( aNotification ); |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
562 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
563 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
564 |
else |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
565 |
{ |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
566 |
// The handler has been marked for deletion |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
567 |
iHandlers.Remove( x ); // remove the entry |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
568 |
--x; // decrement the index. |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
569 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
570 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
571 |
|
66 | 572 |
TRACE_EXIT_POINT; |
573 |
} |
|
574 |
||
575 |
// ---------------------------------------------------------------------------- |
|
576 |
// CCalenNotifier::Progress |
|
577 |
// From MCalProgressCallback. Intentionally empty. |
|
578 |
// (other items were commented in a header). |
|
579 |
// ---------------------------------------------------------------------------- |
|
580 |
// |
|
581 |
void CCalenNotifier::Progress( TInt /*aPercentageCompleted*/ ) |
|
582 |
{ |
|
583 |
TRACE_ENTRY_POINT; |
|
584 |
TRACE_EXIT_POINT; |
|
585 |
} |
|
586 |
||
587 |
// ---------------------------------------------------------------------------- |
|
588 |
// CCalenNotifier::NotifyProgress |
|
589 |
// From MCalProgressCallback. Don't notify us about progress updates. |
|
590 |
// (other items were commented in a header). |
|
591 |
// ---------------------------------------------------------------------------- |
|
592 |
// |
|
593 |
TBool CCalenNotifier::NotifyProgress() |
|
594 |
{ |
|
595 |
TRACE_ENTRY_POINT; |
|
596 |
// No one interested in this notification.Removing to avoid notification clutter. |
|
597 |
// BroadcastNotification( ECalenNotifyViewCreationStarted ); |
|
598 |
||
599 |
TRACE_EXIT_POINT; |
|
600 |
return EFalse; |
|
601 |
} |
|
602 |
||
603 |
// ---------------------------------------------------------------------------- |
|
604 |
// CCalenNotifier::Completed |
|
605 |
// From MCalProgressCallback. |
|
606 |
// Notifies observer of completion |
|
607 |
// (other items were commented in a header). |
|
608 |
// ---------------------------------------------------------------------------- |
|
609 |
// |
|
610 |
void CCalenNotifier::Completed( TInt aStatus ) |
|
611 |
{ |
|
612 |
TRACE_ENTRY_POINT; |
|
613 |
||
614 |
if( aStatus == KErrNone ) |
|
615 |
{ |
|
616 |
BroadcastNotification( ECalenNotifyEntryInstanceViewCreated ); |
|
617 |
} |
|
618 |
else |
|
619 |
{ |
|
620 |
BroadcastNotification( ECalenNotifyEntryInstanceViewCreationFailed ); |
|
621 |
// The view creation has failed, hence the calendar |
|
622 |
// application needs to close gracefully |
|
623 |
// 1) Display error note. |
|
624 |
||
625 |
CErrorUI* errorUi; |
|
626 |
TRAPD(error,errorUi = CErrorUI::NewLC(); |
|
627 |
if(error!=KErrNone) |
|
628 |
{ |
|
629 |
// do avoid warning |
|
630 |
} |
|
631 |
errorUi->ShowGlobalErrorNoteL( aStatus ); |
|
632 |
CleanupStack::PopAndDestroy( errorUi ); |
|
633 |
); |
|
634 |
||
635 |
// If Instance view creation is cancelled, no need to |
|
636 |
// exit application.All other errors exit application. |
|
637 |
if(aStatus != KErrCancel) |
|
638 |
{ |
|
639 |
// Exit application |
|
640 |
if (iAvkonAppUi) |
|
641 |
{ |
|
642 |
iAvkonAppUi->Exit(); |
|
643 |
} |
|
644 |
} |
|
645 |
} |
|
646 |
||
647 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
648 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
649 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
650 |
// ---------------------------------------------------------------------------- |
66 | 651 |
// CCalenNotifier::SystemTimeChangedL |
652 |
// Check if the system time changed since Calendar was last launched |
|
653 |
// If the system time did change, we need to notify the user that alarms may |
|
654 |
// have been missed. |
|
655 |
// (other items were commented in a header). |
|
656 |
// ---------------------------------------------------------------------------- |
|
657 |
// |
|
658 |
TInt CCalenNotifier::SystemTimeChangedL() |
|
659 |
{ |
|
660 |
TRACE_ENTRY_POINT; |
|
661 |
||
662 |
TBool timeZoneChanged(EFalse); |
|
663 |
||
664 |
TPckgBuf<TMissedAlarmPubSubData> alarmPkgVarBuf; |
|
665 |
TInt errorVal = RProperty::Get( KAlarmServerPubSubCategory, |
|
666 |
KMissingAlarmPubSubKey, alarmPkgVarBuf); |
|
667 |
||
668 |
if(errorVal != KErrNone) |
|
669 |
{ |
|
670 |
// Error in accessing the P&S key. |
|
671 |
// Alarm server defines this key when first time SystemTime Changes after bootup. |
|
672 |
// But Calendar may try to access this before it is defined by Alarm server. |
|
673 |
// So better not leaving based on errorVal |
|
674 |
return timeZoneChanged; |
|
675 |
} |
|
676 |
||
677 |
// read the latest timechange from agenda Server Time Stamp |
|
678 |
TTime timeOfChangeUtc = alarmPkgVarBuf().iTimeOfChangeUtc; |
|
679 |
//timeOfChangeUtc.RoundUpToNextMinute(); |
|
680 |
iTimeOfChangeUtcReal = I64REAL(timeOfChangeUtc.Int64()); |
|
681 |
||
682 |
// read the persistent time stamp from CalendarInternalCRKeys |
|
683 |
TReal previousTimeOfChange = 1.0; |
|
684 |
CRepository* repository = CRepository::NewL( KCRUidCalendar ); |
|
685 |
CleanupStack::PushL( repository ); |
|
686 |
errorVal = repository->Get( KCalendarPersistentTime, previousTimeOfChange ); |
|
687 |
User::LeaveIfError( errorVal ); |
|
688 |
||
689 |
TInt tzChangedOrAlarmsMissed(0); |
|
690 |
// compare the times. If the time set in the PubSub key by the Alarm Server is |
|
691 |
// greater than the last time we looked at it, we will show 1 of the 2 info notes |
|
692 |
// to the user. |
|
693 |
if (iTimeOfChangeUtcReal != previousTimeOfChange) |
|
694 |
{ |
|
695 |
// Agenda Server set this value to tell what has happened since |
|
696 |
// the time change |
|
697 |
tzChangedOrAlarmsMissed = alarmPkgVarBuf().iValue; |
|
698 |
} |
|
699 |
CleanupStack::PopAndDestroy( repository ); |
|
700 |
||
701 |
TRACE_EXIT_POINT; |
|
702 |
return tzChangedOrAlarmsMissed; |
|
703 |
} |
|
704 |
||
705 |
// ---------------------------------------------------------------------------- |
|
706 |
// CCalenNotifier::UpdateSytemTimeChangeInfoL |
|
707 |
// Update cenrep with latest system time change info |
|
708 |
// (other items were commented in a header). |
|
709 |
// ---------------------------------------------------------------------------- |
|
710 |
// |
|
711 |
void CCalenNotifier::UpdateSytemTimeChangeInfoL() |
|
712 |
{ |
|
713 |
TRACE_ENTRY_POINT; |
|
714 |
||
715 |
CRepository* repository = CRepository::NewL( KCRUidCalendar ); |
|
716 |
CleanupStack::PushL( repository ); |
|
717 |
||
718 |
// Update the persistent time stamp to the time stamp |
|
719 |
// indicated by the agenda server |
|
720 |
TInt errorVal = repository->Set( KCalendarPersistentTime, iTimeOfChangeUtcReal); |
|
721 |
User::LeaveIfError( errorVal ); |
|
722 |
CleanupStack::PopAndDestroy( repository ); |
|
723 |
||
724 |
TRACE_EXIT_POINT; |
|
725 |
} |
|
726 |
||
727 |
// ---------------------------------------------------------------------------- |
|
728 |
// CCalenNotifier::TNotificationHandler() |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
729 |
// TNotificationHandler contructor |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
730 |
// ---------------------------------------------------------------------------- |
66 | 731 |
CCalenNotifier::TNotificationHandler::TNotificationHandler() : |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
732 |
iHashSet(&::HashCalenNotificationFunction,&::HashCalenNotificationIdentityRelation) |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
733 |
{ |
66 | 734 |
TRACE_ENTRY_POINT; |
735 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
736 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
737 |
|
66 | 738 |
// ---------------------------------------------------------------------------- |
739 |
// CCalenNotifier::CalendarInfoChangeNotificationL() |
|
740 |
// Handle calendar file change notifications |
|
741 |
// ---------------------------------------------------------------------------- |
|
742 |
void CCalenNotifier::CalendarInfoChangeNotificationL( |
|
743 |
RPointerArray<CCalFileChangeInfo>& aCalendarInfoChangeEntries) |
|
744 |
{ |
|
745 |
TRACE_ENTRY_POINT; |
|
746 |
||
747 |
// get the file change count |
|
748 |
TInt calenInfoChangeCount = aCalendarInfoChangeEntries.Count(); |
|
749 |
||
750 |
for(TInt index = 0;index < calenInfoChangeCount;index++) |
|
751 |
{ |
|
752 |
//get the context and set the calendar filename which triggered the |
|
753 |
// notification |
|
754 |
MCalenContext &context = iController.Services().Context(); |
|
755 |
context.SetCalendarFileNameL( |
|
756 |
aCalendarInfoChangeEntries[index]->FileNameL()); |
|
757 |
||
758 |
MCalFileChangeObserver::TChangeType changeType = |
|
759 |
aCalendarInfoChangeEntries[index]->ChangeType(); |
|
760 |
switch(changeType) |
|
761 |
{ |
|
762 |
case MCalFileChangeObserver::ECalendarFileCreated: |
|
763 |
{ |
|
764 |
TFileName lastCreatedFileName = aCalendarInfoChangeEntries[index]->FileNameL(); |
|
765 |
CRepository* cenRep = CRepository::NewLC(KCRUidCalendar); |
|
766 |
User::LeaveIfError( cenRep->Set( KCalendarLastUsedCalendar, lastCreatedFileName ) ); |
|
767 |
CleanupStack::PopAndDestroy( cenRep ); |
|
768 |
} |
|
769 |
case MCalFileChangeObserver::ECalendarInfoCreated: |
|
770 |
{ |
|
771 |
BroadcastNotification(ECalenNotifyDeleteInstanceView); |
|
772 |
BroadcastNotification(ECalenNotifyCalendarInfoCreated); |
|
773 |
} |
|
774 |
break; |
|
775 |
case MCalFileChangeObserver::ECalendarFileDeleted: |
|
776 |
{ |
|
777 |
BroadcastNotification(ECalenNotifyCalendarFileDeleted); |
|
778 |
} |
|
779 |
break; |
|
780 |
case MCalFileChangeObserver::ECalendarInfoUpdated: |
|
781 |
case MCalFileChangeObserver::ECalendarInfoDeleted: |
|
782 |
{ |
|
783 |
TFileName calFileName = aCalendarInfoChangeEntries[index]->FileNameL(); |
|
784 |
CCalSession* session = NULL; |
|
785 |
TRAPD(err, session = &iGlobalData->CalSessionL( calFileName )); |
|
786 |
if(KErrNotFound == err && ECalendarInfoUpdated == changeType) |
|
787 |
{ |
|
788 |
BroadcastNotification(ECalenNotifyDeleteInstanceView); |
|
789 |
BroadcastNotification(ECalenNotifyCalendarInfoCreated); |
|
790 |
break; |
|
791 |
} |
|
792 |
||
793 |
CCalCalendarInfo* calendarInfo = session->CalendarInfoL(); |
|
794 |
CleanupStack::PushL(calendarInfo); |
|
795 |
||
796 |
TBuf8<KBuffLength> keyBuff; |
|
797 |
keyBuff.AppendNum(EMarkAsDelete); |
|
798 |
||
799 |
TBool markAsdelete; |
|
800 |
TPckgC<TBool> pkgMarkAsDelete(markAsdelete); |
|
801 |
TRAP(err,pkgMarkAsDelete.Set(calendarInfo->PropertyValueL(keyBuff))); |
|
802 |
markAsdelete = pkgMarkAsDelete(); |
|
803 |
||
804 |
CleanupStack::PopAndDestroy(calendarInfo); |
|
805 |
||
806 |
//remove calendar except default calendar |
|
78
356f28cd5ca0
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
807 |
if (err == KErrNone && markAsdelete && aCalendarInfoChangeEntries[index]->FileNameL().CompareF( |
356f28cd5ca0
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
74
diff
changeset
|
808 |
KCalendarDatabaseFilePath)) |
66 | 809 |
{ |
810 |
iFilnameDeleted = aCalendarInfoChangeEntries[index]->FileNameL().AllocL(); |
|
811 |
BroadcastNotification(ECalenNotifyDeleteInstanceView); |
|
812 |
iGlobalData->RemoveCalendarL(iFilnameDeleted->Des()); |
|
813 |
BroadcastNotification(ECalenNotifyCalendarFileDeleted); |
|
814 |
||
815 |
delete iFilnameDeleted; |
|
816 |
iFilnameDeleted = NULL; |
|
817 |
} |
|
818 |
else |
|
819 |
{ |
|
820 |
BroadcastNotification(ECalenNotifyCalendarInfoUpdated); |
|
821 |
} |
|
822 |
} |
|
823 |
break; |
|
824 |
default: |
|
825 |
break; |
|
826 |
} |
|
827 |
context.ResetCalendarFileName(); |
|
828 |
} |
|
829 |
||
830 |
TRACE_EXIT_POINT; |
|
831 |
} |
|
832 |
||
833 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
834 |
// End of file |