89
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// ========== INCLUDE FILES ================================
|
|
19 |
|
|
20 |
#include <eikspane.h>
|
|
21 |
#include <eikmenup.h>
|
|
22 |
#include <AknDef.h>
|
|
23 |
#include <aknappui.h>
|
|
24 |
#include <akntitle.h>
|
|
25 |
#include <aknnavi.h>
|
|
26 |
#include <aknlists.h>
|
|
27 |
#include <gulicon.h>
|
|
28 |
#include <coeutils.h> // for ConeUtils::FileExists
|
|
29 |
#include <bautils.h>
|
|
30 |
#include <aknnotewrappers.h>
|
|
31 |
#include <AknWaitDialog.h> // CAknWaitDialog
|
|
32 |
#include <DocumentHandler.h>
|
|
33 |
#include <StringLoader.h> // StringLoader
|
|
34 |
#include <AiwCommon.h>
|
|
35 |
#include <NpdApi.h>
|
|
36 |
#include <avkon.hrh>
|
|
37 |
#include <aknlayout.cdl.h>
|
|
38 |
#include <aknlayoutscalable_avkon.cdl.h>
|
|
39 |
#include <AknUtils.h>
|
|
40 |
#include <AknsUtils.h> // skinned icons
|
|
41 |
#include <AknsConstants.h> // skinned icon ids
|
|
42 |
#include <barsread.h>
|
|
43 |
#include <calendar.mbg>
|
|
44 |
#include <Calendar.rsg>
|
|
45 |
#include <StringLoader.h>
|
|
46 |
#include <AknsBasicBackgroundControlContext.h>
|
|
47 |
#include <calencommonui.rsg>
|
|
48 |
#include <aknlistloadertfx.h>
|
|
49 |
#include <aknlistboxtfxinternal.h>
|
|
50 |
#include <hlplch.h>
|
|
51 |
#include <csxhelp/mail.hlp.hrh>
|
|
52 |
#include <featmgr.h>
|
|
53 |
#include <sysutil.h>
|
|
54 |
#include <ErrorUI.h>
|
|
55 |
#include <calentoolbar.h>
|
|
56 |
|
|
57 |
#include "calenviewattachmentsdialog.h"
|
|
58 |
#include "calencontroller.h"
|
|
59 |
#include "calenattachmentinfo.h"
|
|
60 |
#include "calenattachmentmodel.h"
|
|
61 |
#include "calenattachmentutils.h"
|
|
62 |
#include "calendarui_debug.h"
|
|
63 |
#include "calendar.hrh"
|
|
64 |
#include "calenmultidbeditor.h"
|
|
65 |
#include "CalendarPrivateCRKeys.h"
|
|
66 |
#include "calendarui_debug.h"
|
|
67 |
#include "calenattachmentutils.h"
|
|
68 |
|
|
69 |
//CONSTANTS
|
|
70 |
|
|
71 |
const TInt KMSKControlID(3);
|
|
72 |
_LIT8( KNotePadTextDataType, "text/plain" );
|
|
73 |
|
|
74 |
// ========================= MEMBER FUNCTIONS ================================
|
|
75 |
|
|
76 |
// ----------------------------------------------------------------------------
|
|
77 |
// CCalenAttachmentSelectionObserver::NewL
|
|
78 |
// 1st phase of construction
|
|
79 |
// ----------------------------------------------------------------------------
|
|
80 |
//
|
|
81 |
CCalenViewAttachmentsDialog* CCalenViewAttachmentsDialog::NewL(TDesC& aTitle,
|
|
82 |
CCalenAttachmentModel& aAttachmentModel,
|
|
83 |
CCalenController& aController)
|
|
84 |
{
|
|
85 |
TRACE_ENTRY_POINT;
|
|
86 |
|
|
87 |
CCalenViewAttachmentsDialog* self = new (ELeave) CCalenViewAttachmentsDialog(aTitle,
|
|
88 |
aAttachmentModel,
|
|
89 |
aController);
|
|
90 |
CleanupStack::PushL(self);
|
|
91 |
self->ConstructL();
|
|
92 |
CleanupStack::Pop(self);
|
|
93 |
|
|
94 |
TRACE_EXIT_POINT;
|
|
95 |
return self;
|
|
96 |
}
|
|
97 |
|
|
98 |
// ----------------------------------------------------------------------------
|
|
99 |
// CCalenViewAttachmentsDialog::CCalenViewAttachmentsDialog
|
|
100 |
// Constructor.
|
|
101 |
// (other items were commented in a header).
|
|
102 |
// ----------------------------------------------------------------------------
|
|
103 |
//
|
|
104 |
CCalenViewAttachmentsDialog::CCalenViewAttachmentsDialog(TDesC& aTitle,
|
|
105 |
CCalenAttachmentModel& aAttachmentModel,CCalenController& aController )
|
|
106 |
: iAttachmentModel( aAttachmentModel ),
|
|
107 |
iController(aController),
|
|
108 |
iNewTitle( aTitle ),
|
|
109 |
iEmbeddedFileOpened(EFalse)
|
|
110 |
{
|
|
111 |
TRACE_ENTRY_POINT;
|
|
112 |
TRACE_EXIT_POINT;
|
|
113 |
}
|
|
114 |
|
|
115 |
// ----------------------------------------------------------------------------
|
|
116 |
// CCalenViewAttachmentsDialog::~CCalenViewAttachmentsDialog
|
|
117 |
// Destructor.
|
|
118 |
// (other items were commented in a header).
|
|
119 |
// ----------------------------------------------------------------------------
|
|
120 |
//
|
|
121 |
CCalenViewAttachmentsDialog::~CCalenViewAttachmentsDialog()
|
|
122 |
{
|
|
123 |
TRACE_ENTRY_POINT;
|
|
124 |
|
|
125 |
delete iOldTitle;
|
|
126 |
|
|
127 |
// because it's not possible to set externally owned icon array
|
|
128 |
// for listbox, we delete our icon array here and set listbox
|
|
129 |
// icon array to NULL.
|
|
130 |
delete iIconArray;
|
|
131 |
if ( iListBox )
|
|
132 |
{
|
|
133 |
TRAP_IGNORE( iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( NULL ) );
|
|
134 |
}
|
|
135 |
|
|
136 |
delete iListItems;
|
|
137 |
delete iDocHandler;
|
|
138 |
|
|
139 |
// remove empty navi pane.
|
|
140 |
if ( iNaviPane )
|
|
141 |
{
|
|
142 |
iNaviPane->Pop();
|
|
143 |
}
|
|
144 |
delete iOpenParamList;
|
|
145 |
|
|
146 |
iController.CancelNotifications( this );
|
|
147 |
|
|
148 |
TRACE_EXIT_POINT;
|
|
149 |
}
|
|
150 |
|
|
151 |
// -----------------------------------------------------------------------------
|
|
152 |
// CCalenViewAttachmentsDialog::ConstructL
|
|
153 |
// 2nd phase constructor.
|
|
154 |
// (other items were commented in a header).
|
|
155 |
// ----------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
void CCalenViewAttachmentsDialog::ConstructL()
|
|
158 |
{
|
|
159 |
TRACE_ENTRY_POINT;
|
|
160 |
|
|
161 |
DoConstructL();
|
|
162 |
|
|
163 |
TRACE_EXIT_POINT;
|
|
164 |
}
|
|
165 |
|
|
166 |
// ----------------------------------------------------------------------------
|
|
167 |
// CCalenViewAttachmentsDialog::DoConstructL
|
|
168 |
// (other items were commented in a header).
|
|
169 |
// ----------------------------------------------------------------------------
|
|
170 |
//
|
|
171 |
void CCalenViewAttachmentsDialog::DoConstructL()
|
|
172 |
{
|
|
173 |
TRACE_ENTRY_POINT;
|
|
174 |
|
|
175 |
CAknDialog::ConstructL( R_CALENDAR_ATTACHMENT_MENUBAR );
|
|
176 |
|
|
177 |
iDocHandler = CDocumentHandler::NewL( iEikonEnv->Process() );
|
|
178 |
|
|
179 |
// replace navi pane with empty one.
|
|
180 |
iNaviPane = static_cast<CAknNavigationControlContainer*>
|
|
181 |
( iEikonEnv->AppUiFactory()->StatusPane()->ControlL(
|
|
182 |
TUid::Uid( EEikStatusPaneUidNavi ) ) );
|
|
183 |
|
|
184 |
// CAknNavigationControlContainer internal array of decorators seem to
|
|
185 |
// have big enough granularity that it does not need realloc
|
|
186 |
// and therefore PushDefaultL does not leave.
|
|
187 |
iNaviPane->PushDefaultL();
|
|
188 |
|
|
189 |
iDocHandler->SetExitObserver( this );
|
|
190 |
|
|
191 |
iController.RegisterForNotificationsL( this, ECalenNotifyAttachmentAdded );
|
|
192 |
|
|
193 |
TRACE_EXIT_POINT;
|
|
194 |
}
|
|
195 |
|
|
196 |
// ----------------------------------------------------------------------------
|
|
197 |
// CCalenViewAttachmentsDialog::CurrentListItemIndex
|
|
198 |
// returns current item index.
|
|
199 |
// (other items were commented in a header).
|
|
200 |
// ----------------------------------------------------------------------------
|
|
201 |
//
|
|
202 |
TInt CCalenViewAttachmentsDialog::CurrentListItemIndex()
|
|
203 |
{
|
|
204 |
TRACE_ENTRY_POINT;
|
|
205 |
TRACE_EXIT_POINT;
|
|
206 |
return iListBox->CurrentItemIndex();
|
|
207 |
}
|
|
208 |
|
|
209 |
// ----------------------------------------------------------------------------
|
|
210 |
// CCalenViewAttachmentsDialog::UpdateIcon
|
|
211 |
// (other items were commented in a header).
|
|
212 |
// ----------------------------------------------------------------------------
|
|
213 |
//
|
|
214 |
void CCalenViewAttachmentsDialog::UpdateIcon( TInt aListIndex )
|
|
215 |
{
|
|
216 |
TRACE_ENTRY_POINT;
|
|
217 |
|
|
218 |
iListBox->DrawItem( aListIndex );
|
|
219 |
|
|
220 |
TRACE_EXIT_POINT;
|
|
221 |
}
|
|
222 |
|
|
223 |
// ----------------------------------------------------------------------------
|
|
224 |
// CCalenViewAttachmentsDialog::ProcessCommandL
|
|
225 |
// (other items were commented in a header).
|
|
226 |
// ----------------------------------------------------------------------------
|
|
227 |
//
|
|
228 |
void CCalenViewAttachmentsDialog::ProcessCommandL( TInt aCommandId )
|
|
229 |
{
|
|
230 |
TRACE_ENTRY_POINT;
|
|
231 |
|
|
232 |
HideMenu();
|
|
233 |
|
|
234 |
TFileName filename;
|
|
235 |
TInt index = iListBox->CurrentItemIndex();
|
|
236 |
|
|
237 |
switch ( aCommandId )
|
|
238 |
{
|
|
239 |
case ECalenViewAttachmentCmdOpen:
|
|
240 |
{
|
|
241 |
if ( CheckSpaceBelowCriticalLevelL() )
|
|
242 |
{
|
|
243 |
TRACE_EXIT_POINT;
|
|
244 |
|
|
245 |
return;
|
|
246 |
}
|
|
247 |
else if(index!=KErrNotFound)
|
|
248 |
{
|
|
249 |
//get the attachmentinfo for the current index
|
|
250 |
CCalenAttachmentInfo& attInfo =
|
|
251 |
iAttachmentModel.AttachmentInfoAt( index );
|
|
252 |
|
|
253 |
TDataType datatype( attInfo.DataType() );
|
|
254 |
RFile file = iAttachmentModel.GetAttachmentFileL( index );
|
|
255 |
CleanupClosePushL(file);
|
|
256 |
OpenAttachmentViewerL(file, *this);
|
|
257 |
CleanupStack::PopAndDestroy(&file);
|
|
258 |
}
|
|
259 |
}
|
|
260 |
break;
|
|
261 |
|
|
262 |
case ECalenViewAttachmentCmdSave:
|
|
263 |
{
|
|
264 |
if ( CheckSpaceBelowCriticalLevelL() )
|
|
265 |
{
|
|
266 |
TRACE_EXIT_POINT;
|
|
267 |
return;
|
|
268 |
}
|
|
269 |
//get the attachmentinfo for the current index
|
|
270 |
CCalenAttachmentInfo& attInfo =
|
|
271 |
iAttachmentModel.AttachmentInfoAt( index );
|
|
272 |
|
|
273 |
TDataType datatype( attInfo.DataType() );
|
|
274 |
RFile file = iAttachmentModel.GetAttachmentFileL( index );
|
|
275 |
CleanupClosePushL(file);
|
|
276 |
CCalenAttachmentUtils::SaveAttachmentL(file, *this);
|
|
277 |
CleanupStack::PopAndDestroy(&file);
|
|
278 |
}
|
|
279 |
break;
|
|
280 |
|
|
281 |
case ECalenViewAttachmentCmdRemove:
|
|
282 |
{
|
|
283 |
if ( index != KErrNotFound )
|
|
284 |
{
|
|
285 |
//modify the model
|
|
286 |
if(RemoveAttachmentL(index))
|
|
287 |
{
|
|
288 |
//update the ui
|
|
289 |
ItemRemovedL( index );
|
|
290 |
}
|
|
291 |
}
|
|
292 |
break;
|
|
293 |
}
|
|
294 |
case ECalenViewAttachmentAdd:
|
|
295 |
{
|
|
296 |
//issue this command and it will be handled by attachmentui.
|
|
297 |
iController.Services().IssueCommandL(ECalenAddAttachmentFromViewer);
|
|
298 |
|
|
299 |
}
|
|
300 |
break;
|
|
301 |
case ECalenViewerCmdAttachmentCmdExit:
|
|
302 |
TryExitL(EAknSoftkeyOk);
|
|
303 |
break;
|
|
304 |
case EAknCmdHelp:
|
|
305 |
// Launch help
|
|
306 |
HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(),
|
|
307 |
iEikonEnv->EikAppUi()->AppHelpContextL() );
|
|
308 |
break;
|
|
309 |
case EAknCmdExit:
|
|
310 |
case EEikCmdExit:
|
|
311 |
{
|
|
312 |
static_cast<MEikCommandObserver*>( iEikonEnv->EikAppUi() )
|
|
313 |
->ProcessCommandL( EAknSoftkeyExit );
|
|
314 |
break;
|
|
315 |
}
|
|
316 |
default:
|
|
317 |
{
|
|
318 |
break;
|
|
319 |
}
|
|
320 |
}
|
|
321 |
TRACE_EXIT_POINT;
|
|
322 |
}
|
|
323 |
|
|
324 |
// ----------------------------------------------------------------------------
|
|
325 |
// CCalenViewAttachmentsDialog::DynInitMenuPaneL
|
|
326 |
// (other items were commented in a header).
|
|
327 |
// ----------------------------------------------------------------------------
|
|
328 |
//
|
|
329 |
void CCalenViewAttachmentsDialog::DynInitMenuPaneL(
|
|
330 |
TInt aMenuId, CEikMenuPane* aMenuPane )
|
|
331 |
{
|
|
332 |
TRACE_ENTRY_POINT;
|
|
333 |
|
|
334 |
switch(aMenuId)
|
|
335 |
{
|
|
336 |
case R_CALENDAR_ATTACHMENT_MENUPANE:
|
|
337 |
{
|
|
338 |
if(!(iAttachmentModel.NumberOfItems()))
|
|
339 |
{
|
|
340 |
//remove the options open and remove if count is 0.
|
|
341 |
|
|
342 |
aMenuPane->SetItemDimmed(ECalenViewAttachmentCmdOpen,ETrue);
|
|
343 |
aMenuPane->SetItemDimmed(ECalenViewAttachmentCmdSave,ETrue);
|
|
344 |
aMenuPane->SetItemDimmed(ECalenViewAttachmentCmdRemove,ETrue);
|
|
345 |
}
|
|
346 |
else
|
|
347 |
{
|
|
348 |
aMenuPane->SetItemDimmed(ECalenViewAttachmentCmdOpen,EFalse);
|
|
349 |
aMenuPane->SetItemDimmed(ECalenViewAttachmentCmdSave,EFalse);
|
|
350 |
aMenuPane->SetItemDimmed(ECalenViewAttachmentCmdRemove,EFalse);
|
|
351 |
}
|
|
352 |
}
|
|
353 |
break;
|
|
354 |
default:
|
|
355 |
break;
|
|
356 |
}
|
|
357 |
|
|
358 |
TRACE_EXIT_POINT;
|
|
359 |
}
|
|
360 |
|
|
361 |
// ----------------------------------------------------------------------------
|
|
362 |
// CCalenViewAttachmentsDialog::HandleResourceChangeL
|
|
363 |
// (other items were commented in a header).
|
|
364 |
// ----------------------------------------------------------------------------
|
|
365 |
//
|
|
366 |
void CCalenViewAttachmentsDialog::HandleResourceChange(TInt aType)
|
|
367 |
{
|
|
368 |
TRACE_ENTRY_POINT;
|
|
369 |
|
|
370 |
if ( aType == KEikDynamicLayoutVariantSwitch ||
|
|
371 |
aType == KAknsMessageSkinChange )
|
|
372 |
{
|
|
373 |
TRAP_IGNORE( iAttachmentModel.LoadResourcesL() );
|
|
374 |
}
|
|
375 |
CEikDialog::HandleResourceChange( aType );
|
|
376 |
|
|
377 |
TRACE_EXIT_POINT;
|
|
378 |
}
|
|
379 |
|
|
380 |
// ----------------------------------------------------------------------------
|
|
381 |
// CCalenViewAttachmentsDialog::HandleServerAppExit
|
|
382 |
// (other items were commented in a header).
|
|
383 |
// ----------------------------------------------------------------------------
|
|
384 |
//
|
|
385 |
void CCalenViewAttachmentsDialog::HandleServerAppExit( TInt aReason)
|
|
386 |
{
|
|
387 |
TRACE_ENTRY_POINT;
|
|
388 |
|
|
389 |
iEmbeddedFileOpened = EFalse;
|
|
390 |
if (aReason == EAknCmdExit)
|
|
391 |
{
|
|
392 |
//issue this notification, which will be handled by attachmentui.
|
|
393 |
iController.BroadcastNotification(ECalenNotifyAttachmentViewerClosed);
|
|
394 |
}
|
|
395 |
|
|
396 |
TRACE_EXIT_POINT;
|
|
397 |
}
|
|
398 |
|
|
399 |
// ----------------------------------------------------------------------------
|
|
400 |
// CCalenViewAttachmentsDialog::HandleControlStateChangeL
|
|
401 |
// (other items were commented in a header).
|
|
402 |
// ----------------------------------------------------------------------------
|
|
403 |
//
|
|
404 |
void CCalenViewAttachmentsDialog::HandleControlStateChangeL( TInt aControlId )
|
|
405 |
{
|
|
406 |
TRACE_ENTRY_POINT;
|
|
407 |
|
|
408 |
if ( aControlId == ECalenAttachmentListBoxId )
|
|
409 |
{
|
|
410 |
DoUpdateUiL();
|
|
411 |
}
|
|
412 |
|
|
413 |
CAknDialog::HandleControlStateChangeL( aControlId );
|
|
414 |
|
|
415 |
TRACE_EXIT_POINT;
|
|
416 |
}
|
|
417 |
|
|
418 |
// ----------------------------------------------------------------------------
|
|
419 |
// CCalenViewAttachmentsDialog::OkToExitL
|
|
420 |
// (other items were commented in a header).
|
|
421 |
// ----------------------------------------------------------------------------
|
|
422 |
//
|
|
423 |
TBool CCalenViewAttachmentsDialog::HandleOkToExitL( TInt aButtonId )
|
|
424 |
{
|
|
425 |
TRACE_ENTRY_POINT;
|
|
426 |
|
|
427 |
|
|
428 |
if ( aButtonId == EAknSoftkeyBack )
|
|
429 |
{
|
|
430 |
iTitlePane->SetTextL( *iOldTitle );
|
|
431 |
|
|
432 |
//issue this notification, which will be handled by attachmentui.
|
|
433 |
iController.BroadcastNotification(ECalenNotifyAttachmentViewerClosed);
|
|
434 |
}
|
|
435 |
else if ( aButtonId == EAknSoftkeyOpen )
|
|
436 |
{
|
|
437 |
if(iAttachmentModel.NumberOfItems()!= 0)
|
|
438 |
{
|
|
439 |
//open the attachment if user taps on the item.
|
|
440 |
ProcessCommandL( ECalenViewAttachmentCmdOpen );
|
|
441 |
}
|
|
442 |
TRACE_EXIT_POINT;
|
|
443 |
|
|
444 |
return EFalse;
|
|
445 |
}
|
|
446 |
TRACE_EXIT_POINT;
|
|
447 |
|
|
448 |
return CAknDialog::OkToExitL( aButtonId );
|
|
449 |
}
|
|
450 |
|
|
451 |
// ----------------------------------------------------------------------------
|
|
452 |
// CCalenViewAttachmentsDialog::CreateCustomControlL
|
|
453 |
// (other items were commented in a header).
|
|
454 |
// ----------------------------------------------------------------------------
|
|
455 |
//
|
|
456 |
SEikControlInfo CCalenViewAttachmentsDialog::CreateCustomControlL( TInt aControlType )
|
|
457 |
{
|
|
458 |
TRACE_ENTRY_POINT;
|
|
459 |
|
|
460 |
SEikControlInfo controlInfo;
|
|
461 |
controlInfo.iControl = NULL;
|
|
462 |
controlInfo.iTrailerTextId = 0;
|
|
463 |
controlInfo.iFlags = 0;
|
|
464 |
|
|
465 |
if ( aControlType == ECalenAttachmentListBox )
|
|
466 |
{
|
|
467 |
//create the attachment listbox to list all the attachments
|
|
468 |
controlInfo.iControl = new ( ELeave ) CCalenAttachmentsListBox( iAttachmentModel );
|
|
469 |
}
|
|
470 |
TRACE_EXIT_POINT;
|
|
471 |
|
|
472 |
return controlInfo;
|
|
473 |
}
|
|
474 |
|
|
475 |
// ----------------------------------------------------------------------------
|
|
476 |
// CCalenViewAttachmentsDialog::HandleListBoxEventL
|
|
477 |
// (other items were commented in a header).
|
|
478 |
// ----------------------------------------------------------------------------
|
|
479 |
//
|
|
480 |
#ifdef RD_SCALABLE_UI_V2
|
|
481 |
void CCalenViewAttachmentsDialog::HandleListBoxEventL( CEikListBox* /*aListBox*/,
|
|
482 |
TListBoxEvent aEventType )
|
|
483 |
{
|
|
484 |
TRACE_ENTRY_POINT;
|
|
485 |
|
|
486 |
if ( !MenuShowing() )
|
|
487 |
{
|
|
488 |
//Single click integration
|
|
489 |
if ( aEventType == EEventEnterKeyPressed ||
|
|
490 |
|
|
491 |
aEventType == EEventItemSingleClicked )
|
|
492 |
{
|
|
493 |
const TInt index(CurrentListItemIndex());
|
|
494 |
if ( index != KErrNotFound )
|
|
495 |
{
|
|
496 |
UpdateMiddleSoftKeyL( index );
|
|
497 |
OpenAttachmentL();
|
|
498 |
}
|
|
499 |
}
|
|
500 |
}
|
|
501 |
TRACE_EXIT_POINT;
|
|
502 |
}
|
|
503 |
#else
|
|
504 |
void CCalenViewAttachmentsDialog::HandleListBoxEventL( CEikListBox* /*aListBox*/,
|
|
505 |
TListBoxEvent /*aEventType*/ )
|
|
506 |
{
|
|
507 |
TRACE_ENTRY_POINT;
|
|
508 |
TRACE_EXIT_POINT;
|
|
509 |
}
|
|
510 |
#endif // RD_SCALABLE_UI_V2
|
|
511 |
|
|
512 |
|
|
513 |
// ----------------------------------------------------------------------------
|
|
514 |
// CCalenViewAttachmentsDialog::PreLayoutDynInitL
|
|
515 |
// (other items were commented in a header).
|
|
516 |
// ----------------------------------------------------------------------------
|
|
517 |
//
|
|
518 |
void CCalenViewAttachmentsDialog::PreLayoutDynInitL()
|
|
519 |
{
|
|
520 |
TRACE_ENTRY_POINT;
|
|
521 |
|
|
522 |
CEikStatusPane *sp = static_cast<CAknAppUi*>
|
|
523 |
( iEikonEnv->EikAppUi() )->StatusPane();
|
|
524 |
|
|
525 |
iTitlePane = static_cast<CAknTitlePane*>
|
|
526 |
( sp->ControlL( TUid::Uid(EEikStatusPaneUidTitle ) ) );
|
|
527 |
|
|
528 |
const TDesC* title = iTitlePane->Text();
|
|
529 |
iOldTitle = title->AllocL();
|
|
530 |
|
|
531 |
iTitlePane->SetTextL( iNewTitle );
|
|
532 |
|
|
533 |
iListBox = static_cast<CCalenAttachmentsListBox*>
|
|
534 |
( Control( ECalenAttachmentListBoxId ) );
|
|
535 |
|
|
536 |
iListBox->SetContainerWindowL( *this);
|
|
537 |
iListBox->CreateScrollBarFrameL( ETrue );
|
|
538 |
|
|
539 |
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(
|
|
540 |
CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
|
|
541 |
|
|
542 |
iListBox->SetListBoxObserver( this );
|
|
543 |
|
|
544 |
LoadFormDataL();
|
|
545 |
|
|
546 |
if(iAttachmentModel.NumberOfItems() == 0)
|
|
547 |
{
|
|
548 |
UpdateButtonVisiblity( ECalenViewAttachmentCmdOpen, EFalse );
|
|
549 |
}
|
|
550 |
|
|
551 |
TRACE_EXIT_POINT;
|
|
552 |
}
|
|
553 |
|
|
554 |
// ----------------------------------------------------------------------------
|
|
555 |
// CCalenViewAttachmentsDialog::LoadFormDataL
|
|
556 |
// (other items were commented in a header).
|
|
557 |
// ----------------------------------------------------------------------------
|
|
558 |
//
|
|
559 |
void CCalenViewAttachmentsDialog::LoadFormDataL()
|
|
560 |
{
|
|
561 |
TRACE_ENTRY_POINT;
|
|
562 |
|
|
563 |
// iconarray for two icons.
|
|
564 |
// index 0: application icon.
|
|
565 |
// index 1: indicator.
|
|
566 |
iIconArray = new ( ELeave ) CArrayPtrFlat<CGulIcon>( 2 );
|
|
567 |
|
|
568 |
iListBox->ItemDrawer()->FormattedCellData()->SetIconArrayL( iIconArray );
|
|
569 |
|
|
570 |
// list items is not actually an array but object that returns
|
|
571 |
// list item text for listbox in MdcaPoint method.
|
|
572 |
iListItems = CCalenAttaListItemArray::NewL( iAttachmentModel, iIconArray );
|
|
573 |
iListBox->Model()->SetItemTextArray( iListItems );
|
|
574 |
iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray );
|
|
575 |
}
|
|
576 |
|
|
577 |
// ----------------------------------------------------------------------------
|
|
578 |
// CCalenViewAttachmentsDialog::ItemAddedL
|
|
579 |
// (other items were commented in a header).
|
|
580 |
// ----------------------------------------------------------------------------
|
|
581 |
void CCalenViewAttachmentsDialog::ItemAddedL( TInt aIndex )
|
|
582 |
{
|
|
583 |
iTitlePane->SetTextL( iNewTitle );
|
|
584 |
iListBox->View()->CalcBottomItemIndex();
|
|
585 |
|
|
586 |
TInt itemIndex = aIndex;
|
|
587 |
|
|
588 |
if ( aIndex == -1 )
|
|
589 |
{
|
|
590 |
itemIndex = Max( iListBox->Model()->NumberOfItems() - 1, 0 );
|
|
591 |
}
|
|
592 |
|
|
593 |
iListBox->SetCurrentItemIndexAndDraw(itemIndex);
|
|
594 |
|
|
595 |
if ( !ButtonGroupContainer().IsCommandVisible( EAknSoftkeyOpen ) )
|
|
596 |
{
|
|
597 |
// Set middle button visible if invisible and inserted attachment
|
|
598 |
// has content (i.e. it is not empty)
|
|
599 |
UpdateButtonVisiblity( ECalenViewAttachmentCmdOpen, ETrue );
|
|
600 |
}
|
|
601 |
|
|
602 |
iListBox->HandleItemAdditionL();
|
|
603 |
iListBox->DrawNow();
|
|
604 |
|
|
605 |
TRACE_EXIT_POINT;
|
|
606 |
}
|
|
607 |
|
|
608 |
// ----------------------------------------------------------------------------
|
|
609 |
// CCalenViewAttachmentsDialog::ItemRemovedL
|
|
610 |
// (other items were commented in a header).
|
|
611 |
// ----------------------------------------------------------------------------
|
|
612 |
void CCalenViewAttachmentsDialog::ItemRemovedL( TInt aIndex )
|
|
613 |
{
|
|
614 |
TRACE_ENTRY_POINT;
|
|
615 |
|
|
616 |
iTitlePane->SetTextL( iNewTitle );
|
|
617 |
iListBox->HandleItemRemovalL();
|
|
618 |
TInt lastItem = Max( iListBox->Model()->NumberOfItems() - 1, 0 );
|
|
619 |
|
|
620 |
if ( aIndex - 1 == lastItem )
|
|
621 |
{
|
|
622 |
TInt numItems = iListBox->View()->NumberOfItemsThatFitInRect(
|
|
623 |
iListBox->View()->ViewRect() );
|
|
624 |
TInt topItem = Max( lastItem - numItems, 0 );
|
|
625 |
iListBox->SetTopItemIndex( topItem );
|
|
626 |
}
|
|
627 |
|
|
628 |
iListBox->SetCurrentItemIndex( Min( aIndex, lastItem ) );
|
|
629 |
iListBox->DrawNow();
|
|
630 |
|
|
631 |
if ( iAttachmentModel.NumberOfItems() == 0 )
|
|
632 |
{
|
|
633 |
UpdateButtonVisiblity( ECalenViewAttachmentCmdOpen, EFalse );
|
|
634 |
}
|
|
635 |
TRACE_EXIT_POINT;
|
|
636 |
}
|
|
637 |
|
|
638 |
|
|
639 |
// ----------------------------------------------------------------------------
|
|
640 |
// CCalenViewAttachmentsDialog::RemoveAttachmentL
|
|
641 |
// (other items were commented in a header).
|
|
642 |
// ----------------------------------------------------------------------------
|
|
643 |
//
|
|
644 |
TBool CCalenViewAttachmentsDialog::RemoveAttachmentL( TInt aIndex )
|
|
645 |
{
|
|
646 |
TRACE_ENTRY_POINT;
|
|
647 |
|
|
648 |
TBool attachmentDeleted(EFalse);
|
|
649 |
// delete item from attachment model (notifies its observer about deletion).
|
|
650 |
attachmentDeleted = iAttachmentModel.DeleteAttachment( aIndex );
|
|
651 |
|
|
652 |
TRACE_EXIT_POINT;
|
|
653 |
return attachmentDeleted;
|
|
654 |
}
|
|
655 |
|
|
656 |
// ----------------------------------------------------------------------------
|
|
657 |
// CCalenViewAttachmentsDialog::CleanupWaitDialog
|
|
658 |
// (other items were commented in a header).
|
|
659 |
// ----------------------------------------------------------------------------
|
|
660 |
//
|
|
661 |
void CCalenViewAttachmentsDialog::CleanupWaitDialog( TAny* aAny )
|
|
662 |
{
|
|
663 |
TRACE_ENTRY_POINT;
|
|
664 |
|
|
665 |
//not used as of now, but we can use when attaching is in progress
|
|
666 |
CAknWaitDialog** dialog = (CAknWaitDialog**) aAny;
|
|
667 |
if ( dialog && *dialog )
|
|
668 |
{
|
|
669 |
delete *dialog;
|
|
670 |
}
|
|
671 |
|
|
672 |
TRACE_EXIT_POINT;
|
|
673 |
}
|
|
674 |
|
|
675 |
// ----------------------------------------------------------------------------
|
|
676 |
// CCalenViewAttachmentsDialog::DoUpdateUiL
|
|
677 |
// (other items were commented in a header).
|
|
678 |
// ----------------------------------------------------------------------------
|
|
679 |
//
|
|
680 |
void CCalenViewAttachmentsDialog::DoUpdateUiL()
|
|
681 |
{
|
|
682 |
TRACE_ENTRY_POINT;
|
|
683 |
|
|
684 |
if ( iAttachmentModel.NumberOfItems() == 0 )
|
|
685 |
{
|
|
686 |
UpdateButtonVisiblity( ECalenViewAttachmentCmdOpen, EFalse );
|
|
687 |
}
|
|
688 |
else
|
|
689 |
{
|
|
690 |
UpdateButtonVisiblity( ECalenViewAttachmentCmdOpen, ETrue );
|
|
691 |
}
|
|
692 |
|
|
693 |
TRACE_EXIT_POINT;
|
|
694 |
}
|
|
695 |
|
|
696 |
// ----------------------------------------------------------------------------
|
|
697 |
// CCalenViewAttachmentsDialog::UpdateButtonVisiblity
|
|
698 |
// (other items were commented in a header).
|
|
699 |
// ----------------------------------------------------------------------------
|
|
700 |
//
|
|
701 |
void CCalenViewAttachmentsDialog::UpdateButtonVisiblity( TInt aCommandId, TBool aValue )
|
|
702 |
{
|
|
703 |
TRACE_ENTRY_POINT;
|
|
704 |
|
|
705 |
if ( ButtonGroupContainer().ControlOrNull( aCommandId ) )
|
|
706 |
{
|
|
707 |
ButtonGroupContainer().MakeCommandVisible( aCommandId, aValue );
|
|
708 |
}
|
|
709 |
|
|
710 |
TRACE_EXIT_POINT;
|
|
711 |
}
|
|
712 |
|
|
713 |
// ----------------------------------------------------------------------------
|
|
714 |
// CCalenViewAttachmentsDialog::HandleNotification
|
|
715 |
// Calls back when notifications that it has been registered for are broadcast
|
|
716 |
// (other items were commented in a header).
|
|
717 |
// ----------------------------------------------------------------------------
|
|
718 |
//
|
|
719 |
void CCalenViewAttachmentsDialog::HandleNotification(const TCalenNotification aNotification )
|
|
720 |
{
|
|
721 |
TRACE_ENTRY_POINT;
|
|
722 |
|
|
723 |
PIM_TRAPD_HANDLE( HandleNotificationL( aNotification ) );
|
|
724 |
|
|
725 |
TRACE_EXIT_POINT;
|
|
726 |
}
|
|
727 |
|
|
728 |
// ----------------------------------------------------------------------------
|
|
729 |
// CCalenViewAttachmentsDialog::HandleNotificationL
|
|
730 |
// Called from HandleNotification() when notifications that it has been
|
|
731 |
// registered for are broadcast
|
|
732 |
// (other items were commented in a header).
|
|
733 |
// ----------------------------------------------------------------------------
|
|
734 |
//
|
|
735 |
void CCalenViewAttachmentsDialog::HandleNotificationL( TCalenNotification aNotification )
|
|
736 |
{
|
|
737 |
TRACE_ENTRY_POINT;
|
|
738 |
|
|
739 |
switch( aNotification )
|
|
740 |
{
|
|
741 |
case ECalenNotifyAttachmentAdded:
|
|
742 |
{
|
|
743 |
TInt currentItemIndex = iAttachmentModel.NumberOfItems()-1;
|
|
744 |
ItemAddedL(currentItemIndex);
|
|
745 |
}
|
|
746 |
break;
|
|
747 |
default:
|
|
748 |
break;
|
|
749 |
}
|
|
750 |
|
|
751 |
TRACE_EXIT_POINT;
|
|
752 |
}
|
|
753 |
|
|
754 |
// -----------------------------------------------------------------------------
|
|
755 |
// CCalenViewAttachmentsDialog::CountComponentControls
|
|
756 |
// Gets the number of controls contained in a compound control.
|
|
757 |
// -----------------------------------------------------------------------------
|
|
758 |
//
|
|
759 |
TInt CCalenViewAttachmentsDialog::CountComponentControls() const
|
|
760 |
{
|
|
761 |
TRACE_ENTRY_POINT;
|
|
762 |
TRACE_EXIT_POINT;
|
|
763 |
|
|
764 |
return 1;
|
|
765 |
}
|
|
766 |
|
|
767 |
// -----------------------------------------------------------------------------
|
|
768 |
// CCalenViewAttachmentsDialog::ComponentControl
|
|
769 |
// Gets the specified component of a compound control.
|
|
770 |
// -----------------------------------------------------------------------------
|
|
771 |
//
|
|
772 |
CCoeControl* CCalenViewAttachmentsDialog::ComponentControl(TInt aIndex) const
|
|
773 |
{
|
|
774 |
TRACE_ENTRY_POINT;
|
|
775 |
TRACE_EXIT_POINT;
|
|
776 |
switch (aIndex)
|
|
777 |
{
|
|
778 |
case 0:
|
|
779 |
return iListBox;
|
|
780 |
default:
|
|
781 |
return NULL;
|
|
782 |
}
|
|
783 |
}
|
|
784 |
|
|
785 |
|
|
786 |
// ----------------------------------------------------------------------------
|
|
787 |
// CCalenViewAttachmentsDialog::HandlePointerEventL
|
|
788 |
// Process pointer event.
|
|
789 |
// (other items were commented in a header).
|
|
790 |
// ----------------------------------------------------------------------------
|
|
791 |
//
|
|
792 |
void CCalenViewAttachmentsDialog::HandlePointerEventL(const TPointerEvent& aPointerEvent)
|
|
793 |
{
|
|
794 |
TRACE_ENTRY_POINT;
|
|
795 |
//Single click integration
|
|
796 |
if ( iListBox && !iEmbeddedFileOpened)
|
|
797 |
{
|
|
798 |
iListBox->HandlePointerEventL( aPointerEvent );
|
|
799 |
}
|
|
800 |
TRACE_EXIT_POINT;
|
|
801 |
}
|
|
802 |
|
|
803 |
|
|
804 |
// -----------------------------------------------------------------------------
|
|
805 |
// CCalenViewAttachmentsDialog::NotifySizeChanged
|
|
806 |
// -----------------------------------------------------------------------------
|
|
807 |
//
|
|
808 |
void CCalenViewAttachmentsDialog::NotifySizeChanged()
|
|
809 |
{
|
|
810 |
TRACE_ENTRY_POINT;
|
|
811 |
|
|
812 |
if(iListBox)
|
|
813 |
{
|
|
814 |
iListBox->SizeChanged();
|
|
815 |
}
|
|
816 |
TRACE_EXIT_POINT;
|
|
817 |
}
|
|
818 |
|
|
819 |
// ----------------------------------------------------------------------------
|
|
820 |
// CCalenViewAttachmentsDialog::UpdateAttachmentsFetchFlags
|
|
821 |
// ----------------------------------------------------------------------------
|
|
822 |
//
|
|
823 |
void CCalenViewAttachmentsDialog::UpdateAttachmentsFetchFlags()
|
|
824 |
{
|
|
825 |
TRACE_ENTRY_POINT;
|
|
826 |
|
|
827 |
//Update attachmentmodel to secure model is up to date.
|
|
828 |
for(TInt itemIndex=0; itemIndex<iAttachmentModel.NumberOfItems(); itemIndex++)
|
|
829 |
{
|
|
830 |
CCalenAttachmentInfo& attInfo =
|
|
831 |
iAttachmentModel.AttachmentInfoAt(itemIndex);
|
|
832 |
attInfo.SetFetched( ETrue );
|
|
833 |
}
|
|
834 |
|
|
835 |
//If there are attachments update the middle soft key
|
|
836 |
//according to the first attachment
|
|
837 |
if( iAttachmentModel.NumberOfItems() > 0 )
|
|
838 |
{
|
|
839 |
TRAP_IGNORE( UpdateMiddleSoftKeyL(CurrentListItemIndex()) );
|
|
840 |
}
|
|
841 |
TRACE_EXIT_POINT;
|
|
842 |
|
|
843 |
}
|
|
844 |
|
|
845 |
// ----------------------------------------------------------------------------
|
|
846 |
// CCalenViewAttachmentsDialog::OfferKeyEventL
|
|
847 |
// (other items were commented in a header).
|
|
848 |
// ----------------------------------------------------------------------------
|
|
849 |
//
|
|
850 |
TKeyResponse CCalenViewAttachmentsDialog::OfferKeyEventL(
|
|
851 |
const TKeyEvent& aKeyEvent, TEventCode aType)
|
|
852 |
{
|
|
853 |
TRACE_ENTRY_POINT;
|
|
854 |
|
|
855 |
// Consume send keys, so that they are not handled in the appui
|
|
856 |
if( aType == EEventKey && aKeyEvent.iCode == EKeyYes )
|
|
857 |
{
|
|
858 |
TRACE_EXIT_POINT;
|
|
859 |
|
|
860 |
return EKeyWasConsumed;
|
|
861 |
}
|
|
862 |
|
|
863 |
TInt index( CurrentListItemIndex() );
|
|
864 |
if ( index != KErrNotFound && !MenuShowing() )
|
|
865 |
{
|
|
866 |
if ( aType == EEventKey )
|
|
867 |
{
|
|
868 |
if( aKeyEvent.iCode == EKeyOK )
|
|
869 |
{
|
|
870 |
//Single click integration
|
|
871 |
iListBox->OfferKeyEventL( aKeyEvent, aType );
|
|
872 |
return EKeyWasConsumed;
|
|
873 |
}
|
|
874 |
else if( aKeyEvent.iCode == EKeyBackspace
|
|
875 |
&& iMenuBar->ItemSpecificCommandsEnabled() )
|
|
876 |
{
|
|
877 |
//todo isssue a confirmation query
|
|
878 |
CCalenAttachmentInfo& attaInfo =
|
|
879 |
iAttachmentModel.AttachmentInfoAt(index);
|
|
880 |
if ( CanRemoveAttachment( attaInfo ) )
|
|
881 |
{
|
|
882 |
ProcessCommandL(ECalenViewAttachmentCmdRemove);
|
|
883 |
}
|
|
884 |
TRACE_EXIT_POINT;
|
|
885 |
|
|
886 |
return EKeyWasConsumed;
|
|
887 |
}
|
|
888 |
else if(aKeyEvent.iCode == EKeyNo)
|
|
889 |
{
|
|
890 |
iController.BroadcastNotification(ECalenNotifyAttachmentViewerClosed);
|
|
891 |
}
|
|
892 |
else if(aKeyEvent.iCode == EKeyEscape)
|
|
893 |
{
|
|
894 |
MCalenToolbar* toolbar = iController.Services().ToolbarOrNull();
|
|
895 |
if(toolbar)
|
|
896 |
{
|
|
897 |
toolbar->SetToolbarVisibilityL(ETrue);
|
|
898 |
}
|
|
899 |
iController.BroadcastNotification(ECalenNotifyAttachmentViewerClosed);
|
|
900 |
}
|
|
901 |
}
|
|
902 |
else if ( aType == EEventKeyUp )
|
|
903 |
{
|
|
904 |
UpdateMiddleSoftKeyL( index );
|
|
905 |
}
|
|
906 |
}
|
|
907 |
TRACE_EXIT_POINT;
|
|
908 |
|
|
909 |
return CAknDialog::OfferKeyEventL(aKeyEvent, aType);
|
|
910 |
}
|
|
911 |
|
|
912 |
// ----------------------------------------------------------------------------
|
|
913 |
// CCalenViewAttachmentsDialog::OpenAttachmentL
|
|
914 |
// ----------------------------------------------------------------------------
|
|
915 |
//
|
|
916 |
void CCalenViewAttachmentsDialog::OpenAttachmentL()
|
|
917 |
{
|
|
918 |
TRACE_ENTRY_POINT;
|
|
919 |
|
|
920 |
if ( CheckSpaceBelowCriticalLevelL() )
|
|
921 |
{
|
|
922 |
TRACE_EXIT_POINT;
|
|
923 |
|
|
924 |
return;
|
|
925 |
}
|
|
926 |
else
|
|
927 |
{
|
|
928 |
CCalenViewAttachmentsDialog::ProcessCommandL(ECalenViewAttachmentCmdOpen);
|
|
929 |
}
|
|
930 |
TRACE_EXIT_POINT;
|
|
931 |
|
|
932 |
}
|
|
933 |
|
|
934 |
// ----------------------------------------------------------------------------
|
|
935 |
// CCalenViewAttachmentsDialog::CanRemoveAttachment
|
|
936 |
// ----------------------------------------------------------------------------
|
|
937 |
//
|
|
938 |
TBool CCalenViewAttachmentsDialog::CanRemoveAttachment(
|
|
939 |
CCalenAttachmentInfo& aInfo )
|
|
940 |
{
|
|
941 |
TRACE_ENTRY_POINT;
|
|
942 |
TRACE_EXIT_POINT;
|
|
943 |
return (aInfo.IsFetched() );
|
|
944 |
}
|
|
945 |
|
|
946 |
// ---------------------------------------------------------------------------
|
|
947 |
// CCalenViewAttachmentsDialog::SetMiddleSoftKeyLabelL
|
|
948 |
// ---------------------------------------------------------------------------
|
|
949 |
//
|
|
950 |
void CCalenViewAttachmentsDialog::SetMiddleSoftKeyLabelL(
|
|
951 |
TInt aResourceId, TInt aCommandId )
|
|
952 |
{
|
|
953 |
TRACE_ENTRY_POINT;
|
|
954 |
|
|
955 |
HBufC* middleSKText = StringLoader::LoadLC( aResourceId );
|
|
956 |
|
|
957 |
ButtonGroupContainer().AddCommandToStackL(
|
|
958 |
KMSKControlID,
|
|
959 |
aCommandId,
|
|
960 |
*middleSKText );
|
|
961 |
CleanupStack::PopAndDestroy( middleSKText );
|
|
962 |
|
|
963 |
TRACE_EXIT_POINT;
|
|
964 |
}
|
|
965 |
|
|
966 |
// ---------------------------------------------------------------------------
|
|
967 |
// CCalenViewAttachmentsDialog::UpdateMiddleSoftKeyL
|
|
968 |
// ---------------------------------------------------------------------------
|
|
969 |
//
|
|
970 |
void CCalenViewAttachmentsDialog::UpdateMiddleSoftKeyL( TInt aIndex )
|
|
971 |
{
|
|
972 |
TRACE_ENTRY_POINT;
|
|
973 |
|
|
974 |
ASSERT( aIndex >= 0 && aIndex < iAttachmentModel.NumberOfItems() );
|
|
975 |
|
|
976 |
// set command as "open"
|
|
977 |
ButtonGroupContainer().RemoveCommandFromStack(
|
|
978 |
KMSKControlID, EAknSoftkeyOpen );
|
|
979 |
SetMiddleSoftKeyLabelL(
|
|
980 |
R_QTN_MSK_FETCH, ECalenViewAttachmentCmdOpen );
|
|
981 |
|
|
982 |
TRACE_EXIT_POINT;
|
|
983 |
}
|
|
984 |
|
|
985 |
// ----------------------------------------------------------------------------
|
|
986 |
// CCalenViewAttachmentsDialog::GetHelpContext
|
|
987 |
// This function is called when Help application is launched.
|
|
988 |
// ----------------------------------------------------------------------------
|
|
989 |
//
|
|
990 |
void CCalenViewAttachmentsDialog::GetHelpContext(TCoeHelpContext& /*aContext*/) const
|
|
991 |
{
|
|
992 |
TRACE_ENTRY_POINT;
|
|
993 |
TRACE_EXIT_POINT;
|
|
994 |
}
|
|
995 |
|
|
996 |
// -----------------------------------------------------------------------------
|
|
997 |
// CCalenViewAttachmentsDialog::OkToExitL
|
|
998 |
// -----------------------------------------------------------------------------
|
|
999 |
//
|
|
1000 |
TBool CCalenViewAttachmentsDialog::OkToExitL(TInt aButtonId)
|
|
1001 |
{
|
|
1002 |
TRACE_ENTRY_POINT;
|
|
1003 |
|
|
1004 |
//Check if user has selected exit from menu
|
|
1005 |
// -> whole application shall be closed.
|
|
1006 |
if ( aButtonId == EAknSoftkeyOk )
|
|
1007 |
{
|
|
1008 |
if ( CCalenViewAttachmentsDialog::HandleOkToExitL(aButtonId) )
|
|
1009 |
{
|
|
1010 |
CEikAppUi* appUi = iEikonEnv->EikAppUi();
|
|
1011 |
static_cast<MEikCommandObserver*>(appUi)->ProcessCommandL(
|
|
1012 |
EAknCmdExit );
|
|
1013 |
return ETrue;
|
|
1014 |
}
|
|
1015 |
else
|
|
1016 |
{
|
|
1017 |
TRACE_EXIT_POINT;
|
|
1018 |
|
|
1019 |
return EFalse;
|
|
1020 |
}
|
|
1021 |
}
|
|
1022 |
|
|
1023 |
else if ( aButtonId == ECalenViewAttachmentCmdOpen )
|
|
1024 |
{
|
|
1025 |
ProcessCommandL( aButtonId );
|
|
1026 |
|
|
1027 |
TRACE_EXIT_POINT;
|
|
1028 |
|
|
1029 |
return EFalse;
|
|
1030 |
}
|
|
1031 |
TRACE_EXIT_POINT;
|
|
1032 |
|
|
1033 |
//Let base class decide if it ok to exit
|
|
1034 |
return CCalenViewAttachmentsDialog::HandleOkToExitL(aButtonId);
|
|
1035 |
}
|
|
1036 |
|
|
1037 |
|
|
1038 |
// -----------------------------------------------------------------------------
|
|
1039 |
// CCalenViewAttachmentsDialog::UpdateAttatchmentListL
|
|
1040 |
// Update attatchmentlist
|
|
1041 |
// -----------------------------------------------------------------------------
|
|
1042 |
//
|
|
1043 |
void CCalenViewAttachmentsDialog::UpdateAttatchmentListL()
|
|
1044 |
{
|
|
1045 |
TRACE_ENTRY_POINT;
|
|
1046 |
|
|
1047 |
// Handles item addition
|
|
1048 |
ItemAddedL();
|
|
1049 |
TRACE_EXIT_POINT;
|
|
1050 |
}
|
|
1051 |
|
|
1052 |
// -----------------------------------------------------------------------------
|
|
1053 |
// CCalenViewAttachmentsDialog::CheckSpaceBelowCriticalLevelL
|
|
1054 |
// Checks if the Flash File System storage will fall below critical level.
|
|
1055 |
// If there is not enough space, display an error message and return EFalse.
|
|
1056 |
// Return ETrue otherwise.
|
|
1057 |
// (other items were commented in a header).
|
|
1058 |
// -----------------------------------------------------------------------------
|
|
1059 |
//
|
|
1060 |
TBool CCalenViewAttachmentsDialog::CheckSpaceBelowCriticalLevelL()
|
|
1061 |
{
|
|
1062 |
TRACE_ENTRY_POINT;
|
|
1063 |
|
|
1064 |
// FIXME: Could be moved to commonui
|
|
1065 |
TBool retcode(EFalse);
|
|
1066 |
|
|
1067 |
if (SysUtil::FFSSpaceBelowCriticalLevelL(&(iCoeEnv->FsSession())))
|
|
1068 |
{
|
|
1069 |
CErrorUI* errorUi = CErrorUI::NewLC();
|
|
1070 |
errorUi->ShowGlobalErrorNoteL(KErrDiskFull);
|
|
1071 |
CleanupStack::PopAndDestroy( errorUi );
|
|
1072 |
retcode = ETrue;
|
|
1073 |
}
|
|
1074 |
TRACE_EXIT_POINT;
|
|
1075 |
|
|
1076 |
return retcode;
|
|
1077 |
}
|
|
1078 |
|
|
1079 |
// -----------------------------------------------------------------------------
|
|
1080 |
// CCalenViewAttachmentsDialog::OpenAttachmentL
|
|
1081 |
// Opens a particular attachment
|
|
1082 |
// -----------------------------------------------------------------------------
|
|
1083 |
//
|
|
1084 |
void CCalenViewAttachmentsDialog::OpenAttachmentViewerL(RFile& aFile, MAknServerAppExitObserver& /*aExitObserver*/)
|
|
1085 |
{
|
|
1086 |
TRACE_ENTRY_POINT;
|
|
1087 |
|
|
1088 |
TBuf<250> fileName;
|
|
1089 |
aFile.FullName(fileName);
|
|
1090 |
TDataType datatype( CCalenAttachmentUtils::GetMimeType(aFile) );
|
|
1091 |
|
|
1092 |
TInt ret = KErrNone;
|
|
1093 |
|
|
1094 |
if(datatype == KNotePadTextDataType())
|
|
1095 |
{
|
|
1096 |
if(iEmbeddedFileOpened)
|
|
1097 |
{
|
|
1098 |
return;
|
|
1099 |
}
|
|
1100 |
iEmbeddedFileOpened = ETrue;
|
|
1101 |
const TDesC& notepadTitle = _L("NotePad");
|
|
1102 |
ret = CNotepadApi::ExecFileViewerL( aFile,
|
|
1103 |
¬epadTitle,
|
|
1104 |
ETrue,
|
|
1105 |
ETrue,
|
|
1106 |
KCharacterSetIdentifierIso88591 );
|
|
1107 |
iEmbeddedFileOpened = EFalse;
|
|
1108 |
}
|
|
1109 |
else
|
|
1110 |
{
|
|
1111 |
//doc handler will open the other files (other than text file).
|
|
1112 |
TRAP( ret, iDocHandler->OpenFileEmbeddedL( aFile, datatype ) );
|
|
1113 |
if(ret == KErrNone)
|
|
1114 |
{
|
|
1115 |
iEmbeddedFileOpened = ETrue;
|
|
1116 |
}
|
|
1117 |
}
|
|
1118 |
|
|
1119 |
switch(ret)
|
|
1120 |
{
|
|
1121 |
case KErrNone:
|
|
1122 |
break;
|
|
1123 |
default:
|
|
1124 |
{
|
|
1125 |
CAknInformationNote* note = new ( ELeave ) CAknInformationNote;
|
|
1126 |
HBufC* cannotOpen = StringLoader::LoadLC(
|
|
1127 |
R_QTN_CALEN_INFO_CANNOT_OPEN, CEikonEnv::Static() );
|
|
1128 |
note->ExecuteLD( *cannotOpen );
|
|
1129 |
CleanupStack::PopAndDestroy();
|
|
1130 |
}
|
|
1131 |
break;
|
|
1132 |
}
|
|
1133 |
TRACE_EXIT_POINT
|
|
1134 |
}
|
|
1135 |
|
|
1136 |
// End of File
|