author | hgs |
Wed, 03 Nov 2010 17:12:22 +0530 | |
changeset 89 | b57382753122 |
parent 81 | ce92091cbd61 |
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-2009 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 view manager |
89 | 15 |
* |
0
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 |
|
89 | 19 |
#include <aknViewAppUi.h> |
20 |
#include <centralrepository.h> |
|
21 |
#include <AknQueryDialog.h> |
|
22 |
#include <Calendar.rsg> |
|
23 |
#include <calencommonui.rsg> |
|
24 |
#include <akntoolbar.h> |
|
25 |
#include <calendateutils.h> |
|
26 |
#include <calencommandhandler.h> |
|
27 |
#include <calencommands.hrh> // Calendar commands |
|
28 |
#include <calentoolbar.h> |
|
29 |
#include <akntoolbarextension.h> |
|
30 |
#include <calenactionuiutils.h> |
|
31 |
#include <featmgr.h> |
|
32 |
||
33 |
#include "calendarui_debug.h" |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
34 |
#include "calenviewmanager.h" |
89 | 35 |
#include "CalenUid.h" |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
36 |
#include "calencontroller.h" |
89 | 37 |
#include "calenviewpopulator.h" |
38 |
#include "calenglobaldata.h" |
|
39 |
#include "CalendarPrivateCRKeys.h" // includes CalendarInternalCRKeys.h |
|
40 |
#include "calenmonthview.h" // Native month view |
|
41 |
#include "calenweekview.h" // Native week view |
|
42 |
#include "calendayview.h" // Native day view |
|
43 |
#include "calentodoview.h" // Native todo view |
|
44 |
#include "caleneventview.h" // Event View |
|
45 |
#include "calenmissedalarmsview.h" // Missed alarms view |
|
46 |
#include "calenmissedeventview.h" // Missed event view |
|
47 |
#include "calensetting.h" // CCalenSetting::TViewType |
|
48 |
#include "calencmdlinelauncher.h" // Command line launcher |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
#include "calenservicesimpl.h" |
89 | 50 |
#include "CleanupResetAndDestroy.h" |
51 |
#include "calentoolbarimpl.h" |
|
52 |
#include "calencustomisationmanager.h" |
|
53 |
#include "calenviewinfo.h" |
|
54 |
#include "calentitlepane.h" |
|
55 |
#include "calenicons.h" |
|
56 |
#include "calendummyview.h" |
|
57 |
||
58 |
const TInt KArrayGranularity = 5; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
59 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
60 |
// ---------------------------------------------------------------------------- |
89 | 61 |
// CCalenViewManager::NewL |
62 |
// 1st phase of construction |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
63 |
// (other items were commented in a header). |
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 |
// |
89 | 66 |
CCalenViewManager* CCalenViewManager::NewL( CAknViewAppUi& aAppUi, |
67 |
CCalenController& aController ) |
|
68 |
{ |
|
69 |
TRACE_ENTRY_POINT; |
|
81 | 70 |
|
89 | 71 |
CCalenViewManager* self = new( ELeave ) CCalenViewManager( aAppUi,aController ); |
72 |
CleanupStack::PushL( self ); |
|
73 |
self->ConstructL(); |
|
74 |
CleanupStack::Pop( self ); |
|
45 | 75 |
|
89 | 76 |
TRACE_EXIT_POINT; |
77 |
return self; |
|
45 | 78 |
} |
79 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
80 |
// ---------------------------------------------------------------------------- |
89 | 81 |
// CCalenViewManager::CCalenViewManager |
82 |
// C++ default Constructor. |
|
83 |
// (other items were commented in a header). |
|
84 |
// ---------------------------------------------------------------------------- |
|
85 |
// |
|
86 |
CCalenViewManager::CCalenViewManager( CAknViewAppUi& aAppUi, |
|
87 |
CCalenController& aController ) |
|
88 |
: iAppUi( aAppUi ), iController( aController ) |
|
89 |
{ |
|
90 |
TRACE_ENTRY_POINT; |
|
91 |
TRACE_EXIT_POINT; |
|
92 |
} |
|
93 |
||
94 |
// ---------------------------------------------------------------------------- |
|
95 |
// CCalenViewManager::~CCalenViewManager |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
96 |
// Destructor. |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
97 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
98 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
99 |
// |
89 | 100 |
CCalenViewManager::~CCalenViewManager() |
101 |
{ |
|
102 |
TRACE_ENTRY_POINT; |
|
103 |
||
104 |
delete iPopulator; |
|
105 |
if(iToolbar) |
|
106 |
{ |
|
107 |
delete iToolbar; |
|
108 |
iToolbar = NULL; |
|
109 |
} |
|
110 |
if( iSetting ) |
|
111 |
{ |
|
112 |
iSetting->Release(); |
|
113 |
} |
|
114 |
||
115 |
if( iGlobalData ) |
|
116 |
{ |
|
117 |
iGlobalData->Release(); |
|
118 |
} |
|
119 |
||
120 |
iViewInfoArray.ResetAndDestroy(); |
|
121 |
iKnownPlugins.Reset(); |
|
51 | 122 |
|
89 | 123 |
delete iRemovedActiveView; |
124 |
delete iViewRemovalCallback; |
|
125 |
delete iIcons; |
|
126 |
||
127 |
TRACE_EXIT_POINT; |
|
128 |
} |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
129 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
130 |
// ---------------------------------------------------------------------------- |
89 | 131 |
// CCalenViewManager::ConstructL |
132 |
// 2nd phase of construction. |
|
133 |
// (other items were commented in a header). |
|
134 |
// ---------------------------------------------------------------------------- |
|
135 |
// |
|
136 |
void CCalenViewManager::ConstructL() |
|
137 |
{ |
|
138 |
TRACE_ENTRY_POINT; |
|
139 |
||
140 |
iGlobalData = CCalenGlobalData::InstanceL(); |
|
141 |
iPopulator = CCalenViewPopulator::NewL( iController ); |
|
142 |
||
143 |
// Only create a toolbar impl if touch is enabled and a CAknToolbar exists |
|
144 |
if( AknLayoutUtils::PenEnabled() ) |
|
145 |
{ |
|
146 |
CAknAppUi* appUi = static_cast<CAknAppUi*>( CEikonEnv::Static()->EikAppUi() ); |
|
147 |
if (appUi->CurrentFixedToolbar()) |
|
148 |
{ |
|
149 |
if ( FeatureManager::FeatureSupported( KFeatureIdFfCalDayView ) ) |
|
150 |
{ |
|
151 |
appUi->CurrentFixedToolbar()->SetToolbarVisibility( EFalse ); |
|
152 |
} |
|
153 |
else |
|
154 |
{ |
|
155 |
iToolbar = CCalenToolbarImpl::NewL( iController ); |
|
156 |
} |
|
157 |
} |
|
158 |
} |
|
159 |
||
160 |
iSetting = CCalenSetting::InstanceL(); |
|
161 |
iPreviousViewId.iViewUid = KNullUid; |
|
162 |
iAvoidRepopulation = EFalse; |
|
163 |
iStartupComplete = ETrue; |
|
164 |
iFakeExit = EFalse; |
|
165 |
TRACE_EXIT_POINT; |
|
166 |
} |
|
167 |
||
168 |
// ---------------------------------------------------------------------------- |
|
169 |
// CCalenViewManager::SetCustomisationManagerL |
|
170 |
// Creates custom views. |
|
171 |
// (other items were commented in a header). |
|
172 |
// ---------------------------------------------------------------------------- |
|
173 |
// |
|
174 |
void CCalenViewManager::ConstructCustomViewsL( |
|
175 |
CCalenCustomisationManager& aCustomisationManager ) |
|
176 |
{ |
|
177 |
TRACE_ENTRY_POINT; |
|
178 |
||
179 |
iCustomisationManager = &aCustomisationManager; |
|
180 |
ConstructCustomViewsL(); |
|
181 |
ConstructNativeViewsL(); |
|
182 |
||
183 |
TUid defViewUid = iSetting->DefaultView(); |
|
184 |
ActivateDefaultViewL( defViewUid ); |
|
185 |
||
186 |
// Register for view activation events |
|
187 |
iAppUi.AddViewActivationObserverL( this ); |
|
188 |
||
189 |
TRACE_EXIT_POINT; |
|
190 |
} |
|
191 |
||
192 |
// ---------------------------------------------------------------------------- |
|
193 |
// CCalenViewManager::ViewInfoArray |
|
194 |
// Get info array |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
195 |
// (other items were commented in a header). |
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 |
// |
89 | 198 |
RPointerArray<CCalenViewInfo>& CCalenViewManager::ViewInfoArray() |
199 |
{ |
|
200 |
TRACE_ENTRY_POINT; |
|
201 |
TRACE_EXIT_POINT; |
|
202 |
return iViewInfoArray; |
|
203 |
} |
|
204 |
||
205 |
// ---------------------------------------------------------------------------- |
|
206 |
// CCalenViewManager::CustomiszationManager |
|
207 |
// Return reference to the customisation manager |
|
208 |
// (other items were commented in a header). |
|
209 |
// ---------------------------------------------------------------------------- |
|
210 |
// |
|
211 |
CCalenCustomisationManager& CCalenViewManager::CustomisationManager() |
|
212 |
{ |
|
213 |
TRACE_ENTRY_POINT; |
|
214 |
||
215 |
ASSERT( iCustomisationManager ); |
|
216 |
||
217 |
TRACE_EXIT_POINT; |
|
218 |
return *iCustomisationManager; |
|
219 |
} |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
220 |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
221 |
// ---------------------------------------------------------------------------- |
89 | 222 |
// CCalenViewManager::ConstructNativeViewsL |
223 |
// Constructs the S60 native views and registers them with the view server |
|
224 |
// (other items were commented in a header). |
|
225 |
// ---------------------------------------------------------------------------- |
|
226 |
// |
|
227 |
void CCalenViewManager::ConstructNativeViewsL() |
|
228 |
{ |
|
229 |
TRACE_ENTRY_POINT; |
|
230 |
||
231 |
CCalenTitlePane::NewAndSwapL(iAppUi.StatusPane()); |
|
232 |
MCalenServices& services = iController.Services(); |
|
233 |
||
234 |
||
235 |
// Add the native views for the todo view, week view, day view , month |
|
236 |
// view and event view unless they are already provided by custom views |
|
237 |
// in ROM.This is enforced by the customisation manager rejecting any |
|
238 |
// views that try to replace the native views but are not in ROM. |
|
239 |
||
240 |
if (CreateNativeViewL(KUidCalenMonthView)) |
|
241 |
{ |
|
242 |
// Views take ownership of services object instantly. |
|
243 |
// No need for cleanup stack. |
|
244 |
CCalenMonthView* monthView = CCalenMonthView::NewL(services); |
|
245 |
AddNativeViewL(monthView); // takes ownership immediately. |
|
246 |
} |
|
247 |
||
248 |
if (CreateNativeViewL(KUidCalenWeekView)) |
|
249 |
{ |
|
250 |
// Views take ownership of services object instantly. |
|
251 |
// No need for cleanup stack. |
|
252 |
CCalenWeekView* weekView = CCalenWeekView::NewL(services); |
|
253 |
AddNativeViewL(weekView); // takes ownership immediately. |
|
254 |
} |
|
255 |
||
256 |
if (CreateNativeViewL(KUidCalenDayView)) |
|
257 |
{ |
|
258 |
// Views take ownership of services object instantly. |
|
259 |
// No need for cleanup stack. |
|
260 |
CCalenDayView* dayView = CCalenDayView::NewL(services); |
|
261 |
AddNativeViewL(dayView); // takes ownership immediately. |
|
262 |
} |
|
263 |
||
264 |
if (CreateNativeViewL(KUidCalenTodoView)) |
|
265 |
{ |
|
266 |
// Views take ownership of services object instantly. |
|
267 |
// No need for cleanup stack. |
|
268 |
CCalenTodoView* todoView = CCalenTodoView::NewL(services); |
|
269 |
AddNativeViewL(todoView); // takes ownership immediately. |
|
270 |
} |
|
271 |
||
272 |
if( CreateNativeViewL(KUidCalenEventView)) |
|
273 |
{ |
|
274 |
// Views take ownership of services object instantly. |
|
275 |
// No need for cleanup stack. |
|
276 |
CCalenEventView* eventView = CCalenEventView::NewL(services); |
|
277 |
AddNativeViewL(eventView); // takes ownership immediately. |
|
278 |
} |
|
279 |
||
280 |
if( CreateNativeViewL(KUidCalenMissedAlarmsView)) |
|
281 |
{ |
|
282 |
// Views take ownership of services object instantly. |
|
283 |
// No need for cleanup stack. |
|
284 |
CCalenMissedAlarmsView* missedAlarmsView = CCalenMissedAlarmsView::NewL(services); |
|
285 |
AddNativeViewL(missedAlarmsView); // takes ownership immediately. |
|
286 |
} |
|
287 |
||
288 |
if( CreateNativeViewL(KUidCalenMissedEventView)) |
|
289 |
{ |
|
290 |
// Views take ownership of services object instantly. |
|
291 |
// No need for cleanup stack. |
|
292 |
CCalenMissedEventView* missedEventView = CCalenMissedEventView::NewL(services); |
|
293 |
AddNativeViewL(missedEventView); // takes ownership immediately. |
|
294 |
} |
|
295 |
||
296 |
if(CreateNativeViewL(KUidCalenDummyView)) |
|
297 |
{ |
|
298 |
CCalenDummyView* dummyView = CCalenDummyView::NewL(services); |
|
299 |
AddNativeViewL(dummyView); |
|
300 |
} |
|
301 |
TRACE_EXIT_POINT; |
|
302 |
} |
|
303 |
||
304 |
// ---------------------------------------------------------------------------- |
|
305 |
// CCalenViewManager::CreateNativeViewL |
|
306 |
// Checks to see if the native view needs to created. |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
307 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
308 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
309 |
// |
89 | 310 |
TBool CCalenViewManager::CreateNativeViewL(TUid aViewUid) |
311 |
{ |
|
312 |
TRACE_ENTRY_POINT; |
|
51 | 313 |
|
89 | 314 |
TBool createNativeView = ETrue; |
315 |
TBool (*compareFn)(const TUid*, const CCalenViewInfo&) |
|
316 |
= CCalenViewInfo::ViewInfoIdentifier; |
|
317 |
||
318 |
TInt position = iViewInfoArray.Find( aViewUid, compareFn ); |
|
319 |
if ( position != KErrNotFound ) |
|
320 |
{ |
|
321 |
// A plugin is trying to replace a native view, find if it is rom |
|
322 |
// based or not |
|
323 |
TBool romBased = CustomisationManager().IsViewRomBased( aViewUid ); |
|
324 |
if ( romBased ) |
|
325 |
{ |
|
326 |
createNativeView = EFalse; |
|
327 |
} |
|
328 |
else |
|
329 |
{ |
|
330 |
// A non-rom plugin cannot replace the native views, so the view is |
|
331 |
// removed |
|
332 |
iAppUi.RemoveView( aViewUid ); |
|
333 |
||
334 |
// Remove the entry from the view info array |
|
335 |
iViewInfoArray.Remove( position ); |
|
336 |
||
337 |
createNativeView = ETrue; |
|
338 |
} |
|
339 |
} |
|
340 |
||
341 |
TRACE_EXIT_POINT; |
|
342 |
return createNativeView; |
|
343 |
} |
|
344 |
||
345 |
// ---------------------------------------------------------------------------- |
|
346 |
// CCalenViewManager::ConstructCustomViewsL |
|
347 |
// Constructs any custom views from all the plugins and registers them |
|
348 |
// with the view server |
|
349 |
// (other items were commented in a header). |
|
350 |
// ---------------------------------------------------------------------------- |
|
351 |
// |
|
352 |
void CCalenViewManager::ConstructCustomViewsL() |
|
353 |
{ |
|
354 |
TRACE_ENTRY_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
355 |
|
89 | 356 |
// Get the array of active plugins |
357 |
const RArray<TUid>& plugins = CustomisationManager().ActivePlugins(); |
|
358 |
||
359 |
// For every active plugin, discover if it offers any customised views |
|
360 |
// and adds them to the view server. |
|
361 |
TInt numPlugins = plugins.Count(); |
|
362 |
for( TInt pluginIndex( 0 ); pluginIndex < numPlugins; ++pluginIndex ) |
|
363 |
{ |
|
364 |
TUid pluginUid = plugins[pluginIndex]; |
|
365 |
ConstructCustomViewL( pluginUid ); |
|
366 |
} |
|
367 |
||
368 |
TRACE_EXIT_POINT; |
|
369 |
} |
|
370 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
371 |
// ---------------------------------------------------------------------------- |
89 | 372 |
// CCalenViewManager::ConstructCustomViewsL |
373 |
// Constructs the custom views from a particular plugin and registers them |
|
374 |
// with the view server |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
375 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
376 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
377 |
// |
89 | 378 |
void CCalenViewManager::ConstructCustomViewL( TUid aPluginUid ) |
379 |
{ |
|
380 |
TRACE_ENTRY_POINT; |
|
381 |
||
382 |
iKnownPlugins.AppendL( aPluginUid ); |
|
383 |
||
384 |
RPointerArray<CCalenView> customViews; |
|
385 |
CleanupResetAndDestroyPushL( customViews ); |
|
386 |
||
387 |
TRAP_IGNORE(CustomisationManager().GetCustomViewsL( aPluginUid, customViews )); |
|
388 |
for( TInt viewIndex( customViews.Count()-1 ); viewIndex >= 0; --viewIndex ) |
|
389 |
{ |
|
390 |
CCalenView* customView = customViews[viewIndex]; |
|
391 |
iAppUi.AddViewL( customView ); |
|
392 |
customViews.Remove( viewIndex ); |
|
393 |
} |
|
394 |
CleanupStack::PopAndDestroy(); // customViews |
|
395 |
||
396 |
TRACE_EXIT_POINT; |
|
397 |
} |
|
398 |
||
399 |
// ---------------------------------------------------------------------------- |
|
400 |
// CCalenViewManager::ActivateDefaultViewL |
|
401 |
// Activates the default view (retrieved from settings). |
|
402 |
// ---------------------------------------------------------------------------- |
|
403 |
// |
|
404 |
void CCalenViewManager::ActivateDefaultViewL( TUid aDefaultView ) |
|
405 |
{ |
|
406 |
TRACE_ENTRY_POINT; |
|
407 |
||
408 |
// Find the default view in the view cycle list |
|
409 |
TInt position = iViewInfoArray.Find( |
|
410 |
aDefaultView, CCalenViewInfo::ViewInfoIdentifier ); |
|
411 |
if( position != KErrNotFound ) |
|
412 |
{ |
|
413 |
iAppUi.SetDefaultViewL( *iAppUi.View( aDefaultView ) ); |
|
414 |
iViewCycleIndex = position; |
|
415 |
} |
|
416 |
else |
|
417 |
{ |
|
418 |
CRepository* repository = CRepository::NewL( KCRUidCalendar ); |
|
419 |
CleanupStack::PushL(repository); |
|
420 |
TInt tmp( static_cast<TInt>( KUidCalenMonthView.iUid ) ); |
|
421 |
TInt position = iViewInfoArray.Find( KUidCalenMonthView, CCalenViewInfo::ViewInfoIdentifier ); |
|
422 |
User::LeaveIfError( repository->Set( KCalendarDefaultStartView, tmp ) ); |
|
423 |
iAppUi.SetDefaultViewL( *iAppUi.View( KUidCalenMonthView ) ); |
|
424 |
iViewCycleIndex = position; |
|
425 |
CleanupStack::PopAndDestroy(repository); |
|
426 |
} |
|
427 |
TRACE_EXIT_POINT; |
|
428 |
||
429 |
} |
|
430 |
||
431 |
// ---------------------------------------------------------------------------- |
|
432 |
// CCalenViewManager::InterruptPopulationL |
|
433 |
// Interrupts the population of the current view. When the editors are launched |
|
434 |
// the view population is interrupted as it will be repopulated when the |
|
435 |
// the editor closes. |
|
436 |
// ---------------------------------------------------------------------------- |
|
437 |
// |
|
438 |
void CCalenViewManager::InterruptPopulationL() |
|
439 |
{ |
|
440 |
TRACE_ENTRY_POINT; |
|
441 |
||
442 |
// Cancel population of current view, if it's ongoing. |
|
443 |
iPopulator->InterruptPopulationL(); |
|
444 |
||
445 |
TRACE_EXIT_POINT; |
|
446 |
} |
|
45 | 447 |
|
448 |
// ---------------------------------------------------------------------------- |
|
89 | 449 |
// CCalenViewManager::RemoveCurrentViewFromMenu |
450 |
// Removes the current view from the cascading view switch menu |
|
451 |
// (other items were commented in a header). |
|
55 | 452 |
// ---------------------------------------------------------------------------- |
89 | 453 |
// |
454 |
void CCalenViewManager::RemoveCurrentViewFromMenu( CEikMenuPane* aMenuPane ) |
|
455 |
{ |
|
456 |
TRACE_ENTRY_POINT; |
|
457 |
||
458 |
TUid uid = CurrentView(); |
|
459 |
||
460 |
if( uid == KUidCalenMonthView ) |
|
461 |
{ |
|
462 |
aMenuPane->DeleteMenuItem( ECalenMonthView ); |
|
55 | 463 |
} |
89 | 464 |
else if( uid == KUidCalenWeekView ) |
465 |
{ |
|
466 |
aMenuPane->DeleteMenuItem( ECalenWeekView ); |
|
467 |
} |
|
468 |
else if( uid == KUidCalenDayView ) |
|
469 |
{ |
|
470 |
aMenuPane->DeleteMenuItem( ECalenDayView ); |
|
55 | 471 |
} |
89 | 472 |
else if( uid == KUidCalenTodoView ) |
473 |
{ |
|
474 |
aMenuPane->DeleteMenuItem( ECalenTodoView ); |
|
475 |
} |
|
476 |
else |
|
477 |
{ |
|
478 |
// Assert as this point should never be reached |
|
479 |
ASSERT( 0 ); |
|
480 |
} |
|
481 |
||
482 |
TRACE_EXIT_POINT; |
|
55 | 483 |
} |
484 |
||
485 |
// ---------------------------------------------------------------------------- |
|
89 | 486 |
// CCalenViewManager::AddNativeViewL |
487 |
// Adds a view to the array. |
|
488 |
// (other items were commented in a header). |
|
489 |
// ---------------------------------------------------------------------------- |
|
490 |
// |
|
491 |
void CCalenViewManager::AddNativeViewL( CCalenView* aView ) |
|
492 |
{ |
|
493 |
TRACE_ENTRY_POINT; |
|
494 |
||
495 |
CleanupStack::PushL( aView ); |
|
496 |
iAppUi.AddViewL( aView ); |
|
497 |
CleanupStack::Pop( aView ); |
|
498 |
||
499 |
const TDesC& menuName = aView->LocalisedViewNameL( CCalenView::EMenuName ); |
|
500 |
const TDesC& settingsName = aView->LocalisedViewNameL( CCalenView::ESettingsName ); |
|
501 |
||
502 |
TUid viewUid = aView->Id(); |
|
503 |
||
504 |
||
505 |
CCalenViewInfo* viewInfo = CCalenViewInfo::NewL( aView->Id(), |
|
506 |
KUidCalendar, |
|
507 |
menuName, |
|
508 |
settingsName, |
|
509 |
aView->CyclePosition() ); |
|
510 |
||
511 |
// Discover if a native view has been hidden by a plugin. |
|
512 |
TBool hidden = iCustomisationManager->HiddenView( viewUid ); |
|
513 |
viewInfo->Hide( hidden ); |
|
514 |
||
515 |
// Append to view info array |
|
516 |
iViewInfoArray.InsertInOrderAllowRepeatsL( viewInfo, |
|
517 |
CCalenViewInfo::CyclePositionComparison ); |
|
518 |
||
519 |
TRACE_EXIT_POINT; |
|
520 |
} |
|
521 |
||
522 |
// ---------------------------------------------------------------------------- |
|
523 |
// CCalenViewManager::HandleCommandL |
|
524 |
// Handles view manager commands. |
|
45 | 525 |
// (other items were commented in a header). |
526 |
// ---------------------------------------------------------------------------- |
|
527 |
// |
|
89 | 528 |
TBool CCalenViewManager::HandleCommandL( const TCalenCommand& aCommand ) |
529 |
{ |
|
530 |
TRACE_ENTRY_POINT; |
|
531 |
||
532 |
TBool commandUsed(EFalse); |
|
51 | 533 |
|
89 | 534 |
switch( aCommand.Command() ) |
535 |
{ |
|
536 |
case ECalenMonthView: |
|
537 |
{ |
|
538 |
RequestActivationL( KUidCalenMonthView ); |
|
539 |
} |
|
540 |
break; |
|
541 |
case ECalenWeekView: |
|
542 |
{ |
|
543 |
RequestActivationL( KUidCalenWeekView ); |
|
544 |
} |
|
545 |
break; |
|
546 |
case ECalenDayView: |
|
547 |
{ |
|
548 |
// reset the flag iForwardedToDayView as view switching is active |
|
549 |
if(iPreviousToDayView.iViewUid!=KNullUid) |
|
550 |
{ |
|
551 |
iPreviousToDayView.iViewUid = KNullUid; |
|
552 |
} |
|
553 |
||
554 |
TUid viewUid; |
|
555 |
if ( !iController.IsLaunchFromExternalApp() && FeatureManager::FeatureSupported( KFeatureIdFfCalDayView ) ) |
|
556 |
{ |
|
557 |
viewUid = KUidCalenBCDayViewPlugin; |
|
558 |
} |
|
559 |
else |
|
560 |
{ |
|
561 |
viewUid = KUidCalenDayView; |
|
562 |
} |
|
563 |
||
564 |
RequestActivationL( viewUid, KCalenDummyUid, KNullDesC8() ); |
|
565 |
if(iController.IsLaunchFromExternalApp()) |
|
566 |
{ |
|
567 |
iAvoidRepopulation = ETrue; |
|
568 |
} |
|
569 |
} |
|
570 |
break; |
|
571 |
case ECalenTodoView: |
|
572 |
{ |
|
573 |
if (iAvoidRepopulation) |
|
574 |
{ |
|
575 |
iAvoidRepopulation = EFalse; |
|
576 |
} |
|
577 |
RequestActivationL( KUidCalenTodoView ); |
|
578 |
} |
|
579 |
break; |
|
580 |
case ECalenEventView: |
|
581 |
{ |
|
582 |
// Fix for EJCU-7LKC2C :: to prevent the display of blank view, |
|
583 |
// just set the iAvoidRepopulation to EFalse, |
|
584 |
// so that view is populated properly |
|
57 | 585 |
|
89 | 586 |
if (iAvoidRepopulation) |
587 |
{ |
|
588 |
iAvoidRepopulation = EFalse; |
|
589 |
} |
|
57 | 590 |
|
89 | 591 |
RequestActivationL( KUidCalenEventView ); |
592 |
} |
|
593 |
break; |
|
594 |
case ECalenForwardsToDayView: |
|
595 |
{ |
|
596 |
// set the view iPreviousToDayView to handle the day view's cba |
|
597 |
// when returning from event view. |
|
598 |
// From month/week view -> day view -> event view -> day view |
|
599 |
iPreviousToDayView = iCurrentViewId; |
|
600 |
||
601 |
TUid viewUid; |
|
602 |
if ( FeatureManager::FeatureSupported( KFeatureIdFfCalDayView ) ) |
|
603 |
{ |
|
604 |
viewUid = KUidCalenBCDayViewPlugin; |
|
605 |
} |
|
606 |
else |
|
607 |
{ |
|
608 |
viewUid = KUidCalenDayView; |
|
609 |
} |
|
610 |
if(iAvoidRepopulation) |
|
611 |
{ |
|
612 |
iAvoidRepopulation = EFalse; |
|
613 |
} |
|
614 |
RequestActivationL( viewUid, KUidCalenShowBackCba ); |
|
615 |
} |
|
616 |
break; |
|
617 |
case ECalenForwardsToWeekView: |
|
618 |
{ |
|
619 |
// set the view iPreviousToWeekView to handle the week view's cba |
|
620 |
// From month view -> week view |
|
621 |
iPreviousToWeekView = iCurrentViewId; |
|
622 |
if(iAvoidRepopulation) |
|
623 |
{ |
|
624 |
iAvoidRepopulation = EFalse; |
|
625 |
} |
|
626 |
RequestActivationL( KUidCalenWeekView, KUidCalenShowBackCba ); |
|
627 |
} |
|
628 |
break; |
|
629 |
case ECalenNextView: |
|
630 |
{ |
|
631 |
CycleNextViewL(); |
|
632 |
} |
|
633 |
break; |
|
634 |
case ECalenPrevView: |
|
635 |
{ |
|
636 |
CyclePrevViewL(); |
|
637 |
} |
|
638 |
break; |
|
639 |
case ECalenSwitchView: |
|
640 |
{ |
|
641 |
ShowSwitchViewQueryL(); |
|
642 |
} |
|
643 |
break; |
|
644 |
case ECalenStartActiveStep: |
|
645 |
{ |
|
646 |
StartActiveStepL(); |
|
647 |
} |
|
648 |
break; |
|
649 |
case ECalenFasterAppExit: |
|
650 |
{ |
|
651 |
HandleFasterAppExitCommandL(); |
|
652 |
} |
|
653 |
break; |
|
654 |
case ECalenGotoToday: |
|
655 |
{ |
|
656 |
// get today's date |
|
657 |
TTime today = CalenDateUtils::Today(); |
|
658 |
||
659 |
// get the context |
|
660 |
MCalenContext& context = iController.Services().Context(); |
|
661 |
TCalTime todayCalTime; |
|
662 |
todayCalTime.SetTimeLocalL( today ); |
|
663 |
// set today's date to the context |
|
664 |
context.SetFocusDateAndTimeL( todayCalTime, iCurrentViewId ); |
|
665 |
||
666 |
SetRepopulation(EFalse); |
|
667 |
// reactivate the current view |
|
668 |
//RequestActivationL(iCurrentViewId.iViewUid); |
|
669 |
RequestActivationL(KUidCalenDayView); |
|
670 |
||
671 |
// dim "today" toolbar item since focus is on today |
|
672 |
//iToolbar->Toolbar().SetItemDimmed( ECalenGotoToday, ETrue, ETrue); |
|
673 |
} |
|
674 |
break; |
|
675 |
case ECalenGotoNextDay: |
|
676 |
{ |
|
677 |
ChangeDayL( ETrue ); |
|
678 |
||
679 |
// reactivate the current view |
|
680 |
RequestActivationL(iCurrentViewId.iViewUid); |
|
681 |
} |
|
682 |
break; |
|
683 |
case ECalenGotoPrevDay: |
|
684 |
{ |
|
685 |
ChangeDayL( EFalse ); |
|
686 |
||
687 |
// reactivate the current view |
|
688 |
RequestActivationL(iCurrentViewId.iViewUid); |
|
689 |
} |
|
690 |
break; |
|
691 |
default: |
|
692 |
break; |
|
693 |
} |
|
694 |
||
695 |
TRACE_EXIT_POINT; |
|
696 |
return commandUsed; |
|
697 |
} |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
698 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
699 |
// ---------------------------------------------------------------------------- |
89 | 700 |
// CCalenViewManager::CalenCommandHandlerExtensionL |
701 |
// Dummy implementation. |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
702 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
703 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
704 |
// |
89 | 705 |
TAny* CCalenViewManager::CalenCommandHandlerExtensionL( TUid /*aExtensionUid*/ ) |
706 |
{ |
|
707 |
TRACE_ENTRY_POINT; |
|
708 |
TRACE_EXIT_POINT; |
|
709 |
return NULL; |
|
75 | 710 |
} |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
711 |
|
89 | 712 |
// ---------------------------------------------------------------------------- |
713 |
// CCalenViewManager::CurrentView |
|
714 |
// Returns the current view's view uid. |
|
715 |
// (other items were commented in a header). |
|
716 |
// ---------------------------------------------------------------------------- |
|
717 |
// |
|
718 |
TUid CCalenViewManager::CurrentView() const |
|
719 |
{ |
|
720 |
TRACE_ENTRY_POINT; |
|
721 |
TRACE_EXIT_POINT; |
|
722 |
return iCurrentViewId.iViewUid; |
|
723 |
} |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
724 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
725 |
// ---------------------------------------------------------------------------- |
89 | 726 |
// CCalenViewManager::HandleViewActivation |
727 |
// From MCoeViewActivationObserver |
|
728 |
// Called just before a view in this application is activated by the view server |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
729 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
730 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
731 |
// |
89 | 732 |
void CCalenViewManager::HandleViewActivation( const TVwsViewId& aNewlyActivatedViewId, |
733 |
const TVwsViewId& aViewIdToBeDeactivated ) |
|
734 |
{ |
|
735 |
TRACE_ENTRY_POINT; |
|
736 |
||
737 |
TBool externalViewSwitch( EFalse ); |
|
738 |
// See if this is an internal or external view switch request |
|
739 |
if( aViewIdToBeDeactivated.iAppUid != KUidCalendar ) |
|
740 |
{ |
|
741 |
externalViewSwitch = ETrue; |
|
742 |
} |
|
743 |
||
744 |
// If this is an internal view switch (view cycling from the '*' key) |
|
745 |
// then ActivateLocalViewL will handle any necessary state changes. |
|
746 |
// If this is an external view switch then we need to find out if Calendar was already |
|
747 |
// running or if it is being launched to a specific view by another application |
|
748 |
// calling ActivateViewL with Calendars UID and the UID of one of the standard views. |
|
749 |
// In this case we need to set the current view in the state or we would get the |
|
750 |
// default view (from the settings) activated instead of the requested view. |
|
751 |
if( externalViewSwitch ) |
|
752 |
{ |
|
753 |
// Check that the view being activated belongs to Calendar. Although I don't see |
|
754 |
// how this would be called if this was false anyway. |
|
755 |
if( aNewlyActivatedViewId.iAppUid == KUidCalendar ) |
|
756 |
{ |
|
757 |
// Make sure that any when any open dialogs are closed Calendar will not close as well. |
|
758 |
// This could be true if Calendar was originally launched directly to the editor, and |
|
759 |
// so should be closed when the dialog is closed. If an external view switch request |
|
760 |
// arrives, we want the dialog to close but Calendar to remain open. |
|
761 |
// Otherwise we get a CONE 44 panic. |
|
762 |
//iIsExitOnDlgClose = EFalse; |
|
763 |
if( iFakeExit ) |
|
764 |
{ |
|
765 |
iCurrentViewId.iViewUid = iSetting->DefaultView(); |
|
766 |
} |
|
767 |
else |
|
768 |
{ |
|
769 |
iCurrentViewId = aNewlyActivatedViewId; |
|
770 |
} |
|
771 |
} |
|
772 |
} |
|
773 |
iFakeExit = EFalse; |
|
774 |
iViewsActivated = ETrue; |
|
51 | 775 |
|
89 | 776 |
// check for iAvoidRepopulation to avoid repopulation whenever |
777 |
// 1) Application comes to foreground |
|
778 |
// 2) Applictaion is opened after fake exit |
|
779 |
if(!iAvoidRepopulation || iController.IsLaunchFromExternalApp() ) |
|
780 |
{ |
|
781 |
TRAPD(error,StartActiveStepL()); |
|
782 |
if(error!=KErrNone) |
|
783 |
{ |
|
784 |
// do avoid warning |
|
785 |
} |
|
786 |
} |
|
787 |
||
788 |
// Reset the flag iAvoidRepopulation |
|
789 |
if (iAvoidRepopulation) |
|
790 |
{ |
|
791 |
iAvoidRepopulation = EFalse; |
|
792 |
} |
|
793 |
TRACE_EXIT_POINT; |
|
794 |
} |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
795 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
796 |
// ---------------------------------------------------------------------------- |
89 | 797 |
// CCalenViewManager::RemoveDeActivatedView |
798 |
// Asyncronous callback function to remove the current view after it has been |
|
799 |
// disabled. |
|
800 |
// (other items were commented in a header). |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
801 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
802 |
// |
89 | 803 |
TInt CCalenViewManager::RemoveDeActivatedView( TAny* aObject ) |
804 |
{ |
|
805 |
TRACE_ENTRY_POINT; |
|
806 |
||
807 |
CCalenViewManager* thisPtr( static_cast<CCalenViewManager*>( aObject ) ); |
|
808 |
TRAP_IGNORE( thisPtr->RemoveDeActivatedViewL() ); |
|
809 |
||
810 |
TRACE_EXIT_POINT; |
|
811 |
return 0; |
|
812 |
} |
|
813 |
||
814 |
// ---------------------------------------------------------------------------- |
|
815 |
// CCalenViewManager::RemoveDeActivatedViewL. |
|
816 |
// (Leaving version) |
|
817 |
// Asyncronous callback function to remove the current view after it has been |
|
818 |
// disabled. |
|
819 |
// (other items were commented in a header). |
|
820 |
// ---------------------------------------------------------------------------- |
|
821 |
// |
|
822 |
void CCalenViewManager::RemoveDeActivatedViewL() |
|
823 |
{ |
|
824 |
TRACE_ENTRY_POINT; |
|
825 |
||
826 |
TUid removedViewUid = iRemovedActiveView->ViewUid(); |
|
827 |
TUid removedPluginUid = iRemovedActiveView->PluginUid(); |
|
51 | 828 |
|
89 | 829 |
// The view isn't the current view, so we |
830 |
// can remove it directly from the view server |
|
831 |
iAppUi.RemoveView( removedViewUid ); |
|
832 |
||
833 |
// Delete the view info |
|
834 |
delete iRemovedActiveView;; |
|
835 |
iRemovedActiveView = NULL; |
|
836 |
||
837 |
// Unload the plugin. |
|
838 |
RArray<TUid> pluginArray; |
|
839 |
CleanupClosePushL( pluginArray ); |
|
840 |
||
841 |
pluginArray.AppendL( removedPluginUid ); |
|
842 |
iCustomisationManager->UnloadPluginsL( pluginArray ); |
|
843 |
CleanupStack::PopAndDestroy(); // pluginArray |
|
844 |
||
845 |
if(!iController.IsFasterAppFlagEnabled()) |
|
846 |
{ |
|
847 |
// Refresh the current view by simulating a settings close |
|
848 |
iController.BroadcastNotification( ECalenNotifySettingsClosed ); |
|
849 |
} |
|
850 |
else |
|
851 |
{ |
|
852 |
iController.BroadcastNotification( ECalenNotifyCheckPluginUnloading ); |
|
853 |
} |
|
854 |
||
855 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
856 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
857 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
858 |
// ---------------------------------------------------------------------------- |
89 | 859 |
// CCalenViewManager::CycleNextViewL |
860 |
// Requests activation for the next view in the view cycle |
|
861 |
// (other items were commented in a header). |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
862 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
863 |
// |
89 | 864 |
void CCalenViewManager::CycleNextViewL() |
865 |
{ |
|
866 |
TRACE_ENTRY_POINT; |
|
867 |
||
868 |
// Increment until we get to a valid view. |
|
869 |
do{ |
|
870 |
++iViewCycleIndex; |
|
871 |
||
872 |
if( iViewCycleIndex >= iViewInfoArray.Count() ) |
|
873 |
{ |
|
874 |
iViewCycleIndex = 0; |
|
875 |
} |
|
876 |
} |
|
877 |
while( iViewInfoArray[iViewCycleIndex]->CyclePosition() == CCalenView::ENoCyclePosition ); |
|
878 |
||
879 |
RequestActivationL( iViewInfoArray[iViewCycleIndex]->ViewUid() ); |
|
880 |
||
881 |
TRACE_EXIT_POINT; |
|
882 |
} |
|
883 |
||
884 |
// ---------------------------------------------------------------------------- |
|
885 |
// CCalenViewManager::CyclePrevViewL |
|
886 |
// Requests activation for the previous view in the view cycle |
|
887 |
// (other items were commented in a header). |
|
888 |
// ---------------------------------------------------------------------------- |
|
889 |
// |
|
890 |
void CCalenViewManager::CyclePrevViewL() |
|
891 |
{ |
|
892 |
TRACE_ENTRY_POINT; |
|
893 |
||
894 |
// Decrement until we get to a valid view. |
|
895 |
do{ |
|
896 |
--iViewCycleIndex; |
|
897 |
||
898 |
if( iViewCycleIndex < 0 ) |
|
899 |
{ |
|
900 |
iViewCycleIndex = iViewInfoArray.Count()-1; |
|
901 |
} |
|
902 |
} |
|
903 |
while ( iViewInfoArray[iViewCycleIndex]->CyclePosition() == CCalenView::ENoCyclePosition ); |
|
904 |
||
905 |
RequestActivationL( iViewInfoArray[iViewCycleIndex]->ViewUid() ); |
|
906 |
||
907 |
TRACE_EXIT_POINT; |
|
908 |
} |
|
909 |
||
910 |
// ---------------------------------------------------------------------------- |
|
911 |
// CCalenViewManager::RequestActivationL |
|
912 |
// Request activation of a specific view. |
|
913 |
// (other items were commented in a header). |
|
914 |
// ---------------------------------------------------------------------------- |
|
915 |
// |
|
916 |
void CCalenViewManager::RequestActivationL( const TVwsViewId& aViewId ) |
|
917 |
{ |
|
918 |
TRACE_ENTRY_POINT; |
|
51 | 919 |
|
89 | 920 |
RequestActivationL( aViewId.iViewUid ); |
921 |
||
922 |
TRACE_EXIT_POINT; |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
923 |
} |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
924 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
925 |
// ---------------------------------------------------------------------------- |
89 | 926 |
// CCalenViewManager::RequestActivationL |
927 |
// Call this to try to activate a view |
|
928 |
// (other items were commented in a header). |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
929 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
930 |
// |
89 | 931 |
void CCalenViewManager::RequestActivationL( const TUid& aViewUid, |
932 |
const TUid& aMessageId, |
|
933 |
const TDesC8& aMessage ) |
|
934 |
{ |
|
935 |
TRACE_ENTRY_POINT; |
|
936 |
||
937 |
// Cancel population of current view, if it's ongoing. |
|
938 |
iPopulator->InterruptPopulationL(); |
|
939 |
// We start population of the newly activated view in HandleViewActivationL. |
|
940 |
||
941 |
// cache the previousviewid as we are getting aViewUid as reference. |
|
942 |
TUid cachePreviousViewId = iCurrentViewId.iViewUid; |
|
943 |
||
944 |
iCurrentViewId.iViewUid = aViewUid; |
|
945 |
// Update the view cycle index as iViewInfoArray would have changed |
|
946 |
iViewCycleIndex = iViewInfoArray.Find( iCurrentViewId.iViewUid, |
|
947 |
CCalenViewInfo::ViewInfoIdentifier ); |
|
51 | 948 |
|
89 | 949 |
if( iController.IsFasterAppFlagEnabled() ) |
950 |
{ |
|
951 |
// Leave the application in background |
|
952 |
iAppUi.HideInBackground(); |
|
953 |
// Disable bring-to-foreground on view activation |
|
954 |
iAppUi.SetCustomControl(1); |
|
955 |
||
956 |
// activate the view |
|
957 |
iAppUi.ActivateLocalViewL( aViewUid, KCalenHideInBackGround, KNullDesC8() ); |
|
958 |
||
959 |
// Enable bring-to-foreground on view activation. |
|
960 |
iAppUi.SetCustomControl(0); |
|
45 | 961 |
} |
89 | 962 |
else |
963 |
{ |
|
964 |
iAppUi.ActivateLocalViewL( aViewUid, aMessageId, aMessage ); |
|
965 |
} |
|
966 |
||
967 |
// set the previous view id |
|
968 |
if(cachePreviousViewId != KUidCalenEventView || cachePreviousViewId != iCurrentViewId.iViewUid) |
|
969 |
{ |
|
970 |
iPreviousViewId.iViewUid = cachePreviousViewId; |
|
971 |
} |
|
972 |
TRACE_EXIT_POINT; |
|
973 |
} |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
974 |
|
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
975 |
// ---------------------------------------------------------------------------- |
89 | 976 |
// CCalenViewManager::StartActiveStepL |
977 |
// Starts population of the current view. |
|
978 |
// ---------------------------------------------------------------------------- |
|
979 |
// |
|
980 |
void CCalenViewManager::StartActiveStepL() |
|
981 |
{ |
|
982 |
TRACE_ENTRY_POINT; |
|
983 |
||
984 |
// check for current viewid |
|
985 |
// populate the view only if iCurrentViewId is set |
|
986 |
if(iCurrentViewId.iViewUid != KNullUid) |
|
987 |
{ |
|
988 |
iPopulator->InterruptPopulationL(); |
|
989 |
iPopulator->BeginPopulationL(reinterpret_cast<CCalenView*>(iAppUi.View(CurrentView()))); |
|
990 |
} |
|
991 |
||
992 |
TRACE_EXIT_POINT; |
|
993 |
} |
|
994 |
||
995 |
// ---------------------------------------------------------------------------- |
|
996 |
// CCalenViewManager::ShowSwitchViewQueryL |
|
997 |
// Prompts the user to chose a view to switch to. If cancelled, returns |
|
998 |
// KErrCancel, otherwise one of ECalen*view. |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
999 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1000 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1001 |
// |
89 | 1002 |
void CCalenViewManager::ShowSwitchViewQueryL() |
1003 |
{ |
|
1004 |
TRACE_ENTRY_POINT; |
|
1005 |
||
1006 |
// Create list of view names and uids |
|
1007 |
CDesCArrayFlat* viewNames = new( ELeave ) CDesCArrayFlat( KArrayGranularity ); |
|
1008 |
CleanupStack::PushL( viewNames ); |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1009 |
|
89 | 1010 |
RArray<TUid> viewUids; |
1011 |
CleanupClosePushL( viewUids ); |
|
1012 |
||
1013 |
const RArray<TUid>& activePlugins = CustomisationManager().ActivePlugins(); |
|
1014 |
||
1015 |
for( TInt index( 0 ); index < iViewInfoArray.Count(); ++index ) |
|
1016 |
{ |
|
1017 |
CCalenViewInfo& viewInfo = *( iViewInfoArray[index] ); |
|
1018 |
if( index != iViewCycleIndex ) |
|
1019 |
{ |
|
1020 |
TUid pluginUid = viewInfo.PluginUid(); |
|
1021 |
TInt position = activePlugins.Find( pluginUid ); |
|
1022 |
||
1023 |
// If the view is from plugin or native view with cycle position, |
|
1024 |
// then add it to the switch view list |
|
1025 |
if(( position != KErrNotFound ) || |
|
1026 |
( viewInfo.CyclePosition() != CCalenView::ENoCyclePosition )) |
|
1027 |
{ |
|
1028 |
// Fetch the view name |
|
1029 |
TUid viewUid = viewInfo.ViewUid(); |
|
1030 |
const TDesC& viewName = viewInfo.MenuName(); |
|
1031 |
viewNames->AppendL( viewName ); |
|
1032 |
viewUids.AppendL(viewUid ); |
|
1033 |
} |
|
1034 |
} |
|
1035 |
} |
|
1036 |
||
1037 |
// Show list query. |
|
1038 |
TInt choice = KErrCancel; //KErrNotFound; |
|
1039 |
CAknListQueryDialog* dlg = new( ELeave ) CAknListQueryDialog( &choice ); |
|
1040 |
dlg->PrepareLC( R_CALENDAR_SWITCH_VIEW_QUERY ); // pushes dlg to CS |
|
1041 |
dlg->SetItemTextArray( viewNames ); |
|
1042 |
dlg->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
1043 |
||
1044 |
// Set title |
|
1045 |
CAknPopupHeadingPane* heading = dlg->Heading(); |
|
1046 |
HBufC* title = NULL; |
|
1047 |
title = CCoeEnv::Static()->AllocReadResourceLC( R_CALENDAR_SWITCH_VIEW_QUERY_TITLE ); |
|
1048 |
heading->SetTextL( *title ); |
|
1049 |
CleanupStack::PopAndDestroy( title ); |
|
1050 |
||
1051 |
if( dlg->RunLD() ) |
|
1052 |
{ |
|
1053 |
// user made a choice |
|
1054 |
TUid viewUid = viewUids[choice]; |
|
1055 |
iAvoidRepopulation = EFalse; |
|
1056 |
RequestActivationL( viewUid ); |
|
1057 |
} |
|
1058 |
||
1059 |
CleanupStack::PopAndDestroy(); // viewUids |
|
1060 |
CleanupStack::PopAndDestroy( viewNames ); |
|
1061 |
||
1062 |
TRACE_EXIT_POINT; |
|
1063 |
} |
|
51 | 1064 |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1065 |
// ---------------------------------------------------------------------------- |
89 | 1066 |
// CCalenViewManager::HandleNotification |
1067 |
// Calls back when notifications that it has been registered for are broadcast |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1068 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1069 |
// ---------------------------------------------------------------------------- |
89 | 1070 |
// |
1071 |
void CCalenViewManager::HandleNotification(const TCalenNotification aNotification ) |
|
1072 |
{ |
|
1073 |
TRACE_ENTRY_POINT; |
|
51 | 1074 |
|
89 | 1075 |
PIM_TRAPD_HANDLE( HandleNotificationL( aNotification ) ); |
1076 |
||
1077 |
TRACE_EXIT_POINT; |
|
1078 |
} |
|
1079 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1080 |
// ---------------------------------------------------------------------------- |
89 | 1081 |
// CCalenViewManager::HandleNotificationL |
1082 |
// Called from HandleNotification() when notifications that it has been |
|
1083 |
// registered for are broadcast |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1084 |
// (other items were commented in a header). |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1085 |
// ---------------------------------------------------------------------------- |
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1086 |
// |
89 | 1087 |
void CCalenViewManager::HandleNotificationL( TCalenNotification aNotification ) |
1088 |
{ |
|
1089 |
TRACE_ENTRY_POINT; |
|
51 | 1090 |
|
89 | 1091 |
switch( aNotification ) |
1092 |
{ |
|
1093 |
case ECalenNotifyPluginEnabledDisabled: |
|
1094 |
{ |
|
1095 |
UpdatePluginListL(); |
|
1096 |
} |
|
1097 |
break; |
|
1098 |
case ECalenNotifySettingsClosed: |
|
1099 |
{ |
|
1100 |
// Nothing has changed, refresh statuspane only. |
|
1101 |
iAppUi.StatusPane()->DrawNow(); |
|
1102 |
} |
|
1103 |
break; |
|
1104 |
case ECalenNotifySettingsChanged: |
|
1105 |
{ |
|
1106 |
HandleSettingsChangeNotificationL(); |
|
1107 |
} |
|
1108 |
break; |
|
1109 |
case ECalenNotifyEntryDeleted: |
|
1110 |
case ECalenNotifyInstanceDeleted: |
|
1111 |
{ |
|
1112 |
iAvoidRepopulation = EFalse; |
|
1113 |
HandleEntryDeleteNotificationL(); |
|
1114 |
} |
|
1115 |
break; |
|
1116 |
case ECalenNotifySystemLocaleChanged: |
|
1117 |
case ECalenNotifyEntrySaved: |
|
1118 |
case ECalenNotifyMultipleEntriesDeleted: |
|
1119 |
case ECalenNotifyExternalDatabaseChanged: |
|
1120 |
case ECalenNotifyCancelDelete: |
|
1121 |
case ECalenNotifyCalendarFieldChanged: |
|
1122 |
case ECalenNotifyMarkedEntryCompleted: |
|
1123 |
case ECalenNotifyCalendarInfoCreated: |
|
1124 |
case ECalenNotifyCalendarInfoUpdated: |
|
1125 |
{ |
|
1126 |
StartActiveStepL(); |
|
1127 |
} |
|
1128 |
break; |
|
1129 |
case ECalenNotifyCalendarFileDeleted: |
|
1130 |
{ |
|
1131 |
if(iCurrentViewId.iViewUid==KUidCalenEventView) |
|
1132 |
{ |
|
1133 |
//If the entry which is being viewed belongs to a calendar |
|
1134 |
//that is deleted we check for collection ids of entry and |
|
1135 |
//calendar session if they are same return to previous view |
|
1136 |
TPtrC calFileName = iGlobalData->Context().GetCalendarFileNameL(); |
|
1137 |
TPtrC calFileNameForColId = |
|
1138 |
iGlobalData->GetCalFileNameForCollectionId(iGlobalData->Context().InstanceId().iColId); |
|
1139 |
if(!calFileNameForColId.CompareF(calFileName)) |
|
1140 |
{ |
|
1141 |
ActivateDefaultViewL(iPreviousToDayView.iViewUid); |
|
1142 |
} |
|
1143 |
} |
|
1144 |
else |
|
1145 |
{ |
|
1146 |
// refresh the current view |
|
1147 |
StartActiveStepL(); |
|
1148 |
} |
|
1149 |
} |
|
1150 |
break; |
|
1151 |
case ECalenNotifyEntryClosed: |
|
1152 |
{ |
|
1153 |
HandleEntryClosedNotificationL(); |
|
1154 |
} |
|
1155 |
break; |
|
1156 |
case ECalenNotifySystemTimeChanged: |
|
1157 |
{ |
|
1158 |
HandleSystemTimeChangeNotificationL(); |
|
1159 |
} |
|
1160 |
break; |
|
1161 |
case ECalenNotifyAppForegrounded: |
|
1162 |
{ |
|
1163 |
// check for system time change whenever fake exit is done |
|
1164 |
// or application comes to foreground |
|
1165 |
if(!iStartupComplete) |
|
1166 |
{ |
|
1167 |
iController.CheckSystemTimeAtStartUpL(); |
|
1168 |
} |
|
1169 |
||
1170 |
if( iController.IsFasterAppFlagEnabled() ) |
|
1171 |
{ |
|
1172 |
iAppUi.HideApplicationFromFSW(EFalse); |
|
1173 |
iController.SetFasterAppFlag( EFalse ); |
|
1174 |
||
1175 |
ReloadAllPluginsL(); |
|
1176 |
} |
|
1177 |
else |
|
1178 |
{ |
|
1179 |
iAvoidRepopulation = EFalse; |
|
1180 |
} |
|
1181 |
} |
|
1182 |
break; |
|
1183 |
case ECalenNotifyDayViewClosed: |
|
1184 |
{ |
|
1185 |
if(iPreviousToDayView.iViewUid!= KNullUid) |
|
1186 |
{ |
|
1187 |
// activate the previous view from where day view is launched |
|
1188 |
// From month/week view -> day view |
|
1189 |
RequestActivationL(iPreviousToDayView.iViewUid); |
|
1190 |
} |
|
1191 |
} |
|
1192 |
break; |
|
1193 |
case ECalenNotifyWeekViewClosed: |
|
1194 |
{ |
|
1195 |
if(iPreviousToWeekView.iViewUid!= KNullUid) |
|
1196 |
{ |
|
1197 |
// activate the previous view from where day view is launched |
|
1198 |
// From month/week view -> day view |
|
1199 |
RequestActivationL(iPreviousToWeekView.iViewUid); |
|
1200 |
} |
|
1201 |
} |
|
1202 |
break; |
|
1203 |
case ECalenNotifyAppBackgrounded: |
|
1204 |
{ |
|
1205 |
// set the flag iAvoidRepopulation to prevent repopulation |
|
1206 |
// whenever application is brought to foreground |
|
1207 |
iAvoidRepopulation = ETrue; |
|
1208 |
||
1209 |
if( iController.IsFasterAppFlagEnabled() ) |
|
1210 |
{ |
|
1211 |
TRAP_IGNORE(iController.RemoveDeadCalendarsL()); |
|
1212 |
} |
|
1213 |
} |
|
1214 |
break; |
|
1215 |
case ECalenNotifyViewPopulationComplete: |
|
1216 |
{ |
|
1217 |
if(iStartupComplete) |
|
1218 |
{ |
|
1219 |
iController.CheckSystemTimeAtStartUpL(); |
|
1220 |
iStartupComplete = EFalse; |
|
1221 |
} |
|
1222 |
break; |
|
1223 |
} |
|
1224 |
case ECalenNotifyAttachmentViewerClosed: |
|
1225 |
{ |
|
1226 |
if( iCurrentViewId.iViewUid==KUidCalenEventView) |
|
1227 |
{ |
|
1228 |
StartActiveStepL(); |
|
1229 |
} |
|
1230 |
} |
|
1231 |
case ECalenNotifyAttachmentRemoved: |
|
1232 |
case ECalenNotifyAttachmentAdded: |
|
1233 |
{ |
|
1234 |
if( iCurrentViewId.iViewUid==KUidCalenEventView && |
|
1235 |
!iAvoidRepopulation ) |
|
1236 |
{ |
|
1237 |
StartActiveStepL(); |
|
1238 |
} |
|
1239 |
} |
|
1240 |
case ECalenNotifyDeleteFailed: |
|
1241 |
// Do nothing on deletion failed |
|
1242 |
default: |
|
1243 |
break; |
|
1244 |
} |
|
1245 |
||
1246 |
TRACE_EXIT_POINT; |
|
45 | 1247 |
} |
89 | 1248 |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1249 |
// ---------------------------------------------------------------------------- |
89 | 1250 |
// CCalenViewManager::UpdatePluginListL |
1251 |
// Discovers if a plugin has been enabled or disabled |
|
1252 |
// (other items were commented in a header). |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1253 |
// ---------------------------------------------------------------------------- |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1254 |
// |
89 | 1255 |
void CCalenViewManager::UpdatePluginListL() |
1256 |
{ |
|
1257 |
TRACE_ENTRY_POINT; |
|
51 | 1258 |
|
89 | 1259 |
const RArray<TUid>& activePlugins = CustomisationManager().ActivePlugins(); |
51 | 1260 |
|
89 | 1261 |
// Check for any new plugins |
1262 |
TInt activeCount = activePlugins.Count(); |
|
1263 |
for( TInt index( 0 ); index < activeCount; ++index ) |
|
1264 |
{ |
|
1265 |
// For every active plugin, check to see if it is in the known list, |
|
1266 |
// if it isn't construct any custom views. |
|
1267 |
TUid pluginUid = activePlugins[index]; |
|
1268 |
TInt position = iKnownPlugins.Find( pluginUid ); |
|
1269 |
if( position == KErrNotFound ) |
|
1270 |
{ |
|
1271 |
ConstructCustomViewL( pluginUid ); |
|
1272 |
} |
|
1273 |
} |
|
1274 |
||
1275 |
RArray<TUid> disabledPlugins; |
|
1276 |
CleanupClosePushL( disabledPlugins ); |
|
1277 |
||
1278 |
// Check for any disabled plugins |
|
1279 |
TInt knownCount = iKnownPlugins.Count(); |
|
1280 |
for( TInt index( knownCount - 1 ); index >= 0; --index ) |
|
1281 |
{ |
|
1282 |
// For every known plugin, check to see if it is in the active list, |
|
1283 |
// if it isn't add to the disable plugin list, and remove from the |
|
1284 |
// known list. |
|
1285 |
TUid pluginUid = iKnownPlugins[index]; |
|
1286 |
TInt position = activePlugins.Find( pluginUid ); |
|
1287 |
if ( position == KErrNotFound ) |
|
45 | 1288 |
{ |
89 | 1289 |
disabledPlugins.AppendL( pluginUid ); |
1290 |
iKnownPlugins.Remove( index ); |
|
1291 |
} |
|
1292 |
} |
|
55 | 1293 |
|
89 | 1294 |
TInt disabledPluginCount = disabledPlugins.Count(); |
1295 |
if( disabledPluginCount != 0 ) |
|
1296 |
{ |
|
1297 |
RemoveDisabledPluginsViewsL( disabledPlugins ); |
|
1298 |
// Re sort the view info array |
|
1299 |
iViewInfoArray.Sort( CCalenViewInfo::CyclePositionComparison ); |
|
1300 |
} |
|
1301 |
else |
|
1302 |
{ |
|
1303 |
// Update the view cycle index as iViewInfoArray would have changed |
|
1304 |
iViewCycleIndex = iViewInfoArray.Find( iCurrentViewId.iViewUid, CCalenViewInfo::ViewInfoIdentifier ); |
|
1305 |
} |
|
1306 |
UpdateToolbarNextViewIconL(iCurrentViewId.iViewUid); |
|
1307 |
||
1308 |
CleanupStack::PopAndDestroy(); // disabledPlugins |
|
1309 |
TRACE_EXIT_POINT; |
|
1310 |
} |
|
1311 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1312 |
// ---------------------------------------------------------------------------- |
89 | 1313 |
// CCalenViewManager::RemoveDisabledPluginsViewsL |
1314 |
// Removes any custom views provided by disabled plugins |
|
1315 |
// from the view server. |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1316 |
// (other items were commented in a header). |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1317 |
// ---------------------------------------------------------------------------- |
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1318 |
// |
89 | 1319 |
void CCalenViewManager::RemoveDisabledPluginsViewsL( RArray<TUid>& aDisabledPlugins ) |
1320 |
{ |
|
1321 |
TRACE_ENTRY_POINT; |
|
55 | 1322 |
|
89 | 1323 |
// Find what views are provided by the disabled plugins |
1324 |
TInt disabledPluginCount = aDisabledPlugins.Count(); |
|
1325 |
RArray<TUid> removedViews; |
|
1326 |
CleanupClosePushL( removedViews ); |
|
1327 |
||
1328 |
TUid activeViewUid = CurrentView(); |
|
1329 |
||
1330 |
for( TInt index( disabledPluginCount - 1 ); index >= 0; --index ) |
|
1331 |
{ |
|
1332 |
TUid pluginUid = aDisabledPlugins[index]; |
|
1333 |
||
1334 |
// Does this plugin offer any views |
|
1335 |
TInt position = iViewInfoArray.Find( pluginUid, |
|
1336 |
CCalenViewInfo::ViewPluginIdentifier ); |
|
1337 |
TBool alreadySet = EFalse; |
|
1338 |
while( position != KErrNotFound ) |
|
1339 |
{ |
|
1340 |
CCalenViewInfo* view = iViewInfoArray[position]; |
|
1341 |
TUid viewUid = view->ViewUid(); |
|
1342 |
||
1343 |
// Remove from the view cycle list |
|
1344 |
iViewInfoArray.Remove( position ); |
|
1345 |
||
1346 |
RArray<TInt> hiddenViews; |
|
1347 |
iCustomisationManager->GetHiddenViewIdL(pluginUid, hiddenViews); |
|
1348 |
||
1349 |
if( viewUid == activeViewUid ) |
|
1350 |
{ |
|
1351 |
// Removing the active view is done in three parts |
|
1352 |
// 1) It is removed from the viewInfo list |
|
1353 |
// 2) When settings is closed, the view is switched |
|
1354 |
// to the next view in the view cycle list. |
|
1355 |
// 3) When the view is deactivated it can be deleted. |
|
1356 |
||
1357 |
// Store the information about the current view. |
|
1358 |
iRemovedActiveView = view; |
|
1359 |
||
1360 |
// Update the view cycle index so that hidden view is launched while cycling next view |
|
1361 |
if(hiddenViews.Count()) |
|
1362 |
{ |
|
1363 |
// Find the index of teh hidden view |
|
1364 |
TInt viewInfoIndex = iViewInfoArray.Find(TUid::Uid(hiddenViews[0]), CCalenViewInfo::ViewInfoIdentifier); |
|
1365 |
iViewCycleIndex = viewInfoIndex - 1; // Decrementing it as CycleNextView() funciton will increment it |
|
1366 |
} |
|
1367 |
else if(!alreadySet) |
|
1368 |
{ |
|
1369 |
TInt nextViewCycleIndex = iViewCycleIndex - 1; // To update the view cycle index in plugin disable case |
|
1370 |
||
1371 |
// Update the view cycle index as iViewInfoArray would have changed |
|
1372 |
iViewCycleIndex = iViewInfoArray.Find( iCurrentViewId.iViewUid, CCalenViewInfo::ViewInfoIdentifier ); |
|
1373 |
||
1374 |
// If the current active view has been removed, |
|
1375 |
if(iViewCycleIndex == -1) |
|
1376 |
{ |
|
1377 |
iViewCycleIndex = nextViewCycleIndex; |
|
1378 |
} |
|
1379 |
alreadySet = ETrue; |
|
1380 |
} |
|
1381 |
||
1382 |
hiddenViews.Reset(); |
|
1383 |
// Remove the plugin from the disabled plugin list |
|
1384 |
// to stop the plugin being deleted. |
|
1385 |
aDisabledPlugins.Remove( index ); |
|
1386 |
} |
|
1387 |
else |
|
1388 |
{ |
|
1389 |
// The view isn't the current view, so we |
|
1390 |
// can remove it directly from the view server |
|
1391 |
iAppUi.RemoveView( viewUid ); |
|
45 | 1392 |
|
89 | 1393 |
// Delete the view info |
1394 |
delete view; |
|
1395 |
if(!alreadySet) |
|
1396 |
{ |
|
1397 |
TInt nextViewCycleIndex = iViewCycleIndex - 1; // To update the view cycle index in plugin disable case |
|
1398 |
||
1399 |
// Update the view cycle index as iViewInfoArray would have changed |
|
1400 |
iViewCycleIndex = iViewInfoArray.Find( iCurrentViewId.iViewUid, CCalenViewInfo::ViewInfoIdentifier ); |
|
1401 |
||
1402 |
// If the current active view has been removed, |
|
1403 |
if(iViewCycleIndex == -1) |
|
1404 |
{ |
|
1405 |
iViewCycleIndex = nextViewCycleIndex; |
|
1406 |
} |
|
1407 |
alreadySet = ETrue; |
|
1408 |
} |
|
1409 |
||
1410 |
} |
|
1411 |
||
1412 |
position = iViewInfoArray.Find( pluginUid, |
|
1413 |
CCalenViewInfo::ViewPluginIdentifier ); |
|
1414 |
} |
|
1415 |
} |
|
1416 |
||
1417 |
// Unload the disabled plugins |
|
1418 |
iCustomisationManager->UnloadPluginsL( aDisabledPlugins ); |
|
1419 |
||
1420 |
CleanupStack::PopAndDestroy(); // removedViews |
|
1421 |
||
1422 |
TRACE_EXIT_POINT; |
|
1423 |
} |
|
1424 |
||
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1425 |
// ---------------------------------------------------------------------------- |
89 | 1426 |
// CCalenViewManager::ToolbarOrNull |
1427 |
// Provides access to the calendar toolbar if one is available |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1428 |
// ---------------------------------------------------------------------------- |
89 | 1429 |
MCalenToolbar* CCalenViewManager::ToolbarOrNull() |
1430 |
{ |
|
1431 |
TRACE_ENTRY_POINT; |
|
1432 |
TRACE_EXIT_POINT; |
|
1433 |
if (iToolbar) |
|
1434 |
{ |
|
1435 |
if (iToolbar->IsICalenToolBar()) |
|
1436 |
{ |
|
1437 |
return iToolbar; |
|
1438 |
} |
|
1439 |
} |
|
1440 |
return NULL; |
|
1441 |
} |
|
51 | 1442 |
|
89 | 1443 |
// ---------------------------------------------------------------------------- |
1444 |
// CCalenViewManager::ViewsActivated |
|
1445 |
// Returns if the first view activation on start-up has taken place |
|
1446 |
// ---------------------------------------------------------------------------- |
|
1447 |
TBool CCalenViewManager::ViewsActivated() const |
|
1448 |
{ |
|
1449 |
TRACE_ENTRY_POINT; |
|
1450 |
TRACE_EXIT_POINT; |
|
1451 |
return iViewsActivated; |
|
1452 |
} |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1453 |
|
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1454 |
// ---------------------------------------------------------------------------- |
89 | 1455 |
// CCalenViewManager::UpdateToolbarNextViewIconL |
1456 |
// Updates the nextview icon on the toolbar when default view is not month view |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1457 |
// ---------------------------------------------------------------------------- |
89 | 1458 |
void CCalenViewManager::UpdateToolbarNextViewIconL(TUid aViewUid) |
1459 |
{ |
|
1460 |
// Set the view cycle index based on the newly activated view, |
|
1461 |
// if the view is in the cycle array. |
|
1462 |
TInt index = iViewInfoArray.Find( aViewUid, CCalenViewInfo::ViewInfoIdentifier ); |
|
1463 |
if( index != KErrNotFound ) |
|
1464 |
{ |
|
1465 |
iViewCycleIndex = index; |
|
1466 |
if( iToolbar ) |
|
1467 |
{ |
|
1468 |
TInt nextVwIndex = iViewCycleIndex; |
|
1469 |
do{ |
|
1470 |
nextVwIndex = ( nextVwIndex + 1 )%(iViewInfoArray.Count()); |
|
1471 |
} |
|
1472 |
while( iViewInfoArray[nextVwIndex]->CyclePosition() == CCalenView::ENoCyclePosition ); |
|
1473 |
||
1474 |
CCalenView* nextview = static_cast<CCalenView*>( |
|
1475 |
iAppUi.View( iViewInfoArray[nextVwIndex]->ViewUid() ) ); |
|
1476 |
iToolbar->SetNextViewIcon( nextview->ViewIconL() ); |
|
1477 |
} |
|
1478 |
} |
|
55 | 1479 |
} |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1480 |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1481 |
// ---------------------------------------------------------------------------- |
89 | 1482 |
// CCalenViewManager::HandleFasterAppExitCommandL |
1483 |
// Handles ECalenFasterAppExit command |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1484 |
// ---------------------------------------------------------------------------- |
89 | 1485 |
void CCalenViewManager::HandleFasterAppExitCommandL() |
1486 |
{ |
|
1487 |
TRACE_ENTRY_POINT; |
|
1488 |
||
1489 |
if(iToolbar) |
|
1490 |
{ |
|
1491 |
iToolbar->SetToolbarExtensionFocus(EFalse); |
|
1492 |
} |
|
1493 |
||
1494 |
// For Handling : When the default view is changed keeping that view open, |
|
1495 |
// from day view changing the default view from month view to day view, |
|
1496 |
// we need to reset the previous view id. |
|
1497 |
if(iPreviousToDayView.iViewUid!=KNullUid) |
|
1498 |
{ |
|
1499 |
iPreviousToDayView.iViewUid = KNullUid; |
|
1500 |
} |
|
1501 |
||
1502 |
// For handling specific case::Calendar exited from FSW |
|
1503 |
// iAvoidRepopulation is set when app backgrounded. |
|
1504 |
// Reset the flag for activating the view in background |
|
1505 |
if(iAvoidRepopulation) |
|
1506 |
{ |
|
1507 |
iAvoidRepopulation = EFalse; |
|
1508 |
} |
|
1509 |
||
1510 |
// In case of fasterapp exit, first activate the dummy view before deleting the plugin views |
|
1511 |
// Get the default view before we remove plugins |
|
1512 |
iPreviousViewId.iViewUid = KNullUid; |
|
1513 |
||
1514 |
iController.SetExitOnDialogFlag( EFalse ); // for making iisexitondialogclose EFalse. |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1515 |
|
89 | 1516 |
TUid defView = iSetting->DefaultView(); |
1517 |
||
1518 |
// unload all plugins |
|
1519 |
iCustomisationManager->DisableAllPluginsL(); |
|
1520 |
ActivateViewOnFakeExitL(defView); |
|
1521 |
// Though the current view is active view, there is no need to issue a callback as we are exiting the whole application. |
|
1522 |
if( iRemovedActiveView ) |
|
1523 |
{ |
|
1524 |
||
1525 |
if( !iViewRemovalCallback ) |
|
1526 |
{ |
|
1527 |
TCallBack callback( RemoveDeActivatedView, this ); |
|
1528 |
iViewRemovalCallback = new( ELeave ) CAsyncCallBack( callback, |
|
1529 |
CActive::EPriorityStandard ); |
|
1530 |
} |
|
1531 |
iViewRemovalCallback->CallBack(); |
|
1532 |
} |
|
1533 |
||
1534 |
TRACE_EXIT_POINT; |
|
1535 |
} |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1536 |
// ---------------------------------------------------------------------------- |
89 | 1537 |
// CCalenViewManager::HandleSettingsChangeNotificationL |
1538 |
// Handles ECalenNotifySettingsChanged notification |
|
18
c198609911f9
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1539 |
// ---------------------------------------------------------------------------- |
89 | 1540 |
void CCalenViewManager::HandleSettingsChangeNotificationL() |
1541 |
{ |
|
1542 |
TRACE_ENTRY_POINT; |
|
1543 |
||
1544 |
if( iController.IsFasterAppFlagEnabled() ) |
|
1545 |
{ |
|
1546 |
TUid newViewUid = iSetting->DefaultView(); |
|
1547 |
if(IsNativeView(newViewUid)) |
|
1548 |
{ |
|
1549 |
TUid oldViewUid = CurrentView(); |
|
1550 |
if( newViewUid.iUid != oldViewUid.iUid ) |
|
1551 |
{ |
|
1552 |
RequestActivationL( newViewUid ); |
|
1553 |
} |
|
1554 |
} |
|
1555 |
||
1556 |
// If the plugins are activated using general settings. |
|
1557 |
// unload all plugins.Only load the plugins when application |
|
1558 |
// comes to foreground |
|
1559 |
const RArray<TUid>& plugins = CustomisationManager().ActivePlugins(); |
|
1560 |
if(plugins.Count()) |
|
1561 |
{ |
|
1562 |
// unload all plugins |
|
1563 |
iCustomisationManager->DisableAllPluginsL(); |
|
1564 |
} |
|
1565 |
} |
|
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1566 |
|
89 | 1567 |
if( iRemovedActiveView ) |
1568 |
{ |
|
1569 |
// If the active view has been disabled, the next view in |
|
1570 |
// the view cycle list is activated and the current view |
|
1571 |
// is removed asyncronously. |
|
1572 |
CycleNextViewL(); |
|
45 | 1573 |
|
89 | 1574 |
if( !iViewRemovalCallback ) |
1575 |
{ |
|
1576 |
TCallBack callback( RemoveDeActivatedView, this ); |
|
1577 |
iViewRemovalCallback = new( ELeave ) CAsyncCallBack( callback, |
|
1578 |
CActive::EPriorityStandard ); |
|
1579 |
} |
|
1580 |
||
1581 |
iViewRemovalCallback->CallBack(); |
|
1582 |
} |
|
1583 |
else if(iCustomisationManager->HiddenView(iCurrentViewId.iViewUid)) |
|
1584 |
{ |
|
1585 |
// Get the uid of the plugin view that is hiding the current view |
|
1586 |
TUid viewUid = iCustomisationManager->GetReplacePluginViewIdL(iCurrentViewId.iViewUid); |
|
1587 |
||
1588 |
// update the view cycle index before activating the plugin view |
|
1589 |
iViewCycleIndex = iViewInfoArray.Find( viewUid, |
|
1590 |
CCalenViewInfo::ViewInfoIdentifier ); |
|
1591 |
RequestActivationL(viewUid); |
|
1592 |
} |
|
1593 |
else |
|
1594 |
{ |
|
1595 |
StartActiveStepL(); |
|
1596 |
} |
|
1597 |
||
1598 |
TRACE_EXIT_POINT; |
|
45 | 1599 |
} |
1600 |
||
1601 |
// ---------------------------------------------------------------------------- |
|
89 | 1602 |
// CCalenViewManager::HandleEntryDeleteNotificationL |
1603 |
// Handles ECalenNotifyEntryDeleted and ECalenNotifyInstanceDeleted |
|
1604 |
// notifications |
|
45 | 1605 |
// ---------------------------------------------------------------------------- |
89 | 1606 |
void CCalenViewManager::HandleEntryDeleteNotificationL() |
1607 |
{ |
|
1608 |
TRACE_ENTRY_POINT; |
|
51 | 1609 |
|
89 | 1610 |
if(iCurrentViewId.iViewUid == KUidCalenEventView) |
1611 |
{ |
|
1612 |
// Activate the previous view when an event is deleted from |
|
1613 |
// the event view |
|
1614 |
if(iPreviousViewId.iViewUid != KNullUid) |
|
1615 |
{ |
|
1616 |
if(iPreviousToDayView.iViewUid != KNullUid) |
|
1617 |
{ |
|
1618 |
RequestActivationL(iPreviousViewId.iViewUid, KUidCalenShowBackCba); |
|
1619 |
} |
|
1620 |
else |
|
1621 |
{ |
|
1622 |
RequestActivationL(iPreviousViewId.iViewUid); |
|
1623 |
} |
|
1624 |
} |
|
1625 |
} |
|
1626 |
else |
|
1627 |
{ |
|
1628 |
// refresh the current view |
|
1629 |
StartActiveStepL(); |
|
1630 |
} |
|
1631 |
||
1632 |
TRACE_EXIT_POINT; |
|
64 | 1633 |
} |
45 | 1634 |
|
1635 |
// ---------------------------------------------------------------------------- |
|
89 | 1636 |
// CCalenViewManager::HandleEntryClosedNotificationL |
1637 |
// Handles ECalenNotifyEntryClosed notification |
|
45 | 1638 |
// ---------------------------------------------------------------------------- |
89 | 1639 |
void CCalenViewManager::HandleEntryClosedNotificationL() |
1640 |
{ |
|
1641 |
TRACE_ENTRY_POINT; |
|
1642 |
||
1643 |
// reset tha flag iAvoidRepopulation to refresh the view. |
|
1644 |
iAvoidRepopulation = EFalse; |
|
1645 |
||
1646 |
// if previous view is native view activate that view |
|
1647 |
// otherwise commandlauncher will handle |
|
1648 |
if(iPreviousViewId.iViewUid != KNullUid) |
|
1649 |
{ |
|
1650 |
// if iPreviousToDayView is active activate the day view with "Back" cba. |
|
1651 |
if(iPreviousToDayView.iViewUid!=KNullUid) |
|
1652 |
{ |
|
1653 |
RequestActivationL(iPreviousViewId.iViewUid, KUidCalenShowBackCba); |
|
1654 |
} |
|
1655 |
else |
|
1656 |
{ |
|
1657 |
if( !iController.GetExitOnDialogFlag() ) |
|
1658 |
{ |
|
1659 |
RequestActivationL(iPreviousViewId.iViewUid); |
|
1660 |
} |
|
1661 |
} |
|
1662 |
} |
|
1663 |
||
1664 |
// reset tha flag iAvoidRepopulation to avoid the repopulation. |
|
1665 |
iAvoidRepopulation = ETrue; |
|
1666 |
||
1667 |
TRACE_EXIT_POINT; |
|
1668 |
} |
|
45 | 1669 |
|
1670 |
// ---------------------------------------------------------------------------- |
|
89 | 1671 |
// CCalenViewManager::HandleSystemTimeChangeNotificationL |
1672 |
// Handles ECalenNotifySystemTimeChanged notification |
|
55 | 1673 |
// ---------------------------------------------------------------------------- |
89 | 1674 |
void CCalenViewManager::HandleSystemTimeChangeNotificationL() |
1675 |
{ |
|
1676 |
TRACE_ENTRY_POINT; |
|
1677 |
||
1678 |
//Set the context whenever system time is changed |
|
1679 |
TUid newViewUid = iSetting->DefaultView(); |
|
1680 |
MCalenContext& context = iController.Services().Context(); |
|
1681 |
TCalTime focusTime = context.DefaultCalTimeForViewsL(); |
|
1682 |
context.SetFocusDateAndTimeL( focusTime, |
|
1683 |
TVwsViewId( KUidCalendar, newViewUid )); |
|
1684 |
if( iController.IsFasterAppFlagEnabled() ) |
|
1685 |
{ |
|
1686 |
// reset tha flag iAvoidRepopulation to refresh the view whenever |
|
1687 |
// system time is changed |
|
1688 |
iAvoidRepopulation = EFalse; |
|
1689 |
||
1690 |
if(IsNativeView(newViewUid)) |
|
1691 |
{ |
|
1692 |
// activate the default view in background |
|
1693 |
RequestActivationL( newViewUid ); |
|
1694 |
} |
|
1695 |
||
1696 |
// set the flag iAvoidRepopulation to avoid repopulation |
|
1697 |
iAvoidRepopulation = ETrue; |
|
1698 |
} |
|
1699 |
else |
|
1700 |
{ |
|
1701 |
// refresh the current view |
|
1702 |
StartActiveStepL(); |
|
1703 |
} |
|
1704 |
||
1705 |
TRACE_EXIT_POINT; |
|
1706 |
} |
|
1707 |
||
1708 |
// ----------------------------------------------------------------------------- |
|
1709 |
// CCalenViewManager::IconsL |
|
1710 |
// Create a CCalenIcons object if neccessary and return a reference |
|
1711 |
// (other items were commented in a header). |
|
1712 |
// ----------------------------------------------------------------------------- |
|
1713 |
CCalenIcons& CCalenViewManager::IconsL() |
|
1714 |
{ |
|
1715 |
TRACE_ENTRY_POINT; |
|
1716 |
||
1717 |
if (!iIcons) |
|
1718 |
{ |
|
1719 |
// Icons |
|
1720 |
iIcons = CCalenIcons::NewL(); |
|
1721 |
} |
|
55 | 1722 |
|
89 | 1723 |
TRACE_EXIT_POINT; |
1724 |
return *iIcons; |
|
1725 |
} |
|
1726 |
||
1727 |
// ----------------------------------------------------------------------------- |
|
1728 |
// CCalenViewManager::GetNextViewIconL |
|
1729 |
// Gets next view icon |
|
1730 |
// ----------------------------------------------------------------------------- |
|
1731 |
CGulIcon* CCalenViewManager::GetNextViewIconL() |
|
1732 |
{ |
|
1733 |
TRACE_ENTRY_POINT; |
|
1734 |
||
1735 |
// Set the view cycle index based on the newly activated view, |
|
1736 |
// if the view is in the cycle array. |
|
1737 |
TInt index = iViewInfoArray.Find( iCurrentViewId.iViewUid, CCalenViewInfo::ViewInfoIdentifier ); |
|
1738 |
if( index != KErrNotFound ) |
|
1739 |
{ |
|
1740 |
iViewCycleIndex = index; |
|
1741 |
TInt nextVwIndex = iViewCycleIndex; |
|
1742 |
do |
|
1743 |
{ |
|
1744 |
nextVwIndex = ( nextVwIndex + 1 )%(iViewInfoArray.Count()); |
|
1745 |
}while( iViewInfoArray[nextVwIndex]->CyclePosition() == CCalenView::ENoCyclePosition ); |
|
1746 |
||
1747 |
// Get the next view icon |
|
1748 |
CCalenView* nextview = static_cast<CCalenView*>( iAppUi.View( iViewInfoArray[nextVwIndex]->ViewUid() ) ); |
|
1749 |
return( nextview->ViewIconL() ); |
|
55 | 1750 |
} |
89 | 1751 |
|
1752 |
TRACE_EXIT_POINT; |
|
1753 |
return NULL; |
|
1754 |
} |
|
1755 |
||
1756 |
// ----------------------------------------------------------------------------- |
|
1757 |
// CCalenViewManager::SetRepopulation |
|
1758 |
// Resets the flag iAvoidRepopulation to activate the view. |
|
1759 |
// ----------------------------------------------------------------------------- |
|
1760 |
void CCalenViewManager::SetRepopulation(TBool aRePopulate) |
|
1761 |
{ |
|
1762 |
TRACE_ENTRY_POINT; |
|
1763 |
// to prevent the display of blank view, |
|
1764 |
// set the iAvoidRepopulation to EFalse, |
|
1765 |
// so that view is populated properly |
|
1766 |
||
1767 |
iAvoidRepopulation = aRePopulate; |
|
1768 |
||
1769 |
TRACE_EXIT_POINT; |
|
1770 |
} |
|
1771 |
||
1772 |
// ----------------------------------------------------------------------------- |
|
1773 |
// CCalenViewManager::CalenToolbar |
|
1774 |
// Returns calendar toolbar |
|
1775 |
// ----------------------------------------------------------------------------- |
|
1776 |
CCalenToolbarImpl* CCalenViewManager::CalenToolbar() |
|
1777 |
{ |
|
1778 |
TRACE_ENTRY_POINT; |
|
1779 |
TRACE_EXIT_POINT; |
|
1780 |
return iToolbar; |
|
55 | 1781 |
} |
1782 |
||
89 | 1783 |
// ----------------------------------------------------------------------------- |
1784 |
// CCalenViewManager::ReloadAllPluginsL |
|
1785 |
// Reload all plugins |
|
1786 |
// ----------------------------------------------------------------------------- |
|
1787 |
void CCalenViewManager::ReloadAllPluginsL() |
|
1788 |
{ |
|
1789 |
TRACE_ENTRY_POINT; |
|
51 | 1790 |
|
89 | 1791 |
// load all plugins |
1792 |
iCustomisationManager->DoPluginLoadingL(); |
|
1793 |
UpdatePluginListL(); |
|
45 | 1794 |
|
89 | 1795 |
// only activate plugin view if it is default view |
1796 |
TUid defaultViewUid = iSetting->DefaultView(); |
|
1797 |
if(!IsNativeView(defaultViewUid)) |
|
1798 |
{ |
|
1799 |
iAvoidRepopulation = EFalse; |
|
1800 |
||
1801 |
// Find the default view in the view cycle list |
|
1802 |
TInt position = iViewInfoArray.Find( |
|
1803 |
defaultViewUid, CCalenViewInfo::ViewInfoIdentifier ); |
|
1804 |
if( position != KErrNotFound ) |
|
1805 |
{ |
|
1806 |
TVwsViewId targetViewId( KUidCalendar, defaultViewUid); |
|
1807 |
RequestActivationL(targetViewId); |
|
1808 |
iViewCycleIndex = position; |
|
1809 |
} |
|
1810 |
else |
|
1811 |
{ |
|
1812 |
// if plugin providing default view is already uninstalled |
|
1813 |
// activate month view as default view |
|
1814 |
CRepository* repository = CRepository::NewL( KCRUidCalendar ); |
|
1815 |
CleanupStack::PushL(repository); |
|
1816 |
TInt tmp( static_cast<TInt>( KUidCalenMonthView.iUid ) ); |
|
1817 |
TInt position = iViewInfoArray.Find( KUidCalenMonthView, CCalenViewInfo::ViewInfoIdentifier ); |
|
1818 |
User::LeaveIfError( repository->Set( KCalendarDefaultStartView, tmp ) ); |
|
1819 |
iAppUi.SetDefaultViewL( *iAppUi.View( KUidCalenMonthView ) ); |
|
1820 |
TVwsViewId targetViewId( KUidCalendar, KUidCalenMonthView); |
|
1821 |
RequestActivationL(targetViewId); |
|
1822 |
iViewCycleIndex = position; |
|
1823 |
CleanupStack::PopAndDestroy(repository); |
|
1824 |
} |
|
1825 |
} |
|
1826 |
||
1827 |
TRACE_EXIT_POINT; |
|
45 | 1828 |
} |
0
f979ecb2b13e
Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1829 |
|
89 | 1830 |
// ----------------------------------------------------------------------------- |
1831 |
// CCalenViewManager::GetPreviousViewUid |
|
1832 |
// Rest of the details are commented in header. |
|
1833 |
// ----------------------------------------------------------------------------- |
|
1834 |
TUid CCalenViewManager::GetPreviousViewUid() |
|
1835 |
{ |
|
1836 |
return iPreviousViewId.iViewUid; |
|
1837 |
} |
|
63 | 1838 |
|
89 | 1839 |
// ----------------------------------------------------------------------------- |
1840 |
// CCalenViewManager::SetPreviousViewUid |
|
1841 |
// Rest of the details are commented in header. |
|
1842 |
// ----------------------------------------------------------------------------- |
|
1843 |
void CCalenViewManager::SetPreviousViewUid(TUid aPreviousUid) |
|
1844 |
{ |
|
1845 |
iPreviousViewId.iViewUid = aPreviousUid; |
|
63 | 1846 |
} |
89 | 1847 |
// ----------------------------------------------------------------------------- |
1848 |
// CCalenViewManager::IsNativeView |
|
1849 |
// Check for native view |
|
1850 |
// ----------------------------------------------------------------------------- |
|
1851 |
TBool CCalenViewManager::IsNativeView(TUid aViewUid) |
|
1852 |
{ |
|
1853 |
TRACE_ENTRY_POINT; |
|
1854 |
||
1855 |
if( (aViewUid == KUidCalenMonthView)|| |
|
1856 |
(aViewUid == KUidCalenWeekView) || |
|
1857 |
(aViewUid == KUidCalenDayView) || |
|
1858 |
(aViewUid == KUidCalenTodoView) ) |
|
1859 |
{ |
|
1860 |
TRACE_EXIT_POINT; |
|
1861 |
return ETrue; |
|
1862 |
} |
|
1863 |
TRACE_EXIT_POINT; |
|
1864 |
return EFalse; |
|
1865 |
} |
|
63 | 1866 |
|
89 | 1867 |
// ----------------------------------------------------------------------------- |
1868 |
// CCalenViewManager::ActivateViewOnFakeExitL |
|
1869 |
// Check for native view |
|
1870 |
// ----------------------------------------------------------------------------- |
|
1871 |
void CCalenViewManager::ActivateViewOnFakeExitL(TUid aDefView) |
|
1872 |
{ |
|
1873 |
TRACE_ENTRY_POINT; |
|
1874 |
iFakeExit = ETrue; |
|
1875 |
if(IsNativeView(aDefView)) |
|
1876 |
{ |
|
1877 |
// activate the view in background |
|
1878 |
RequestActivationL( aDefView, KCalenHideInBackGround, KNullDesC8() ); |
|
1879 |
} |
|
1880 |
else |
|
1881 |
{ |
|
1882 |
RequestActivationL( KUidCalenDummyView, KCalenHideInBackGround, KNullDesC8() ); |
|
1883 |
} |
|
1884 |
||
1885 |
// set the flag to avoid repopulation when application is |
|
1886 |
// opened after faster exit |
|
1887 |
iAvoidRepopulation = ETrue; |
|
1888 |
||
1889 |
// set the context |
|
1890 |
MCalenContext& context = iController.Services().Context(); |
|
1891 |
TCalTime focusTime = context.DefaultCalTimeForViewsL(); |
|
1892 |
context.SetFocusDateAndTimeL( focusTime, |
|
1893 |
TVwsViewId( KUidCalendar, aDefView) ); |
|
1894 |
||
1895 |
TRACE_EXIT_POINT; |
|
1896 |
} |
|
63 | 1897 |
|
89 | 1898 |
// ----------------------------------------------------------------------------- |
1899 |
// CCalenViewManager::ActivateLocalViewL |
|
1900 |
// Activate the local view if application already in back ground |
|
1901 |
// ----------------------------------------------------------------------------- |
|
1902 |
void CCalenViewManager::ActivateLocalViewL(TUid aDefView) |
|
1903 |
{ |
|
1904 |
iAppUi.ActivateLocalViewL( aDefView ); |
|
1905 |
} |
|
63 | 1906 |
|
89 | 1907 |
// ----------------------------------------------------------------------------- |
1908 |
// CCalenViewManager::ChangeDayL |
|
1909 |
// Change day when preview pane swipped |
|
1910 |
// ----------------------------------------------------------------------------- |
|
1911 |
void CCalenViewManager::ChangeDayL( TBool aNextDay ) |
|
1912 |
{ |
|
1913 |
TInt aInterval(1); |
|
1914 |
MCalenContext& context = iController.Services().Context(); |
|
1915 |
TCalTime focusedTime = context.FocusDateAndTimeL(); |
|
1916 |
TTime newDay(0); |
|
1917 |
if ( aNextDay ) |
|
1918 |
{ |
|
1919 |
newDay = focusedTime.TimeLocalL() + TTimeIntervalDays( aInterval ); |
|
1920 |
} |
|
1921 |
else |
|
1922 |
{ |
|
1923 |
newDay = focusedTime.TimeLocalL() - TTimeIntervalDays( aInterval ); |
|
1924 |
} |
|
1925 |
focusedTime.SetTimeLocalL( newDay ); |
|
1926 |
context.SetFocusDateAndTimeL( focusedTime, |
|
1927 |
iCurrentViewId ); |
|
1928 |
} |
|
63 | 1929 |
|
89 | 1930 |
// End of file |