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"
|
|
44 |
#include "calenlocationutil.h"
|
|
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 |
|
|
339 |
CCalenNativeView::HandleCommandL(aCommand);
|
|
340 |
}
|
|
341 |
break;
|
|
342 |
case ECalenCmdFindPhoneNum:
|
|
343 |
{
|
|
344 |
cnt->OnCmdFindPhoneNumL();
|
|
345 |
}
|
|
346 |
break;
|
|
347 |
case ECalenCmdFindEmail:
|
|
348 |
{
|
|
349 |
cnt->OnCmdFindEmailL();
|
|
350 |
}
|
|
351 |
break;
|
|
352 |
case ECalenCmdFindURL:
|
|
353 |
{
|
|
354 |
cnt->OnCmdFindUrlL();
|
|
355 |
}
|
|
356 |
default:
|
|
357 |
if(cnt->GetFindItemMenu()->CommandIsValidL(aCommand))
|
|
358 |
{
|
|
359 |
cnt->GetFindItemMenu()->HandleItemFinderCommandL(aCommand);
|
|
360 |
return;
|
|
361 |
}
|
|
362 |
CCalenNativeView::HandleCommandL(aCommand);
|
|
363 |
break;
|
|
364 |
}
|
|
365 |
|
|
366 |
TRACE_EXIT_POINT;
|
|
367 |
}
|
|
368 |
|
|
369 |
// ----------------------------------------------------------------------------
|
|
370 |
// CCalenMissedEventView::DynInitMenuPaneL
|
|
371 |
// (other items were commented in a header).
|
|
372 |
// ----------------------------------------------------------------------------
|
|
373 |
//
|
|
374 |
void CCalenMissedEventView::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
|
|
375 |
{
|
|
376 |
TRACE_ENTRY_POINT;
|
|
377 |
CCalenMissedEventContainer* cnt = static_cast<CCalenMissedEventContainer*>( iContainer );
|
|
378 |
switch(aResourceId)
|
|
379 |
{
|
|
380 |
case R_CALEN_EVENT_VIEW_MENUPANE:
|
|
381 |
case R_CALEN_EVENT_VIEW_LONGTAP_MENUPANE:
|
|
382 |
{
|
|
383 |
CCalenEntryUtil* eventViewData = cnt->GetEventViewData();
|
|
384 |
if(eventViewData)
|
|
385 |
{
|
|
386 |
if(eventViewData->EntryType() == CCalEntry::ETodo)
|
|
387 |
{
|
|
388 |
if(eventViewData->Status() == CCalEntry::ETodoCompleted)
|
|
389 |
{
|
|
390 |
aMenuPane->DeleteMenuItem(ECalenCompleteTodo);
|
|
391 |
}
|
|
392 |
else
|
|
393 |
{
|
|
394 |
aMenuPane->DeleteMenuItem(ECalenRestoreTodo);
|
|
395 |
}
|
|
396 |
}
|
|
397 |
else
|
|
398 |
{
|
|
399 |
aMenuPane->DeleteMenuItem(ECalenCompleteTodo);
|
|
400 |
aMenuPane->DeleteMenuItem(ECalenRestoreTodo);
|
|
401 |
}
|
|
402 |
}
|
|
403 |
|
|
404 |
|
|
405 |
|
|
406 |
if(CCalenLocationUtil::IsMapProviderAvailableL())
|
|
407 |
{
|
|
408 |
if(cnt->IsEventHasMapLocationL() || cnt->IsEventHasNoLocationTextL())
|
|
409 |
{
|
|
410 |
aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace );
|
|
411 |
}
|
|
412 |
if(!cnt->IsEventHasMapLocationL())
|
|
413 |
{
|
|
414 |
aMenuPane->DeleteMenuItem( ECalenShowLocation );
|
|
415 |
}
|
|
416 |
}
|
|
417 |
else // No map provider available, remove both option items
|
|
418 |
{
|
|
419 |
aMenuPane->DeleteMenuItem( ECalenGetLocationAndReplace );
|
|
420 |
aMenuPane->DeleteMenuItem( ECalenShowLocation );
|
|
421 |
}
|
|
422 |
//as no toolbar in missedeventview no need to handle thees commands
|
|
423 |
aMenuPane->DeleteMenuItem( ECalenCmdPromptThenEdit );
|
|
424 |
aMenuPane->DeleteMenuItem( ECalenDeleteCurrentEntry );
|
|
425 |
aMenuPane->DeleteMenuItem( ECalenSend );
|
|
426 |
break;
|
|
427 |
}
|
|
428 |
default:
|
|
429 |
{
|
|
430 |
cnt->GetFindItemMenu()->UpdateItemFinderMenuL(aResourceId,aMenuPane);
|
|
431 |
}
|
|
432 |
break;
|
|
433 |
}
|
|
434 |
|
|
435 |
TRACE_EXIT_POINT;
|
|
436 |
}
|
|
437 |
|
|
438 |
// ----------------------------------------------------------------------------
|
|
439 |
// CCalenMissedEventView::Id
|
|
440 |
// Returns unique view id
|
|
441 |
// ----------------------------------------------------------------------------
|
|
442 |
//
|
|
443 |
TUid CCalenMissedEventView::Id() const
|
|
444 |
{
|
|
445 |
TRACE_ENTRY_POINT;
|
|
446 |
TRACE_EXIT_POINT;
|
|
447 |
return KUidCalenMissedEventView;
|
|
448 |
}
|
|
449 |
|
|
450 |
// ----------------------------------------------------------------------------
|
|
451 |
// CCalenMissedEventView::CreateContainerImplL
|
|
452 |
// create container
|
|
453 |
// ----------------------------------------------------------------------------
|
|
454 |
//
|
|
455 |
CCalenContainer* CCalenMissedEventView::CreateContainerImplL()
|
|
456 |
{
|
|
457 |
TRACE_ENTRY_POINT;
|
|
458 |
TRACE_EXIT_POINT;
|
|
459 |
return new( ELeave )CCalenMissedEventContainer( this, iServices );
|
|
460 |
}
|
|
461 |
|
|
462 |
// ---------------------------------------------------------
|
|
463 |
// CCalenMissedEventView::UpdateCbaL
|
|
464 |
// Set CBA button
|
|
465 |
// ---------------------------------------------------------
|
|
466 |
//
|
|
467 |
void CCalenMissedEventView::UpdateCbaL()
|
|
468 |
{
|
|
469 |
TRACE_ENTRY_POINT;
|
|
470 |
|
|
471 |
CEikButtonGroupContainer* cba = Cba();
|
|
472 |
|
|
473 |
if(iShowCloseButtonOnCba)
|
|
474 |
{
|
|
475 |
cba->SetCommandL( KSK2CBAPosition, R_CALEN_CLOSE_CBA_BUTTON );
|
|
476 |
}
|
|
477 |
else
|
|
478 |
{
|
|
479 |
cba->SetCommandL( KSK2CBAPosition, R_CALEN_BACK_CBA_BUTTON);
|
|
480 |
}
|
|
481 |
|
|
482 |
cba->DrawNow();
|
|
483 |
|
|
484 |
TRACE_EXIT_POINT;
|
|
485 |
}
|
|
486 |
// ----------------------------------------------------------------------------
|
|
487 |
// CCalenMissedEventView::ClearViewSpecificDataL
|
|
488 |
// Clear view specific data
|
|
489 |
// ----------------------------------------------------------------------------
|
|
490 |
//
|
|
491 |
void CCalenMissedEventView::ClearViewSpecificDataL()
|
|
492 |
{
|
|
493 |
TRACE_ENTRY_POINT;
|
|
494 |
|
|
495 |
TRACE_EXIT_POINT;
|
|
496 |
}
|
|
497 |
|
|
498 |
// ----------------------------------------------------------------------------
|
|
499 |
// CCalenMissedEventView::CyclePosition
|
|
500 |
// Returns view cycle position
|
|
501 |
// ----------------------------------------------------------------------------
|
|
502 |
//
|
|
503 |
CCalenView::TCyclePosition CCalenMissedEventView::CyclePosition() const
|
|
504 |
{
|
|
505 |
TRACE_ENTRY_POINT;
|
|
506 |
TRACE_EXIT_POINT;
|
|
507 |
return ENoCyclePosition;
|
|
508 |
}
|
|
509 |
|
|
510 |
// ----------------------------------------------------------------------------
|
|
511 |
// CCalenMissedEventView::AddToolbarButtonsL
|
|
512 |
// Adds the necessary toolbar buttons on the existing toolbar for event viewer
|
|
513 |
// ----------------------------------------------------------------------------
|
|
514 |
//
|
|
515 |
void CCalenMissedEventView::AddToolbarButtonsL()
|
|
516 |
{
|
|
517 |
TRACE_ENTRY_POINT;
|
|
518 |
|
|
519 |
// Get the existing toolbar from MCalenservices
|
|
520 |
MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
|
|
521 |
|
|
522 |
if(toolbarImpl) // If toolbar exists
|
|
523 |
{
|
|
524 |
CAknToolbar& toolbar = toolbarImpl->Toolbar();
|
|
525 |
|
|
526 |
// Create the new buttons for event viewer toolbar
|
|
527 |
// If layout is mirrored the button order is reversed.
|
|
528 |
// For Non mirrored layouts each button is appended to the toolbar
|
|
529 |
// For mirrored layouts each button is inserted at index 0.
|
|
530 |
TBool mirrored( AknLayoutUtils::LayoutMirrored() );
|
|
531 |
|
|
532 |
CAknButton* button = NULL;
|
|
533 |
CGulIcon* icon = NULL;
|
|
534 |
|
|
535 |
// First button: Send
|
|
536 |
icon = iServices.GetIconL( MCalenServices::ECalenViewerSendIcon );
|
|
537 |
// put icon onto cleanup stack before its ownership is transferred to CAknButton
|
|
538 |
button = CreateButtonL( icon, _L(""), R_CALEN_TB_SEND, toolbar );
|
|
539 |
if( mirrored )
|
|
540 |
{
|
|
541 |
// Insert the button at index 0
|
|
542 |
toolbar.AddItemL( button, EAknCtButton, ECalenSend, 0, 0 );
|
|
543 |
}
|
|
544 |
else
|
|
545 |
{
|
|
546 |
// Append the button
|
|
547 |
toolbar.AddItemL( button, EAknCtButton, ECalenSend, 0, 0 );
|
|
548 |
}
|
|
549 |
|
|
550 |
// Second button: Edit
|
|
551 |
icon = iServices.GetIconL( MCalenServices::ECalenViewerEditIcon );
|
|
552 |
// put icon onto cleanup stack before its ownership is transferred to CAknButton
|
|
553 |
button = CreateButtonL( icon, _L(""), R_CALEN_TB_EDIT, toolbar );
|
|
554 |
if( mirrored )
|
|
555 |
{
|
|
556 |
// Insert the button at index 0
|
|
557 |
toolbar.AddItemL( button, EAknCtButton, ECalenEditCurrentEntry, 0, 0 );
|
|
558 |
}
|
|
559 |
else
|
|
560 |
{
|
|
561 |
// Append the button
|
|
562 |
toolbar.AddItemL( button, EAknCtButton, ECalenEditCurrentEntry, 0, 1 );
|
|
563 |
}
|
|
564 |
|
|
565 |
// Third button: Delete
|
|
566 |
icon = iServices.GetIconL( MCalenServices::ECalenViewerDeleteIcon );
|
|
567 |
// put icon onto cleanup stack before its ownership is transferred to CAknButton
|
|
568 |
button = CreateButtonL( icon, _L(""), R_CALEN_TB_DELETE, toolbar );
|
|
569 |
if( mirrored )
|
|
570 |
{
|
|
571 |
// Insert the button at index 0
|
|
572 |
toolbar.AddItemL( button, EAknCtButton, ECalenDeleteCurrentEntry, 0, 0 );
|
|
573 |
}
|
|
574 |
else
|
|
575 |
{
|
|
576 |
// Append the button
|
|
577 |
toolbar.AddItemL( button, EAknCtButton, ECalenDeleteCurrentEntry, 0, 2 );
|
|
578 |
}
|
|
579 |
}
|
|
580 |
TRACE_EXIT_POINT;
|
|
581 |
}
|
|
582 |
|
|
583 |
// ----------------------------------------------------------------------------
|
|
584 |
// CCalenMissedEventView::RemoveToolbarButtonsL
|
|
585 |
// Removes the event viewer toolbar buttons and unhides the view cycling buttons
|
|
586 |
// ----------------------------------------------------------------------------
|
|
587 |
//
|
|
588 |
void CCalenMissedEventView::RemoveToolbarButtonsL()
|
|
589 |
{
|
|
590 |
TRACE_ENTRY_POINT;
|
|
591 |
|
|
592 |
MCalenToolbar* toolbarImpl = iServices.ToolbarOrNull();
|
|
593 |
if(toolbarImpl) // If toolbar exists
|
|
594 |
{
|
|
595 |
CAknToolbar& toolbar = toolbarImpl->Toolbar();
|
|
596 |
if(&toolbar)
|
|
597 |
{
|
|
598 |
// Remove the viewer toolbar buttons
|
|
599 |
toolbar.RemoveItem(ECalenDeleteCurrentEntry); // Delete button
|
|
600 |
toolbar.RemoveItem(ECalenEditCurrentEntry); // Edit button
|
|
601 |
toolbar.RemoveItem(ECalenSend); // Send button
|
|
602 |
}
|
|
603 |
}
|
|
604 |
|
|
605 |
TRACE_EXIT_POINT;
|
|
606 |
}
|
|
607 |
|
|
608 |
// ----------------------------------------------------------------------------
|
|
609 |
// CCalenMissedEventView::CreateButtonL
|
|
610 |
// Create calendar toolbar buttons
|
|
611 |
// ----------------------------------------------------------------------------
|
|
612 |
CAknButton* CCalenMissedEventView::CreateButtonL( CGulIcon* aIcon,
|
|
613 |
const TDesC& aText,
|
|
614 |
TInt aTooltipID,
|
|
615 |
CAknToolbar& aToolbar )
|
|
616 |
{
|
|
617 |
TRACE_ENTRY_POINT;
|
|
618 |
|
|
619 |
TInt flags = 0;
|
|
620 |
CAknButton* button = NULL;
|
|
621 |
|
|
622 |
CleanupStack::PushL( aIcon );
|
|
623 |
HBufC* tooltipText = StringLoader::LoadLC( aTooltipID );
|
|
624 |
CleanupStack::Pop( tooltipText );
|
|
625 |
// put icon onto cleanup stack before its ownership is transferred to CAknButton
|
|
626 |
CleanupStack::Pop( aIcon );
|
|
627 |
CleanupStack::PushL( tooltipText );
|
|
628 |
button = CAknButton::NewL( aIcon, NULL, NULL, NULL,
|
|
629 |
aText, tooltipText->Des(), flags, 0 );
|
|
630 |
CleanupStack::PopAndDestroy( tooltipText );
|
|
631 |
|
|
632 |
button->SetIconScaleMode( EAspectRatioNotPreserved );
|
|
633 |
button->SetFocusing( EFalse );
|
|
634 |
button->SetBackground( &aToolbar );
|
|
635 |
|
|
636 |
TRACE_EXIT_POINT;
|
|
637 |
return button;
|
|
638 |
}
|
|
639 |
|
|
640 |
//end of file
|