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