author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 14 Sep 2010 21:17:03 +0300 | |
branch | RCL_3 |
changeset 31 | 97232defd20e |
parent 30 | bd7edf625bdd |
permissions | -rw-r--r-- |
30 | 1 |
/* |
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* |
|
9 |
* Initial Contributors: |
|
10 |
* Nokia Corporation - initial contribution. |
|
11 |
* |
|
12 |
* Contributors: |
|
13 |
* |
|
14 |
* Description: Missed Event View implementation |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
// system includes |
|
21 |
#include <StringLoader.h> |
|
22 |
#include <aknbutton.h> |
|
23 |
#include <akntoolbar.h> |
|
24 |
#include <finditem.hrh> |
|
25 |
#include <finditemmenu.h> |
|
26 |
#include <Calendar.rsg> |
|
27 |
#include <missedalarm.h> |
|
28 |
#include <missedalarmstore.h> |
|
29 |
#include <calenagendautils.h> |
|
30 |
#include <calentry.h> |
|
31 |
#include <calentryview.h> |
|
32 |
#include <calencommands.hrh> // Calendar commands |
|
33 |
#include <calencontext.h> |
|
34 |
#include <CalenStatusPaneUtils.h> |
|
35 |
#include <caleninstanceid.h> // TCalenInstanceId |
|
36 |
#include <aknappui.h> |
|
37 |
||
38 |
// user includes |
|
39 |
#include "calenmissedeventview.h" |
|
40 |
#include "calendarui_debug.h" |
|
41 |
#include "calenmissedeventcontainer.h" |
|
42 |
#include <calenview.h> |
|
43 |
#include "CalenUid.h" |
|
31
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
44 |
#include <calenlocationutil.h> |
30 | 45 |
#include "calenentryutil.h" |
46 |
#include "CleanupResetAndDestroy.h" |
|
47 |
||
48 |
// Button position of the MSK CBA button |
|
49 |
const TInt KSK2CBAPosition = 2; |
|
50 |
_LIT8( KCommandMissedEventView,"MEV" ); |
|
51 |
||
52 |
// ---------------------------------------------------------------------------- |
|
53 |
// CCalenMissedEventView::NewL |
|
54 |
// Two-phased constructor. |
|
55 |
// ---------------------------------------------------------------------------- |
|
56 |
// |
|
57 |
EXPORT_C CCalenMissedEventView* CCalenMissedEventView::NewL( MCalenServices& aServices ) |
|
58 |
{ |
|
59 |
TRACE_ENTRY_POINT; |
|
60 |
||
61 |
CCalenMissedEventView* self = new( ELeave )CCalenMissedEventView( aServices ); |
|
62 |
CleanupStack::PushL( self ); |
|
63 |
self->ConstructL(); |
|
64 |
CleanupStack::Pop( self ); |
|
65 |
||
66 |
TRACE_EXIT_POINT; |
|
67 |
return self; |
|
68 |
} |
|
69 |
||
70 |
// ---------------------------------------------------------------------------- |
|
71 |
// CCalenMissedEventView::ConstructL |
|
72 |
// Constructor |
|
73 |
// ---------------------------------------------------------------------------- |
|
74 |
// |
|
75 |
void CCalenMissedEventView::ConstructL() |
|
76 |
{ |
|
77 |
TRACE_ENTRY_POINT; |
|
78 |
||
79 |
CommonConstructL( R_CALEN_MISSED_EVENT_VIEW ); |
|
80 |
||
81 |
TRACE_EXIT_POINT; |
|
82 |
} |
|
83 |
||
84 |
// ---------------------------------------------------------------------------- |
|
85 |
// CCalenMissedEventView::CCalenMissedEventView |
|
86 |
// C++ constructor. |
|
87 |
// ---------------------------------------------------------------------------- |
|
88 |
// |
|
89 |
CCalenMissedEventView::CCalenMissedEventView( MCalenServices& aServices ) |
|
90 |
: CCalenNativeView( aServices ), |
|
91 |
iPopulationStep( ENothingDone ) |
|
92 |
{ |
|
93 |
TRACE_ENTRY_POINT; |
|
94 |
TRACE_EXIT_POINT; |
|
95 |
} |
|
96 |
||
97 |
// ---------------------------------------------------------------------------- |
|
98 |
// CCalenMissedEventView::~CCalenMissedEventView |
|
99 |
// Destructor |
|
100 |
// ---------------------------------------------------------------------------- |
|
101 |
// |
|
102 |
CCalenMissedEventView::~CCalenMissedEventView() |
|
103 |
{ |
|
104 |
TRACE_ENTRY_POINT; |
|
105 |
TRACE_EXIT_POINT; |
|
106 |
} |
|
107 |
||
108 |
// ---------------------------------------------------------------------------- |
|
109 |
// CCalenMissedEventView::ActiveStepL |
|
110 |
// From CCalenView |
|
111 |
// (other items were commented in a header) |
|
112 |
// ---------------------------------------------------------------------------- |
|
113 |
// |
|
114 |
CCalenView::TNextPopulationStep CCalenMissedEventView::ActiveStepL() |
|
115 |
{ |
|
116 |
TRACE_ENTRY_POINT; |
|
117 |
||
118 |
CCalenView::TNextPopulationStep nextStep = CCalenView::EDone; |
|
119 |
CCalenMissedEventContainer* cnt = static_cast<CCalenMissedEventContainer*>( iContainer ); |
|
120 |
||
121 |
switch( iPopulationStep ) |
|
122 |
{ |
|
123 |
case ENothingDone: |
|
124 |
{ |
|
125 |
iPopulationStep = EBuildTextEditor; |
|
126 |
nextStep = CCalenView::EKeepGoing; |
|
127 |
} |
|
128 |
break; |
|
129 |
case EBuildTextEditor: |
|
130 |
{ |
|
131 |
cnt->BuildTextEditorL(); |
|
132 |
iPopulationStep = ERequestInstanceView; |
|
133 |
nextStep = CCalenView::EKeepGoing; |
|
134 |
} |
|
135 |
break; |
|
136 |
case ERequestInstanceView: |
|
137 |
{ |
|
138 |
cnt->RequestInstanceViewL(); |
|
139 |
iPopulationStep = EAddField; |
|
140 |
nextStep = CCalenView::EKeepGoing; |
|
141 |
} |
|
142 |
break; |
|
143 |
case EAddField: |
|
144 |
{ |
|
145 |
cnt->AddFieldsL(); |
|
146 |
iPopulationStep = EPopulationDone; |
|
147 |
nextStep = CCalenView::EKeepGoing; |
|
148 |
} |
|
149 |
break; |
|
150 |
case EPopulationDone: |
|
151 |
default: |
|
152 |
{ |
|
153 |
cnt->CompletePopulationL(); |
|
154 |
if(!iAvkonAppUi->IsDisplayingMenuOrDialog()) |
|
155 |
{ |
|
156 |
RedrawStatusPaneL(); |
|
157 |
} |
|
158 |
nextStep = CCalenView::EDone; |
|
159 |
} |
|
160 |
break; |
|
161 |
} |
|
162 |
TRACE_EXIT_POINT; |
|
163 |
return nextStep; |
|
164 |
} |
|
165 |
||
166 |
// ---------------------------------------------------------------------------- |
|
167 |
// CCalenMissedEventView::CancelPopulation |
|
168 |
// From CCalenView |
|
169 |
// (other items were commented in a header) |
|
170 |
// ---------------------------------------------------------------------------- |
|
171 |
// |
|
172 |
void CCalenMissedEventView::CancelPopulation() |
|
173 |
{ |
|
174 |
TRACE_ENTRY_POINT; |
|
175 |
||
176 |
iPopulationStep = ENothingDone; |
|
177 |
||
178 |
TRACE_EXIT_POINT; |
|
179 |
} |
|
180 |
||
181 |
// ---------------------------------------------------------------------------- |
|
182 |
// CCalenMissedEventView::LocalisedViewNameL |
|
183 |
// From CCalenView |
|
184 |
// (other items were commented in a header) |
|
185 |
// ---------------------------------------------------------------------------- |
|
186 |
// |
|
187 |
const TDesC& CCalenMissedEventView::LocalisedViewNameL( CCalenView::TViewName /*aViewName*/ ) |
|
188 |
{ |
|
189 |
TRACE_ENTRY_POINT; |
|
190 |
_LIT(KEV,"Missed Event View"); |
|
191 |
TRACE_EXIT_POINT; |
|
192 |
return KEV; |
|
193 |
} |
|
194 |
||
195 |
// ---------------------------------------------------------------------------- |
|
196 |
// CCalenMissedEventView::ViewIcon |
|
197 |
// From CCalenView |
|
198 |
// (other items were commented in a header) |
|
199 |
// ---------------------------------------------------------------------------- |
|
200 |
// |
|
201 |
CGulIcon* CCalenMissedEventView::ViewIconL() const |
|
202 |
{ |
|
203 |
TRACE_ENTRY_POINT; |
|
204 |
TRACE_EXIT_POINT; |
|
205 |
return NULL; |
|
206 |
} |
|
207 |
||
208 |
// ---------------------------------------------------------------------------- |
|
209 |
// CCalenMissedEventView::DoActivateImplL |
|
210 |
// (other items were commented in a header). |
|
211 |
// ---------------------------------------------------------------------------- |
|
212 |
// |
|
213 |
void CCalenMissedEventView::DoActivateImplL( const TVwsViewId& aPrevViewId, |
|
214 |
TUid aCustomMessageId , |
|
215 |
const TDesC8& aCustomMessage ) |
|
216 |
{ |
|
217 |
TRACE_ENTRY_POINT; |
|
218 |
||
219 |
iShowCloseButtonOnCba = |
|
220 |
( aCustomMessageId == KUidCalenShowCloseCba ? ETrue : EFalse ); |
|
221 |
||
222 |
// for handling missedeventview activation from sn/indicator |
|
223 |
// when only one missed alarm is there |
|
224 |
// issue command ECalenMissedEventViewFromIdle to set the context, |
|
225 |
// clear the missed alarm before launching missed event view |
|
226 |
if(aPrevViewId.iAppUid!=KUidCalendar) |
|
227 |
{ |
|
228 |
// get the custom view message |
|
229 |
HBufC8* temp = aCustomMessage.AllocLC(); |
|
230 |
TPtr8 des = temp->Des(); |
|
231 |
des.UpperCase(); |
|
232 |
||
233 |
if( des.Find( KCommandMissedEventView) != KErrNotFound ) |
|
234 |
{ |
|
235 |
iServices.IssueCommandL(ECalenMissedEventViewFromIdle); |
|
236 |
} |
|
237 |
CleanupStack::PopAndDestroy( temp ); |
|
238 |
} |
|
239 |
||
240 |
UpdateCbaL(); |
|
241 |
||
242 |
||
243 |
TRACE_EXIT_POINT; |
|
244 |
} |
|
245 |
||
246 |
// ---------------------------------------------------------------------------- |
|
247 |
// CCalenMissedEventView::DoDeactivateImpl |
|
248 |
// Take action before deactivating the view |
|
249 |
// ---------------------------------------------------------------------------- |
|
250 |
// |
|
251 |
void CCalenMissedEventView::DoDeactivateImpl() |
|
252 |
{ |
|
253 |
TRACE_ENTRY_POINT; |
|
254 |
||
255 |
iPreviousViewId.iViewUid = KNullUid; |
|
256 |
/*MCalenToolbar* toolbar = iServices.ToolbarOrNull(); |
|
257 |
if(toolbar) |
|
258 |
{ |
|
259 |
toolbar->SetToolbarVisibilityL(ETrue); |
|
260 |
}*/ |
|
261 |
||
262 |
||
263 |
TRACE_EXIT_POINT; |
|
264 |
} |
|
265 |
||
266 |
// ---------------------------------------------------------------------------- |
|
267 |
// CCalenMissedEventView::OnLocaleChangedL |
|
268 |
// (other items were commented in a header). |
|
269 |
// ---------------------------------------------------------------------------- |
|
270 |
// |
|
271 |
void CCalenMissedEventView::OnLocaleChangedL(TInt /*aReason*/) |
|
272 |
{ |
|
273 |
TRACE_ENTRY_POINT; |
|
274 |
||
275 |
TRACE_EXIT_POINT; |
|
276 |
} |
|
277 |
||
278 |
// ---------------------------------------------------------------------------- |
|
279 |
// CCalenMissedEventView::RedrawStatusPaneL |
|
280 |
// (other items were commented in a header). |
|
281 |
// ---------------------------------------------------------------------------- |
|
282 |
// |
|
283 |
void CCalenMissedEventView::RedrawStatusPaneL() |
|
284 |
{ |
|
285 |
TRACE_ENTRY_POINT; |
|
286 |
||
287 |
CCalenMissedEventContainer* cnt = static_cast<CCalenMissedEventContainer*>( iContainer ); |
|
288 |
HBufC* titleText = StringLoader::LoadLC( cnt->GetTitleTextId(), iCoeEnv ); |
|
289 |
iSPUtils->UnderLineTitleText( EFalse ); |
|
290 |
iSPUtils->SetTitleText( titleText ); // ownership passed |
|
291 |
CleanupStack::Pop( titleText ); |
|
292 |
iSPUtils->RefreshStatusPane(); |
|
293 |
||
294 |
TRACE_EXIT_POINT; |
|
295 |
} |
|
296 |
||
297 |
// ---------------------------------------------------------------------------- |
|
298 |
// CCalenMissedEventView::HandleCommandL |
|
299 |
// (other items were commented in a header). |
|
300 |
// ---------------------------------------------------------------------------- |
|
301 |
// |
|
302 |
void CCalenMissedEventView::HandleCommandL(TInt aCommand) |
|
303 |
{ |
|
304 |
TRACE_ENTRY_POINT; |
|
305 |
||
306 |
CCalenMissedEventContainer* cnt = static_cast<CCalenMissedEventContainer*>( iContainer ); |
|
307 |
switch(aCommand) |
|
308 |
{ |
|
309 |
case ECalenCmdPromptThenEdit: |
|
310 |
{ |
|
311 |
iServices.IssueCommandL(ECalenEditCurrentEntry); |
|
312 |
break; |
|
313 |
} |
|
314 |
case ECalenCompleteTodo: |
|
315 |
case ECalenRestoreTodo: |
|
316 |
{ |
|
317 |
CCalenNativeView::HandleCommandL(aCommand); |
|
318 |
} |
|
319 |
break; |
|
320 |
case EAknSoftkeyClose: |
|
321 |
{ |
|
322 |
MCalenToolbar* toolbar = iServices.ToolbarOrNull(); |
|
323 |
if(toolbar) |
|
324 |
{ |
|
325 |
toolbar->SetToolbarVisibilityL(ETrue); |
|
326 |
} |
|
327 |
iServices.IssueNotificationL(ECalenNotifyMissedEventViewClosed); |
|
328 |
break; |
|
329 |
} |
|
330 |
||
331 |
case EAknSoftkeyBack: |
|
332 |
{ |
|
333 |
iServices.IssueNotificationL(ECalenNotifyMissedEventViewClosed); |
|
334 |
break; |
|
335 |
} |
|
336 |
case EAknSoftkeyExit: |
|
337 |
{ |
|
338 |
||
31
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
339 |
MCalenToolbar* toolbar = iServices.ToolbarOrNull(); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
340 |
if (toolbar) |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
341 |
{ |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
342 |
toolbar->SetToolbarVisibilityL(ETrue); |
97232defd20e
Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
30
diff
changeset
|
343 |
} |
30 | 344 |
CCalenNativeView::HandleCommandL(aCommand); |
345 |
} |
|
346 |
break; |
|
347 |
case ECalenCmdFindPhoneNum: |
|
348 |
{ |
|
349 |
cnt->OnCmdFindPhoneNumL(); |
|
350 |
} |
|
351 |
break; |
|
352 |
case ECalenCmdFindEmail: |
|
353 |
{ |
|
354 |
cnt->OnCmdFindEmailL(); |
|
355 |
} |
|
356 |
break; |
|
357 |
case ECalenCmdFindURL: |
|
358 |
{ |
|
359 |
cnt->OnCmdFindUrlL(); |
|
360 |
} |
|
361 |
default: |
|
362 |
if(cnt->GetFindItemMenu()->CommandIsValidL(aCommand)) |
|
363 |
{ |
|
364 |
cnt->GetFindItemMenu()->HandleItemFinderCommandL(aCommand); |
|
365 |
return; |
|
366 |
} |
|
367 |
CCalenNativeView::HandleCommandL(aCommand); |
|
368 |
break; |
|
369 |
} |
|
370 |
||
371 |
TRACE_EXIT_POINT; |
|
372 |
} |
|
373 |
||
374 |
// ---------------------------------------------------------------------------- |
|
375 |
// CCalenMissedEventView::DynInitMenuPaneL |
|
376 |
// (other items were commented in a header). |
|
377 |
// ---------------------------------------------------------------------------- |
|
378 |
// |
|
379 |
void CCalenMissedEventView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane) |
|
380 |
{ |
|
381 |
TRACE_ENTRY_POINT; |
|
382 |
CCalenMissedEventContainer* cnt = static_cast<CCalenMissedEventContainer*>( iContainer ); |
|
383 |
switch(aResourceId) |
|
384 |
{ |
|
385 |
case R_CALEN_EVENT_VIEW_MENUPANE: |
|
386 |
case R_CALEN_EVENT_VIEW_LONGTAP_MENUPANE: |
|
387 |
{ |
|
388 |
CCalenEntryUtil* eventViewData = cnt->GetEventViewData(); |
|
389 |
if(eventViewData) |
|
390 |
{ |
|
391 |
if(eventViewData->EntryType() == CCalEntry::ETodo) |
|
392 |
{ |
|
393 |
if(eventViewData->Status() == CCalEntry::ETodoCompleted) |
|
394 |
{ |
|
395 |
aMenuPane->DeleteMenuItem(ECalenCompleteTodo); |
|
396 |
} |
|
397 |
else |
|
398 |
{ |
|
399 |
aMenuPane->DeleteMenuItem(ECalenRestoreTodo); |
|
400 |
} |
|
401 |
} |
|
402 |
else |
|
403 |
{ |
|
404 |
aMenuPane->DeleteMenuItem(ECalenCompleteTodo); |
|
405 |
aMenuPane->DeleteMenuItem(ECalenRestoreTodo); |
|
406 |
} |
|
407 |
} |
|
408 |
||
409 |
||
410 |
||
411 |
if(CCalenLocationUtil::IsMapProviderAvailableL()) |
|
412 |
{ |
|
413 |
if(cnt->IsEventHasMapLocationL() || cnt->IsEventHasNoLocationTextL()) |
|
414 |
{ |
|
415 |
aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace ); |
|
416 |
} |
|
417 |
if(!cnt->IsEventHasMapLocationL()) |
|
418 |
{ |
|
419 |
aMenuPane->DeleteMenuItem( ECalenShowLocation ); |
|
420 |
} |
|
421 |
} |
|
422 |
else // No map provider available, remove both option items |
|
423 |
{ |
|
424 |
aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace ); |
|
425 |
aMenuPane->DeleteMenuItem( ECalenShowLocation ); |
|
426 |
} |
|
427 |
//as no toolbar in missedeventview no need to handle thees commands |
|
428 |
aMenuPane->DeleteMenuItem( ECalenCmdPromptThenEdit ); |
|
429 |
aMenuPane->DeleteMenuItem( ECalenDeleteCurrentEntry ); |
|
430 |
aMenuPane->DeleteMenuItem( ECalenSend ); |
|
431 |
break; |
|
432 |
} |
|
433 |
default: |
|
434 |
{ |
|
435 |
cnt->GetFindItemMenu()->UpdateItemFinderMenuL(aResourceId,aMenuPane); |
|
436 |
} |
|
437 |
break; |
|
438 |
} |
|
439 |
||
440 |
TRACE_EXIT_POINT; |
|
441 |
} |
|
442 |
||
443 |
// ---------------------------------------------------------------------------- |
|
444 |
// CCalenMissedEventView::Id |
|
445 |
// Returns unique view id |
|
446 |
// ---------------------------------------------------------------------------- |
|
447 |
// |
|
448 |
TUid CCalenMissedEventView::Id() const |
|
449 |
{ |
|
450 |
TRACE_ENTRY_POINT; |
|
451 |
TRACE_EXIT_POINT; |
|
452 |
return KUidCalenMissedEventView; |
|
453 |
} |
|
454 |
||
455 |
// ---------------------------------------------------------------------------- |
|
456 |
// CCalenMissedEventView::CreateContainerImplL |
|
457 |
// create container |
|
458 |
// ---------------------------------------------------------------------------- |
|
459 |
// |
|
460 |
CCalenContainer* CCalenMissedEventView::CreateContainerImplL() |
|
461 |
{ |
|
462 |
TRACE_ENTRY_POINT; |
|
463 |
TRACE_EXIT_POINT; |
|
464 |
return new( ELeave )CCalenMissedEventContainer( this, iServices ); |
|
465 |
} |
|
466 |
||
467 |
// --------------------------------------------------------- |
|
468 |
// CCalenMissedEventView::UpdateCbaL |
|
469 |
// Set CBA button |
|
470 |
// --------------------------------------------------------- |
|
471 |
// |
|
472 |
void CCalenMissedEventView::UpdateCbaL() |
|
473 |
{ |
|
474 |
TRACE_ENTRY_POINT; |
|
475 |
||
476 |
CEikButtonGroupContainer* cba = Cba(); |
|
477 |
||
478 |
if(iShowCloseButtonOnCba) |
|
479 |
{ |
|
480 |
cba->SetCommandL( KSK2CBAPosition, R_CALEN_CLOSE_CBA_BUTTON ); |
|
481 |
} |
|
482 |
else |
|
483 |
{ |
|
484 |
cba->SetCommandL( KSK2CBAPosition, R_CALEN_BACK_CBA_BUTTON); |
|
485 |
} |
|
486 |
||
487 |
cba->DrawNow(); |
|
488 |
||
489 |
TRACE_EXIT_POINT; |
|
490 |
} |
|
491 |
// ---------------------------------------------------------------------------- |
|
492 |
// CCalenMissedEventView::ClearViewSpecificDataL |
|
493 |
// Clear view specific data |
|
494 |
// ---------------------------------------------------------------------------- |
|
495 |
// |
|
496 |
void CCalenMissedEventView::ClearViewSpecificDataL() |
|
497 |
{ |
|
498 |
TRACE_ENTRY_POINT; |
|
499 |
||
500 |
TRACE_EXIT_POINT; |
|
501 |
} |
|
502 |
||
503 |
// ---------------------------------------------------------------------------- |
|
504 |
// CCalenMissedEventView::CyclePosition |
|
505 |
// Returns view cycle position |
|
506 |
// ---------------------------------------------------------------------------- |
|
507 |
// |
|
508 |
CCalenView::TCyclePosition CCalenMissedEventView::CyclePosition() const |
|
509 |
{ |
|
510 |
TRACE_ENTRY_POINT; |
|
511 |
TRACE_EXIT_POINT; |
|
512 |
return ENoCyclePosition; |
|
513 |
} |
|
514 |
||
515 |
// ---------------------------------------------------------------------------- |
|
516 |
// CCalenMissedEventView::AddToolbarButtonsL |
|
517 |
// Adds the necessary toolbar buttons on the existing toolbar for event viewer |
|
518 |
// ---------------------------------------------------------------------------- |
|
519 |
// |
|
520 |
void CCalenMissedEventView::AddToolbarButtonsL() |
|
521 |
{ |
|
522 |
TRACE_ENTRY_POINT; |
|
523 |
||
524 |
// Get the existing toolbar from MCalenservices |
|
525 |
MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull(); |
|
526 |
||
527 |
if(toolbarImpl) // If toolbar exists |
|
528 |
{ |
|
529 |
CAknToolbar& toolbar = toolbarImpl->Toolbar(); |
|
530 |
||
531 |
// Create the new buttons for event viewer toolbar |
|
532 |
// If layout is mirrored the button order is reversed. |
|
533 |
// For Non mirrored layouts each button is appended to the toolbar |
|
534 |
// For mirrored layouts each button is inserted at index 0. |
|
535 |
TBool mirrored( AknLayoutUtils::LayoutMirrored() ); |
|
536 |
||
537 |
CAknButton* button = NULL; |
|
538 |
CGulIcon* icon = NULL; |
|
539 |
||
540 |
// First button: Send |
|
541 |
icon = iServices.GetIconL( MCalenServices::ECalenViewerSendIcon ); |
|
542 |
// put icon onto cleanup stack before its ownership is transferred to CAknButton |
|
543 |
button = CreateButtonL( icon, _L(""), R_CALEN_TB_SEND, toolbar ); |
|
544 |
if( mirrored ) |
|
545 |
{ |
|
546 |
// Insert the button at index 0 |
|
547 |
toolbar.AddItemL( button, EAknCtButton, ECalenSend, 0, 0 ); |
|
548 |
} |
|
549 |
else |
|
550 |
{ |
|
551 |
// Append the button |
|
552 |
toolbar.AddItemL( button, EAknCtButton, ECalenSend, 0, 0 ); |
|
553 |
} |
|
554 |
||
555 |
// Second button: Edit |
|
556 |
icon = iServices.GetIconL( MCalenServices::ECalenViewerEditIcon ); |
|
557 |
// put icon onto cleanup stack before its ownership is transferred to CAknButton |
|
558 |
button = CreateButtonL( icon, _L(""), R_CALEN_TB_EDIT, toolbar ); |
|
559 |
if( mirrored ) |
|
560 |
{ |
|
561 |
// Insert the button at index 0 |
|
562 |
toolbar.AddItemL( button, EAknCtButton, ECalenEditCurrentEntry, 0, 0 ); |
|
563 |
} |
|
564 |
else |
|
565 |
{ |
|
566 |
// Append the button |
|
567 |
toolbar.AddItemL( button, EAknCtButton, ECalenEditCurrentEntry, 0, 1 ); |
|
568 |
} |
|
569 |
||
570 |
// Third button: Delete |
|
571 |
icon = iServices.GetIconL( MCalenServices::ECalenViewerDeleteIcon ); |
|
572 |
// put icon onto cleanup stack before its ownership is transferred to CAknButton |
|
573 |
button = CreateButtonL( icon, _L(""), R_CALEN_TB_DELETE, toolbar ); |
|
574 |
if( mirrored ) |
|
575 |
{ |
|
576 |
// Insert the button at index 0 |
|
577 |
toolbar.AddItemL( button, EAknCtButton, ECalenDeleteCurrentEntry, 0, 0 ); |
|
578 |
} |
|
579 |
else |
|
580 |
{ |
|
581 |
// Append the button |
|
582 |
toolbar.AddItemL( button, EAknCtButton, ECalenDeleteCurrentEntry, 0, 2 ); |
|
583 |
} |
|
584 |
} |
|
585 |
TRACE_EXIT_POINT; |
|
586 |
} |
|
587 |
||
588 |
// ---------------------------------------------------------------------------- |
|
589 |
// CCalenMissedEventView::RemoveToolbarButtonsL |
|
590 |
// Removes the event viewer toolbar buttons and unhides the view cycling buttons |
|
591 |
// ---------------------------------------------------------------------------- |
|
592 |
// |
|
593 |
void CCalenMissedEventView::RemoveToolbarButtonsL() |
|
594 |
{ |
|
595 |
TRACE_ENTRY_POINT; |
|
596 |
||
597 |
MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull(); |
|
598 |
if(toolbarImpl) // If toolbar exists |
|
599 |
{ |
|
600 |
CAknToolbar& toolbar = toolbarImpl->Toolbar(); |
|
601 |
if(&toolbar) |
|
602 |
{ |
|
603 |
// Remove the viewer toolbar buttons |
|
604 |
toolbar.RemoveItem(ECalenDeleteCurrentEntry); // Delete button |
|
605 |
toolbar.RemoveItem(ECalenEditCurrentEntry); // Edit button |
|
606 |
toolbar.RemoveItem(ECalenSend); // Send button |
|
607 |
} |
|
608 |
} |
|
609 |
||
610 |
TRACE_EXIT_POINT; |
|
611 |
} |
|
612 |
||
613 |
// ---------------------------------------------------------------------------- |
|
614 |
// CCalenMissedEventView::CreateButtonL |
|
615 |
// Create calendar toolbar buttons |
|
616 |
// ---------------------------------------------------------------------------- |
|
617 |
CAknButton* CCalenMissedEventView::CreateButtonL( CGulIcon* aIcon, |
|
618 |
const TDesC& aText, |
|
619 |
TInt aTooltipID, |
|
620 |
CAknToolbar& aToolbar ) |
|
621 |
{ |
|
622 |
TRACE_ENTRY_POINT; |
|
623 |
||
624 |
TInt flags = 0; |
|
625 |
CAknButton* button = NULL; |
|
626 |
||
627 |
CleanupStack::PushL( aIcon ); |
|
628 |
HBufC* tooltipText = StringLoader::LoadLC( aTooltipID ); |
|
629 |
CleanupStack::Pop( tooltipText ); |
|
630 |
// put icon onto cleanup stack before its ownership is transferred to CAknButton |
|
631 |
CleanupStack::Pop( aIcon ); |
|
632 |
CleanupStack::PushL( tooltipText ); |
|
633 |
button = CAknButton::NewL( aIcon, NULL, NULL, NULL, |
|
634 |
aText, tooltipText->Des(), flags, 0 ); |
|
635 |
CleanupStack::PopAndDestroy( tooltipText ); |
|
636 |
||
637 |
button->SetIconScaleMode( EAspectRatioNotPreserved ); |
|
638 |
button->SetFocusing( EFalse ); |
|
639 |
button->SetBackground( &aToolbar ); |
|
640 |
||
641 |
TRACE_EXIT_POINT; |
|
642 |
return button; |
|
643 |
} |
|
644 |
||
645 |
//end of file |