|
1 /* |
|
2 * Copyright (c) 2002-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: MsgEditorAppUi implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // ========== INCLUDE FILES ================================ |
|
21 |
|
22 #include <featmgr.h> // for feature manager |
|
23 |
|
24 #include <eikenv.h> // Eikon Enviroment |
|
25 #include <txtrich.h> // Rich Text |
|
26 #include <eikrted.h> // CEikRichTextEditor |
|
27 #include <eikmenub.h> // CEikMenuBar |
|
28 #include <eikspane.h> // status panel |
|
29 |
|
30 #include <eikapp.h> // CEikApplication |
|
31 #include <eikserverapp.h> |
|
32 #include <bautils.h> // NearestLanguageFile |
|
33 #include <eikdialg.h> // CEikDialog |
|
34 #include <data_caging_path_literals.hrh> |
|
35 |
|
36 #include <msvapi.h> // |
|
37 #include <mtmuibas.h> // MTM UI |
|
38 #include <mtmuidef.hrh> // Preferences |
|
39 #include <mtmdef.h> // TMsvPartList |
|
40 |
|
41 #include <MuiuMsgEmbeddedEditorWatchingOperation.h> |
|
42 #include <MuiuMsgEditorLauncher.h> // for TEditorParameters |
|
43 #include <MuiuMessageIterator.h> // for CMessageIterator |
|
44 #include <MuiuOperationWait.h> // for CMuiuOperationWait |
|
45 #include <muiu.mbg> |
|
46 |
|
47 #include <aknenv.h> |
|
48 #include <aknnavi.h> // CAknNavigationControlContainer |
|
49 #include <aknnavide.h> // CAknNavigationDecorator |
|
50 #include <akntabgrp.h> // CAknTabGroup |
|
51 #include <akninputblock.h> // CAknInputBlock |
|
52 #include <aknnotewrappers.h> |
|
53 #include <AknIndicatorContainer.h> |
|
54 #include <akncontext.h> // For message store in MMC -indication |
|
55 #include <AknsUtils.h> |
|
56 #include <AknsConstants.h> |
|
57 #include <commonphoneparser.h> // Common phone number validity checker |
|
58 #include <apgicnfl.h> // apamasked bitmaps |
|
59 #include <ErrorUI.h> // CErrorUI - to show global error notes |
|
60 #include <StringLoader.h> // StringLoader |
|
61 #include <NpdApi.h> // Notepad API |
|
62 #include <avkon.hrh> |
|
63 #include <AknStatuspaneUtils.h> |
|
64 #include <AknSettingCache.h> |
|
65 #include <messaginginternalcrkeys.h> |
|
66 #include <MessagingSDKCRKeys.h> |
|
67 #include "MsgEditorAppUiExtension.h" |
|
68 |
|
69 #include <aknlayoutscalable_avkon.cdl.h> |
|
70 |
|
71 #include "MsgEditorShutter.h" |
|
72 |
|
73 #include "MsgEditorCommon.h" |
|
74 #include "MsgEditorAppUi.h" // class header |
|
75 #include "MsgEditorView.h" // View |
|
76 #include "MsgBodyControl.h" // Body Control |
|
77 #include "MsgSendKeyAcceptingQuery.h" |
|
78 #include "MsgEditorAppUiPanic.h" // Panics |
|
79 #include "MsgEditorFlags.h" // EditorFlags |
|
80 #include "MsgAttachmentUtils.h" |
|
81 #include <MsgEditorAppUi.rsg> // resource identifiers |
|
82 #include "MsgNaviPaneControl.h" |
|
83 |
|
84 #ifdef RD_MSG_FAST_PREV_NEXT |
|
85 #include <messaginginternalpskeys.h> |
|
86 #endif |
|
87 |
|
88 #include "MsgEditorLogging.h" |
|
89 |
|
90 // ========== EXTERNAL DATA STRUCTURES ===================== |
|
91 |
|
92 // ========== EXTERNAL FUNCTION PROTOTYPES ================= |
|
93 |
|
94 // ========== CONSTANTS ==================================== |
|
95 |
|
96 const TInt KMsgDiskSpaceForDelete = ( 5 * 1024 ); // minimum disk space needed when deleting messages |
|
97 |
|
98 // ========== MACROS ======================================= |
|
99 |
|
100 _LIT( KMsgEditorAppUiResourceFileName, "msgeditorappui.rsc" ); |
|
101 _LIT( KMuiuBitmapFileName, "muiu.mbm" ); |
|
102 _LIT( KMsgEditorAppUiFilterRe, "RE:" ); |
|
103 _LIT( KMsgEditorAppUiFilterFw, "FW:" ); |
|
104 _LIT( KMsgEditorAppUiFilterFwd, "FWD:" ); |
|
105 |
|
106 // ========== LOCAL CONSTANTS AND MACROS =================== |
|
107 |
|
108 // ========== MODULE DATA STRUCTURES ======================= |
|
109 |
|
110 // ========== LOCAL FUNCTION PROTOTYPES ==================== |
|
111 |
|
112 // ========== LOCAL FUNCTIONS ============================== |
|
113 |
|
114 // ========== MEMBER FUNCTIONS ============================= |
|
115 |
|
116 // --------------------------------------------------------- |
|
117 // CMsgEditorAppUi::CMsgEditorAppUi |
|
118 // |
|
119 // Constructor. |
|
120 // --------------------------------------------------------- |
|
121 // |
|
122 EXPORT_C CMsgEditorAppUi::CMsgEditorAppUi() : |
|
123 iExitMode( MApaEmbeddedDocObserver::EKeepChanges ), |
|
124 iCloseWithEndKey( ETrue ) |
|
125 { |
|
126 } |
|
127 |
|
128 // --------------------------------------------------------- |
|
129 // CMsgEditorAppUi::ConstructL |
|
130 // |
|
131 // 2nd phase constructor. |
|
132 // --------------------------------------------------------- |
|
133 // |
|
134 EXPORT_C void CMsgEditorAppUi::ConstructL() |
|
135 { |
|
136 CMsgEditorBaseUi::ConstructL(); |
|
137 |
|
138 iMsgNaviDirection = KErrNotFound; |
|
139 |
|
140 // initialize feature manager to check supported features |
|
141 FeatureManager::InitializeLibL(); |
|
142 iMmcFeatureSupported = FeatureManager::FeatureSupported( KFeatureIdMmc ); |
|
143 |
|
144 TParse parse; |
|
145 parse.Set( KMsgEditorAppUiResourceFileName, &KDC_RESOURCE_FILES_DIR, NULL ); |
|
146 TFileName fileName( parse.FullName() ); |
|
147 |
|
148 BaflUtils::NearestLanguageFile( iCoeEnv->FsSession(), fileName ); |
|
149 iResourceFileOffset = iEikonEnv->AddResourceFileL( fileName ); |
|
150 |
|
151 Document()->SetEditorModelObserver( this ); |
|
152 |
|
153 iFileMan = CFileMan::NewL( iEikonEnv->FsSession() ); |
|
154 |
|
155 // create msgeditor temp directory. |
|
156 TFileName temppath; |
|
157 MsgAttachmentUtils::GetMsgEditorTempPath( temppath ); |
|
158 |
|
159 RFs& fs = iEikonEnv->FsSession(); |
|
160 fs.MkDir( temppath ); |
|
161 |
|
162 CEikStatusPane* sp = StatusPane(); |
|
163 if ( iMmcFeatureSupported && |
|
164 TInt( Document()->Session().CurrentDriveL() ) == EDriveE ) |
|
165 { |
|
166 CAknContextPane* contextPane = static_cast<CAknContextPane*> |
|
167 ( sp->ControlL( TUid::Uid( EEikStatusPaneUidContext ) ) ); |
|
168 TParse fileParse; |
|
169 fileParse.Set( KMuiuBitmapFileName, &KDC_APP_BITMAP_DIR, NULL ); |
|
170 CFbsBitmap* bmp = NULL; |
|
171 CFbsBitmap* mask = NULL; |
|
172 #ifdef __SCALABLE_ICONS |
|
173 AknsUtils::CreateIconL( |
|
174 AknsUtils::SkinInstance(), |
|
175 KAknsIIDQgnMenuMceMmcCxt, |
|
176 bmp, |
|
177 mask, |
|
178 fileParse.FullName(), |
|
179 EMbmMuiuQgn_menu_mce_mmc, |
|
180 EMbmMuiuQgn_menu_mce_mmc_mask ); |
|
181 #else |
|
182 AknsUtils::CreateIconL( |
|
183 AknsUtils::SkinInstance(), |
|
184 KAknsIIDQgnMenuMceMmcCxt, |
|
185 bmp, |
|
186 mask, |
|
187 fileParse.FullName(), |
|
188 EMbmMuiuQgn_menu_mce_mmc_cxt, |
|
189 EMbmMuiuQgn_menu_mce_mmc_cxt_mask ); |
|
190 #endif //__SCALABLE_ICONS |
|
191 contextPane->SetPicture( bmp, mask ); |
|
192 } |
|
193 iOwnNaviPane = static_cast<CAknNavigationControlContainer*> |
|
194 ( sp->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
195 iCoeEnv->FsSession().ReserveDriveSpace( |
|
196 TInt( Document()->Session().CurrentDriveL() ), |
|
197 KMsgDiskSpaceForDelete ); |
|
198 |
|
199 CMsgEditorDocument* doc = Document(); |
|
200 iEditorShutter = CMsgEditorShutter::NewL(*doc); |
|
201 |
|
202 iMsgEditorAppUiExtension = new(ELeave) CMsgEditorAppUiExtension( this ); |
|
203 CAknEnv* env = iAvkonEnv; |
|
204 CAknSettingCache& cache = env->SettingCache(); |
|
205 cache.RegisterPluginL( &( iMsgEditorAppUiExtension->iSettingCachePlugin ) ); |
|
206 |
|
207 iStatusPaneRes = StatusPane()->CurrentLayoutResId(); |
|
208 } |
|
209 |
|
210 // --------------------------------------------------------- |
|
211 // CMsgEditorAppUi::~CMsgEditorAppUi |
|
212 // |
|
213 // Destructor. |
|
214 // --------------------------------------------------------- |
|
215 // |
|
216 EXPORT_C CMsgEditorAppUi::~CMsgEditorAppUi() |
|
217 { |
|
218 delete iEditorShutter; |
|
219 |
|
220 Document()->SetEditorModelObserver( NULL ); |
|
221 |
|
222 // remove resource file from CONE-maintained resource file list. |
|
223 if ( iResourceFileOffset ) |
|
224 { |
|
225 iEikonEnv->DeleteResourceFile( iResourceFileOffset ); |
|
226 } |
|
227 |
|
228 // call NotifyExit on completion of editing of an embedded document. |
|
229 if ( iDoorObserver ) |
|
230 { |
|
231 MEBLOGGER_WRITEF( _L( "MEB: CMsgEditorAppUi: Closing with exit mode %d" ), iExitMode ); |
|
232 iDoorObserver->NotifyExit( iExitMode ); |
|
233 } |
|
234 |
|
235 delete iView; |
|
236 delete iLock; |
|
237 delete iNaviDecorator; |
|
238 |
|
239 delete iIterator; |
|
240 |
|
241 // delete files from our temp directory. |
|
242 if ( iFileMan ) |
|
243 { |
|
244 TFileName temppath; |
|
245 MsgAttachmentUtils::GetMsgEditorTempPath( temppath ); |
|
246 |
|
247 /*TInt err =*/ iFileMan->Delete( temppath /*, CFileMan::ERecurse*/ ); |
|
248 //TInt err2 = iFileMan->RmDir(temppath); // remove directory |
|
249 } |
|
250 |
|
251 delete iFileMan; |
|
252 |
|
253 // Uninitialize FeatureManager and members |
|
254 FeatureManager::UnInitializeLib(); |
|
255 if( iMsgEditorAppUiExtension ) |
|
256 { |
|
257 CAknEnv* env = iAvkonEnv; |
|
258 CAknSettingCache& cache = env->SettingCache(); |
|
259 cache.DeRegisterPlugin( &( iMsgEditorAppUiExtension->iSettingCachePlugin ) ); |
|
260 delete iMsgEditorAppUiExtension; |
|
261 } |
|
262 } |
|
263 |
|
264 // --------------------------------------------------------- |
|
265 // CMsgEditorAppUi::HandleKeyEventL |
|
266 // |
|
267 // Route key events to view. |
|
268 // --------------------------------------------------------- |
|
269 // |
|
270 EXPORT_C TKeyResponse CMsgEditorAppUi::HandleKeyEventL( |
|
271 const TKeyEvent& aKeyEvent, TEventCode aType ) |
|
272 { |
|
273 if ( iView ) |
|
274 { |
|
275 return iView->OfferKeyEventL( aKeyEvent, aType ); |
|
276 } |
|
277 return EKeyWasNotConsumed; |
|
278 } |
|
279 |
|
280 // --------------------------------------------------------- |
|
281 // CMsgEditorAppUi::HandleWsEventL |
|
282 // |
|
283 // |
|
284 // --------------------------------------------------------- |
|
285 // |
|
286 EXPORT_C void CMsgEditorAppUi::HandleWsEventL( const TWsEvent& aEvent,CCoeControl* aDestination ) |
|
287 { |
|
288 TInt type = aEvent.Type(); |
|
289 |
|
290 if ( type == EEventKey ) |
|
291 { |
|
292 TKeyEvent* key = aEvent.Key(); |
|
293 if ( ( key->iModifiers & EModifierShift ) && |
|
294 ( key->iCode == EKeyBackspace ) ) |
|
295 { |
|
296 if ( iView ) |
|
297 { |
|
298 CMsgBodyControl* body = |
|
299 static_cast<CMsgBodyControl*>( iView->ControlById( EMsgComponentIdBody ) ); |
|
300 |
|
301 if ( body && body->IsReadOnly() ) |
|
302 { |
|
303 TRAP_IGNORE( SaveBodyL( body ) ); |
|
304 } |
|
305 } |
|
306 |
|
307 key->iModifiers &= ~EModifierShift; |
|
308 key->iCode = EKeyDelete; |
|
309 } |
|
310 } |
|
311 |
|
312 if ( type != KAknUidValueEndKeyCloseEvent || |
|
313 iCloseWithEndKey ) |
|
314 { |
|
315 CAknAppUi::HandleWsEventL( aEvent, aDestination ); |
|
316 } |
|
317 } |
|
318 |
|
319 // --------------------------------------------------------- |
|
320 // CMsgEditorAppUi::NextMessageL |
|
321 // |
|
322 // Set a specific exit code for opening next or previous message. Codes are |
|
323 // defined in MuiuMsgEmbeddedEditorWatchingOperation.h |
|
324 // and handled by MCE after msg viewer has been closed. |
|
325 // --------------------------------------------------------- |
|
326 // |
|
327 EXPORT_C void CMsgEditorAppUi::NextMessageL( TBool aForward ) |
|
328 { |
|
329 // Next is ETrue if layout is EAknLayoutIdABRW, |
|
330 // EFalse if EAknLayoutIdELAF or EAknLayoutIdAPAC |
|
331 if ( AknLayoutUtils::LayoutMirrored() ) |
|
332 { |
|
333 aForward = !aForward; |
|
334 } |
|
335 |
|
336 iMsgNaviDirection = aForward; |
|
337 #ifdef RD_MSG_FAST_PREV_NEXT |
|
338 // Check if next/previous message can be fast opened by viewer |
|
339 __ASSERT_DEBUG( iIterator != NULL, Panic( ENullPointer1 ) ); |
|
340 if ( aForward ) |
|
341 { |
|
342 iIterator->SetNextMessage(); |
|
343 } |
|
344 else |
|
345 { |
|
346 iIterator->SetPreviousMessage(); |
|
347 } |
|
348 |
|
349 if ( CanFastOpenL( *iIterator) ) |
|
350 { |
|
351 // Load next/previous message |
|
352 TRAPD( err, Document()->SetEntryL( iIterator->CurrentMessage().Id() ) ); |
|
353 // If fast open fails, view is incompletely constructed |
|
354 // Drop back to mce |
|
355 if( err == KErrCancel ) |
|
356 { |
|
357 /* It is a known-valid failure(quick lauch cancelled in viewers due to heterogenous messages) |
|
358 * In that case, reset the current entry to original and exit with correct code so that message |
|
359 * will be launched completely from MCE. |
|
360 */ |
|
361 if ( iMsgNaviDirection ) |
|
362 { |
|
363 iIterator->SetPreviousMessage(); |
|
364 } |
|
365 else |
|
366 { |
|
367 iIterator->SetNextMessage(); |
|
368 } |
|
369 Document()->SetEntryWithoutNotificationL( iIterator->CurrentMessage().Id() ); |
|
370 iExitMode = iMsgNaviDirection ? |
|
371 MApaEmbeddedDocObserver::TExitMode( |
|
372 CMsgEmbeddedEditorWatchingOperation::EMsgExitNext) : |
|
373 MApaEmbeddedDocObserver::TExitMode( |
|
374 CMsgEmbeddedEditorWatchingOperation::EMsgExitPrevious); |
|
375 Exit( iExitMode ); |
|
376 } |
|
377 else if ( err != KErrNone ) |
|
378 { |
|
379 // Unknown error during quick launch. |
|
380 iCoeEnv->HandleError( err ); |
|
381 iExitMode = MApaEmbeddedDocObserver::ENoChanges; |
|
382 Exit( EAknSoftkeyClose ); |
|
383 } |
|
384 } |
|
385 else |
|
386 #endif // RD_MSG_FAST_PREV_NEXT |
|
387 { |
|
388 iExitMode = aForward ? |
|
389 MApaEmbeddedDocObserver::TExitMode( |
|
390 CMsgEmbeddedEditorWatchingOperation::EMsgExitNext) : |
|
391 MApaEmbeddedDocObserver::TExitMode( |
|
392 CMsgEmbeddedEditorWatchingOperation::EMsgExitPrevious); |
|
393 Exit( iExitMode ); |
|
394 } |
|
395 iMsgNaviDirection = KErrNotFound; |
|
396 } |
|
397 |
|
398 // --------------------------------------------------------- |
|
399 // CMsgEditorAppUi::IsNextMessageAvailableL |
|
400 // |
|
401 // Check if next or previous msg is available. |
|
402 // --------------------------------------------------------- |
|
403 // |
|
404 EXPORT_C TBool CMsgEditorAppUi::IsNextMessageAvailableL( TBool aForward ) |
|
405 { |
|
406 TBool ret = EFalse; |
|
407 |
|
408 if ( iEikonEnv->StartedAsServerApp() ) |
|
409 { |
|
410 CMsgEditorDocument* doc = Document(); |
|
411 |
|
412 if ( iIterator == NULL ) |
|
413 { |
|
414 iIterator = CMessageIterator::NewL( doc->Session(), doc->Entry() ); |
|
415 iIterator->SetMessageIteratorObserver( this ); |
|
416 } |
|
417 |
|
418 // Next is ETrue if layout is EAknLayoutIdABRW, |
|
419 // EFalse if EAknLayoutIdELAF or EAknLayoutIdAPAC |
|
420 if ( AknLayoutUtils::LayoutMirrored() ) |
|
421 { |
|
422 aForward = !aForward; |
|
423 } |
|
424 |
|
425 if ( aForward ) |
|
426 { |
|
427 if ( iIterator->NextMessageExists() ) |
|
428 { |
|
429 ret = ETrue; |
|
430 } |
|
431 } |
|
432 else |
|
433 { |
|
434 if ( iIterator->PreviousMessageExists() ) |
|
435 { |
|
436 ret = ETrue; |
|
437 } |
|
438 } |
|
439 } |
|
440 |
|
441 return ret; |
|
442 } |
|
443 |
|
444 // --------------------------------------------------------- |
|
445 // CMsgEditorAppUi::MessageIndexInFolderL |
|
446 // |
|
447 // Returns index of current msg and also total number of msgs in folder. |
|
448 // --------------------------------------------------------- |
|
449 // |
|
450 EXPORT_C void CMsgEditorAppUi::MessageIndexInFolderL( TInt& aCurrentIndex, |
|
451 TInt& aMsgsInFolder ) |
|
452 { |
|
453 if ( iEikonEnv->StartedAsServerApp() ) |
|
454 { |
|
455 CMsgEditorDocument* doc = Document(); |
|
456 |
|
457 if ( iIterator == NULL ) |
|
458 { |
|
459 iIterator = CMessageIterator::NewL( doc->Session(), doc->Entry() ); |
|
460 iIterator->SetMessageIteratorObserver( this ); |
|
461 } |
|
462 |
|
463 aCurrentIndex = iIterator->CurrentMessageIndex(); |
|
464 aMsgsInFolder = iIterator->MessagesInFolder(); |
|
465 } |
|
466 else |
|
467 { |
|
468 aCurrentIndex = 0; |
|
469 aMsgsInFolder = 0; |
|
470 } |
|
471 } |
|
472 |
|
473 // --------------------------------------------------------- |
|
474 // CMsgEditorAppUi::MoveMessageEntryL |
|
475 // |
|
476 // Moves an entry to another location. |
|
477 // --------------------------------------------------------- |
|
478 // |
|
479 EXPORT_C TMsvId CMsgEditorAppUi::MoveMessageEntryL( TMsvId aTarget ) const |
|
480 { |
|
481 TMsvEntry msvEntry = Document()->Entry(); |
|
482 TMsvId id = KMsvNullIndexEntryId; |
|
483 |
|
484 if ( msvEntry.Parent() != aTarget ) |
|
485 { |
|
486 CAknInputBlock::NewLC(); |
|
487 |
|
488 CMsvEntry* parentEntry = Document()->Session().GetEntryL( msvEntry.Parent() ); |
|
489 CleanupStack::PushL( parentEntry ); |
|
490 |
|
491 // -- Change sort parameters so that parentEntry->MoveL does not leave as the child is invisible. |
|
492 TMsvSelectionOrdering sort = parentEntry->SortType(); |
|
493 sort.SetShowInvisibleEntries( ETrue ); |
|
494 parentEntry->SetSortTypeL( sort ); |
|
495 |
|
496 // Copy original from the parent to the new location. |
|
497 CMuiuOperationWait* wait = CMuiuOperationWait::NewLC(); |
|
498 |
|
499 CMsvOperation* op = parentEntry->MoveL( |
|
500 msvEntry.Id(), aTarget, wait->iStatus ); |
|
501 CleanupStack::PushL( op ); |
|
502 wait->Start(); // wait for asynch operation |
|
503 |
|
504 TMsvLocalOperationProgress prog = McliUtils::GetLocalProgressL( *op ); |
|
505 User::LeaveIfError( prog.iError ); |
|
506 id = prog.iId; |
|
507 |
|
508 CleanupStack::PopAndDestroy( 4 ); // op, wait, parentEntry, absorber |
|
509 } |
|
510 |
|
511 return id; |
|
512 } |
|
513 |
|
514 // --------------------------------------------------------- |
|
515 // CMsgEditorAppUi::DeleteAndExitL |
|
516 // |
|
517 // Deletes current entry and then exits. |
|
518 // --------------------------------------------------------- |
|
519 // |
|
520 EXPORT_C void CMsgEditorAppUi::DeleteAndExitL() |
|
521 { |
|
522 DeleteCurrentEntryL(); |
|
523 Exit( EAknSoftkeyBack ); |
|
524 } |
|
525 |
|
526 // --------------------------------------------------------- |
|
527 // CMsgEditorAppUi::DeleteCurrentEntryL |
|
528 // |
|
529 // Deletes current entry. |
|
530 // --------------------------------------------------------- |
|
531 // |
|
532 EXPORT_C void CMsgEditorAppUi::DeleteCurrentEntryL() |
|
533 { |
|
534 CMsgEditorDocument* doc = Document(); |
|
535 UnlockEntry(); |
|
536 |
|
537 TInt msgStoreDrive = TInt( doc->Session().CurrentDriveL() ); |
|
538 iCoeEnv->FsSession().GetReserveAccess( msgStoreDrive ); |
|
539 |
|
540 if ( doc->CurrentEntry().OwningService() == KMsvLocalServiceIndexEntryId ) |
|
541 { |
|
542 const TMsvId id = doc->Entry().Id(); |
|
543 //doc->CurrentEntry().SetEntryL( doc->Entry().Parent() ); |
|
544 TRAPD( |
|
545 err, |
|
546 { |
|
547 doc->CurrentEntry().SetEntryL( doc->Entry().Parent() ); |
|
548 doc->CurrentEntry().DeleteL( id ); |
|
549 } |
|
550 ); |
|
551 if ( err != KErrNone ) |
|
552 { |
|
553 doc->Session().RemoveEntry( id ); |
|
554 } |
|
555 } |
|
556 else |
|
557 { |
|
558 CMsvEntrySelection* sel = new ( ELeave ) CMsvEntrySelection; |
|
559 CleanupStack::PushL( sel ); |
|
560 TMsvId id = doc->Entry().Id(); |
|
561 sel->AppendL( id ); |
|
562 doc->Mtm().SwitchCurrentEntryL( doc->Entry().Parent() ); |
|
563 |
|
564 CMuiuOperationWait* wait = CMuiuOperationWait::NewLC(); |
|
565 |
|
566 CMsvOperation* op = doc->MtmUi().DeleteFromL( *sel, wait->iStatus ); |
|
567 CleanupStack::PushL( op ); |
|
568 |
|
569 wait->Start(); |
|
570 |
|
571 const TInt err = doc->MtmUi().DisplayProgressSummary( op->ProgressL() ); |
|
572 CleanupStack::PopAndDestroy( 3, sel ); // sel, wait, op |
|
573 if ( err == KErrCancel ) |
|
574 { |
|
575 doc->Mtm().SwitchCurrentEntryL( id ); |
|
576 LockEntryL(); |
|
577 return ; |
|
578 } |
|
579 User::LeaveIfError( err ); |
|
580 } |
|
581 |
|
582 iCoeEnv->FsSession().ReleaseReserveAccess( msgStoreDrive ); |
|
583 } |
|
584 |
|
585 // --------------------------------------------------------- |
|
586 // CMsgEditorAppUi::PrepareToExit |
|
587 // |
|
588 // |
|
589 // --------------------------------------------------------- |
|
590 // |
|
591 EXPORT_C void CMsgEditorAppUi::PrepareToExit() |
|
592 { |
|
593 CMsgEditorDocument* doc = Document(); |
|
594 |
|
595 if ( doc->HasModel() ) |
|
596 { |
|
597 if ( doc->Entry().InPreparation() ) |
|
598 { |
|
599 doc->Session().RemoveEntry( doc->Entry().Id() ); |
|
600 } |
|
601 } |
|
602 |
|
603 CEikAppUi::PrepareToExit(); |
|
604 } |
|
605 |
|
606 // --------------------------------------------------------- |
|
607 // CMsgEditorAppUi::ReplyL |
|
608 // |
|
609 // Asynchronous Mtm reply command. |
|
610 // --------------------------------------------------------- |
|
611 // |
|
612 EXPORT_C void CMsgEditorAppUi::ReplyL( |
|
613 TMsvId aTarget, TBool aIncludeOriginal /*= ETrue*/ ) |
|
614 { |
|
615 TMsvPartList parts = |
|
616 KMsvMessagePartDescription | |
|
617 KMsvMessagePartOriginator; |
|
618 |
|
619 if ( aIncludeOriginal ) |
|
620 { |
|
621 parts |= KMsvMessagePartBody; |
|
622 } |
|
623 |
|
624 CBaseMtmUi& mtmUi = Document()->MtmUi(); |
|
625 |
|
626 // to by-pass scanner warning about member variable being stored into |
|
627 // cleanup stack blocker is first stored into temporary variable. Storing |
|
628 // is allowed here as it is not owned. |
|
629 CAknInputBlock* blocker = CAknInputBlock::NewCancelHandlerLC( this ); |
|
630 iInputBlocker = blocker; |
|
631 |
|
632 CMuiuOperationWait* wait = |
|
633 CMuiuOperationWait::NewLC( EActivePriorityWsEvents + 10 ); |
|
634 |
|
635 mtmUi.SetPreferences( mtmUi.Preferences() | EMtmUiFlagEditorPreferEmbedded ); |
|
636 CMsvOperation* oper = mtmUi.ReplyL( aTarget, parts, wait->iStatus ); |
|
637 CleanupStack::PushL( oper ); |
|
638 |
|
639 wait->Start(); |
|
640 |
|
641 CleanupStack::PopAndDestroy( 3, iInputBlocker ); // absorber, wait, oper |
|
642 iInputBlocker = NULL; |
|
643 } |
|
644 |
|
645 // --------------------------------------------------------- |
|
646 // CMsgEditorAppUi::ReplyToAllL |
|
647 // |
|
648 // Asynchronous Mtm reply all command. |
|
649 // --------------------------------------------------------- |
|
650 // |
|
651 EXPORT_C void CMsgEditorAppUi::ReplyToAllL( |
|
652 TMsvId aTarget, TBool aIncludeOriginal /*= ETrue*/ ) |
|
653 { |
|
654 TMsvPartList parts = |
|
655 KMsvMessagePartDescription | |
|
656 KMsvMessagePartRecipient | |
|
657 KMsvMessagePartOriginator ; |
|
658 |
|
659 if ( aIncludeOriginal ) |
|
660 { |
|
661 parts |= KMsvMessagePartBody; |
|
662 } |
|
663 |
|
664 CBaseMtmUi& mtmUi = Document()->MtmUi(); |
|
665 |
|
666 // to by-pass scanner warning about member variable being stored into |
|
667 // cleanup stack blocker is first stored into temporary variable. Storing |
|
668 // is allowed here as it is not owned. |
|
669 CAknInputBlock* blocker = CAknInputBlock::NewCancelHandlerLC( this ); |
|
670 iInputBlocker = blocker; |
|
671 |
|
672 CMuiuOperationWait* wait = |
|
673 CMuiuOperationWait::NewLC( EActivePriorityWsEvents + 10 ); |
|
674 |
|
675 mtmUi.SetPreferences( mtmUi.Preferences() | EMtmUiFlagEditorPreferEmbedded ); |
|
676 CMsvOperation* oper = mtmUi.ReplyL( aTarget, parts, wait->iStatus ); |
|
677 CleanupStack::PushL( oper ); |
|
678 |
|
679 wait->Start(); |
|
680 |
|
681 CleanupStack::PopAndDestroy( 3, iInputBlocker ); // absorber, wait, oper |
|
682 iInputBlocker = NULL; |
|
683 } |
|
684 |
|
685 // --------------------------------------------------------- |
|
686 // CMsgEditorAppUi::ForwardL |
|
687 // |
|
688 // Asynchronous Mtm forward command. |
|
689 // --------------------------------------------------------- |
|
690 // |
|
691 EXPORT_C void CMsgEditorAppUi::ForwardL( TMsvId aTarget ) |
|
692 { |
|
693 TMsvPartList parts = |
|
694 KMsvMessagePartBody | |
|
695 KMsvMessagePartDescription | |
|
696 KMsvMessagePartAttachments; |
|
697 |
|
698 CBaseMtmUi& mtmUi = Document()->MtmUi(); |
|
699 mtmUi.SetPreferences( mtmUi.Preferences() | EMtmUiFlagEditorPreferEmbedded ); |
|
700 |
|
701 // to by-pass scanner warning about member variable being stored into |
|
702 // cleanup stack blocker is first stored into temporary variable. Storing |
|
703 // is allowed here as it is not owned. |
|
704 CAknInputBlock* blocker = CAknInputBlock::NewCancelHandlerLC( this ); |
|
705 iInputBlocker = blocker; |
|
706 |
|
707 CMuiuOperationWait* wait = CMuiuOperationWait::NewLC( EActivePriorityWsEvents + 10 ); |
|
708 |
|
709 CMsvOperation* oper = mtmUi.ForwardL( aTarget, parts, wait->iStatus ); |
|
710 CleanupStack::PushL( oper ); |
|
711 |
|
712 wait->Start(); |
|
713 |
|
714 CleanupStack::PopAndDestroy( 3, iInputBlocker ); // absorber, wait, oper |
|
715 iInputBlocker = NULL; |
|
716 } |
|
717 |
|
718 // --------------------------------------------------------- |
|
719 // CMsgEditorAppUi::InsertTemplate |
|
720 // |
|
721 // |
|
722 // --------------------------------------------------------- |
|
723 // |
|
724 EXPORT_C TInt CMsgEditorAppUi::InsertTemplateL( TInt aMaxChars /*= -1*/ ) |
|
725 { |
|
726 __ASSERT_DEBUG( iView != NULL, Panic( ENullPointer1 ) ); |
|
727 |
|
728 // get memo content from notepad to buffer. |
|
729 HBufC* title = iEikonEnv->AllocReadResourceLC( R_QTN_MAIL_POPUP_TEXT_SEL_TEMP ); |
|
730 |
|
731 HBufC* buf = CNotepadApi::FetchTemplateL( title ); |
|
732 CleanupStack::PushL( buf ); |
|
733 |
|
734 TInt err = DoInsertTextL( buf, aMaxChars ); |
|
735 |
|
736 CleanupStack::PopAndDestroy( 2, title ); // buf, title |
|
737 return err; |
|
738 } |
|
739 |
|
740 // --------------------------------------------------------- |
|
741 // CMsgEditorAppUi::InsertTextMemoL |
|
742 // |
|
743 // |
|
744 // --------------------------------------------------------- |
|
745 // |
|
746 EXPORT_C TInt CMsgEditorAppUi::InsertTextMemoL( TInt aMaxChars ) |
|
747 { |
|
748 __ASSERT_DEBUG( iView != NULL, Panic( ENullPointer1 ) ); |
|
749 |
|
750 // get memo content from notepad to buffer. |
|
751 HBufC* title = iEikonEnv->AllocReadResourceLC( R_QTN_NMAKE_FETCH_MEMO_PRMPT ); |
|
752 |
|
753 HBufC* buf = CNotepadApi::FetchMemoL( title ); |
|
754 CleanupStack::PushL( buf ); |
|
755 |
|
756 TInt err = DoInsertTextL( buf, aMaxChars ); |
|
757 |
|
758 CleanupStack::PopAndDestroy( 2, title ); // buf, title |
|
759 return err; |
|
760 } |
|
761 |
|
762 // --------------------------------------------------------- |
|
763 // CMsgEditorAppUi::DoInsertTextL |
|
764 // |
|
765 // |
|
766 // --------------------------------------------------------- |
|
767 // |
|
768 TInt CMsgEditorAppUi::DoInsertTextL( HBufC* aBuffer, TInt aMaxChars ) |
|
769 { |
|
770 TInt err( KErrNone ); |
|
771 if ( aBuffer ) |
|
772 { |
|
773 TInt buflen = aBuffer->Length(); |
|
774 |
|
775 if ( aMaxChars == -1 || buflen <= aMaxChars ) |
|
776 { |
|
777 CMsgBodyControl* body = |
|
778 static_cast<CMsgBodyControl*>( iView->ControlById( EMsgComponentIdBody ) ); |
|
779 |
|
780 if ( body ) |
|
781 { |
|
782 CEikRichTextEditor& editor = body->Editor(); |
|
783 |
|
784 if ( body != iView->FocusedControl() ) |
|
785 { |
|
786 editor.SetCursorPosL( editor.TextLength(), EFalse ); |
|
787 } |
|
788 |
|
789 body->InsertTextL( *aBuffer ); |
|
790 |
|
791 iView->SetFocus( EMsgComponentIdBody ); |
|
792 |
|
793 Document()->SetChanged( ETrue ); |
|
794 } |
|
795 } |
|
796 else |
|
797 { |
|
798 err = KErrOverflow; |
|
799 } |
|
800 } |
|
801 else |
|
802 { |
|
803 err = KErrCancel; |
|
804 } |
|
805 |
|
806 return err; |
|
807 } |
|
808 |
|
809 // --------------------------------------------------------- |
|
810 // CMsgEditorAppUi::UpdateNaviPaneL |
|
811 // |
|
812 // Updates navi pane. |
|
813 // --------------------------------------------------------- |
|
814 // |
|
815 EXPORT_C void CMsgEditorAppUi::UpdateNaviPaneL( |
|
816 const CFbsBitmap* aBitmap /*= NULL*/, |
|
817 const CFbsBitmap* aBitmapMask /*= NULL*/ ) |
|
818 { |
|
819 UpdateNaviPaneL( EFalse, aBitmap, aBitmapMask ); |
|
820 } |
|
821 |
|
822 // --------------------------------------------------------- |
|
823 // CMsgEditorAppUi::UpdateNaviPaneL |
|
824 // |
|
825 // Updates navi pane. |
|
826 // --------------------------------------------------------- |
|
827 // |
|
828 void CMsgEditorAppUi::UpdateNaviPaneL( |
|
829 TBool aUpdateExisting, |
|
830 const CFbsBitmap* aBitmap /*= NULL*/, |
|
831 const CFbsBitmap* aBitmapMask /*= NULL*/ ) |
|
832 { |
|
833 if ( !iOwnNaviPane ) |
|
834 { |
|
835 return; |
|
836 } |
|
837 TInt index = 0; |
|
838 TInt msgs = 0; |
|
839 HBufC* buf; |
|
840 |
|
841 MessageIndexInFolderL( index, msgs ); |
|
842 |
|
843 TBool prevAvailable = IsNextMessageAvailableL( EFalse ); |
|
844 TBool nextAvailable = IsNextMessageAvailableL( ETrue ); |
|
845 |
|
846 CArrayFixFlat<TInt>* array = new( ELeave ) CArrayFixFlat<TInt>( 2 ); |
|
847 CleanupStack::PushL( array ); |
|
848 |
|
849 if ( msgs ) |
|
850 { |
|
851 array->AppendL( index + 1 ); |
|
852 array->AppendL( msgs ); |
|
853 buf = StringLoader::LoadLC( R_QTN_STAT_MSG_NUMBER, *array, iCoeEnv ); |
|
854 } |
|
855 else |
|
856 { |
|
857 // if no messages make empty message label. |
|
858 buf = HBufC::NewLC( 0 ); |
|
859 prevAvailable = nextAvailable = 0; |
|
860 } |
|
861 |
|
862 if ( aUpdateExisting ) |
|
863 { |
|
864 if ( iNaviDecorator ) |
|
865 { |
|
866 CAknTabGroup* tabGroup = |
|
867 static_cast<CAknTabGroup*>( iNaviDecorator->DecoratedControl() ); |
|
868 tabGroup->ReplaceTabTextL( 0, *buf ); |
|
869 |
|
870 iNaviDecorator->MakeScrollButtonVisible( ETrue ); |
|
871 iNaviDecorator->SetScrollButtonDimmed( |
|
872 CAknNavigationDecorator::ELeftButton, |
|
873 !prevAvailable ); |
|
874 iNaviDecorator->SetScrollButtonDimmed( |
|
875 CAknNavigationDecorator::ERightButton, |
|
876 !nextAvailable ); |
|
877 |
|
878 iOwnNaviPane->PushL( *iNaviDecorator ); |
|
879 } |
|
880 } |
|
881 else |
|
882 { |
|
883 delete iNaviDecorator; |
|
884 iNaviDecorator = NULL; |
|
885 iNaviDecorator = iOwnNaviPane->CreateTabGroupL(); |
|
886 |
|
887 CAknTabGroup* tabGroup = |
|
888 static_cast<CAknTabGroup*>( iNaviDecorator->DecoratedControl() ); |
|
889 tabGroup->AddTabL( 0, *buf ); |
|
890 tabGroup->SetActiveTabById( 0 ); |
|
891 // does not leave with one tab. |
|
892 tabGroup->SetTabFixedWidthL( KTabWidthWithOneTab ); |
|
893 |
|
894 iNaviDecorator->MakeScrollButtonVisible( ETrue ); |
|
895 iNaviDecorator->SetScrollButtonDimmed( |
|
896 CAknNavigationDecorator::ELeftButton, |
|
897 !prevAvailable ); |
|
898 iNaviDecorator->SetScrollButtonDimmed( |
|
899 CAknNavigationDecorator::ERightButton, |
|
900 !nextAvailable ); |
|
901 |
|
902 iOwnNaviPane->PushL( *iNaviDecorator ); |
|
903 |
|
904 if ( aBitmap && aBitmapMask ) |
|
905 { |
|
906 // replace tab with new one containing text and bitmaps. |
|
907 // this must be done after PushL because this transfers |
|
908 // ownership of caller's bitmaps to tab group. |
|
909 tabGroup->ReplaceTabL( 0, *buf, aBitmap, aBitmapMask ); |
|
910 } |
|
911 } |
|
912 CleanupStack::PopAndDestroy( 2, array ); // buf, array |
|
913 } |
|
914 |
|
915 // --------------------------------------------------------- |
|
916 // CMsgEditorAppUi::HandleIteratorEventL |
|
917 // |
|
918 // |
|
919 // --------------------------------------------------------- |
|
920 // |
|
921 EXPORT_C void CMsgEditorAppUi::HandleIteratorEventL( |
|
922 TMessageIteratorEvent aEvent ) |
|
923 { |
|
924 if ( aEvent == EFolderCountChanged ) |
|
925 { |
|
926 UpdateNaviPaneL( ETrue ); |
|
927 } |
|
928 } |
|
929 |
|
930 // --------------------------------------------------------- |
|
931 // CMsgEditorAppUi::CallToSenderQueryL |
|
932 // |
|
933 // |
|
934 // --------------------------------------------------------- |
|
935 // |
|
936 EXPORT_C TBool CMsgEditorAppUi::CallToSenderQueryL( |
|
937 const TDesC& aNumber, const TDesC& aAlias ) |
|
938 { |
|
939 CDesCArrayFlat* strings = new ( ELeave ) CDesCArrayFlat( 2 ); |
|
940 CleanupStack::PushL( strings ); |
|
941 |
|
942 strings->AppendL( aAlias ); // %0U |
|
943 strings->AppendL( aNumber ); // %1U |
|
944 |
|
945 HBufC* prompt = StringLoader::LoadLC( |
|
946 R_QTN_SMS_QUEST_CALL, *strings, iCoeEnv ); |
|
947 |
|
948 CMsgSendKeyAcceptingQuery* dlg = CMsgSendKeyAcceptingQuery::NewL( *prompt ); |
|
949 TInt ret = dlg->ExecuteLD( R_MEB_CALLBACK_QUERY ); |
|
950 |
|
951 CleanupStack::PopAndDestroy( 2, strings ); // strings, prompt |
|
952 |
|
953 return ( ret != 0 ); // No = EFalse, others = ETrue. |
|
954 } |
|
955 |
|
956 // --------------------------------------------------------- |
|
957 // CMsgEditorAppUi::ProcessCommandParametersL |
|
958 // |
|
959 // Parses command line parameter and launch model accoring to them. |
|
960 // --------------------------------------------------------- |
|
961 // |
|
962 EXPORT_C TBool CMsgEditorAppUi::ProcessCommandParametersL( |
|
963 TApaCommand /*aCommand*/, |
|
964 TFileName& /*aDocumentName*/, |
|
965 const TDesC8& aTail ) |
|
966 { |
|
967 CMsgEditorDocument& doc = *Document(); |
|
968 |
|
969 if ( aTail.Length() > 0 ) |
|
970 { |
|
971 // Get the parameters passed by the launching MTMUI. |
|
972 TPckgBuf<TEditorParameters> paramPack; |
|
973 const TInt paramSize = sizeof( TEditorParameters ); |
|
974 |
|
975 __ASSERT_ALWAYS( aTail.Length() == paramSize, Panic( EInvalidArgument ) ); |
|
976 |
|
977 paramPack.Copy( aTail ); |
|
978 const TEditorParameters& params = paramPack(); |
|
979 |
|
980 // to by-pass scanner warning about member variable being stored into |
|
981 // cleanup stack blocker is first stored into temporary variable. Storing |
|
982 // is allowed here as it is not owned. |
|
983 CAknInputBlock* blocker = CAknInputBlock::NewCancelHandlerLC( this ); |
|
984 iInputBlocker = blocker; |
|
985 |
|
986 doc.LaunchParametersL( params ); |
|
987 doc.EntryChangedL(); // notified after is unique (and unlocked). |
|
988 doc.PrepareToLaunchL( this ); |
|
989 |
|
990 CleanupStack::PopAndDestroy( iInputBlocker ); |
|
991 iInputBlocker = NULL; |
|
992 } |
|
993 else |
|
994 { |
|
995 // no parameters enable TestEditor launching... |
|
996 doc.PrepareToLaunchL( this ); |
|
997 } |
|
998 |
|
999 return EFalse; |
|
1000 } |
|
1001 |
|
1002 // --------------------------------------------------------- |
|
1003 // CMsgEditorAppUi::MenuBar |
|
1004 // |
|
1005 // Returns application menubar. |
|
1006 // --------------------------------------------------------- |
|
1007 // |
|
1008 EXPORT_C CEikMenuBar* CMsgEditorAppUi::MenuBar() const |
|
1009 { |
|
1010 return iEikonEnv->AppUiFactory()->MenuBar(); |
|
1011 } |
|
1012 |
|
1013 // --------------------------------------------------------- |
|
1014 // CMsgEditorAppUi::SetEmphasis |
|
1015 // |
|
1016 // From MEikMenuObserver (called when menu is opened). |
|
1017 // --------------------------------------------------------- |
|
1018 // |
|
1019 EXPORT_C void CMsgEditorAppUi::SetEmphasis( |
|
1020 CCoeControl* aMenuControl, TBool aEmphasis ) |
|
1021 { |
|
1022 if ( iView ) |
|
1023 { |
|
1024 UpdateStackedControlFlags( |
|
1025 iView, |
|
1026 aEmphasis ? ECoeStackFlagRefusesFocus : 0, |
|
1027 ECoeStackFlagRefusesFocus ); |
|
1028 } |
|
1029 |
|
1030 UpdateStackedControlFlags( |
|
1031 aMenuControl, |
|
1032 aEmphasis ? 0 : ECoeStackFlagRefusesFocus, |
|
1033 ECoeStackFlagRefusesFocus ); |
|
1034 |
|
1035 HandleStackChanged(); |
|
1036 } |
|
1037 |
|
1038 // --------------------------------------------------------- |
|
1039 // CMsgEditorAppUi::HandleEntryChangeL |
|
1040 // |
|
1041 // Default error handling for all messaging editors and viewers. |
|
1042 // HandleEntryChangeL is called when the currently open message |
|
1043 // has been modified by some other messaging client. The default |
|
1044 // action is "do nothing", but editors can define their own event |
|
1045 // processing by overriding this function. |
|
1046 // --------------------------------------------------------- |
|
1047 // |
|
1048 EXPORT_C void CMsgEditorAppUi::HandleEntryChangeL() |
|
1049 { |
|
1050 // no action |
|
1051 } |
|
1052 |
|
1053 // --------------------------------------------------------- |
|
1054 // CMsgEditorAppUi::HandleEntryDeletedL |
|
1055 // |
|
1056 // Default error handling for all messaging editors and viewers. |
|
1057 // HandleEntryDeletedL is called when the currently open message |
|
1058 // has been deleted by some other messaging client. |
|
1059 // --------------------------------------------------------- |
|
1060 // |
|
1061 EXPORT_C void CMsgEditorAppUi::HandleEntryDeletedL() |
|
1062 { |
|
1063 // TODO: get error code from errorres. |
|
1064 ViewErrorL(-7005); |
|
1065 |
|
1066 // close the application (and possible chain of viewers, editors and mce etc.). |
|
1067 ProcessCommandL( EAknCmdExit ); |
|
1068 //Exit(); |
|
1069 } |
|
1070 |
|
1071 // --------------------------------------------------------- |
|
1072 // CMsgEditorAppUi::HandleEntryMovedL |
|
1073 // |
|
1074 // Default error handling for all messaging editors and viewers. |
|
1075 // HandleEntryMovedL is called when the currently open message |
|
1076 // has been moved to some other folder, by some other messaging |
|
1077 // client. |
|
1078 // --------------------------------------------------------- |
|
1079 // |
|
1080 EXPORT_C void CMsgEditorAppUi::HandleEntryMovedL( |
|
1081 TMsvId /*aOldParent*/, TMsvId /*aNewParent*/ ) |
|
1082 { |
|
1083 // refresh model content. |
|
1084 Document()->SetEntryWithoutNotificationL( Document()->Entry().Id() ); |
|
1085 } |
|
1086 |
|
1087 // --------------------------------------------------------- |
|
1088 // CMsgEditorAppUi::HandleMtmGroupDeinstalledL |
|
1089 // |
|
1090 // Default error handling for all messaging editors and viewers. |
|
1091 // HandleMtmGroupDeinstalledL is called when the MTM Group used |
|
1092 // by the currently open message has been removed from the device. |
|
1093 // --------------------------------------------------------- |
|
1094 // |
|
1095 EXPORT_C void CMsgEditorAppUi::HandleMtmGroupDeinstalledL() |
|
1096 { |
|
1097 // TODO: get error code from errorres. |
|
1098 ViewErrorL( -7006 ); |
|
1099 |
|
1100 // close the application (and possible chain of viewers, editors and mce etc.). |
|
1101 ProcessCommandL( EAknCmdExit ); |
|
1102 //Exit(); |
|
1103 } |
|
1104 |
|
1105 // --------------------------------------------------------- |
|
1106 // CMsgEditorAppUi::HandleGeneralErrorL |
|
1107 // |
|
1108 // Default error handling for all messaging editors and viewers. |
|
1109 // HandleGeneralErrorL is called when some unknown error has |
|
1110 // happened. The aErrorCode parameter contains the error code. |
|
1111 // --------------------------------------------------------- |
|
1112 // |
|
1113 EXPORT_C void CMsgEditorAppUi::HandleGeneralErrorL( TInt /*aErrorCode*/ ) |
|
1114 { |
|
1115 // TODO: show note? |
|
1116 |
|
1117 // close the application (and possible chain of viewers, editors and mce etc.). |
|
1118 ProcessCommandL( EAknCmdExit ); |
|
1119 //Exit(); |
|
1120 } |
|
1121 |
|
1122 // --------------------------------------------------------- |
|
1123 // CMsgEditorAppUi::HandleCloseSessionL |
|
1124 // |
|
1125 // Default error handling for all messaging editors and viewers. |
|
1126 // HandleCloseSessionL is called when the messaging server wants |
|
1127 // to close the session (e.g. because it's closing down and wants |
|
1128 // to get rid of all messaging clients). |
|
1129 // --------------------------------------------------------- |
|
1130 // |
|
1131 EXPORT_C void CMsgEditorAppUi::HandleCloseSessionL() |
|
1132 { |
|
1133 // save changes and close the application. |
|
1134 DoMsgSaveExitL(); |
|
1135 } |
|
1136 |
|
1137 // --------------------------------------------------------- |
|
1138 // CMsgEditorAppUi::HandleServerFailedToStartL |
|
1139 // |
|
1140 // Default error handling for all messaging editors and viewers. |
|
1141 // HandleServerFailedToStartL is called when the message server |
|
1142 // start-up was not successful. |
|
1143 // --------------------------------------------------------- |
|
1144 // |
|
1145 EXPORT_C void CMsgEditorAppUi::HandleServerFailedToStartL() |
|
1146 { |
|
1147 // TODO: get error code from errorres. |
|
1148 ViewErrorL( -7007 ); |
|
1149 |
|
1150 // close the application (and possible chain of viewers, editors and mce etc.). |
|
1151 ProcessCommandL( EAknCmdExit ); |
|
1152 //Exit(); |
|
1153 } |
|
1154 |
|
1155 // --------------------------------------------------------- |
|
1156 // CMsgEditorAppUi::HandleServerTerminatedL |
|
1157 // |
|
1158 // Default error handling for all messaging editors and viewers. |
|
1159 // HandleServerTerminatedL is called when the messaging server has |
|
1160 // died. Application cannot use the message server session any more. |
|
1161 // --------------------------------------------------------- |
|
1162 // |
|
1163 EXPORT_C void CMsgEditorAppUi::HandleServerTerminatedL() |
|
1164 { |
|
1165 // TODO: get error code from errorres. |
|
1166 ViewErrorL( -7008 ); |
|
1167 |
|
1168 // close the application (and possible chain of viewers, editors and mce etc.). |
|
1169 ProcessCommandL( EAknCmdExit ); |
|
1170 //Exit(); |
|
1171 } |
|
1172 |
|
1173 // --------------------------------------------------------- |
|
1174 // CMsgEditorAppUi::HandleMediaChangedL |
|
1175 // |
|
1176 // Default error handling for all messaging editors and viewers. |
|
1177 // HandleMediaChangedL is called when the messaging storage has |
|
1178 // been moved into another disk, This means that the current |
|
1179 // message entry is not valid any more. This function creates |
|
1180 // new entry in the new messaging store, in order to enable saving |
|
1181 // the message. The new entry is left in InPreparation state, so |
|
1182 // that it will be deleted if the application (e.g. viewer) does |
|
1183 // not save anything in it. |
|
1184 // --------------------------------------------------------- |
|
1185 // |
|
1186 EXPORT_C void CMsgEditorAppUi::HandleMediaChangedL() |
|
1187 { |
|
1188 if( iMmcFeatureSupported ) |
|
1189 { |
|
1190 // create new InPreparation entry in the new messaging store. |
|
1191 CMsgEditorDocument* doc = Document(); |
|
1192 doc->CreateNewL( doc->DefaultMsgService(), doc->DefaultMsgFolder() ); |
|
1193 } |
|
1194 } |
|
1195 |
|
1196 // --------------------------------------------------------- |
|
1197 // CMsgEditorAppUi::HandleMediaUnavailableL |
|
1198 // |
|
1199 // Default error handling for all messaging editors and viewers. |
|
1200 // The media state is recorded in model and default action in AppUi |
|
1201 // is to display warning message to the user. |
|
1202 // --------------------------------------------------------- |
|
1203 // |
|
1204 EXPORT_C void CMsgEditorAppUi::HandleMediaUnavailableL() |
|
1205 { |
|
1206 if( iMmcFeatureSupported ) |
|
1207 { |
|
1208 ProcessCommandL( EAknCmdExit ); |
|
1209 } |
|
1210 } |
|
1211 |
|
1212 // --------------------------------------------------------- |
|
1213 // CMsgEditorAppUi::HandleMediaAvailableL |
|
1214 // |
|
1215 // Default error handling for all messaging editors and viewers. |
|
1216 // No action made by default, the media state is recorded in model. |
|
1217 // --------------------------------------------------------- |
|
1218 // |
|
1219 EXPORT_C void CMsgEditorAppUi::HandleMediaAvailableL() |
|
1220 { |
|
1221 // no action |
|
1222 } |
|
1223 |
|
1224 // --------------------------------------------------------- |
|
1225 // CMsgEditorAppUi::HandleMediaIncorrectL |
|
1226 // |
|
1227 // Default error handling for all messaging editors and viewers. |
|
1228 // The media state is recorded in model, and warning note is displayed |
|
1229 // to the user here. |
|
1230 // --------------------------------------------------------- |
|
1231 // |
|
1232 EXPORT_C void CMsgEditorAppUi::HandleMediaIncorrectL() |
|
1233 { |
|
1234 if( iMmcFeatureSupported ) |
|
1235 { |
|
1236 ViewErrorL( KMsvMediaIncorrect ); |
|
1237 } |
|
1238 } |
|
1239 |
|
1240 // --------------------------------------------------------- |
|
1241 // CMsgEditorAppUi::HandleCorruptedIndexRebuildingL |
|
1242 // |
|
1243 // Default error handling for all messaging editors and viewers. |
|
1244 // The default action is to put busy note on the screen. The busy |
|
1245 // note will be displayed while the index is being rebuilt - until |
|
1246 // we get "index rebuilt" event in HandleCorruptedIndexRebuiltL(). |
|
1247 // --------------------------------------------------------- |
|
1248 // |
|
1249 EXPORT_C void CMsgEditorAppUi::HandleCorruptedIndexRebuildingL() |
|
1250 { |
|
1251 HBufC* line = iEikonEnv->AllocReadResourceLC( R_MEB_N_IN_REBUILDING_INDEX ); |
|
1252 iEikonEnv->BusyMsgL( *line ); |
|
1253 CleanupStack::PopAndDestroy( line ); // line |
|
1254 } |
|
1255 |
|
1256 // --------------------------------------------------------- |
|
1257 // CMsgEditorAppUi::HandleCorruptedIndexRebuiltL |
|
1258 // |
|
1259 // Default error handling for all messaging editors and viewers. |
|
1260 // The default action is to remove the busy note displayed when |
|
1261 // the index rebuilding event was received. |
|
1262 // --------------------------------------------------------- |
|
1263 // |
|
1264 EXPORT_C void CMsgEditorAppUi::HandleCorruptedIndexRebuiltL() |
|
1265 { |
|
1266 iEikonEnv->BusyMsgCancel(); |
|
1267 } |
|
1268 |
|
1269 // --------------------------------------------------------- |
|
1270 // CMsgEditorAppUi::CreateCustomControlL |
|
1271 // |
|
1272 // Default implementation is NULL since viewers do not need this. |
|
1273 // --------------------------------------------------------- |
|
1274 // |
|
1275 EXPORT_C CMsgBaseControl* CMsgEditorAppUi::CreateCustomControlL( TInt /*aControlType*/ ) |
|
1276 { |
|
1277 return NULL; |
|
1278 } |
|
1279 |
|
1280 // --------------------------------------------------------- |
|
1281 // CMsgEditorAppUi::IsLaunchedL |
|
1282 // |
|
1283 // Checks if document has finished launching. |
|
1284 // --------------------------------------------------------- |
|
1285 // |
|
1286 EXPORT_C TBool CMsgEditorAppUi::IsLaunchedL() const |
|
1287 { |
|
1288 return Document()->IsLaunched(); |
|
1289 } |
|
1290 |
|
1291 // --------------------------------------------------------- |
|
1292 // CMsgEditorAppUi::EditorObserver |
|
1293 // |
|
1294 // Default implementation. |
|
1295 // --------------------------------------------------------- |
|
1296 // |
|
1297 EXPORT_C void CMsgEditorAppUi::EditorObserver( |
|
1298 TMsgEditorObserverFunc aFunc, |
|
1299 TAny* /*aArg1*/, |
|
1300 TAny* aArg2, |
|
1301 TAny* /*aArg3*/ ) |
|
1302 { |
|
1303 switch (aFunc) |
|
1304 { |
|
1305 case EMsgDenyClipboardOperation: |
|
1306 { |
|
1307 TInt* ret = static_cast<TInt*>( aArg2 ); |
|
1308 *ret = 0; |
|
1309 } |
|
1310 break; |
|
1311 |
|
1312 case EMsgHandleFocusChange: |
|
1313 default: |
|
1314 break; |
|
1315 } |
|
1316 } |
|
1317 |
|
1318 |
|
1319 // --------------------------------------------------------- |
|
1320 // CMsgEditorAppUi::DoMtmCmdL |
|
1321 // |
|
1322 // Get services from mtm's and offers them to APP UI. |
|
1323 // --------------------------------------------------------- |
|
1324 // |
|
1325 void CMsgEditorAppUi::DoMtmCmdL( const TUid& /*aQuery*/, TInt aCmd ) const |
|
1326 { |
|
1327 CMsvEntrySelection* selection = new ( ELeave ) CMsvEntrySelection; |
|
1328 CleanupStack::PushL( selection ); |
|
1329 selection->AppendL( Document()->Entry().Id() ); |
|
1330 TBuf8<1> null; |
|
1331 TMsvId origMessageId = Document()->Entry().Id(); |
|
1332 Document()->MtmUi().InvokeSyncFunctionL( aCmd, *selection, null ); |
|
1333 CleanupStack::PopAndDestroy( selection ); // selection |
|
1334 Document()->SetEntryL( origMessageId ); |
|
1335 } |
|
1336 |
|
1337 // --------------------------------------------------------- |
|
1338 // CMsgEditorAppUi::ViewErrorL |
|
1339 // |
|
1340 // Helper function for Handle... methods. |
|
1341 // --------------------------------------------------------- |
|
1342 // |
|
1343 void CMsgEditorAppUi::ViewErrorL( TInt aTitle ) |
|
1344 { |
|
1345 // TODO: check if app in foreground and show error note only then. |
|
1346 CErrorUI* errorUI = CErrorUI::NewLC( *iCoeEnv ); |
|
1347 errorUI->ShowGlobalErrorNoteL( aTitle ); |
|
1348 CleanupStack::PopAndDestroy( errorUI ); // errorUI |
|
1349 } |
|
1350 |
|
1351 // --------------------------------------------------------- |
|
1352 // CMsgEditorAppUi::HandleResourceChangeL |
|
1353 // |
|
1354 // |
|
1355 // --------------------------------------------------------- |
|
1356 // |
|
1357 EXPORT_C void CMsgEditorAppUi::HandleResourceChangeL(TInt aType) |
|
1358 { |
|
1359 CAknAppUi::HandleResourceChangeL( aType ); |
|
1360 if ( iView ) |
|
1361 { |
|
1362 iView->HandleResourceChange( aType ); |
|
1363 } |
|
1364 |
|
1365 if ( aType == KEikDynamicLayoutVariantSwitch ) |
|
1366 { |
|
1367 iStatusPaneRes = StatusPane()->CurrentLayoutResId(); |
|
1368 } |
|
1369 } |
|
1370 |
|
1371 // --------------------------------------------------------- |
|
1372 // CMsgEditorAppUi::SaveBodyL |
|
1373 // |
|
1374 // |
|
1375 // --------------------------------------------------------- |
|
1376 // |
|
1377 void CMsgEditorAppUi::SaveBodyL( CMsgBodyControl* aBody ) |
|
1378 { |
|
1379 CEikRichTextEditor* bodyEditor = &aBody->Editor(); |
|
1380 if ( bodyEditor ) |
|
1381 { |
|
1382 CRichText* richText = bodyEditor->RichText(); |
|
1383 if ( richText ) |
|
1384 { |
|
1385 TInt len = richText->DocumentLength(); |
|
1386 if ( len ) |
|
1387 { |
|
1388 HBufC* buf = HBufC::NewLC( len ); |
|
1389 TPtr ptr = buf->Des(); |
|
1390 richText->Extract( ptr, 0 ); |
|
1391 CNotepadApi::AddContentL( ptr ); |
|
1392 CleanupStack::PopAndDestroy( buf ); |
|
1393 } |
|
1394 } |
|
1395 } |
|
1396 } |
|
1397 |
|
1398 // --------------------------------------------------------- |
|
1399 // CMsgEditorAppUi::ShowCloseQueryL |
|
1400 // --------------------------------------------------------- |
|
1401 // |
|
1402 EXPORT_C TInt CMsgEditorAppUi::ShowCloseQueryL() |
|
1403 { |
|
1404 TInt selectedIndex( 0 ); |
|
1405 CAknListQueryDialog* dlg = new ( ELeave ) CAknListQueryDialog( &selectedIndex ); |
|
1406 dlg->PrepareLC( R_MEB_CLOSE_QUERY ); |
|
1407 if ( dlg->RunLD() ) |
|
1408 { |
|
1409 return ( selectedIndex == 0 ) |
|
1410 ? EMsgCloseSave |
|
1411 : EMsgCloseDelete; |
|
1412 } |
|
1413 else |
|
1414 { |
|
1415 return EMsgCloseCancel; |
|
1416 } |
|
1417 } |
|
1418 |
|
1419 // --------------------------------------------------------- |
|
1420 // CMsgEditorAppUi::CreateSubjectPrefixStringL |
|
1421 // --------------------------------------------------------- |
|
1422 // |
|
1423 EXPORT_C HBufC* CMsgEditorAppUi::CreateSubjectPrefixStringL( |
|
1424 const TDesC& aSubject, |
|
1425 TBool aReply ) |
|
1426 { |
|
1427 HBufC* newSubject = NULL; |
|
1428 TInt subjectLength = aSubject.Length(); |
|
1429 if ( subjectLength >= 0 ) |
|
1430 { |
|
1431 TInt formatResource = aReply |
|
1432 ? R_MSG_REPLY_PREFIX |
|
1433 : R_MSG_FORWARD_PREFIX; |
|
1434 |
|
1435 HBufC* subjectFormat = StringLoader::LoadLC( |
|
1436 formatResource, |
|
1437 iCoeEnv ); |
|
1438 |
|
1439 HBufC* filteredSubject = RemovePrefixesL( aSubject ); |
|
1440 CleanupStack::PushL( filteredSubject ); |
|
1441 |
|
1442 if ( filteredSubject->Length() > 0 ) |
|
1443 { |
|
1444 // Create a buffer large enough to hold the re-formated subject |
|
1445 newSubject = HBufC::NewL( subjectLength + subjectFormat->Length()); |
|
1446 |
|
1447 TPtr ptr( newSubject->Des() ); |
|
1448 ptr.Append( *subjectFormat ); |
|
1449 ptr.Append( *filteredSubject ); |
|
1450 } |
|
1451 else |
|
1452 { |
|
1453 newSubject = HBufC::NewL( 0 ); |
|
1454 } |
|
1455 |
|
1456 CleanupStack::PopAndDestroy( filteredSubject ); |
|
1457 CleanupStack::PopAndDestroy( subjectFormat ); |
|
1458 } |
|
1459 return newSubject; |
|
1460 } |
|
1461 |
|
1462 // --------------------------------------------------------- |
|
1463 // CMsgEditorAppUi::RemovePrefixesL |
|
1464 // --------------------------------------------------------- |
|
1465 // |
|
1466 HBufC* CMsgEditorAppUi::RemovePrefixesL( const TDesC& aSubject ) |
|
1467 { |
|
1468 // filter setup |
|
1469 RPointerArray<TDesC> prefixArray; |
|
1470 CleanupClosePushL( prefixArray ); |
|
1471 |
|
1472 // add prefixes to remove |
|
1473 TPtrC filterRe( KMsgEditorAppUiFilterRe ); |
|
1474 prefixArray.AppendL( &filterRe ); |
|
1475 |
|
1476 TPtrC filterFw( KMsgEditorAppUiFilterFw ); |
|
1477 prefixArray.AppendL( &filterFw ); |
|
1478 |
|
1479 TPtrC filterFwd( KMsgEditorAppUiFilterFwd ); |
|
1480 prefixArray.AppendL( &filterFwd ); |
|
1481 |
|
1482 // corresponding prefixes for the current language variant |
|
1483 HBufC* prefixReply = StringLoader::LoadLC( R_MSG_REPLY_PREFIX, iCoeEnv ); |
|
1484 TPtr prefixReplyPtr = prefixReply->Des(); |
|
1485 prefixReplyPtr.Trim(); |
|
1486 prefixArray.AppendL( &prefixReplyPtr ); |
|
1487 |
|
1488 HBufC* prefixForward = StringLoader::LoadLC( R_MSG_FORWARD_PREFIX, iCoeEnv ); |
|
1489 TPtr prefixForwardPtr = prefixForward->Des(); |
|
1490 prefixForwardPtr.Trim(); |
|
1491 prefixArray.AppendL( &prefixForwardPtr ); |
|
1492 |
|
1493 // Remove prefixes |
|
1494 HBufC* subject = aSubject.AllocL(); |
|
1495 TPtr ptr( subject->Des() ); |
|
1496 TBool prefixFound; |
|
1497 // Search until no prefixes found |
|
1498 do |
|
1499 { |
|
1500 // Loop all prefixes |
|
1501 prefixFound = EFalse; |
|
1502 ptr.TrimLeft(); |
|
1503 for ( TInt i = 0; i < prefixArray.Count(); i++ ) |
|
1504 { |
|
1505 TPtrC prefix( *prefixArray[i] ); |
|
1506 |
|
1507 // Remove prefixes while same prefix found at begining of subject |
|
1508 while ( ptr.FindC( prefix ) == 0 ) |
|
1509 { |
|
1510 ptr.Delete( 0, prefix.Length() ); |
|
1511 prefixFound = ETrue; |
|
1512 ptr.TrimLeft(); |
|
1513 } |
|
1514 } |
|
1515 } while ( prefixFound ); |
|
1516 |
|
1517 CleanupStack::PopAndDestroy(3, &prefixArray ); |
|
1518 |
|
1519 return subject; |
|
1520 } |
|
1521 // --------------------------------------------------------- |
|
1522 // CMsgEditorAppUi::LockEntryL |
|
1523 // |
|
1524 // |
|
1525 // --------------------------------------------------------- |
|
1526 // |
|
1527 EXPORT_C void CMsgEditorAppUi::LockEntryL() |
|
1528 { |
|
1529 if ( iLock == NULL ) |
|
1530 { |
|
1531 iLock = CLock::LockL( *Document() ); |
|
1532 } |
|
1533 } |
|
1534 |
|
1535 // --------------------------------------------------------- |
|
1536 // CMsgEditorAppUi::UnlockEntry |
|
1537 // |
|
1538 // |
|
1539 // --------------------------------------------------------- |
|
1540 // |
|
1541 EXPORT_C void CMsgEditorAppUi::UnlockEntry() |
|
1542 { |
|
1543 delete iLock; |
|
1544 iLock = NULL; |
|
1545 } |
|
1546 |
|
1547 // --------------------------------------------------------- |
|
1548 // CMsgEditorAppUi::IsLockedEntry |
|
1549 // |
|
1550 // |
|
1551 // --------------------------------------------------------- |
|
1552 // |
|
1553 EXPORT_C TBool CMsgEditorAppUi::IsLockedEntry() const |
|
1554 { |
|
1555 return iLock != NULL; |
|
1556 } |
|
1557 |
|
1558 // --------------------------------------------------------- |
|
1559 // CMsgEditorAppUi::Exit |
|
1560 // |
|
1561 // |
|
1562 // --------------------------------------------------------- |
|
1563 // |
|
1564 EXPORT_C void CMsgEditorAppUi::Exit( TInt aReason /*= EEikCmdExit*/ ) |
|
1565 { |
|
1566 #ifdef RD_MSG_FAST_PREV_NEXT |
|
1567 // Communicate message id via publish and subscribe to MCE |
|
1568 RProperty::Set( KPSUidMuiu, KMuiuKeyCurrentMsg, |
|
1569 Document()->Entry().Id() ); |
|
1570 #endif // RD_MSG_FAST_PREV_NEXT |
|
1571 |
|
1572 CEikAppServer* server = iEikonEnv->AppServer(); |
|
1573 if ( server ) |
|
1574 { |
|
1575 server->NotifyServerExit( aReason ); |
|
1576 } |
|
1577 CEikAppUi::Exit(); |
|
1578 } |
|
1579 |
|
1580 // --------------------------------------------------------- |
|
1581 // CMsgEditorAppUi::HandleLocalZoomChangeL |
|
1582 // --------------------------------------------------------- |
|
1583 // |
|
1584 EXPORT_C void CMsgEditorAppUi::HandleLocalZoomChangeL( TMsgCommonCommands aNewZoom ) |
|
1585 { |
|
1586 TInt localZoom = 0; |
|
1587 TInt oldLocalZoom = EAknUiZoomAutomatic; |
|
1588 CRepository* repository = CRepository::NewL( KCRUidMessagingUiSettings ); |
|
1589 TInt ret = repository->Get( KMessagingEditorLocalUiZoom, oldLocalZoom ); |
|
1590 if ( ret == KErrNone ) |
|
1591 { |
|
1592 switch( aNewZoom ) |
|
1593 { |
|
1594 case EMsgDispSizeAutomatic: |
|
1595 { |
|
1596 localZoom = EAknUiZoomAutomatic; |
|
1597 break; |
|
1598 } |
|
1599 case EMsgDispSizeLarge: |
|
1600 { |
|
1601 localZoom = EAknUiZoomLarge; |
|
1602 break; |
|
1603 } |
|
1604 case EMsgDispSizeNormal: |
|
1605 { |
|
1606 localZoom = EAknUiZoomNormal; |
|
1607 break; |
|
1608 } |
|
1609 case EMsgDispSizeSmall: |
|
1610 { |
|
1611 localZoom = EAknUiZoomSmall; |
|
1612 break; |
|
1613 } |
|
1614 default: |
|
1615 break; |
|
1616 } |
|
1617 if( oldLocalZoom != localZoom ) |
|
1618 { |
|
1619 ret = repository->Set( KMessagingEditorLocalUiZoom, localZoom ); |
|
1620 __ASSERT_DEBUG( !ret, Panic( EMsgRepositorySettingFailure ) ); |
|
1621 TWsEvent event; |
|
1622 event.SetType( KAknLocalZoomLayoutSwitch ); |
|
1623 ret = iEikonEnv->WsSession().SendEventToAllWindowGroups( event ); |
|
1624 } |
|
1625 } |
|
1626 |
|
1627 delete repository; |
|
1628 } |
|
1629 |
|
1630 // --------------------------------------------------------- |
|
1631 // CMsgEditorAppUi::CreateViewerNaviPaneL |
|
1632 // --------------------------------------------------------- |
|
1633 // |
|
1634 EXPORT_C void CMsgEditorAppUi::CreateViewerNaviPaneL( TTime aTime, |
|
1635 TMsgEditorMsgPriority aPriority, |
|
1636 TBool aUtcTime ) |
|
1637 { |
|
1638 CAknNavigationControlContainer* naviContainer = |
|
1639 static_cast<CAknNavigationControlContainer*>( StatusPane()->ControlL( |
|
1640 TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
1641 if ( !iNaviDecorator ) |
|
1642 { |
|
1643 CMsgNaviPaneControl* naviPaneControl = CMsgNaviPaneControl::NewL( naviContainer ); |
|
1644 naviPaneControl->SetNavigationControlObserver( this ); |
|
1645 |
|
1646 // naviPaneControl ownership transferred to iNaviDecorator. |
|
1647 iNaviDecorator = CAknNavigationDecorator::NewL( naviContainer, naviPaneControl ); |
|
1648 |
|
1649 naviPaneControl->SetTimeIndicatorL( aTime, aUtcTime ); |
|
1650 naviPaneControl->SetPriorityIndicatorL( aPriority ); |
|
1651 |
|
1652 CMsgEditorDocument* doc = Document(); |
|
1653 naviPaneControl->SetNavigationIndicatorL( doc->Session(), doc->Entry() ); |
|
1654 |
|
1655 iNaviDecorator->SetContainerWindowL( *naviContainer ); |
|
1656 iNaviDecorator->MakeScrollButtonVisible( EFalse ); |
|
1657 iNaviDecorator->SetComponentsToInheritVisibility( ETrue ); |
|
1658 iOwnNaviPane = NULL; |
|
1659 } |
|
1660 else |
|
1661 { |
|
1662 User::Leave( KErrAlreadyExists ); |
|
1663 } |
|
1664 } |
|
1665 |
|
1666 // --------------------------------------------------------- |
|
1667 // CMsgEditorAppUi::HandleNavigationControlEventL |
|
1668 // --------------------------------------------------------- |
|
1669 // |
|
1670 EXPORT_C void CMsgEditorAppUi::HandleNavigationControlEventL( TMsgNaviControlEventId aEvent ) |
|
1671 { |
|
1672 if ( aEvent == MMsgNaviPaneControlObserver::EMsgNaviLeftArrowPressed || |
|
1673 aEvent == MMsgNaviPaneControlObserver::EMsgNaviRightArrowPressed ) |
|
1674 { |
|
1675 if ( IsNextMessageAvailableL( aEvent == MMsgNaviPaneControlObserver::EMsgNaviRightArrowPressed ) ) |
|
1676 { |
|
1677 /* no need for separate checks for right and left arrows |
|
1678 because IsNextMessageAvailableL() and NextMessageL |
|
1679 are called with the truth-value of the same comparison */ |
|
1680 NextMessageL( aEvent == MMsgNaviPaneControlObserver::EMsgNaviRightArrowPressed ); |
|
1681 } |
|
1682 } |
|
1683 } |
|
1684 |
|
1685 // --------------------------------------------------------- |
|
1686 // CMsgEditorAppUi::CLock::LockL |
|
1687 // |
|
1688 // |
|
1689 // --------------------------------------------------------- |
|
1690 // |
|
1691 CMsgEditorAppUi::CLock* CMsgEditorAppUi::CLock::LockL( |
|
1692 const CMsgEditorDocument& aDoc) |
|
1693 { |
|
1694 CLock* lock = new ( ELeave ) CLock(); |
|
1695 CleanupStack::PushL( lock ); |
|
1696 |
|
1697 lock->iStore = aDoc.CurrentEntry().EditStoreL(); |
|
1698 lock->iStream.AssignL( *( lock->iStore ), KMsvEntryRichTextBody ); |
|
1699 |
|
1700 CleanupStack::Pop( lock ); |
|
1701 return lock; |
|
1702 } |
|
1703 |
|
1704 // --------------------------------------------------------- |
|
1705 // CMsgEditorAppUi::CLock::CLock |
|
1706 // |
|
1707 // |
|
1708 // --------------------------------------------------------- |
|
1709 // |
|
1710 CMsgEditorAppUi::CLock::CLock() |
|
1711 { |
|
1712 } |
|
1713 |
|
1714 // --------------------------------------------------------- |
|
1715 // CMsgEditorAppUi::CLock::~CLock |
|
1716 // |
|
1717 // |
|
1718 // --------------------------------------------------------- |
|
1719 // |
|
1720 CMsgEditorAppUi::CLock::~CLock() |
|
1721 { |
|
1722 if ( iStore != NULL ) |
|
1723 { |
|
1724 iStream.Release(); |
|
1725 iStream.Close(); |
|
1726 iStore->Revert(); |
|
1727 delete iStore; |
|
1728 } |
|
1729 } |
|
1730 |
|
1731 // --------------------------------------------------------- |
|
1732 // CMsgEditorAppUi::CanFastOpenL |
|
1733 // --------------------------------------------------------- |
|
1734 // |
|
1735 EXPORT_C TBool CMsgEditorAppUi::CanFastOpenL( const CMessageIterator& /*aIterator*/ ) |
|
1736 { |
|
1737 return EFalse; |
|
1738 } |
|
1739 |
|
1740 // --------------------------------------------------------- |
|
1741 // CMsgEditorAppUi::AknInputBlockCancel |
|
1742 // --------------------------------------------------------- |
|
1743 // |
|
1744 EXPORT_C void CMsgEditorAppUi::AknInputBlockCancel() |
|
1745 { |
|
1746 if ( iInputBlocker ) |
|
1747 { |
|
1748 iInputBlocker->MakeVisible( EFalse ); |
|
1749 iInputBlocker->ControlEnv()->AppUi()->RemoveFromStack( iInputBlocker ); |
|
1750 } |
|
1751 } |
|
1752 |
|
1753 // --------------------------------------------------------- |
|
1754 // CMsgEditorAppUi::SetTitleIconSizeL |
|
1755 // --------------------------------------------------------- |
|
1756 // |
|
1757 EXPORT_C void CMsgEditorAppUi::SetTitleIconSizeL( CFbsBitmap* aTitleBitmap ) |
|
1758 { |
|
1759 TRect mainPane; |
|
1760 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::ETitlePane, mainPane ); |
|
1761 TAknLayoutRect titleIconPaneLayoutRect; |
|
1762 |
|
1763 if ( AknStatuspaneUtils::StaconPaneActive() ) |
|
1764 { |
|
1765 titleIconPaneLayoutRect.LayoutRect( mainPane, |
|
1766 AknLayoutScalable_Avkon::title_pane_stacon_g1( 0 ).LayoutLine() ); |
|
1767 } |
|
1768 else |
|
1769 { |
|
1770 titleIconPaneLayoutRect.LayoutRect( mainPane, |
|
1771 AknLayoutScalable_Avkon::title_pane_g2( 0 ).LayoutLine() ); |
|
1772 } |
|
1773 |
|
1774 TSize iconSize = titleIconPaneLayoutRect.Rect().Size(); |
|
1775 |
|
1776 User::LeaveIfError( AknIconUtils::SetSize( aTitleBitmap, iconSize, EAspectRatioPreserved ) ); |
|
1777 } |
|
1778 |
|
1779 // --------------------------------------------------------- |
|
1780 // CMsgEditorAppUi::HandleStatusPaneSizeChange |
|
1781 // |
|
1782 // Performs layout switch on view area if statuspane is changed to |
|
1783 // same statuspane that is used by CMsgEditorAppUi. This is for |
|
1784 // correcting the layout if layout switch was performed when |
|
1785 // SMIL player or SMIL editor that use different statuspane |
|
1786 // were displayed. Without this the layout would be shown as if |
|
1787 // statuspane that SMIL components use would be used. |
|
1788 // --------------------------------------------------------- |
|
1789 // |
|
1790 EXPORT_C void CMsgEditorAppUi::HandleStatusPaneSizeChange() |
|
1791 { |
|
1792 CAknAppUi::HandleStatusPaneSizeChange(); |
|
1793 |
|
1794 if ( iView && |
|
1795 iStatusPaneRes == StatusPane()->CurrentLayoutResId() ) |
|
1796 { |
|
1797 iView->HandleResourceChange( KEikDynamicLayoutVariantSwitch ); |
|
1798 } |
|
1799 } |
|
1800 |
|
1801 // End of File |