|
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: |
|
15 * Sms Viewer Application UI |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 |
|
23 // UIKON/AVKON |
|
24 #include <akntitle.h> // CAknTitlePane |
|
25 #include <eikmenub.h> // CEikMenuBar |
|
26 #include <aknnotewrappers.h> // AknNoteWrappers |
|
27 #include <txtrich.h> // Rich text ed |
|
28 #include <aknnavide.h> // CAknNavigationDecorator |
|
29 // messaging editors |
|
30 #include <MsgBodyControl.h> // CMsgBodyControl |
|
31 #include <eikrted.h> // CEikRichTextEditor |
|
32 #include <MsgEditorView.h> // CMsgEditorView |
|
33 #include <MsgAddressControl.h> // CMsgAddressControl |
|
34 #include <msgbiobodycontrol.h> // CMsgBioBodyControl |
|
35 #include <MsgBioUids.h> // smart message type uids |
|
36 #include <msgbiocontrol.h> // CMsgBioControl |
|
37 #include <CGmsWrapper.h> // CGmsWrapper |
|
38 #include <MsgNaviPaneControl.h> |
|
39 #include <MsgExpandableControlEditor.h> |
|
40 // messaging |
|
41 #include <smuthdr.h> // CSmsHeader |
|
42 #include <smsclnt.h> // CSmsClientMtm |
|
43 #include <MsgFolderSelectionDialog.h> // CMsgFolderSelectionDialog |
|
44 #include <MuiuMsvProgressReporterOperation.h> // CMsvProgressReporterOperation |
|
45 #include <MtmExtendedCapabilities.hrh> // function id of MessageInfo |
|
46 #include <MuiuOperationWait.h> // MuiuOperationWait |
|
47 #include <mtclreg.h> |
|
48 #include <mtuireg.h> |
|
49 #include <mtmdef.h> |
|
50 #include <akninputblock.h> // CAknInputBlock |
|
51 #include <MuiuMsvUiServiceUtilities.h> // DiskSpaceBelowCriticalLevelL |
|
52 #include <muiumsvuiserviceutilitiesinternal.h> |
|
53 #include <messagingvariant.hrh> // Local variation flags |
|
54 #include <smumutil.h> // SmumUtil |
|
55 #include <csmsemailfields.h> // CSmsEmailFields |
|
56 #include <msgtextutils.h> |
|
57 // phone |
|
58 #include <commonphoneparser.h> // Common phone number validity checker |
|
59 // resources |
|
60 #include <SmsViewer.rsg> // resouce identifiers |
|
61 #include <msgeditor.mbg> // bitmaps |
|
62 // local |
|
63 #include "MsgSmsViewer.hrh" // application specific commands |
|
64 #include "MsgSmsViewerDoc.h" // CMsgSmsViewerDocument |
|
65 #include "MsgSmsViewerAppUi.h" // CMsgSmsViewerAppUi |
|
66 // Find item |
|
67 #include <FindItemmenu.rsg> // find item resources |
|
68 #include <finditemmenu.h> // CFindItemMenu |
|
69 #include <finditemdialog.h> // CFindItemDialog |
|
70 #include <finditem.hrh> |
|
71 #include <ItemFinder.h> |
|
72 // Creating contact card via AIW |
|
73 #include <AiwServiceHandler.h> // CAiwServiceHandler |
|
74 #include <AiwContactAssignDataTypes.h> // AiwContactAssign |
|
75 // general |
|
76 #include <StringLoader.h> // StringLoader |
|
77 #include <featmgr.h> // FeatureManager |
|
78 #include <SenduiMtmUids.h> |
|
79 #include <sendui.h> |
|
80 #include <CMessageData.h> // for SendUi |
|
81 #include <data_caging_path_literals.hrh> |
|
82 #include <AknIconUtils.h> |
|
83 #include <centralrepository.h> |
|
84 #include <messaginginternalcrkeys.h> |
|
85 #include <CommonUiInternalCRKeys.h> |
|
86 #include <coreapplicationuisdomainpskeys.h> |
|
87 |
|
88 |
|
89 // help |
|
90 #include <csxhelp/sms.hlp.hrh> // sms help context ids |
|
91 #include <csxhelp/smart.hlp.hrh> |
|
92 #include <hlplch.h> // for HlpLauncher |
|
93 |
|
94 #include <msgvoipextension.h> |
|
95 |
|
96 #include <MsgEditorAppUiExtension.h>// for iMsgEditorAppUiExtension |
|
97 #include <MsgEditorSettingCacheUpdatePlugin.h> |
|
98 |
|
99 //Skinnable Title pane icon |
|
100 #include <AknStatuspaneUtils.h> // AknStatuspaneUtils |
|
101 #include <aknlayoutscalable_apps.cdl.h> |
|
102 #include <aknlayoutscalable_avkon.cdl.h> |
|
103 #include <AknsUtils.h> |
|
104 #include <muiu.mbg> // title icon |
|
105 #ifdef RD_MSG_FAST_PREV_NEXT |
|
106 #include <MuiuMessageIterator.h> |
|
107 #endif |
|
108 |
|
109 #ifdef RD_SCALABLE_UI_V2 |
|
110 #include <aknnavide.h> // pen support on navi pane |
|
111 #include <AknNaviObserver.h> // pen support of volume control of navi pane |
|
112 #include <akntoolbar.h> |
|
113 #include <eikcolib.h> //Added for touchbar support |
|
114 #endif |
|
115 #include <aknclearer.h> // CAknLocalScreenClearer |
|
116 // CONSTANTS |
|
117 |
|
118 // Sms Viewer Uid |
|
119 const TUid KUidSmsViewer ={0x100058BD}; |
|
120 // GMS Viewer Uid |
|
121 const TUid KUidGMSViewer ={0x101F4CDA}; |
|
122 // Sms Mtm Service Uid |
|
123 const TUid KUidSmsMtm = {0x1000102c}; |
|
124 // First free id |
|
125 const TInt EMsgImageControlId = EMsgComponentIdFirstFreeEditorSpecificId; |
|
126 |
|
127 // Size approxamations |
|
128 // TMsvEntry itself |
|
129 const TInt KApproxEmptyTMsvEntrySize = 200; // atleast when SC included to entry (Outbox) |
|
130 // Recipients |
|
131 const TInt KApproxRecipientSize = 80; // manually entered ~50 & fetched ~70 |
|
132 // GMS msg with full 120 chars and whole picture (no recipients) |
|
133 const TInt KApproxFullGMS = 450; // full of text and whole picture |
|
134 |
|
135 _LIT( KSmsBitmapFileName, "muiu.mif" ); |
|
136 |
|
137 // ================= MEMBER FUNCTIONS ======================= |
|
138 |
|
139 // C++ default constructor can NOT contain any code, that |
|
140 // might leave. |
|
141 CMsgSmsViewerAppUi::CMsgSmsViewerAppUi() |
|
142 { |
|
143 // Put constructor code into function InitMembers() as it's |
|
144 // also called to prepare the viewer to show a new message. |
|
145 InitMembers(); |
|
146 } |
|
147 |
|
148 // Initialize data members into a default state. Called from a constructor |
|
149 // and when a sms is loaded into a viewer to replace a current one. |
|
150 void CMsgSmsViewerAppUi::InitMembers() |
|
151 { |
|
152 // Initialize variables that cannot be zeroed or are initialized to a |
|
153 // non-zero value. |
|
154 |
|
155 // iFullyConstructed is only initialized in construction |
|
156 |
|
157 iNumber.Zero(); |
|
158 iRecipientstring.Zero(); |
|
159 |
|
160 // Initialize flags |
|
161 Mem::FillZ( &iFlags, sizeof(iFlags) ); |
|
162 |
|
163 iControlId = 0; |
|
164 iClass0CBA = NULL; |
|
165 iFindItemMenu = NULL; |
|
166 iAiwServiceHandler = NULL; |
|
167 iGmsModel = NULL; |
|
168 iSmsHeader = NULL; |
|
169 iViewerOperation = NULL; |
|
170 iMsgVoIPExtension = NULL; |
|
171 iSendUi = NULL; |
|
172 iCenRepSession = NULL; |
|
173 iNotifier = NULL; |
|
174 } |
|
175 |
|
176 // Symbian OS default constructor can leave. |
|
177 void CMsgSmsViewerAppUi::ConstructL() |
|
178 { |
|
179 CMsgEditorAppUi::ConstructL(); |
|
180 |
|
181 ConstructMembersL(); |
|
182 |
|
183 if( !iEikonEnv->StartedAsServerApp( ) ) |
|
184 { // If the app was not started as server app, we can call PrepareLaunchL |
|
185 Document()->PrepareToLaunchL( this ); |
|
186 } |
|
187 } |
|
188 |
|
189 // ConstructL() without calling base class construct |
|
190 void CMsgSmsViewerAppUi::ConstructMembersL() |
|
191 { |
|
192 // Prepare FeatureManager, read values to members and uninitialize FeatureManager |
|
193 FeatureManager::InitializeLibL(); |
|
194 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
195 { |
|
196 iFlags.iHelpFeatureSupported = ETrue; |
|
197 } |
|
198 // SMSGms variation flags |
|
199 if ( FeatureManager::FeatureSupported( KFeatureIdSmartmsgSMSGmsMessageReceiving ) ) |
|
200 { |
|
201 iFlags.iSmartMsgSmsGmsMessageReceiving = ETrue; |
|
202 } |
|
203 if ( FeatureManager::FeatureSupported( KFeatureIdSmartmsgSMSGmsMessageSendingSupported ) ) |
|
204 { |
|
205 iFlags.iSmartMsgSmsGmsMessageSending = ETrue; |
|
206 } |
|
207 if ( FeatureManager::FeatureSupported( KFeatureIdAudioMessaging ) ) |
|
208 { |
|
209 iFlags.iAudioMsgSupported = ETrue; |
|
210 } |
|
211 FeatureManager::UnInitializeLib(); |
|
212 |
|
213 //check unieditor restricted reply mode |
|
214 TInt features = 0; |
|
215 CRepository* repository = CRepository::NewLC( KCRUidMuiuVariation ); |
|
216 repository->Get( KMuiuUniEditorFeatures, features ); |
|
217 CleanupStack::PopAndDestroy( repository ); |
|
218 iFlags.iSmsRestrictedMode = ( features & KUniEditorFeatureIdRestrictedReplySms ); |
|
219 repository = NULL; |
|
220 |
|
221 //check autolock mode |
|
222 TInt value( KErrNotFound ); |
|
223 RProperty::Get( KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, value ); |
|
224 if ( value > EAutolockOff ) |
|
225 { |
|
226 iFlags.iAutoLockEnabled = ETrue; |
|
227 } |
|
228 iMsgVoIPExtension = CMsgVoIPExtension::NewL(); |
|
229 |
|
230 // Local variation flags |
|
231 if ( SmumUtil::CheckEmailOverSmsSupportL() ) |
|
232 { // Email supported |
|
233 iFlags.iEmailFeatureSupported = ETrue; |
|
234 } |
|
235 //Middle softkey |
|
236 MenuBar()->SetContextMenuTitleResourceId( R_SMSV_CONTEXTMENUBAR ); |
|
237 // Set path of bitmap file |
|
238 TParse fileParse; |
|
239 fileParse.Set( KSmsBitmapFileName, &KDC_APP_BITMAP_DIR, NULL ); |
|
240 |
|
241 |
|
242 iAppIcon = AknsUtils::CreateGulIconL( |
|
243 AknsUtils::SkinInstance(), |
|
244 KAknsIIDQgnPropMceSmsTitle, |
|
245 fileParse.FullName(), |
|
246 EMbmMuiuQgn_prop_mce_sms_title, |
|
247 EMbmMuiuQgn_prop_mce_sms_title_mask ); |
|
248 |
|
249 |
|
250 iScreenClearer = CAknLocalScreenClearer::NewLC( ETrue ); |
|
251 CleanupStack::Pop( iScreenClearer ); |
|
252 iTypeMsg = CSmsPDU::ESmsDeliver; //for successful launch save the PDU Type. |
|
253 |
|
254 |
|
255 |
|
256 } |
|
257 |
|
258 // Destructor |
|
259 CMsgSmsViewerAppUi::~CMsgSmsViewerAppUi() |
|
260 { |
|
261 // Put destructor code into function DestructMembers() as it's |
|
262 // also called to prepare the viewer to show a new message. |
|
263 DestructMembers(); |
|
264 } |
|
265 |
|
266 // Destruct data members. Called from a destructor and when a sms |
|
267 // is loaded into a viewer to replace a current one. |
|
268 void CMsgSmsViewerAppUi::DestructMembers() |
|
269 { |
|
270 // If operation is still active we must cancel it before exit |
|
271 if ( iViewerOperation ) |
|
272 { |
|
273 iViewerOperation->Cancel(); |
|
274 } |
|
275 delete iViewerOperation; |
|
276 iViewerOperation = NULL; |
|
277 delete iFindItemMenu; |
|
278 iFindItemMenu = NULL; |
|
279 delete iSendUi; |
|
280 iSendUi = NULL; |
|
281 delete iAiwServiceHandler; |
|
282 iAiwServiceHandler = NULL; |
|
283 delete iGmsModel; |
|
284 iGmsModel = NULL; |
|
285 delete iSmsHeader; |
|
286 iSmsHeader = NULL; |
|
287 |
|
288 if( iNotifier ) |
|
289 { |
|
290 iNotifier->StopListening(); |
|
291 delete iNotifier; |
|
292 iNotifier = NULL; |
|
293 } |
|
294 delete iCenRepSession; // don't delete before notifier |
|
295 iCenRepSession = NULL; |
|
296 delete iMsgVoIPExtension; |
|
297 iMsgVoIPExtension = NULL; |
|
298 // AppUi doesn't own iClass0CBA, so it's deleted elsewhere |
|
299 #ifdef RD_SCALABLE_UI_V2 |
|
300 if(iToolbar) |
|
301 { |
|
302 delete iToolbar; |
|
303 iToolbar = NULL; |
|
304 static_cast<CEikAppUiFactory*>( |
|
305 CEikonEnv::Static()->AppUiFactory() )->SetViewFixedToolbar( NULL ); |
|
306 } |
|
307 #endif |
|
308 delete iAppIcon; |
|
309 iAppIcon = NULL; |
|
310 delete iScreenClearer; |
|
311 iScreenClearer = NULL; |
|
312 } |
|
313 |
|
314 #ifdef RD_MSG_FAST_PREV_NEXT |
|
315 // --------------------------------------------------------- |
|
316 // CMsgSmsViewerAppUi::EntryChangedL |
|
317 // (other items were commented in a header). |
|
318 // --------------------------------------------------------- |
|
319 void CMsgSmsViewerAppUi::EntryChangedL() |
|
320 { |
|
321 // First call to EntryChangedL() comes before LaunchViewL() has been called by |
|
322 // document. |
|
323 if ( !iFullyConstructed ) |
|
324 return; |
|
325 |
|
326 if( iMsgNaviDirection == KErrNotFound ) |
|
327 { |
|
328 // Clear and redraw all controls |
|
329 iView->ResetControls(); |
|
330 iView->DrawNow(); |
|
331 |
|
332 DestructMembers(); |
|
333 InitMembers(); |
|
334 delete iView; iView = NULL; |
|
335 ConstructMembersL(); |
|
336 LaunchViewL(); |
|
337 } |
|
338 else |
|
339 { |
|
340 QuicklaunchViewL(); |
|
341 } |
|
342 |
|
343 // Note: In smum (sms mtm UI), file smsu.cpp. Message is marked as read in |
|
344 // sim in case it's class 2 sms stored in sim. It is referenced as a fix to |
|
345 // an error SPAN-6B7K33. That piece of code could be executed here but is |
|
346 // left out because all sim messages are shown as read by default in sim folder |
|
347 // anyways. |
|
348 } |
|
349 #endif // RD_MSG_FAST_PREV_NEXT |
|
350 |
|
351 // --------------------------------------------------------- |
|
352 // CMsgSmsViewerAppUi::Document |
|
353 // (other items were commented in a header). |
|
354 // --------------------------------------------------------- |
|
355 CMsgSmsViewerDocument* CMsgSmsViewerAppUi::Document() const |
|
356 { |
|
357 return STATIC_CAST( CMsgSmsViewerDocument*, CMsgEditorAppUi::Document()); |
|
358 } |
|
359 |
|
360 // --------------------------------------------------------- |
|
361 // CMsgSmsViewerAppUi::LaunchViewL |
|
362 // (other items were commented in a header). |
|
363 // --------------------------------------------------------- |
|
364 void CMsgSmsViewerAppUi::LaunchViewL() |
|
365 { |
|
366 CAknInputBlock::NewLC(); |
|
367 // get hands on entry |
|
368 TMsvEntry msvEntry1; |
|
369 |
|
370 TRAPD( error, msvEntry1 = Document()->Entry() ); |
|
371 |
|
372 if( error != KErrNone ) |
|
373 { |
|
374 //Something wrong. Exit here |
|
375 DoMsgSaveExitL(); |
|
376 return; |
|
377 } |
|
378 |
|
379 TBool toolbarVisible = EFalse; |
|
380 #ifdef RD_SCALABLE_UI_V2 |
|
381 if ((!iToolbar)&& (AknLayoutUtils::PenEnabled() && !msvEntry1.iBioType && !iFlags.iGms) ) |
|
382 { |
|
383 CEikAppUiFactory* appUiFactory = static_cast<CEikAppUiFactory*>( iEikonEnv->AppUiFactory() ); |
|
384 CAknToolbar* oldFixedToolbar = appUiFactory->CurrentFixedToolbar(); |
|
385 |
|
386 iToolbar = CAknToolbar::NewL( R_SMSVIEWER_APP_TOOLBAR ); |
|
387 iToolbar->SetToolbarObserver( this ); |
|
388 |
|
389 |
|
390 if ( oldFixedToolbar != iToolbar ) |
|
391 { |
|
392 oldFixedToolbar->SetToolbarVisibility( EFalse ); |
|
393 } |
|
394 |
|
395 appUiFactory->SetViewFixedToolbar( iToolbar ); |
|
396 iToolbar->SetToolbarVisibility( ETrue, EFalse ); |
|
397 toolbarVisible = ETrue; |
|
398 } |
|
399 //handling the case of iToolbar already created [delete the toolbar incase of biomsgs] |
|
400 else if((iToolbar)&&(AknLayoutUtils::PenEnabled() && msvEntry1.iBioType && iFlags.iGms)) |
|
401 { |
|
402 delete iToolbar; |
|
403 iToolbar = NULL; |
|
404 } |
|
405 |
|
406 #endif |
|
407 // Creating view (exits app immediately if fails) |
|
408 iView = CMsgEditorView::NewL( *this, CMsgEditorView::EMsgReadOnly ); |
|
409 // get hands on entry |
|
410 const CMsgSmsViewerDocument* doc = Document(); |
|
411 TMsvEntry msvEntry = doc->Entry(); |
|
412 |
|
413 // Getting sender/receiver to From/To-field |
|
414 // (just copies the content of iDetails to To/From-field, |
|
415 // should work also with IR-messages...) |
|
416 |
|
417 //Copy only 50 chars with extremely long names |
|
418 iRecipientstring = msvEntry.iDetails.Left( KPhCltNameBufferLength ); |
|
419 |
|
420 __ASSERT_DEBUG(msvEntry.Id() != |
|
421 KMsvNullIndexEntryId, Panic( EMsgSmsNoMessage )); |
|
422 |
|
423 iFlags.iGms = (msvEntry.iBioType == KMsgBioUidPictureMsg.iUid); |
|
424 |
|
425 // Instead of using Sms Mtm load the entry's values |
|
426 // using store. This is because Sms Viewer is also used |
|
427 // by bio messages and then sms mtm can't be used... |
|
428 CPlainText* nullString = CPlainText::NewL(); |
|
429 CleanupStack::PushL( nullString ); |
|
430 iSmsHeader = CSmsHeader::NewL( CSmsPDU::ESmsDeliver, *nullString ); |
|
431 CMsvStore* store = doc->CurrentEntry().ReadStoreL(); |
|
432 CleanupStack::PushL(store); |
|
433 |
|
434 // This TRAPping is needed to find out if the entry's store has |
|
435 // KUidMsvSMSHeaderStream. If it hasn't, we're most propably dealing |
|
436 // with non sms message and we can assume it is received message. |
|
437 TRAPD( err, iSmsHeader->RestoreL( *store )); |
|
438 |
|
439 // Check if we are dealing with E-mail sms message |
|
440 // We use TP-PID as the only validation rule |
|
441 CSmsPDU& pdu = iSmsHeader->Message().SmsPDU(); |
|
442 if( pdu.ProtocolIdentifierPresent() ) |
|
443 { |
|
444 if( pdu.PIDType() == TSmsProtocolIdentifier::ESmsPIDTelematicInterworking && |
|
445 pdu.TelematicDeviceIndicator() == TSmsProtocolIdentifier::ESmsTelematicDevice && |
|
446 pdu.TelematicDeviceType() == TSmsProtocolIdentifier::ESmsInternetElectronicMail ) |
|
447 { |
|
448 iFlags.iIsEmailMessage = ETrue; |
|
449 } |
|
450 } |
|
451 |
|
452 if (err == KErrNone) |
|
453 {// Yes, it is sms based message |
|
454 |
|
455 // Original longish LaunchViewL-function is splitted to 3 parts; |
|
456 // LaunchViewL, SmsBasedMsgHandlingL & LaunchBioViewL |
|
457 SmsBasedMsgHandlingL( msvEntry.iBioType, store ); |
|
458 } |
|
459 else |
|
460 {// No, this is not a sms and sms pdu can't be checked. However |
|
461 // this is most propably _received_ IR or BT message. |
|
462 iFlags.iIrBt = ETrue; |
|
463 iControlId = EMsgComponentIdFrom; |
|
464 iView->AddControlFromResourceL( |
|
465 R_SMSV_FROM, |
|
466 EMsgAddressControl, |
|
467 EMsgAppendControl, |
|
468 EMsgHeader); |
|
469 } |
|
470 CleanupStack::PopAndDestroy( 2 ); //store, nullString |
|
471 |
|
472 // Tests if Bio message |
|
473 if ( msvEntry.iBioType && !iFlags.iGms ) |
|
474 { |
|
475 // parse the number if wappush |
|
476 if( msvEntry.iBioType == KMsgBioProvisioningMessage.iUid ) |
|
477 { |
|
478 TPtrC tempNumber( msvEntry.iDetails ); |
|
479 if(CommonPhoneParser::IsValidPhoneNumber( |
|
480 tempNumber, CommonPhoneParser::ESMSNumber )) |
|
481 { |
|
482 iNumber = tempNumber; |
|
483 } |
|
484 } |
|
485 // Original longish LaunchViewL-function is split into 3 parts; |
|
486 // LaunchViewL, SmsBasedMsgHandlingL & LaunchBioViewL |
|
487 LaunchBioViewL( msvEntry ); |
|
488 } |
|
489 |
|
490 // Fill address ctrl |
|
491 if ( !iFlags.iIsEmailMessage && KErrNotFound != iNumber.Match( iRecipientstring ) ) |
|
492 { |
|
493 iRecipientstring = KNullDesC; |
|
494 } |
|
495 CMsgBaseControl* addressBase = iView->ControlById( iControlId ); |
|
496 CMsgAddressControl* addressControl = STATIC_CAST( CMsgAddressControl*, addressBase ); |
|
497 |
|
498 MVPbkContactLink* link= NULL; |
|
499 addressControl->AddRecipientL( |
|
500 iRecipientstring, |
|
501 iNumber, |
|
502 ETrue, |
|
503 link ); |
|
504 |
|
505 // Message indication ( e.g. 2/32 ) |
|
506 #ifdef RD_MSG_NAVIPANE_IMPROVEMENT |
|
507 // Fetch pointer to the default navi pane control |
|
508 iNaviPane = static_cast<CAknNavigationControlContainer*> |
|
509 ( StatusPane( )->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
510 |
|
511 if( !iNaviDecorator ) |
|
512 { |
|
513 CreateViewerNaviPaneL( Document()->Entry().iDate, EMsgEditorMsgPriorityNormal, ETrue ); |
|
514 iNaviPane->PushL( *iNaviDecorator ); // <- This has nothing to do with cleanup-stack! |
|
515 } |
|
516 else |
|
517 { |
|
518 //We end up here when fast msg opening is enabled |
|
519 CMsgNaviPaneControl* naviControl = static_cast<CMsgNaviPaneControl*> |
|
520 ( iNaviDecorator->DecoratedControl() ); |
|
521 naviControl->SetTimeIndicatorL( Document()->Entry().iDate, ETrue ); |
|
522 naviControl->SetNavigationIndicatorL( Document()->Session(), Document()->Entry() ); |
|
523 } |
|
524 |
|
525 #else |
|
526 UpdateNaviPaneL(); |
|
527 #endif |
|
528 //remove buttons from navipane |
|
529 if( iNaviDecorator && iClass0CBA ) |
|
530 { |
|
531 iNaviDecorator->SetScrollButtonDimmed( CAknNavigationDecorator::ELeftButton, ETrue ); |
|
532 iNaviDecorator->SetScrollButtonDimmed( CAknNavigationDecorator::ERightButton, ETrue ); |
|
533 } |
|
534 #ifdef RD_SCALABLE_UI_V2 |
|
535 if ( AknLayoutUtils::PenEnabled() ) |
|
536 { |
|
537 iNaviDecorator->SetNaviDecoratorObserver( this ); |
|
538 if ( iToolbar ) |
|
539 { |
|
540 |
|
541 if ( iFlags.iBioMsg || iFlags.iGms ) |
|
542 { |
|
543 //By Default make take touchbar invisible, dimmed and disabled |
|
544 iToolbar->SetToolbarVisibility(EFalse, EFalse); |
|
545 iToolbar->SetDimmed(ETrue); |
|
546 iToolbar->DisableToolbarL( ETrue ); |
|
547 } |
|
548 |
|
549 //Test that message type is normal SMS |
|
550 if ( !iFlags.iBioMsg && !iFlags.iGms) |
|
551 { |
|
552 if(!toolbarVisible) |
|
553 { |
|
554 //Enable the touchbar, make it visible and undimmed |
|
555 iToolbar->DisableToolbarL( EFalse ); |
|
556 iToolbar->SetDimmed(EFalse); |
|
557 iToolbar->SetToolbarVisibility(ETrue, EFalse); |
|
558 } |
|
559 // default state, nothing dimmed. Uncomment the below lines only if necessary to force set it dim again |
|
560 /* |
|
561 iToolbar->SetItemDimmed(ESmsViewerToolbarReply, EFalse, EFalse); |
|
562 iToolbar->SetItemDimmed(ESmsViewerToolbarForward, EFalse, EFalse); |
|
563 iToolbar->SetItemDimmed(ESmsViewerToolbarDelete, EFalse, ETrue); |
|
564 */ |
|
565 |
|
566 //What buttons to dim |
|
567 switch ( iSmsHeader->Type() ) |
|
568 { |
|
569 |
|
570 //Received Message |
|
571 case CSmsPDU::ESmsDeliver: |
|
572 //Nothing dimmed, unless sender unknown |
|
573 if (msvEntry.iDetails.Length() == 0 ) |
|
574 iToolbar->SetItemDimmed(ESmsViewerToolbarReply, ETrue, ETrue); |
|
575 |
|
576 //Or not valid |
|
577 if (!iFlags.iValidSenderNumber) |
|
578 iToolbar->SetItemDimmed(ESmsViewerToolbarReply, ETrue, ETrue); |
|
579 break; |
|
580 |
|
581 //Sent Message |
|
582 case CSmsPDU::ESmsSubmit: |
|
583 //Dim the reply button, we would be replying to ourselves |
|
584 iToolbar->SetItemDimmed(ESmsViewerToolbarReply, ETrue, ETrue); |
|
585 break; |
|
586 |
|
587 //Some other cases we might consider dimming |
|
588 //ESmsSubmitReport SMS-SUBMIT-REPORT, sent from SC to MS |
|
589 //ESmsStatusReport SMS-STATUS-REQUEST, sent from SC to MS |
|
590 //ESmsCommand SMS-COMMAND, sent from MS to SC |
|
591 //ESmsDeliverReport SMS-DELIVER-REPORT, sent from MS to SC |
|
592 |
|
593 //TODO Necessary? |
|
594 default: |
|
595 Panic( EMsgSmsViewerUnknownSmsPduType ); |
|
596 break; |
|
597 |
|
598 } // Switch |
|
599 } // if ( !iFlags.iBioMsg && !iFlags.iGms) |
|
600 } // if ( iToolbar ) |
|
601 } // if ( AknLayoutUtils::PenEnabled() ) |
|
602 #endif |
|
603 // set focus |
|
604 iView->ExecuteL( ClientRect(), iControlId ); |
|
605 |
|
606 SetTitleIconL(); |
|
607 iFullyConstructed = ETrue; |
|
608 |
|
609 if ( !iFlags.iBioMsg && !iFlags.iGms ) |
|
610 { |
|
611 // Read the value of automatic highlight sd-key |
|
612 ReadAutoHlSharedDataValueAndSetNotifyL(); |
|
613 // Set the state of automatic highlighting for sms |
|
614 SetAutomaticHighlightL( iFlags.iAutomaticHlValue ); |
|
615 } |
|
616 |
|
617 else |
|
618 { |
|
619 if ( iView && iView->ItemFinder() ) |
|
620 { |
|
621 iView->ItemFinder()->SetFindModeL( CItemFinder::ENoneSelected ); |
|
622 } |
|
623 |
|
624 } |
|
625 |
|
626 delete iScreenClearer; |
|
627 iScreenClearer = NULL; |
|
628 CleanupStack::PopAndDestroy();// CAknInputBlock |
|
629 } |
|
630 |
|
631 // --------------------------------------------------------- |
|
632 // CMsgSmsViewerAppUi::SmsBasedMsgHandlingL |
|
633 // (other items were commented in a header). |
|
634 // --------------------------------------------------------- |
|
635 void CMsgSmsViewerAppUi::SmsBasedMsgHandlingL( |
|
636 TInt32 aBioType, CMsvStore* aStore ) |
|
637 { |
|
638 // Initialize the richtext object... |
|
639 CParaFormatLayer* paraFormat = iEikonEnv->SystemParaFormatLayerL(); // <- pointer only |
|
640 CCharFormatLayer* charFormat = iEikonEnv->SystemCharFormatLayerL(); // <- pointer only |
|
641 CRichText* textBody = CRichText::NewL( paraFormat, charFormat ); |
|
642 CleanupStack::PushL( textBody ); |
|
643 // ...and read bodytext |
|
644 aStore->RestoreBodyTextL( *textBody ); |
|
645 |
|
646 if ( !aBioType || iFlags.iGms) |
|
647 { |
|
648 // message is ordinary sms message or Picture Message |
|
649 // so, let's get message body to viewer. |
|
650 CMsgBaseControl* baseControl = iView->ControlById( |
|
651 EMsgComponentIdBody ); |
|
652 CMsgBodyControl* bodyControl = STATIC_CAST( |
|
653 CMsgBodyControl*, |
|
654 baseControl ); |
|
655 |
|
656 if ( !iFlags.iGms ) |
|
657 { // normal sms |
|
658 //the Title-pane text |
|
659 HBufC* text = StringLoader::LoadLC( R_QTN_TITLE_SMS, iCoeEnv ); |
|
660 CAknTitlePane* title = STATIC_CAST( |
|
661 CAknTitlePane*, |
|
662 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ))); |
|
663 title->SetTextL( *text ); |
|
664 CleanupStack::PopAndDestroy(); // text |
|
665 |
|
666 CMsgTextUtils::ConvertLineBreaksL( *textBody, CMsgTextUtils::ECRLFtoLF ); |
|
667 |
|
668 // body text |
|
669 bodyControl->SetTextContentL( *textBody ); |
|
670 |
|
671 // Class 0 handling... |
|
672 TSmsDataCodingScheme::TSmsClass smsClass; |
|
673 if ( iSmsHeader->Message().SmsPDU().Class( smsClass ) |
|
674 && smsClass == TSmsDataCodingScheme::ESmsClass0 ) |
|
675 { |
|
676 // Create new softkeys |
|
677 iClass0CBA = Cba(); // <- pointer only |
|
678 if (iClass0CBA) |
|
679 { // iClass0CBA shouldn't be NULL, but if.... |
|
680 iClass0CBA->SetCommandSetL( R_SMSVIEWER_CLASS0_SOFTKEYS_OPTIONS_EXIT__CONTEXTOPTIONS ); |
|
681 //Middle softkey |
|
682 MenuBar()->SetContextMenuTitleResourceId( R_SMSV_OPTIONSCONTEXTMENUBAR_CLASS0 ); |
|
683 MenuBar()->SetMenuTitleResourceId( R_SMSV_OPTIONSMENUBAR_CLASS0 ); |
|
684 MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions); |
|
685 } |
|
686 } |
|
687 } |
|
688 else |
|
689 { // picture message |
|
690 iGmsModel = CGmsWrapper::NewL(iCoeEnv->FsSession()); |
|
691 iGmsModel->LoadMsgL(*textBody); |
|
692 bodyControl->SetTextContentL(*iGmsModel->GetTextLC()); |
|
693 CleanupStack::PopAndDestroy(); // CRichText instance |
|
694 iGmsModel->AddPictureControlToViewL(*iView, EMsgImageControlId); |
|
695 iGmsModel->SetPictureMsgTitleL(*StatusPane(), |
|
696 R_QTN_SM_TITLE_PICTURE_MESSAGE); |
|
697 } |
|
698 |
|
699 bodyControl->SetPlainTextMode( ETrue ); |
|
700 } |
|
701 CleanupStack::PopAndDestroy(); //textBody |
|
702 |
|
703 // Deciding between To/From text in address control |
|
704 const CSmsPDU::TSmsPDUType pduType = iSmsHeader->Type(); |
|
705 switch ( pduType ) |
|
706 { |
|
707 case CSmsPDU::ESmsDeliver: |
|
708 { |
|
709 // Setting from-control |
|
710 iControlId = EMsgComponentIdFrom; |
|
711 iView->AddControlFromResourceL( |
|
712 R_SMSV_FROM, |
|
713 EMsgAddressControl, |
|
714 EMsgAppendControl, |
|
715 EMsgHeader ); |
|
716 // take the number and verify it |
|
717 iNumber = iSmsHeader->FromAddress(); |
|
718 if ( !iFlags.iIsEmailMessage ) |
|
719 { |
|
720 iFlags.iValidSenderNumber = CommonPhoneParser::IsValidPhoneNumber( |
|
721 iNumber, CommonPhoneParser::ESMSNumber ); |
|
722 |
|
723 if( !iFlags.iValidSenderNumber && iMsgVoIPExtension->IsVoIPSupported() ) |
|
724 { |
|
725 if( MsvUiServiceUtilities::IsValidEmailAddressL( iNumber ) ) |
|
726 { |
|
727 iFlags.iValidSenderNumber = ETrue; |
|
728 iFlags.iVoIPNumber = ETrue; |
|
729 } |
|
730 } |
|
731 // Replypath indication |
|
732 if ( iSmsHeader->Deliver().ReplyPath() ) |
|
733 { |
|
734 iView->AddControlFromResourceL( |
|
735 R_SMSV_REPLYPATH, |
|
736 EMsgExpandableControl, |
|
737 EMsgAppendControl, |
|
738 EMsgHeader ); |
|
739 |
|
740 HBufC* text = StringLoader::LoadLC( R_QTN_SMS_HEADING_REPLY_PATH, iCoeEnv ); |
|
741 CRichText& replyPath = STATIC_CAST(CMsgExpandableControl*, |
|
742 iView->ControlById(EMsgComponentIdCc))->TextContent(); |
|
743 replyPath.Reset(); |
|
744 replyPath.InsertL( 0, *text ); |
|
745 CleanupStack::PopAndDestroy(); // text |
|
746 } |
|
747 } |
|
748 else |
|
749 { |
|
750 iFlags.iValidSenderNumber = |
|
751 MsvUiServiceUtilities::IsValidEmailAddressL( |
|
752 iRecipientstring ); |
|
753 } |
|
754 } |
|
755 break; |
|
756 case CSmsPDU::ESmsSubmit: |
|
757 // Setting To-control |
|
758 iControlId = EMsgComponentIdTo; |
|
759 iView->AddControlFromResourceL( |
|
760 R_SMSV_TO, |
|
761 EMsgAddressControl, |
|
762 EMsgAppendControl, |
|
763 EMsgHeader ); |
|
764 // take the number |
|
765 iNumber = iSmsHeader->FromAddress(); |
|
766 if ( !iFlags.iIsEmailMessage ) |
|
767 { |
|
768 iFlags.iValidSenderNumber = CommonPhoneParser::IsValidPhoneNumber( |
|
769 iNumber, CommonPhoneParser::ESMSNumber ); |
|
770 } |
|
771 else |
|
772 { |
|
773 iFlags.iValidSenderNumber = |
|
774 MsvUiServiceUtilities::IsValidEmailAddressL( |
|
775 iRecipientstring ); |
|
776 } |
|
777 break; |
|
778 default: |
|
779 #if defined ( _DEBUG ) |
|
780 Panic( EMsgSmsViewerUnknownSmsPduType ); |
|
781 #else |
|
782 User::Leave( KErrNotSupported ); |
|
783 #endif |
|
784 break; |
|
785 } |
|
786 // If we are dealing with Email message |
|
787 // we add subject control for Email type subject |
|
788 if ( iFlags.iIsEmailMessage ) |
|
789 { |
|
790 TPtrC subj( iSmsHeader->EmailFields().Subject() ); |
|
791 if ( subj.Length() ) |
|
792 { |
|
793 // Add subject control |
|
794 AddSubjectControlL(); |
|
795 // Set the Subject field text accordigly |
|
796 SetSubjectL( subj ); |
|
797 } |
|
798 } |
|
799 iTypeMsg = pduType; //for successful launch save the PDU Type. |
|
800 } |
|
801 |
|
802 // --------------------------------------------------------- |
|
803 // CMsgSmsViewerAppUi::LaunchBioViewL |
|
804 // (other items were commented in a header). |
|
805 // --------------------------------------------------------- |
|
806 void CMsgSmsViewerAppUi::LaunchBioViewL( const TMsvEntry& aTMsvEntry ) |
|
807 { |
|
808 // Picture Messages are not handled as Bio in this class. |
|
809 __ASSERT_DEBUG(!iFlags.iGms, Panic(EMsgSmsNotForGms)); |
|
810 |
|
811 // Load in BioControl |
|
812 const TUid bioType={ aTMsvEntry.iBioType }; |
|
813 CMsgBioBodyControl* bioBody = NULL; |
|
814 bioBody = CMsgBioBodyControl::NewL( |
|
815 *this, |
|
816 bioType, |
|
817 aTMsvEntry.Id(), |
|
818 EMsgBioViewerMode, |
|
819 Document()->Session()); //since this is the viewer application |
|
820 CleanupStack::PushL( bioBody ); |
|
821 |
|
822 // Remove default body control and replace with Bio Control |
|
823 iView->DeleteControlL( EMsgComponentIdBody ); |
|
824 iView->AddControlL( |
|
825 bioBody, |
|
826 EMsgComponentIdBody, |
|
827 EMsgAppendControl, |
|
828 EMsgBody ); |
|
829 CleanupStack::Pop(); // bioBody |
|
830 |
|
831 //the Title-pane text |
|
832 HBufC* text = bioBody->HeaderTextL(); |
|
833 CleanupStack::PushL( text ); |
|
834 CAknTitlePane* title = STATIC_CAST( |
|
835 CAknTitlePane*, |
|
836 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ))); |
|
837 title->SetTextL( *text ); |
|
838 CleanupStack::PopAndDestroy(); // text |
|
839 |
|
840 //current message is bio message |
|
841 iFlags.iBioMsg = ETrue; |
|
842 |
|
843 } |
|
844 |
|
845 // --------------------------------------------------------- |
|
846 // CMsgSmsViewerAppUi::AddBioCommandsToMenuL |
|
847 // (other items were commented in a header). |
|
848 // --------------------------------------------------------- |
|
849 void CMsgSmsViewerAppUi::AddBioCommandsToMenuL( |
|
850 CEikMenuPane* aMenuPane ) |
|
851 { |
|
852 BioBody().SetMenuCommandSetL( *aMenuPane ); |
|
853 } |
|
854 |
|
855 // --------------------------------------------------------- |
|
856 // CMsgSmsViewerAppUi::OptionsMenuPermissionsBioL |
|
857 // (other items were commented in a header). |
|
858 // --------------------------------------------------------- |
|
859 TUint32 CMsgSmsViewerAppUi::OptionsMenuPermissionsBioL() |
|
860 { |
|
861 __ASSERT_DEBUG( iFlags.iBioMsg, Panic( EMsgSmsBioNotActive )); |
|
862 return BioBody().BioControl().OptionMenuPermissionsL(); |
|
863 } |
|
864 |
|
865 // --------------------------------------------------------- |
|
866 // CMsgSmsViewerAppUi::DynInitMenuPaneL |
|
867 // (other items were commented in a header). |
|
868 // --------------------------------------------------------- |
|
869 void CMsgSmsViewerAppUi::DynInitMenuPaneL( |
|
870 TInt aMenuId, |
|
871 CEikMenuPane* aMenuPane ) |
|
872 { |
|
873 // Confirm app is running properly |
|
874 if ( !Document()->IsLaunched()) |
|
875 { |
|
876 // If not, hide everything and return |
|
877 TInt amountOfItems = aMenuPane->NumberOfItemsInPane(); |
|
878 if ( amountOfItems ) |
|
879 { |
|
880 aMenuPane->DeleteBetweenMenuItems( 0, amountOfItems-1 ); |
|
881 return; |
|
882 } |
|
883 } |
|
884 // Init all needed objects |
|
885 // Creation delayed to speed up the |
|
886 // viewer's opening process |
|
887 if( !iSendUi ) |
|
888 { |
|
889 iSendUi = CSendUi::NewL(); |
|
890 } |
|
891 if ( !iFindItemMenu ) |
|
892 { |
|
893 // Tests if normal message |
|
894 if ( !iFlags.iBioMsg || !iFlags.iGms ) |
|
895 { |
|
896 // Prepare FindItem |
|
897 iFindItemMenu = CFindItemMenu::NewL( EFindItemMenuPlaceHolder ); |
|
898 iFindItemMenu->SetCallSubMenuVisibility ( EFalse ); // Click-To-Call |
|
899 iFindItemMenu->AttachItemFinderMenuL( R_SMSV_OPTIONSMENUPANE ); |
|
900 } |
|
901 } |
|
902 |
|
903 // ...then construct the menu itself. There are two menu-resources, |
|
904 // one for contextmenu and one for normal optionsmenu. |
|
905 switch ( aMenuId ) |
|
906 { |
|
907 case R_SMSV_REPLY_MENU: |
|
908 { |
|
909 TSendingCapabilities dummy; |
|
910 |
|
911 //hide normal short message |
|
912 aMenuPane->SetItemDimmed( |
|
913 ESmsViewerReplyNormal, ETrue); |
|
914 //hide mms |
|
915 aMenuPane->SetItemDimmed( |
|
916 ESmsViewerReplyViaMms, ETrue); |
|
917 |
|
918 //if Audio msg supported |
|
919 if ( iFlags.iAudioMsgSupported ) |
|
920 { |
|
921 aMenuPane->SetItemDimmed( |
|
922 ESmsViewerReplyViaAudio, EFalse); |
|
923 } |
|
924 |
|
925 // If this is from email and email settings are defined |
|
926 // we allow the user to reply via E-mail |
|
927 if ( iFlags.iIsEmailMessage && |
|
928 iSendUi->ValidateServiceL( KSenduiMtmSmtpUid, dummy ) ) |
|
929 { |
|
930 aMenuPane->SetItemDimmed( |
|
931 ESmsViewerReplyViaEmail, EFalse); |
|
932 } |
|
933 // If this is from PS number normal reply is dimmed |
|
934 if ( iFlags.iVoIPNumber ) |
|
935 { |
|
936 aMenuPane->SetItemDimmed( |
|
937 ESmsViewerReplyViaEmail, EFalse); |
|
938 aMenuPane->SetItemDimmed( |
|
939 ESmsViewerReplyNormal, ETrue); |
|
940 aMenuPane->SetItemDimmed( |
|
941 ESmsViewerCreateCC, ETrue); |
|
942 } |
|
943 } |
|
944 break; |
|
945 case R_SMSV_OPTIONSMENUPANE: |
|
946 { |
|
947 //hide aiw menu item for calender, |
|
948 aMenuPane->SetItemDimmed( KAiwCmdSaveToCalendar, ETrue ); |
|
949 |
|
950 if ( !iFlags.iBioMsg ) |
|
951 { // Normal sms or picture msg |
|
952 DynInitNonBioOptionsMenuL( aMenuPane ); |
|
953 } |
|
954 else |
|
955 { // Smart (BIO) msg |
|
956 DynInitBioOptionsMenuL( aMenuId, aMenuPane ); |
|
957 } |
|
958 if ( iFlags.iBioMsg || iFlags.iGms ) |
|
959 { |
|
960 aMenuPane->SetItemDimmed( ESmsViewerSubmenuZoomCommands, ETrue ); |
|
961 } |
|
962 } |
|
963 break; |
|
964 case R_SMSV_CONTEXTMENUPANE: |
|
965 { |
|
966 if ( !iFlags.iBioMsg ) |
|
967 { // Normal sms or picture msg |
|
968 DynInitNonBioContextMenuL( aMenuPane ); |
|
969 } |
|
970 else |
|
971 { // Smart (BIO) msg |
|
972 DynInitBioContextMenuL( aMenuPane ); |
|
973 } |
|
974 } |
|
975 break; |
|
976 case R_FINDITEMMENU_MENU: |
|
977 { |
|
978 // Coverty fix , Forward NULL http://ousrv057/cov.cgi?cid=35945 |
|
979 if(iFindItemMenu) |
|
980 { |
|
981 iFindItemMenu->DisplayFindItemCascadeMenuL( *aMenuPane ); |
|
982 } |
|
983 } |
|
984 break; |
|
985 case R_SMSV_OPTIONSMENUPANE_CLASS0: |
|
986 { |
|
987 TPtrC senderNumber = KNullDesC(); |
|
988 |
|
989 TBool senderHighlighted = EFalse; |
|
990 if ( FocusedControlId( ) == EMsgComponentIdFrom ) |
|
991 { |
|
992 CMsgAddressControl* address = static_cast<CMsgAddressControl*>( |
|
993 iView->ControlById( EMsgComponentIdFrom ) ); |
|
994 |
|
995 if ( address && address->Editor().SelectionLength() |
|
996 == address->Editor().TextLength() ) |
|
997 { |
|
998 senderHighlighted = ETrue; |
|
999 } |
|
1000 } |
|
1001 if ( iFlags.iValidSenderNumber |
|
1002 && senderHighlighted ) |
|
1003 { |
|
1004 senderNumber.Set( iNumber ); |
|
1005 } |
|
1006 //if autolock enabled, hide finditem-menu |
|
1007 if ( iFlags.iAutoLockEnabled ) |
|
1008 { |
|
1009 aMenuPane->DeleteMenuItem( EFindItemMenuPlaceHolder ); |
|
1010 } |
|
1011 // Coverty fix , Forward NULL http://ousrv057/cov.cgi?cid=35945 |
|
1012 else if(iFindItemMenu) |
|
1013 { |
|
1014 iFindItemMenu->AddItemFindMenuL( |
|
1015 FindItemHighlighted() ? iView->ItemFinder() : 0, |
|
1016 aMenuPane, EFindItemMenuPlaceHolder, |
|
1017 senderNumber, |
|
1018 iRecipientstring.Length() != 0 ? ETrue : EFalse, |
|
1019 EFalse ); |
|
1020 } |
|
1021 } |
|
1022 break; |
|
1023 case R_SMSV_OPTIONSCONTEXTMENUPANE_CLASS0: |
|
1024 { |
|
1025 TPtrC senderNumber = KNullDesC(); |
|
1026 if ( iFlags.iValidSenderNumber ) |
|
1027 { |
|
1028 senderNumber.Set( iNumber ); |
|
1029 } |
|
1030 //if autolock enabled, hide finditem-menu |
|
1031 if ( iFlags.iAutoLockEnabled ) |
|
1032 { |
|
1033 aMenuPane->DeleteMenuItem( EFindItemContextMenuPlaceHolder ); |
|
1034 } |
|
1035 else |
|
1036 { |
|
1037 iFindItemMenu->AddItemFindMenuL( |
|
1038 IsBodyFocused() ? iView->ItemFinder() : 0, |
|
1039 aMenuPane, EFindItemContextMenuPlaceHolder, |
|
1040 senderNumber, |
|
1041 iRecipientstring.Length() != 0 ? ETrue : EFalse, |
|
1042 ETrue ); |
|
1043 } |
|
1044 } |
|
1045 break; |
|
1046 case R_SMSVIEWER_ZOOM_SUBMENU: |
|
1047 { |
|
1048 TInt zoomLevel = KErrGeneral; |
|
1049 iMsgEditorAppUiExtension-> |
|
1050 iSettingCachePlugin.GetValue( KAknLocalZoomLayoutSwitch, zoomLevel ); |
|
1051 switch ( zoomLevel ) |
|
1052 { |
|
1053 case EAknUiZoomAutomatic: |
|
1054 aMenuPane->SetItemButtonState( EMsgDispSizeAutomatic, |
|
1055 EEikMenuItemSymbolOn ); |
|
1056 break; |
|
1057 case EAknUiZoomNormal: |
|
1058 aMenuPane->SetItemButtonState( EMsgDispSizeNormal, |
|
1059 EEikMenuItemSymbolOn ); |
|
1060 break; |
|
1061 case EAknUiZoomSmall: |
|
1062 aMenuPane->SetItemButtonState( EMsgDispSizeSmall, |
|
1063 EEikMenuItemSymbolOn ); |
|
1064 break; |
|
1065 case EAknUiZoomLarge: |
|
1066 aMenuPane->SetItemButtonState( EMsgDispSizeLarge, |
|
1067 EEikMenuItemSymbolOn ); |
|
1068 break; |
|
1069 default: |
|
1070 break; |
|
1071 } |
|
1072 } |
|
1073 break; |
|
1074 default: |
|
1075 if ( iFlags.iBioMsg || iFlags.iGms ) |
|
1076 {// for BIO & GMS; create contact card menu |
|
1077 // If it's AIW sub-menu, let AIW initialize it |
|
1078 InitAiwContactCardSubMenuL( aMenuPane ); |
|
1079 } |
|
1080 else |
|
1081 {// for normal SMS; update the finder menu |
|
1082 if( iFlags.iVoIPNumber ) |
|
1083 { |
|
1084 iFindItemMenu->SetSenderDescriptorType( CItemFinder::EEmailAddress ); |
|
1085 } |
|
1086 iFindItemMenu->UpdateItemFinderMenuL( aMenuId, aMenuPane ); |
|
1087 } |
|
1088 break; |
|
1089 } |
|
1090 } |
|
1091 |
|
1092 // --------------------------------------------------------- |
|
1093 // CMsgSmsViewerAppUi::DynInitNonBioOptionsMenuL |
|
1094 // (other items were commented in a header). |
|
1095 // --------------------------------------------------------- |
|
1096 void CMsgSmsViewerAppUi::DynInitNonBioOptionsMenuL( CEikMenuPane* aMenuPane ) |
|
1097 { |
|
1098 if ( !iFlags.iGms ) |
|
1099 { // normal sms |
|
1100 |
|
1101 //hide submenu if only item is "via message" or restricted mode ON |
|
1102 TSendingCapabilities dummy; |
|
1103 if( iFlags.iSmsRestrictedMode || |
|
1104 ( !iFlags.iAudioMsgSupported && |
|
1105 !iFlags.iVoIPNumber && |
|
1106 !(iFlags.iIsEmailMessage && |
|
1107 iSendUi->ValidateServiceL( KSenduiMtmSmtpUid, dummy )) )) |
|
1108 { |
|
1109 aMenuPane->DeleteMenuItem( ESmsViewerReply ); |
|
1110 aMenuPane->SetItemDimmed( ESmsViewerReplyNoSubMenu, EFalse ); |
|
1111 } |
|
1112 |
|
1113 // add automatic highlight menus |
|
1114 TPtrC senderNumber = KNullDesC(); |
|
1115 |
|
1116 TBool senderHighlighted = EFalse; |
|
1117 if ( FocusedControlId( ) == EMsgComponentIdFrom ) |
|
1118 { |
|
1119 CMsgAddressControl* address = static_cast<CMsgAddressControl*>( |
|
1120 iView->ControlById( EMsgComponentIdFrom ) ); |
|
1121 |
|
1122 if ( address && address->Editor().SelectionLength() |
|
1123 == address->Editor().TextLength() ) |
|
1124 { |
|
1125 senderHighlighted = ETrue; |
|
1126 } |
|
1127 } |
|
1128 |
|
1129 if ( iFlags.iIsEmailMessage ) // SMS originating address is email address |
|
1130 { |
|
1131 if ( senderHighlighted ) |
|
1132 { |
|
1133 senderNumber.Set( iRecipientstring ); |
|
1134 } |
|
1135 iFindItemMenu->SetSenderDescriptorType( CItemFinder::EEmailAddress ); |
|
1136 } |
|
1137 else |
|
1138 {// SMS originating adddress is Phone number |
|
1139 if ( iFlags.iValidSenderNumber |
|
1140 && senderHighlighted ) |
|
1141 { |
|
1142 senderNumber.Set( iNumber ); |
|
1143 } |
|
1144 } |
|
1145 //Added to remove Copy-option when sender number is not valid (for example it has alphabets) |
|
1146 if ( iFlags.iValidSenderNumber || IsBodyFocused() ) |
|
1147 { |
|
1148 iFindItemMenu->SetSenderHighlightStatus( ( senderHighlighted && |
|
1149 iView->ControlById( EMsgComponentIdFrom ) == iView->FocusedControl() ) ); |
|
1150 iFindItemMenu->SetSenderDisplayText( senderNumber ); |
|
1151 if( !iFlags.iVoIPNumber ) |
|
1152 { |
|
1153 iFindItemMenu->AddItemFindMenuL( |
|
1154 FindItemHighlighted() ? iView->ItemFinder() : 0, |
|
1155 aMenuPane, EFindItemMenuPlaceHolder, |
|
1156 senderNumber, |
|
1157 iFlags.iIsEmailMessage ? EFalse : ( iRecipientstring.Length() != 0 ) ); |
|
1158 } |
|
1159 else |
|
1160 { |
|
1161 iFindItemMenu->AddItemFindMenuL( |
|
1162 FindItemHighlighted() ? iView->ItemFinder() : 0, |
|
1163 aMenuPane, EFindItemMenuPlaceHolder, |
|
1164 senderNumber, |
|
1165 ETrue ); |
|
1166 } |
|
1167 } |
|
1168 else //Not valid sender number, dim the find item |
|
1169 { |
|
1170 aMenuPane->SetItemDimmed( EFindItemMenuPlaceHolder, ETrue); |
|
1171 } |
|
1172 |
|
1173 // not needed in automatic highlight |
|
1174 aMenuPane->SetItemDimmed( ESmsViewerCallBack, ETrue ); |
|
1175 aMenuPane->SetItemDimmed( ESmsViewerCreateCC, ETrue ); |
|
1176 } |
|
1177 else |
|
1178 { // GMS |
|
1179 // dim automatic highlight items |
|
1180 aMenuPane->SetItemDimmed( EFindItemMenuPlaceHolder, ETrue ); |
|
1181 |
|
1182 // not supported in unified editor |
|
1183 aMenuPane->SetItemDimmed( ESmsViewerForward, ETrue ); |
|
1184 |
|
1185 //dim the Add to Contacts menu if the number is already in address book |
|
1186 if (iRecipientstring.Length() != 0) |
|
1187 { |
|
1188 //Number is already in address book |
|
1189 aMenuPane->SetItemDimmed( ESmsViewerCreateCC, ETrue ); |
|
1190 } |
|
1191 |
|
1192 } |
|
1193 |
|
1194 // Remove "Call back to sender", "reply" and "create cc" from |
|
1195 // menu, if this is a sent message or sender number is unusable |
|
1196 if ( iControlId == EMsgComponentIdTo || !iFlags.iValidSenderNumber ) |
|
1197 { |
|
1198 aMenuPane->SetItemDimmed( ESmsViewerReply, ETrue ); |
|
1199 if ( iFlags.iGms ) |
|
1200 { // "create cc" and "call back to sender" valid only Gms |
|
1201 aMenuPane->SetItemDimmed( ESmsViewerCreateCC, ETrue ); |
|
1202 aMenuPane->SetItemDimmed( ESmsViewerCallBack, ETrue ); |
|
1203 } |
|
1204 } |
|
1205 else if ( iFlags.iValidSenderNumber && iFlags.iGms ) |
|
1206 { |
|
1207 // Number usable, request Phonebook2 to add menu items (AIW) |
|
1208 InitAiwContactCardMenuL( R_SMSV_OPTIONSMENUPANE, aMenuPane ); |
|
1209 } |
|
1210 else |
|
1211 { // Lint |
|
1212 } |
|
1213 |
|
1214 if ( iFlags.iVoIPNumber ) |
|
1215 { |
|
1216 aMenuPane->SetItemDimmed( ESmsViewerCreateCC, ETrue ); |
|
1217 aMenuPane->SetItemDimmed( ESmsViewerReply, ETrue ); |
|
1218 aMenuPane->SetItemDimmed( ESmsViewerForward, ETrue ); |
|
1219 } |
|
1220 else |
|
1221 { // Lint |
|
1222 } |
|
1223 |
|
1224 // Help handling |
|
1225 aMenuPane->SetItemDimmed( EAknCmdHelp, !iFlags.iHelpFeatureSupported ); |
|
1226 } |
|
1227 |
|
1228 // --------------------------------------------------------- |
|
1229 // CMsgSmsViewerAppUi::DynInitNonBioContextMenuL |
|
1230 // (other items were commented in a header). |
|
1231 // --------------------------------------------------------- |
|
1232 void CMsgSmsViewerAppUi::DynInitNonBioContextMenuL( CEikMenuPane* aMenuPane ) |
|
1233 { |
|
1234 // Remove "Call back to sender" and "reply" from |
|
1235 // menu, if this is a sent message or sender number is not usable |
|
1236 |
|
1237 // if not GMS, dim following |
|
1238 if ( !iFlags.iGms ) |
|
1239 { // Sms |
|
1240 // add automatic highlight menus |
|
1241 TPtrC senderNumber = KNullDesC(); |
|
1242 if ( iFlags.iIsEmailMessage ) // SMS originating address is email address |
|
1243 { |
|
1244 senderNumber.Set( iRecipientstring ); |
|
1245 iFindItemMenu->SetSenderDescriptorType( CItemFinder::EEmailAddress ); |
|
1246 } |
|
1247 else |
|
1248 {// SMS originating adddress is Phone number |
|
1249 if ( iFlags.iValidSenderNumber ) |
|
1250 { |
|
1251 senderNumber.Set( iNumber ); |
|
1252 } |
|
1253 } |
|
1254 if( !iFlags.iVoIPNumber ) |
|
1255 { |
|
1256 iFindItemMenu->SetSenderHighlightStatus( |
|
1257 iView->ControlById( EMsgComponentIdFrom ) == iView->FocusedControl() ); |
|
1258 iFindItemMenu->SetSenderDisplayText( senderNumber ); |
|
1259 iFindItemMenu->AddItemFindMenuL( |
|
1260 IsBodyFocused() ? iView->ItemFinder() : 0, |
|
1261 aMenuPane, EFindItemContextMenuPlaceHolder, |
|
1262 senderNumber, |
|
1263 iFlags.iIsEmailMessage ? EFalse : ( iRecipientstring.Length() != 0 ), |
|
1264 ETrue ); |
|
1265 } |
|
1266 else |
|
1267 { |
|
1268 iFindItemMenu->SetSenderHighlightStatus( |
|
1269 iView->ControlById( EMsgComponentIdFrom ) == iView->FocusedControl() ); |
|
1270 iFindItemMenu->SetSenderDisplayText( senderNumber ); |
|
1271 iFindItemMenu->AddItemFindMenuL( |
|
1272 IsBodyFocused() ? iView->ItemFinder() : 0, |
|
1273 aMenuPane, EFindItemContextMenuPlaceHolder, |
|
1274 senderNumber, |
|
1275 ETrue, |
|
1276 ETrue ); |
|
1277 } |
|
1278 } |
|
1279 else |
|
1280 { // Gms |
|
1281 // dim automatic highlight items |
|
1282 aMenuPane->SetItemDimmed( EFindItemContextMenuPlaceHolder, ETrue ); |
|
1283 } |
|
1284 } |
|
1285 |
|
1286 // --------------------------------------------------------- |
|
1287 // CMsgSmsViewerAppUi::DynInitBioOptionsMenuL |
|
1288 // (other items were commented in a header). |
|
1289 // --------------------------------------------------------- |
|
1290 void CMsgSmsViewerAppUi::DynInitBioOptionsMenuL( |
|
1291 TInt aMenuId, |
|
1292 CEikMenuPane* aMenuPane ) |
|
1293 { |
|
1294 // dim automatic highlight items |
|
1295 aMenuPane->SetItemDimmed( EFindItemMenuPlaceHolder, ETrue ); |
|
1296 //dim the Add to Contacts menu if the number is already in address book |
|
1297 if (iRecipientstring.Length() != 0) |
|
1298 { |
|
1299 //Number is already in address book |
|
1300 aMenuPane->SetItemDimmed( ESmsViewerCreateCC, ETrue ); |
|
1301 } |
|
1302 |
|
1303 if ( iControlId == EMsgComponentIdTo ) // Sent item |
|
1304 { |
|
1305 aMenuPane->SetItemDimmed( ESmsViewerCallBack, ETrue ); |
|
1306 aMenuPane->SetItemDimmed( ESmsViewerReply, ETrue ); |
|
1307 aMenuPane->SetItemDimmed( ESmsViewerCreateCC, ETrue ); |
|
1308 aMenuPane->SetItemDimmed( ESmsViewerForward, ETrue ); |
|
1309 } |
|
1310 else // Inbox item |
|
1311 { |
|
1312 AddBioCommandsToMenuL( aMenuPane ); |
|
1313 |
|
1314 TUint32 permBio = OptionsMenuPermissionsBioL(); |
|
1315 |
|
1316 if ( !iFlags.iValidSenderNumber ) |
|
1317 { |
|
1318 aMenuPane->SetItemDimmed( ESmsViewerCallBack, ETrue ); |
|
1319 aMenuPane->SetItemDimmed( ESmsViewerReply, ETrue ); |
|
1320 aMenuPane->SetItemDimmed( ESmsViewerCreateCC, ETrue ); |
|
1321 } |
|
1322 else // Sender number is valid, check does biocontrol accept options |
|
1323 { |
|
1324 if ( !( permBio & EMsgBioReply ) ) |
|
1325 { |
|
1326 aMenuPane->SetItemDimmed( ESmsViewerReply, ETrue ); |
|
1327 } |
|
1328 |
|
1329 if ( !( permBio & EMsgBioCallBack ) || iFlags.iIrBt ) |
|
1330 { |
|
1331 aMenuPane->SetItemDimmed( ESmsViewerCallBack, ETrue ); |
|
1332 } |
|
1333 |
|
1334 if ( !( permBio & EMsgBioCreateCC) ) |
|
1335 { |
|
1336 aMenuPane->SetItemDimmed( ESmsViewerCreateCC, ETrue ); |
|
1337 } |
|
1338 else |
|
1339 { |
|
1340 // Request Phonebook2 to add menu items (AIW) |
|
1341 InitAiwContactCardMenuL( aMenuId, aMenuPane ); |
|
1342 } |
|
1343 } |
|
1344 |
|
1345 if ( !( permBio & EMsgBioForward ) ) |
|
1346 { |
|
1347 aMenuPane->SetItemDimmed( ESmsViewerForward, ETrue ); |
|
1348 } |
|
1349 |
|
1350 if ( !( permBio & EMsgBioDelete )) |
|
1351 { |
|
1352 aMenuPane->SetItemDimmed( ESmsViewerDelete, ETrue ); |
|
1353 } |
|
1354 |
|
1355 if ( !( permBio & EMsgBioMessInfo )) |
|
1356 { |
|
1357 aMenuPane->SetItemDimmed( ESmsViewerMessInfo, ETrue ); |
|
1358 } |
|
1359 |
|
1360 if ( !( permBio & EMsgBioMove )) |
|
1361 { |
|
1362 aMenuPane->SetItemDimmed( ESmsViewerMove, ETrue ); |
|
1363 } |
|
1364 |
|
1365 // Help-handling |
|
1366 aMenuPane->SetItemDimmed( EAknCmdHelp, !iFlags.iHelpFeatureSupported || !( permBio & EMsgBioHelp )); |
|
1367 |
|
1368 if ( permBio & EMsgBioFindItem ) // This used to be else if. Mistake? |
|
1369 { |
|
1370 iFindItemMenu->DisplayFindItemMenuItemL( *aMenuPane, ESmsViewerCreateCC ); |
|
1371 } |
|
1372 } |
|
1373 } |
|
1374 |
|
1375 // --------------------------------------------------------- |
|
1376 // CMsgSmsViewerAppUi::DynInitBioContextMenuL |
|
1377 // (other items were commented in a header). |
|
1378 // --------------------------------------------------------- |
|
1379 void CMsgSmsViewerAppUi::DynInitBioContextMenuL( CEikMenuPane* aMenuPane ) |
|
1380 { |
|
1381 // dim automatic highlight items |
|
1382 aMenuPane->SetItemDimmed( EFindItemContextMenuPlaceHolder, ETrue ); |
|
1383 |
|
1384 if ( iControlId == EMsgComponentIdTo ) |
|
1385 { |
|
1386 //aMenuPane->SetItemDimmed( ESmsViewerReply, ETrue ); |
|
1387 } |
|
1388 else |
|
1389 { |
|
1390 AddBioCommandsToMenuL( aMenuPane ); |
|
1391 |
|
1392 if ( !(OptionsMenuPermissionsBioL() & EMsgBioDelete )) |
|
1393 { |
|
1394 //aMenuPane->SetItemDimmed( ESmsViewerDelete, ETrue ); |
|
1395 } |
|
1396 } |
|
1397 } |
|
1398 |
|
1399 // --------------------------------------------------------- |
|
1400 // CMsgSmsViewerAppUi::HandleCommandL |
|
1401 // (other items were commented in a header). |
|
1402 // --------------------------------------------------------- |
|
1403 void CMsgSmsViewerAppUi::HandleCommandL(TInt aCommand ) |
|
1404 { |
|
1405 |
|
1406 if ( aCommand != EEikCmdExit && !iFullyConstructed ) |
|
1407 { |
|
1408 return; |
|
1409 } |
|
1410 |
|
1411 |
|
1412 // is it find item command |
|
1413 if ( iFindItemMenu && iFindItemMenu->CommandIsValidL( aCommand ) && !iFlags.iGms && !iFlags.iBioMsg ) |
|
1414 { |
|
1415 iFindItemMenu->HandleItemFinderCommandL( aCommand ); |
|
1416 return; |
|
1417 } |
|
1418 |
|
1419 // Are we dealing with bio-message? |
|
1420 if ( iFlags.iBioMsg ) |
|
1421 { |
|
1422 // let the biocontrol handle the command and check |
|
1423 // whether it was handled. |
|
1424 if ( aCommand==EAknCmdHelp ) |
|
1425 { |
|
1426 LaunchHelpL(); |
|
1427 return; |
|
1428 } |
|
1429 |
|
1430 if ( Document( )->IsLaunched( ) && BioBody().HandleBioCommandL( aCommand )) |
|
1431 { |
|
1432 return;// Bio control has handled the command. |
|
1433 } |
|
1434 } |
|
1435 |
|
1436 // find item |
|
1437 if ( iFindItemMenu && iFindItemMenu->CommandIsValidL( aCommand ) && ( iFlags.iGms || iFlags.iBioMsg )) |
|
1438 { |
|
1439 DoSearchL( aCommand ); |
|
1440 } |
|
1441 |
|
1442 switch ( aCommand ) |
|
1443 { |
|
1444 case ESmsViewerReplyNormal: //normal sms |
|
1445 CheckDiskAndReplyForwardL( EFalse ); |
|
1446 if (!(iEditorBaseFeatures & EStayInViewerAfterReply)) |
|
1447 { |
|
1448 Exit( EAknSoftkeyClose ); |
|
1449 } |
|
1450 break; |
|
1451 case ESmsViewerReplyViaMms: |
|
1452 DoReplyViaL( ESmsViewerReplyViaMms ); |
|
1453 if (!(iEditorBaseFeatures & EStayInViewerAfterReply)) |
|
1454 { |
|
1455 Exit( EAknSoftkeyClose ); |
|
1456 } |
|
1457 break; |
|
1458 case ESmsViewerReplyViaEmail: |
|
1459 DoReplyViaL( ESmsViewerReplyViaEmail ); |
|
1460 if (!(iEditorBaseFeatures & EStayInViewerAfterReply)) |
|
1461 { |
|
1462 Exit( EAknSoftkeyClose ); |
|
1463 } |
|
1464 break; |
|
1465 case ESmsViewerReplyViaAudio: |
|
1466 DoReplyViaL( ESmsViewerReplyViaAudio ); |
|
1467 if (!(iEditorBaseFeatures & EStayInViewerAfterReply)) |
|
1468 { |
|
1469 Exit( EAknSoftkeyClose ); |
|
1470 } |
|
1471 break; |
|
1472 case ESmsViewerReplyNoSubMenu: //unieditor, submenu hidden |
|
1473 CheckDiskAndReplyForwardL( EFalse ); |
|
1474 if (!(iEditorBaseFeatures & EStayInViewerAfterReply)) |
|
1475 { |
|
1476 Exit( EAknSoftkeyClose ); |
|
1477 } |
|
1478 break; |
|
1479 case ESmsViewerReplyViaMessage: //unieditor |
|
1480 CheckDiskAndReplyForwardL( EFalse ); |
|
1481 if (!(iEditorBaseFeatures & EStayInViewerAfterReply)) |
|
1482 { |
|
1483 Exit( EAknSoftkeyClose ); |
|
1484 } |
|
1485 break; |
|
1486 case ESmsViewerForward: |
|
1487 CheckDiskAndReplyForwardL( ETrue ); |
|
1488 if (!(iEditorBaseFeatures & EStayInViewerAfterReply)) |
|
1489 { |
|
1490 Exit( EAknSoftkeyClose ); |
|
1491 } |
|
1492 break; |
|
1493 case ESmsViewerDelete: |
|
1494 DoFileDeleteL(); |
|
1495 break; |
|
1496 case ESmsViewerMove: |
|
1497 DoMoveEntryL(); |
|
1498 break; |
|
1499 case ESmsViewerSave: |
|
1500 SaveClass0SmsL( ETrue ); |
|
1501 Exit( EAknSoftkeyClose ); |
|
1502 break; |
|
1503 case ESmsViewerCallBack: |
|
1504 DoCallBackToSenderL(); |
|
1505 break; |
|
1506 case ESmsViewerCreateCCNew: |
|
1507 // FALLTHROUGH |
|
1508 case ESmsViewerCreateCCExisting: |
|
1509 DoCreateContactCardL( aCommand ); |
|
1510 break; |
|
1511 case ESmsViewerMessInfo: |
|
1512 DoMessageInfoL(); |
|
1513 break; |
|
1514 case EAknSoftkeyBack: |
|
1515 Exit( EAknSoftkeyClose ); |
|
1516 break; |
|
1517 case EEikCmdExit: |
|
1518 // system exit |
|
1519 DoMsgSaveExitL(); |
|
1520 break; |
|
1521 case EAknSoftkeyExit: // called only with class 0 exit |
|
1522 DeleteAndExitL(); |
|
1523 break; |
|
1524 case EAknCmdHelp: |
|
1525 LaunchHelpL(); |
|
1526 break; |
|
1527 case EMsgDispSizeAutomatic: |
|
1528 case EMsgDispSizeLarge: |
|
1529 case EMsgDispSizeNormal: |
|
1530 case EMsgDispSizeSmall: |
|
1531 HandleLocalZoomChangeL( (TMsgCommonCommands)aCommand ); |
|
1532 break; |
|
1533 default: |
|
1534 break; |
|
1535 } |
|
1536 } |
|
1537 |
|
1538 // --------------------------------------------------------- |
|
1539 // CMsgSmsViewerAppUi::BodyEditor |
|
1540 // (other items were commented in a header). |
|
1541 // --------------------------------------------------------- |
|
1542 CEikRichTextEditor& CMsgSmsViewerAppUi::BodyEditor() const |
|
1543 { |
|
1544 __ASSERT_DEBUG( !iFlags.iBioMsg, Panic(EMsgSmsNotAllowedForBio)); |
|
1545 return STATIC_CAST( CMsgBodyControl*, iView->ControlById( EMsgComponentIdBody ))->Editor(); |
|
1546 } |
|
1547 |
|
1548 // --------------------------------------------------------- |
|
1549 // CMsgSmsViewerAppUi::BioBody |
|
1550 // (other items were commented in a header). |
|
1551 // --------------------------------------------------------- |
|
1552 CMsgBioBodyControl& CMsgSmsViewerAppUi::BioBody() const |
|
1553 { |
|
1554 __ASSERT_DEBUG( iFlags.iBioMsg, Panic( EMsgSmsBioBodyOnlyForBio )); |
|
1555 return *STATIC_CAST( CMsgBioBodyControl*, iView->ControlById( EMsgComponentIdBody )); |
|
1556 } |
|
1557 |
|
1558 // --------------------------------------------------------- |
|
1559 // CMsgSmsViewerAppUi::FirstFreeCommand |
|
1560 // (other items were commented in a header). |
|
1561 // --------------------------------------------------------- |
|
1562 TInt CMsgSmsViewerAppUi::FirstFreeCommand() const |
|
1563 { |
|
1564 return ESmsViewerFirstFreeCmdId; |
|
1565 } |
|
1566 |
|
1567 // --------------------------------------------------------- |
|
1568 // CMsgSmsViewerAppUi::RequestHandleCommandL |
|
1569 // (other items were commented in a header). |
|
1570 // --------------------------------------------------------- |
|
1571 TInt CMsgSmsViewerAppUi::RequestHandleCommandL( |
|
1572 TMsgCommands /*aCommand*/ ) |
|
1573 { |
|
1574 //Not used at the moment. |
|
1575 return KErrNotSupported; |
|
1576 } |
|
1577 |
|
1578 // --------------------------------------------------------- |
|
1579 // CMsgSmsViewerAppUi::IsCommandSupported |
|
1580 // (other items were commented in a header). |
|
1581 // --------------------------------------------------------- |
|
1582 TBool CMsgSmsViewerAppUi::IsCommandSupported( |
|
1583 TMsgCommands /*aCommand*/ ) const |
|
1584 { |
|
1585 //Nothing supported at the moment. |
|
1586 return EFalse; |
|
1587 } |
|
1588 |
|
1589 // --------------------------------------------------------- |
|
1590 // CMsgSmsViewerAppUi::IsBodyFocused |
|
1591 // (other items were commented in a header). |
|
1592 // --------------------------------------------------------- |
|
1593 TBool CMsgSmsViewerAppUi::IsBodyFocused() const |
|
1594 { |
|
1595 return (( iView->ControlById( EMsgComponentIdBody )) |
|
1596 == iView->FocusedControl()); |
|
1597 } |
|
1598 // --------------------------------------------------------- |
|
1599 // CMsgSmsViewerAppUi::IsSenderFocused |
|
1600 // (other items were commented in a header). |
|
1601 // --------------------------------------------------------- |
|
1602 TBool CMsgSmsViewerAppUi::IsSenderFocused() const |
|
1603 { |
|
1604 return (( iView->ControlById( EMsgComponentIdFrom )) |
|
1605 == iView->FocusedControl()); |
|
1606 } |
|
1607 |
|
1608 // --------------------------------------------------------- |
|
1609 // CMsgSmsViewerAppUi::HandleKeyEventL |
|
1610 // (other items were commented in a header). |
|
1611 // --------------------------------------------------------- |
|
1612 TKeyResponse CMsgSmsViewerAppUi::HandleKeyEventL( |
|
1613 const TKeyEvent& aKeyEvent, |
|
1614 TEventCode aType ) |
|
1615 { |
|
1616 |
|
1617 // Confirm app is running properly |
|
1618 if ( iView && ( aType == EEventKey ) && Document()->IsLaunched()) |
|
1619 { |
|
1620 // react with all sms classes |
|
1621 switch ( aKeyEvent.iCode ) |
|
1622 { |
|
1623 case EKeyUpArrow: |
|
1624 case EKeyDownArrow: |
|
1625 { |
|
1626 // Base-editor handles scrolling |
|
1627 iView->OfferKeyEventL( aKeyEvent, aType ); |
|
1628 return EKeyWasConsumed; |
|
1629 } |
|
1630 case EKeyDevice3: |
|
1631 case EKeyEnter: |
|
1632 { |
|
1633 CMsgExpandableControl* ctrl = NULL; |
|
1634 TBool checkHighlight = EFalse; |
|
1635 |
|
1636 if( iView->FocusedControl() ) |
|
1637 { |
|
1638 ctrl = static_cast<CMsgExpandableControl*>( iView->FocusedControl() ); |
|
1639 if ( ctrl->ControlType() == EMsgAddressControl |
|
1640 && !ctrl->Editor().SelectionLength() ) |
|
1641 { |
|
1642 checkHighlight = ETrue; |
|
1643 } |
|
1644 else if ( ctrl->ControlType() == EMsgBodyControl ) |
|
1645 { |
|
1646 CItemFinder* itemFinder = iView->ItemFinder(); |
|
1647 if ( FocusedControlId() == EMsgComponentIdBody && itemFinder |
|
1648 && !itemFinder->CurrentSelection().Length() ) |
|
1649 { |
|
1650 checkHighlight = ETrue; |
|
1651 } |
|
1652 } |
|
1653 } |
|
1654 if ( ctrl && checkHighlight ) |
|
1655 { |
|
1656 // Check if highlight needs to be restored to editor, |
|
1657 // address/body editor offerkeyevent will handle it |
|
1658 if ( ctrl->Editor().OfferKeyEventL( aKeyEvent, aType ) |
|
1659 == EKeyWasConsumed ) |
|
1660 { |
|
1661 // Highlight was restored, just return, no cs menu needed |
|
1662 return EKeyWasConsumed; |
|
1663 } |
|
1664 } |
|
1665 |
|
1666 // Selection-key checking (Context sensitive menu) |
|
1667 // (with Class 0 just show the menu) |
|
1668 if ( !iClass0CBA ) |
|
1669 { |
|
1670 MenuBar()->SetMenuTitleResourceId( R_SMSV_CONTEXTMENUBAR ); |
|
1671 MenuBar()->SetMenuType(CEikMenuBar::EMenuContext); |
|
1672 } |
|
1673 MenuBar()->TryDisplayMenuBarL(); |
|
1674 if ( !iClass0CBA ) |
|
1675 { |
|
1676 MenuBar()->SetMenuTitleResourceId( R_SMSV_OPTIONSMENUBAR ); |
|
1677 MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions); |
|
1678 } |
|
1679 return EKeyWasConsumed; |
|
1680 } |
|
1681 case EKeyYes: |
|
1682 {// Send-key checking |
|
1683 if ( !iFlags.iIrBt && !iFlags.iBioMsg && !iFlags.iGms && !iFlags.iIsEmailMessage && |
|
1684 !iFlags.iAutoLockEnabled ) |
|
1685 { // normal sms |
|
1686 DoHandleSendKeyL(); |
|
1687 } |
|
1688 else if ( iFlags.iValidSenderNumber && !iFlags.iIrBt && !iFlags.iIsEmailMessage |
|
1689 && !iFlags.iAutoLockEnabled ) |
|
1690 { // bio / gms - sms |
|
1691 TBool okToQuery( ETrue ); |
|
1692 // Is it biocontrol? |
|
1693 if ( iFlags.iBioMsg ) |
|
1694 { |
|
1695 TUint32 permBio = OptionsMenuPermissionsBioL(); |
|
1696 okToQuery = ( permBio & EMsgBioCallBack ) ? ETrue : EFalse ; |
|
1697 } |
|
1698 // Launch confirmation query and start calling |
|
1699 if ( okToQuery ) |
|
1700 { |
|
1701 if ( iMsgVoIPExtension && |
|
1702 iMsgVoIPExtension->IsPreferredTelephonyVoIP() && |
|
1703 iMsgVoIPExtension->VoIPProfilesExistL() ) |
|
1704 { |
|
1705 MsvUiServiceUtilitiesInternal::InternetCallToSenderQueryL( iNumber, iRecipientstring, ETrue ); |
|
1706 } |
|
1707 else |
|
1708 { |
|
1709 MsvUiServiceUtilitiesInternal::CallToSenderQueryL( iNumber, iRecipientstring, ETrue ); |
|
1710 } |
|
1711 } |
|
1712 } |
|
1713 } |
|
1714 |
|
1715 default: |
|
1716 break; |
|
1717 } |
|
1718 |
|
1719 if ( !iClass0CBA ) // ignore following events if class 0 sms |
|
1720 { |
|
1721 switch ( aKeyEvent.iCode ) |
|
1722 { |
|
1723 case EKeyRightArrow: |
|
1724 {// Show next message if possible |
|
1725 if ( IsNextMessageAvailableL( ETrue )) |
|
1726 { |
|
1727 NextMessageL( ETrue ); |
|
1728 return EKeyWasConsumed; |
|
1729 } |
|
1730 } |
|
1731 break; |
|
1732 case EKeyLeftArrow: |
|
1733 { // Show prev message if possible |
|
1734 if ( IsNextMessageAvailableL( EFalse )) |
|
1735 { |
|
1736 NextMessageL( EFalse ); |
|
1737 return EKeyWasConsumed; |
|
1738 } |
|
1739 } |
|
1740 break; |
|
1741 case EKeyBackspace: |
|
1742 { |
|
1743 DoFileDeleteL(); |
|
1744 return EKeyWasConsumed; |
|
1745 } |
|
1746 default: |
|
1747 break; |
|
1748 } |
|
1749 } |
|
1750 else |
|
1751 { // class 0 |
|
1752 return EKeyWasConsumed; |
|
1753 } |
|
1754 } |
|
1755 else // App is not running properly yet |
|
1756 { |
|
1757 return EKeyWasConsumed; |
|
1758 } |
|
1759 |
|
1760 return EKeyWasNotConsumed; |
|
1761 } |
|
1762 |
|
1763 // --------------------------------------------------------- |
|
1764 // CMsgSmsViewerAppUi::DoMsgSaveExitL |
|
1765 // (other items were commented in a header). |
|
1766 // --------------------------------------------------------- |
|
1767 void CMsgSmsViewerAppUi::DoMsgSaveExitL() |
|
1768 { |
|
1769 // exit in anycase |
|
1770 Exit(); |
|
1771 } |
|
1772 |
|
1773 // --------------------------------------------------------- |
|
1774 // CMsgSmsViewerAppUi::DoFileDeleteL |
|
1775 // (other items were commented in a header). |
|
1776 // --------------------------------------------------------- |
|
1777 void CMsgSmsViewerAppUi::DoFileDeleteL() |
|
1778 { |
|
1779 // Load the texts from resources |
|
1780 HBufC* text = StringLoader::LoadLC( R_QTN_QUERY_COMMON_CONF_DELETE_ME, iCoeEnv ); |
|
1781 |
|
1782 // Confirm from user deletion of message and delete if needed. |
|
1783 CAknQueryDialog* dlg = CAknQueryDialog::NewL(); |
|
1784 if ( dlg->ExecuteLD( R_DELETEMSGCONF_QUERY, *text )) |
|
1785 { |
|
1786 DeleteAndExitL(); |
|
1787 } |
|
1788 |
|
1789 CleanupStack::PopAndDestroy(); // text, confText |
|
1790 } |
|
1791 |
|
1792 // --------------------------------------------------------- |
|
1793 // CMsgSmsViewerAppUi::DoMoveEntryL |
|
1794 // (other items were commented in a header). |
|
1795 // --------------------------------------------------------- |
|
1796 void CMsgSmsViewerAppUi::DoMoveEntryL() |
|
1797 { |
|
1798 CMsvEntry& entry = Document()->CurrentEntry(); |
|
1799 TMsvEntry msvEntry( entry.Entry()); |
|
1800 |
|
1801 // When going in to SelectFolder-dialog folderId is |
|
1802 // the folder where message is, but when coming |
|
1803 // out (if selection done) it has the value of destination |
|
1804 // folder. |
|
1805 TMsvId folderId = msvEntry.Parent(); |
|
1806 HBufC* text = StringLoader::LoadLC( R_QTN_MCE_MOVE_MOVE_TO, iCoeEnv ); |
|
1807 |
|
1808 // Launch moving-dialog and proceed if ok-returned |
|
1809 TBool moveIt = CMsgFolderSelectionDialog::SelectFolderL( folderId, *text ); |
|
1810 CleanupStack::PopAndDestroy(); // text |
|
1811 if ( moveIt ) |
|
1812 { |
|
1813 MoveMessageEntryL( folderId ); |
|
1814 Exit( EAknSoftkeyClose ); |
|
1815 } |
|
1816 } |
|
1817 |
|
1818 // ---------------------------------------------------- |
|
1819 // CMsgSmsViewerAppUi::DoSearchL |
|
1820 // (other items were commented in a header). |
|
1821 // ---------------------------------------------------- |
|
1822 void CMsgSmsViewerAppUi::DoSearchL( TInt aCommand ) |
|
1823 { |
|
1824 __ASSERT_DEBUG(!iFlags.iBioMsg, Panic(EMsgSmsNotAllowedForBio)); |
|
1825 CFindItemDialog* dlg; |
|
1826 |
|
1827 CMsgBodyControl* ctrl = STATIC_CAST( CMsgBodyControl*, |
|
1828 iView->ControlById( |
|
1829 EMsgComponentIdBody )); |
|
1830 |
|
1831 dlg = CFindItemDialog::NewL( |
|
1832 ctrl->TextContent().Read( 0 ), |
|
1833 iFindItemMenu->SearchCase( aCommand) ); |
|
1834 |
|
1835 dlg->ExecuteLD(); |
|
1836 } |
|
1837 |
|
1838 // ---------------------------------------------------- |
|
1839 // CMsgSmsViewerAppUi::DoCallBackToSenderL |
|
1840 // (other items were commented in a header). |
|
1841 // ---------------------------------------------------- |
|
1842 void CMsgSmsViewerAppUi::DoCallBackToSenderL() |
|
1843 { |
|
1844 if ( iFlags.iValidSenderNumber ) |
|
1845 { |
|
1846 MsvUiServiceUtilitiesInternal::CallToSenderQueryL( iNumber, iRecipientstring ); |
|
1847 } |
|
1848 } |
|
1849 |
|
1850 // --------------------------------------------------------- |
|
1851 // CMsgSmsViewerAppUi::DoCreateContactCardL |
|
1852 // (other items were commented in a header). |
|
1853 // --------------------------------------------------------- |
|
1854 void CMsgSmsViewerAppUi::DoCreateContactCardL( TInt aCommand ) |
|
1855 { |
|
1856 CAiwGenericParamList& inList = iAiwServiceHandler->InParamListL(); |
|
1857 InitAiwContactCardParamL( inList ); |
|
1858 // Callback is not specified as we are not interested in the outcome of the assign |
|
1859 // operation. |
|
1860 iAiwServiceHandler->ExecuteMenuCmdL( aCommand, inList, |
|
1861 iAiwServiceHandler->OutParamListL(), 0, NULL); |
|
1862 } |
|
1863 |
|
1864 // ---------------------------------------------------- |
|
1865 // CMsgSmsViewerAppUi::OpCompleted |
|
1866 // ---------------------------------------------------- |
|
1867 void CMsgSmsViewerAppUi::OpCompleted( |
|
1868 CMsvSingleOpWatcher& aOpWatcher, |
|
1869 TInt aCompletionCode ) |
|
1870 { |
|
1871 CMsvOperation* op = &aOpWatcher.Operation(); |
|
1872 // Must be trapped because calls Leaving function |
|
1873 TRAP_IGNORE( DoOperationCompletedL( op, aCompletionCode ) );// Ignored as non critical block |
|
1874 // The only operation |
|
1875 delete iViewerOperation; |
|
1876 iViewerOperation = NULL; |
|
1877 } |
|
1878 |
|
1879 // ---------------------------------------------------- |
|
1880 // CMsgSmsViewerAppUi::DoOperationCompletedL |
|
1881 // ---------------------------------------------------- |
|
1882 void CMsgSmsViewerAppUi::DoOperationCompletedL( |
|
1883 CMsvOperation* aOperation, |
|
1884 TInt aCompletionCode ) |
|
1885 { |
|
1886 __ASSERT_DEBUG( aOperation, Panic( EMsgSmsNullPointer ) ); |
|
1887 if ( aOperation && aCompletionCode == EEikCmdExit ) |
|
1888 { |
|
1889 CAknAppUi::ProcessCommandL( EAknCmdExit ); |
|
1890 } |
|
1891 } |
|
1892 |
|
1893 // --------------------------------------------------------- |
|
1894 // CMsgSmsViewerAppUi::DoMessageInfoL |
|
1895 // (other items were commented in a header). |
|
1896 // --------------------------------------------------------- |
|
1897 void CMsgSmsViewerAppUi::DoMessageInfoL() |
|
1898 { |
|
1899 __ASSERT_DEBUG( !iViewerOperation, Panic( EMsgSmsNullPointer ) ); |
|
1900 CMsvEntrySelection* selection = NULL; // Not used by KMtmUiFunctionMessageInfo |
|
1901 CAknInputBlock::NewLC(); |
|
1902 CBaseMtmUi& uiMtm = Document()->MtmUiL(); |
|
1903 TBuf8<1> dummy; |
|
1904 CMsvSingleOpWatcher* singleOpWatcher = CMsvSingleOpWatcher::NewL( *this ); |
|
1905 CleanupStack::PushL( singleOpWatcher ); |
|
1906 |
|
1907 CMsvOperation* op = uiMtm.InvokeAsyncFunctionL( |
|
1908 KMtmUiFunctionMessageInfo, |
|
1909 *selection, |
|
1910 singleOpWatcher->iStatus, |
|
1911 dummy ); |
|
1912 iViewerOperation = singleOpWatcher; |
|
1913 CleanupStack::Pop( 1 ); // singleOpWatcher |
|
1914 singleOpWatcher->SetOperation( op ); |
|
1915 |
|
1916 CleanupStack::PopAndDestroy( 1 );// CAknInputBlock |
|
1917 } |
|
1918 |
|
1919 // ---------------------------------------------------- |
|
1920 // CMsgSmsViewerAppUi::ForwardGmsL |
|
1921 // (other items were commented in a header). |
|
1922 // ---------------------------------------------------- |
|
1923 void CMsgSmsViewerAppUi::ForwardGmsL(TMsvId aTarget) |
|
1924 { |
|
1925 DoFwdRepGmsL(aTarget, ETrue); |
|
1926 } |
|
1927 |
|
1928 // ---------------------------------------------------- |
|
1929 // CMsgSmsViewerAppUi::ReplyGmsL |
|
1930 // (other items were commented in a header). |
|
1931 // ---------------------------------------------------- |
|
1932 void CMsgSmsViewerAppUi::ReplyGmsL(TMsvId aTarget) |
|
1933 { |
|
1934 DoFwdRepGmsL(aTarget, EFalse); |
|
1935 } |
|
1936 |
|
1937 // ---------------------------------------------------- |
|
1938 // CMsgSmsViewerAppUi::DoFwdRepGmsL |
|
1939 // (other items were commented in a header). |
|
1940 // ---------------------------------------------------- |
|
1941 void CMsgSmsViewerAppUi::DoFwdRepGmsL(TMsvId aTarget, TBool aForward) |
|
1942 { |
|
1943 CMsgEditorDocument& document = *Document(); |
|
1944 TMsvId origMsgId = document.Entry().Id(); |
|
1945 |
|
1946 // Change the MTM type of msg temporarily |
|
1947 CMsvEntry* entry = |
|
1948 document.Session().GetEntryL(origMsgId); |
|
1949 CleanupStack::PushL(entry); |
|
1950 |
|
1951 TMsvEntry tentry(entry->Entry()); |
|
1952 const TUid OrigMtmUid = tentry.iMtm; |
|
1953 tentry.iMtm = KUidSmsMtm; |
|
1954 |
|
1955 // Trap errors, so we can try to restore the original MTM Uid |
|
1956 TRAPD(err, |
|
1957 { |
|
1958 entry->ChangeL(tentry); |
|
1959 document.SetEntryWithoutNotificationL(origMsgId); |
|
1960 |
|
1961 if (aForward) |
|
1962 { |
|
1963 ForwardL(aTarget); |
|
1964 } |
|
1965 else |
|
1966 { |
|
1967 ReplyL(aTarget); |
|
1968 } |
|
1969 |
|
1970 }); |
|
1971 // Restore original Mtm Uid |
|
1972 tentry = entry->Entry(); |
|
1973 tentry.iMtm = OrigMtmUid; |
|
1974 entry->ChangeL(tentry); |
|
1975 document.SetEntryWithoutNotificationL(origMsgId); |
|
1976 |
|
1977 User::LeaveIfError(err); |
|
1978 CleanupStack::PopAndDestroy(entry); |
|
1979 } |
|
1980 |
|
1981 // ---------------------------------------------------- |
|
1982 // CMsgSmsViewerAppUi::SaveClass0SmsL |
|
1983 // (other items were commented in a header). |
|
1984 // ---------------------------------------------------- |
|
1985 void CMsgSmsViewerAppUi::SaveClass0SmsL( TBool aShowNotes ) |
|
1986 { |
|
1987 if ( aShowNotes ) |
|
1988 { // Show global "Saved"-note |
|
1989 HBufC* text = StringLoader::LoadLC( R_QTN_MCE_CONF_MESSAGE_SAVED, iCoeEnv ); |
|
1990 CAknGlobalNote* note = CAknGlobalNote::NewLC(); |
|
1991 note->ShowNoteL( EAknGlobalConfirmationNote, *text ); |
|
1992 CleanupStack::PopAndDestroy( 2 ); // note, text |
|
1993 } |
|
1994 |
|
1995 // Get handle to entry |
|
1996 const CMsgSmsViewerDocument* doc = Document(); |
|
1997 CMsvEntry& entry = doc->CurrentEntry(); |
|
1998 TMsvEntry msvEntry( entry.Entry()); |
|
1999 |
|
2000 // Read values from TMsvEntry |
|
2001 HBufC* details = msvEntry.iDetails.AllocLC(); |
|
2002 HBufC* description = msvEntry.iDescription.AllocLC(); |
|
2003 |
|
2004 // Ensure entry is not read only |
|
2005 msvEntry.SetReadOnly( EFalse ); |
|
2006 entry.ChangeL( msvEntry ); |
|
2007 |
|
2008 // Set class from 0 to 1 and save |
|
2009 CMsvStore* msvstore = entry.EditStoreL(); |
|
2010 CleanupStack::PushL( msvstore ); |
|
2011 iSmsHeader->Message().SmsPDU().SetClass( |
|
2012 ETrue, TSmsDataCodingScheme::ESmsClass1 ); |
|
2013 iSmsHeader->StoreL( *msvstore ); |
|
2014 msvstore->Commit(); |
|
2015 CleanupStack::PopAndDestroy(); // msvstore |
|
2016 |
|
2017 // Put values back to TMsvEntry |
|
2018 msvEntry.iDetails.Set( *details ); |
|
2019 msvEntry.iDescription.Set( *description ); |
|
2020 |
|
2021 // Change entry back to read only and ensure it's visible |
|
2022 msvEntry.SetReadOnly( ETrue ); |
|
2023 msvEntry.SetInPreparation( EFalse ); |
|
2024 msvEntry.SetVisible( ETrue ); |
|
2025 entry.ChangeL( msvEntry ); |
|
2026 CleanupStack::PopAndDestroy( 2 ); // details, description |
|
2027 } |
|
2028 |
|
2029 // --------------------------------------------------------- |
|
2030 // CMsgSmsViewerAppUi::ApproximateReplyForwardSize |
|
2031 // (other items were commented in a header). |
|
2032 // --------------------------------------------------------- |
|
2033 TInt CMsgSmsViewerAppUi::ApproximateReplyForwardSize( TBool aForward ) |
|
2034 { |
|
2035 // |
|
2036 // Approximate size |
|
2037 TInt approximatedSize = 0; |
|
2038 if ( aForward ) |
|
2039 { // yes, forward |
|
2040 if ( iFlags.iGms ) |
|
2041 { // picture msg |
|
2042 approximatedSize = KApproxEmptyTMsvEntrySize + KApproxFullGMS; |
|
2043 } |
|
2044 else |
|
2045 { // normal sms |
|
2046 approximatedSize = KApproxEmptyTMsvEntrySize + STATIC_CAST( CMsgBodyControl*, iView->ControlById( EMsgComponentIdBody ))->Editor().TextLength()*2; // multiplied because of unicode saving |
|
2047 } |
|
2048 } |
|
2049 else |
|
2050 { // no, reply (same for normal sms and gms) |
|
2051 approximatedSize = KApproxEmptyTMsvEntrySize + KApproxRecipientSize; |
|
2052 } |
|
2053 |
|
2054 return approximatedSize; |
|
2055 } |
|
2056 |
|
2057 // --------------------------------------------------------- |
|
2058 // CMsgSmsViewerAppUi::CheckDiskAndReplyForwardL |
|
2059 // (other items were commented in a header). |
|
2060 // --------------------------------------------------------- |
|
2061 void CMsgSmsViewerAppUi::CheckDiskAndReplyForwardL( TBool aForward ) |
|
2062 { |
|
2063 // |
|
2064 // Check disk |
|
2065 if ( MsvUiServiceUtilities::DiskSpaceBelowCriticalLevelL( |
|
2066 Document()->Session(), |
|
2067 ApproximateReplyForwardSize( aForward ))) |
|
2068 { |
|
2069 User::Leave( KErrDiskFull ); |
|
2070 } |
|
2071 |
|
2072 //to reduce flickering after sending a message. |
|
2073 if (!(iEditorBaseFeatures & EStayInViewerAfterReply )) |
|
2074 { |
|
2075 if(iToolbar) |
|
2076 { |
|
2077 iToolbar->SetToolbarVisibility( EFalse ); |
|
2078 } |
|
2079 iView->MakeVisible( EFalse ); |
|
2080 iNaviDecorator->MakeVisible( EFalse ); |
|
2081 } |
|
2082 |
|
2083 TRAPD(err, DoReplyFwdL( aForward )); |
|
2084 if(!(err == KErrNone) ) |
|
2085 { |
|
2086 iNaviDecorator->MakeVisible( ETrue ); |
|
2087 iView->MakeVisible( ETrue ); |
|
2088 if(iToolbar) |
|
2089 { |
|
2090 iToolbar->SetToolbarVisibility( ETrue ); |
|
2091 } |
|
2092 } |
|
2093 |
|
2094 } |
|
2095 |
|
2096 // --------------------------------------------------------- |
|
2097 // CMsgSmsViewerAppUi::DoReplyFwdL |
|
2098 // (other items were commented in a header). |
|
2099 // --------------------------------------------------------- |
|
2100 void CMsgSmsViewerAppUi::DoReplyFwdL( TBool aForward ) |
|
2101 { |
|
2102 // Actual forward / reply |
|
2103 // Are we forwarding... |
|
2104 if ( aForward ) |
|
2105 { //...yes, forwarding |
|
2106 if ( iFlags.iGms ) |
|
2107 { |
|
2108 ForwardGmsL( Document()->DefaultMsgFolder()); |
|
2109 } |
|
2110 else |
|
2111 { |
|
2112 ForwardL( Document()->DefaultMsgFolder()); |
|
2113 } |
|
2114 } |
|
2115 else |
|
2116 { //...no, we're replying |
|
2117 if ( iFlags.iGms ) |
|
2118 { |
|
2119 ReplyGmsL( Document()->DefaultMsgFolder()); |
|
2120 } |
|
2121 else |
|
2122 { |
|
2123 ReplyL( Document()->DefaultMsgFolder()); |
|
2124 } |
|
2125 } |
|
2126 } |
|
2127 |
|
2128 // --------------------------------------------------------- |
|
2129 // CMsgSmsViewerAppUi::HandleEntryDeletedL |
|
2130 // (other items were commented in a header). |
|
2131 // --------------------------------------------------------- |
|
2132 void CMsgSmsViewerAppUi::HandleEntryDeletedL() |
|
2133 { |
|
2134 Exit( EAknSoftkeyClose ); |
|
2135 } |
|
2136 |
|
2137 // ---------------------------------------------------- |
|
2138 // CMsgSmsViewerAppUi::LaunchHelpL |
|
2139 // launch help using context |
|
2140 // ---------------------------------------------------- |
|
2141 void CMsgSmsViewerAppUi::LaunchHelpL() |
|
2142 { |
|
2143 if ( iFlags.iHelpFeatureSupported ) |
|
2144 { |
|
2145 // activate Help application |
|
2146 CArrayFix<TCoeHelpContext>* helpContext = AppHelpContextL(); |
|
2147 HlpLauncher::LaunchHelpApplicationL( iEikonEnv->WsSession(), helpContext ); |
|
2148 } |
|
2149 } |
|
2150 |
|
2151 |
|
2152 // ---------------------------------------------------- |
|
2153 // CMsgSmsViewerAppUi::HelpContextL |
|
2154 // returns help context |
|
2155 // ---------------------------------------------------- |
|
2156 CArrayFix<TCoeHelpContext>* CMsgSmsViewerAppUi::HelpContextL() const |
|
2157 { |
|
2158 // Check if not bio message or picture message |
|
2159 if ( !iFlags.iBioMsg && !iFlags.iGms ) |
|
2160 { |
|
2161 // sms editor and sms viewer use same help file, in which |
|
2162 // sms editor id is used |
|
2163 return CreateHelpContextArrayL( |
|
2164 TCoeHelpContext( KUidSmsViewer, KSMS_HLP_VIEWER())); |
|
2165 } |
|
2166 |
|
2167 // Help context of picture message |
|
2168 // GMS xhtml-help is now under smartmessaging |
|
2169 else if ( iFlags.iGms ) |
|
2170 { |
|
2171 return CreateHelpContextArrayL( |
|
2172 TCoeHelpContext( KUidGMSViewer, KSMART_HLP_GMSVIEWER())); |
|
2173 } |
|
2174 |
|
2175 // Help context of bio messages |
|
2176 else |
|
2177 { |
|
2178 TCoeHelpContext bioControlHelpContext; |
|
2179 BioBody().BioControl().GetHelpContext( bioControlHelpContext ); |
|
2180 if ( !bioControlHelpContext.IsNull()) |
|
2181 { |
|
2182 return CreateHelpContextArrayL( bioControlHelpContext ); |
|
2183 } |
|
2184 // if help context not available for bio control |
|
2185 else |
|
2186 { |
|
2187 return NULL; |
|
2188 } |
|
2189 } |
|
2190 } |
|
2191 |
|
2192 // ---------------------------------------------------- |
|
2193 // CMsgSmsViewerAppUi::CreateHelpContextArrayL |
|
2194 // |
|
2195 // ---------------------------------------------------- |
|
2196 CArrayFix<TCoeHelpContext>* CMsgSmsViewerAppUi::CreateHelpContextArrayL( const TCoeHelpContext& aHelpContext ) const |
|
2197 { |
|
2198 CArrayFix<TCoeHelpContext>* r = new(ELeave) CArrayFixFlat<TCoeHelpContext>(1); |
|
2199 CleanupStack::PushL(r); |
|
2200 r->AppendL(aHelpContext); |
|
2201 CleanupStack::Pop(r); |
|
2202 return r; |
|
2203 } |
|
2204 |
|
2205 // ---------------------------------------------------- |
|
2206 // CMsgSmsViewerAppUi::DoHandleSendKeyL |
|
2207 // |
|
2208 // ---------------------------------------------------- |
|
2209 void CMsgSmsViewerAppUi::DoHandleSendKeyL() |
|
2210 { |
|
2211 if ( !iMsgVoIPExtension ) |
|
2212 { |
|
2213 return; |
|
2214 } |
|
2215 |
|
2216 TPtrC number = KNullDesC(); |
|
2217 TPtrC alias = KNullDesC(); |
|
2218 TPtrC focusedAddr = KNullDesC(); |
|
2219 TBool dailerDisabled = EFalse; |
|
2220 // sender-number |
|
2221 if ( iFlags.iValidSenderNumber ) |
|
2222 { |
|
2223 number.Set( *&iNumber ); |
|
2224 if ( iRecipientstring.Length() ) |
|
2225 { |
|
2226 alias.Set( *&iRecipientstring ); |
|
2227 } |
|
2228 if(IsSenderFocused()) |
|
2229 { |
|
2230 //Disabling the SendKey Event handling by Avkon |
|
2231 iAvkonAppUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | CAknAppUiBase::EDisableSendKeyLong ); |
|
2232 dailerDisabled = ETrue; |
|
2233 } |
|
2234 } |
|
2235 |
|
2236 if ( IsBodyFocused() && iView->ItemFinder( ) ) |
|
2237 { |
|
2238 const CItemFinder::CFindItemExt& item = |
|
2239 iView->ItemFinder( )->CurrentItemExt( ); |
|
2240 if ( item.iItemDescriptor |
|
2241 && ( item.iItemType == CItemFinder::EPhoneNumber |
|
2242 || item.iItemType == CItemFinder::EEmailAddress ) ) |
|
2243 { |
|
2244 //Dialer is opened when creating a VoIP call from SMS via Call creation key |
|
2245 //Disabling the SendKey Event handling by Avkon |
|
2246 iAvkonAppUi->SetKeyEventFlags( CAknAppUiBase::EDisableSendKeyShort | CAknAppUiBase::EDisableSendKeyLong ); |
|
2247 dailerDisabled = ETrue; |
|
2248 focusedAddr.Set( *(item.iItemDescriptor) ); |
|
2249 } |
|
2250 } |
|
2251 |
|
2252 if(dailerDisabled) |
|
2253 { |
|
2254 MsvUiServiceUtilitiesInternal::InternetOrVoiceCallServiceL( |
|
2255 *iMsgVoIPExtension, |
|
2256 number, |
|
2257 alias, |
|
2258 focusedAddr, |
|
2259 ETrue, |
|
2260 iEikonEnv ); |
|
2261 } |
|
2262 } |
|
2263 |
|
2264 // ---------------------------------------------------- |
|
2265 // CMsgSmsViewerAppUi::SetAutomaticHighlightL |
|
2266 // |
|
2267 // ---------------------------------------------------- |
|
2268 void CMsgSmsViewerAppUi::SetAutomaticHighlightL( const TBool aSwitchON ) |
|
2269 { |
|
2270 __ASSERT_DEBUG( !iFlags.iGms, Panic( EMsgSmsNotForGms ) ); |
|
2271 __ASSERT_DEBUG( !iFlags.iBioMsg, Panic( EMsgSmsNotAllowedForBio ) ); |
|
2272 if ( iView->ItemFinder() ) |
|
2273 { |
|
2274 // content highlight |
|
2275 if ( aSwitchON ) |
|
2276 { // switch ON |
|
2277 iView->ItemFinder()->SetFindModeL( |
|
2278 CItemFinder::EPhoneNumber | |
|
2279 CItemFinder::EUrlAddress | |
|
2280 CItemFinder::EEmailAddress ); |
|
2281 } |
|
2282 else |
|
2283 { // switch OFF |
|
2284 iView->ItemFinder()->SetFindModeL( |
|
2285 CItemFinder::ENoneSelected ); |
|
2286 } |
|
2287 // header highlight |
|
2288 if ( iControlId != EMsgComponentIdTo && iFlags.iValidSenderNumber ) |
|
2289 { |
|
2290 static_cast<CMsgAddressControl*> |
|
2291 (iView->ControlById( iControlId ))->SetAddressFieldAutoHighlight( aSwitchON ); |
|
2292 |
|
2293 } |
|
2294 } |
|
2295 } |
|
2296 |
|
2297 // ---------------------------------------------------- |
|
2298 // CMsgSmsViewerAppUi::ReadAutoHlSharedDataValueL |
|
2299 // |
|
2300 // ---------------------------------------------------- |
|
2301 void CMsgSmsViewerAppUi::ReadAutoHlSharedDataValueAndSetNotifyL() |
|
2302 { |
|
2303 __ASSERT_DEBUG( !iFlags.iGms, Panic( EMsgSmsNotForGms ) ); |
|
2304 __ASSERT_DEBUG( !iFlags.iBioMsg, Panic( EMsgSmsNotAllowedForBio ) ); |
|
2305 if ( iFlags.iAutomaticHlInitialized ) |
|
2306 return; |
|
2307 // Create the session |
|
2308 iCenRepSession = CRepository::NewL( KCRUidCommonUi ); |
|
2309 if( iCenRepSession ) |
|
2310 { |
|
2311 // Get the value of AutomaticHighlight key |
|
2312 TBool value = ETrue; |
|
2313 iCenRepSession->Get( KCuiAutomaticHighlight, value ); |
|
2314 iFlags.iAutomaticHlValue = value; |
|
2315 // Create the notifer |
|
2316 iNotifier = |
|
2317 CCenRepNotifyHandler::NewL( |
|
2318 *this, *iCenRepSession, CCenRepNotifyHandler::EIntKey, |
|
2319 KCuiAutomaticHighlight ); |
|
2320 // Start listening |
|
2321 iNotifier->StartListeningL(); |
|
2322 } |
|
2323 iFlags.iAutomaticHlInitialized = ETrue; // Done once per viewer |
|
2324 } |
|
2325 |
|
2326 // ---------------------------------------------------------------------------- |
|
2327 // CMsgSmsViewerAppUi::HandleNotifyInt |
|
2328 // ---------------------------------------------------------------------------- |
|
2329 // |
|
2330 void CMsgSmsViewerAppUi::HandleNotifyInt( |
|
2331 TUint32 /*aId*/, |
|
2332 TInt aNewValue ) |
|
2333 { |
|
2334 // Notifies changes on KCuiAutomaticHighlight |
|
2335 iFlags.iAutomaticHlValue = aNewValue; |
|
2336 TRAP_IGNORE( SetAutomaticHighlightL( aNewValue ) ); |
|
2337 } |
|
2338 |
|
2339 // ---------------------------------------------------------------------------- |
|
2340 // CMsgSmsViewerAppUi::HandleNotifyError |
|
2341 // ---------------------------------------------------------------------------- |
|
2342 // |
|
2343 void CMsgSmsViewerAppUi::HandleNotifyError( |
|
2344 TUint32 /*aId*/, |
|
2345 TInt /* aError */, |
|
2346 CCenRepNotifyHandler* /* aHandler */ ) |
|
2347 { |
|
2348 // Remove session and notifier |
|
2349 if( iNotifier ) |
|
2350 { |
|
2351 iNotifier->StopListening(); |
|
2352 delete iNotifier; |
|
2353 iNotifier = NULL; |
|
2354 } |
|
2355 delete iCenRepSession; |
|
2356 iCenRepSession = NULL; |
|
2357 } |
|
2358 |
|
2359 // ---------------------------------------------------- |
|
2360 // CMsgSmsViewerAppUi::DoReplyViaL |
|
2361 // |
|
2362 // ---------------------------------------------------- |
|
2363 void CMsgSmsViewerAppUi::DoReplyViaL( TInt aCase ) |
|
2364 { |
|
2365 __ASSERT_DEBUG( iControlId != |
|
2366 EMsgComponentIdTo, Panic( EMsgSmsNoSuchComponent ) ); |
|
2367 |
|
2368 CMessageData* msgData = CMessageData::NewL(); |
|
2369 CleanupStack::PushL( msgData ); |
|
2370 CMsgAddressControl* addressControl = |
|
2371 static_cast<CMsgAddressControl*> ( iView->ControlById( iControlId ) ); |
|
2372 if ( addressControl ) |
|
2373 { |
|
2374 CMsgRecipientArray& recs = *addressControl->GetRecipientsL(); |
|
2375 TInt count(recs.Count()); |
|
2376 for (TInt index = 0; index < count; index++) |
|
2377 { |
|
2378 if ( iFlags.iIsEmailMessage ) |
|
2379 { |
|
2380 msgData->AppendToAddressL( |
|
2381 *recs.At( index )->Name(), |
|
2382 KNullDesC() ); |
|
2383 //sender->AppendL( *recs.At( index )->Name() ); |
|
2384 //alias->AppendL( KNullDesC() ); |
|
2385 } |
|
2386 else |
|
2387 { |
|
2388 msgData->AppendToAddressL( |
|
2389 *recs.At( index )->Address(), |
|
2390 *recs.At( index )->Name() ); |
|
2391 } |
|
2392 } |
|
2393 } |
|
2394 // Via MMS, Email, Audio or to Unieditor |
|
2395 TUid mtmUid; |
|
2396 switch( aCase ) |
|
2397 { |
|
2398 case ESmsViewerReplyViaMms: |
|
2399 mtmUid = KSenduiMtmMmsUid; |
|
2400 break; |
|
2401 case ESmsViewerReplyViaEmail: |
|
2402 mtmUid = KSenduiMtmSmtpUid; |
|
2403 break; |
|
2404 case ESmsViewerReplyViaAudio: |
|
2405 mtmUid = KSenduiMtmAudioMessageUid; |
|
2406 break; |
|
2407 case ESmsViewerReplyViaMessage: //unieditor |
|
2408 mtmUid = KSenduiMtmUniMessageUid; |
|
2409 break; |
|
2410 default: |
|
2411 __ASSERT_DEBUG( EFalse, Panic( EMsgSmsNoSuchMtmUid ) ); |
|
2412 mtmUid = KSenduiMtmUniMessageUid; // suppress compiler warning |
|
2413 break; |
|
2414 } |
|
2415 |
|
2416 |
|
2417 if ( iFlags.iEmailSubjectControlPresent ) |
|
2418 { |
|
2419 if ( SubjectControl()->TextContent().DocumentLength() ) |
|
2420 { |
|
2421 HBufC* buf = SubjectControl()->Editor().GetTextInHBufL(); |
|
2422 CleanupStack::PushL( buf ); |
|
2423 TInt length = buf->Length(); |
|
2424 HBufC* replyFormat = StringLoader::LoadLC( R_QTN_SMS_REPLYFORMAT, iCoeEnv ); |
|
2425 |
|
2426 _LIT( KSmsSubjectFormat, "%S" ); |
|
2427 TInt formatPos = replyFormat->Find( KSmsSubjectFormat ); |
|
2428 TInt foundInSubj = KErrNotFound; |
|
2429 if ( formatPos > 0 ) |
|
2430 { |
|
2431 // -1 to avoid % in the string |
|
2432 foundInSubj = buf->FindF( replyFormat->Left( formatPos-1 ) ); |
|
2433 } |
|
2434 HBufC* newSubject = NULL; |
|
2435 //append only when it is not in the beginning of the subject line or not found. |
|
2436 if ( foundInSubj==KErrNotFound || foundInSubj ) |
|
2437 { |
|
2438 // Create a buffer large enough to hold the re-formated subject - need |
|
2439 // to subtract two from the prefix length (the %S). |
|
2440 length += replyFormat->Length() - 2; |
|
2441 newSubject = HBufC::NewLC(length); |
|
2442 TPtr ptr( newSubject->Des() ); |
|
2443 // Format the reply subject |
|
2444 ptr.Format( replyFormat->Des(), buf ); |
|
2445 } |
|
2446 else |
|
2447 { |
|
2448 newSubject = buf->Des().AllocLC(); |
|
2449 } |
|
2450 msgData->SetSubjectL( newSubject ); |
|
2451 //CleanupStack::Pop( ); // newSubject |
|
2452 CleanupStack::PopAndDestroy( 3 ); // buf, replyFormat, newSubject |
|
2453 //CleanupStack::PushL( newSubject ); |
|
2454 } |
|
2455 } |
|
2456 iSendUi->CreateAndSendMessageL( mtmUid, msgData ); |
|
2457 CleanupStack::PopAndDestroy( msgData ); // msgData |
|
2458 } |
|
2459 |
|
2460 // ---------------------------------------------------- |
|
2461 // CMsgSmsViewerAppUi::AddSubjectControlL() |
|
2462 // |
|
2463 // ---------------------------------------------------- |
|
2464 void CMsgSmsViewerAppUi::AddSubjectControlL() |
|
2465 { |
|
2466 // Sanity |
|
2467 __ASSERT_DEBUG( iView, Panic( EMsgSmsNullPointer ) ); |
|
2468 if ( !iFlags.iEmailSubjectControlPresent ) |
|
2469 { |
|
2470 iView->AddControlFromResourceL( R_SMS_VIEWER_SUBJECT, |
|
2471 EMsgExpandableControl, EMsgAppendControl, EMsgHeader ); |
|
2472 // Mark the control creation |
|
2473 iFlags.iEmailSubjectControlPresent = ETrue; |
|
2474 } |
|
2475 } |
|
2476 |
|
2477 // ---------------------------------------------------- |
|
2478 // CMsgSmsViewerAppUi::SetSubjectL() |
|
2479 // |
|
2480 // ---------------------------------------------------- |
|
2481 void CMsgSmsViewerAppUi::SetSubjectL(const TDesC& aText) |
|
2482 { |
|
2483 CMsgExpandableControl* subjectControl = SubjectControl(); |
|
2484 if (subjectControl) |
|
2485 { |
|
2486 CRichText& subject = subjectControl->TextContent(); |
|
2487 subject.Reset(); |
|
2488 subject.InsertL( 0, aText ); |
|
2489 } |
|
2490 } |
|
2491 |
|
2492 // ---------------------------------------------------- |
|
2493 // CMsgSmsViewerAppUi::SubjectControl() |
|
2494 // |
|
2495 // ---------------------------------------------------- |
|
2496 CMsgExpandableControl* CMsgSmsViewerAppUi::SubjectControl() const |
|
2497 { |
|
2498 __ASSERT_DEBUG( iFlags.iEmailSubjectControlPresent, Panic( EMsgSmsNullPointer )); |
|
2499 return STATIC_CAST(CMsgExpandableControl*, |
|
2500 iView->ControlById(EMsgComponentIdSubject)); |
|
2501 } |
|
2502 |
|
2503 // ---------------------------------------------------- |
|
2504 // CMsgSmsViewerAppUi::InitAiwContactCardMenuL |
|
2505 // |
|
2506 // ---------------------------------------------------- |
|
2507 void CMsgSmsViewerAppUi::InitAiwContactCardMenuL( TInt aMenuId, |
|
2508 CEikMenuPane* aMenuPane ) |
|
2509 { |
|
2510 if ( !iAiwServiceHandler) |
|
2511 { |
|
2512 // Create AIW service handler and attach to contact card menu item |
|
2513 iAiwServiceHandler = CAiwServiceHandler::NewL(); |
|
2514 iAiwServiceHandler->AttachMenuL( aMenuId, |
|
2515 R_SMSV_AIW_CONTACT_INTEREST ); |
|
2516 } |
|
2517 |
|
2518 // This menu should contain AIW menu placeholder |
|
2519 __ASSERT_DEBUG( iAiwServiceHandler->IsAiwMenu( aMenuId ), |
|
2520 Panic( EMsgSmsAiwMenu ) ); |
|
2521 |
|
2522 CAiwGenericParamList& inList = iAiwServiceHandler->InParamListL(); |
|
2523 InitAiwContactCardParamL( inList ); |
|
2524 iAiwServiceHandler->InitializeMenuPaneL( *aMenuPane, aMenuId, |
|
2525 ESmsViewerCreateCCNew, inList ); |
|
2526 } |
|
2527 |
|
2528 // ---------------------------------------------------- |
|
2529 // CMsgSmsViewerAppUi::InitAiwContactCardSubMenuL |
|
2530 // |
|
2531 // ---------------------------------------------------- |
|
2532 void CMsgSmsViewerAppUi::InitAiwContactCardSubMenuL( CEikMenuPane* aMenuPane ) |
|
2533 { |
|
2534 // If menu is AIW sub-menu, AIW will initialize it |
|
2535 if ( iAiwServiceHandler && |
|
2536 iAiwServiceHandler->HandleSubmenuL( *aMenuPane ) ) |
|
2537 { |
|
2538 // We assume AIW inserts at most 2 items into the submenu. |
|
2539 // ESmsViewerCreateCCNew and ESmsViewerCreateCCExisting. |
|
2540 // Otherwise command codes will overlap |
|
2541 #ifdef _DEBUG |
|
2542 const TInt KMaxItems = 2; |
|
2543 __ASSERT_ALWAYS( aMenuPane->NumberOfItemsInPane() <= |
|
2544 KMaxItems, Panic( EMsgSmsAiwMenu ) ); |
|
2545 #endif |
|
2546 } |
|
2547 } |
|
2548 |
|
2549 // ---------------------------------------------------- |
|
2550 // CMsgSmsViewerAppUi::InitAiwContactCardParamL() |
|
2551 // |
|
2552 // ---------------------------------------------------- |
|
2553 void CMsgSmsViewerAppUi::InitAiwContactCardParamL( |
|
2554 CAiwGenericParamList& aParamList ) const |
|
2555 { |
|
2556 using namespace AiwContactAssign; |
|
2557 |
|
2558 TAiwGenericParam param( EGenericParamContactAssignData ); |
|
2559 TAiwSingleContactAssignDataV1 assignData; |
|
2560 assignData.SetFlags( 0 ); |
|
2561 param.Value().Set( TAiwSingleContactAssignDataV1Pckg( assignData ) ); |
|
2562 aParamList.AppendL( param ); |
|
2563 |
|
2564 // Phone number |
|
2565 param.Reset(); |
|
2566 param.SetSemanticId( EGenericParamPhoneNumber ); |
|
2567 param.Value().Set( iNumber ); |
|
2568 aParamList.AppendL( param ); |
|
2569 } |
|
2570 |
|
2571 #ifdef RD_SCALABLE_UI_V2 |
|
2572 #ifndef RD_MSG_NAVIPANE_IMPROVEMENT |
|
2573 |
|
2574 // ----------------------------------------------------------------------------- |
|
2575 // handles the touch-ui related control events for next/previous message |
|
2576 // ----------------------------------------------------------------------------- |
|
2577 // |
|
2578 void CMsgSmsViewerAppUi::HandleNaviDecoratorEventL( TInt aEventID ) |
|
2579 { |
|
2580 if( AknLayoutUtils::PenEnabled() && |
|
2581 IsNextMessageAvailableL( aEventID == EAknNaviDecoratorEventRightTabArrow ) ) |
|
2582 { |
|
2583 /* no need for separate checks for right and left arrows |
|
2584 because IsNextMessageAvailableL() and NextMessageL |
|
2585 are called with the truth-value of the same comparison */ |
|
2586 NextMessageL( aEventID == EAknNaviDecoratorEventRightTabArrow ); |
|
2587 } |
|
2588 } |
|
2589 #else |
|
2590 void CMsgSmsViewerAppUi::HandleNaviDecoratorEventL( TInt /* aEventID */) |
|
2591 { |
|
2592 } |
|
2593 #endif // !RD_MSG_NAVIPANE_IMPROVEMENT |
|
2594 #else |
|
2595 void CMsgSmsViewerAppUi::HandleNaviDecoratorEventL( TInt /* aEventID */) |
|
2596 { |
|
2597 } |
|
2598 #endif |
|
2599 |
|
2600 #ifdef RD_MSG_FAST_PREV_NEXT |
|
2601 // ---------------------------------------------------- |
|
2602 // CMsgSmsViewerAppUi::CanFastOpenL |
|
2603 // ---------------------------------------------------- |
|
2604 TBool CMsgSmsViewerAppUi::CanFastOpenL( const CMessageIterator& aIterator ) |
|
2605 { |
|
2606 // Only sms messages can be fast opened. Bio message open is performed |
|
2607 // using bio mtm-server which parses the message before viewer is opened. |
|
2608 // Picture and configuration bio-messages seem to work without parsing by |
|
2609 // bio mtm-server. Vcards however do not work as there is no vcard attachment |
|
2610 // expected by the viewer unless message is parsed by the server first. |
|
2611 // Also, allow fast open only if currently sms is open. This ensures that |
|
2612 // the viewer is entered through sms mtm ui and before sms messages are viewed |
|
2613 // (CSmsMtmUi::CheckAndEnsureSmsServiceOkL() is executed). |
|
2614 TBool retVal = EFalse; |
|
2615 TMsvEntry msvEntry = Document()->Entry(); |
|
2616 if( msvEntry.iMtm.iUid == KSenduiMtmSmsUidValue && |
|
2617 aIterator.CurrentMessage().iMtm.iUid == KSenduiMtmSmsUidValue && |
|
2618 !msvEntry.iBioType ) |
|
2619 { |
|
2620 retVal = ETrue; |
|
2621 } |
|
2622 return retVal; |
|
2623 } |
|
2624 #endif |
|
2625 |
|
2626 // --------------------------------------------------------- |
|
2627 // OfferToolbarEventL |
|
2628 // --------------------------------------------------------- |
|
2629 // |
|
2630 #ifdef RD_SCALABLE_UI_V2 |
|
2631 void CMsgSmsViewerAppUi::OfferToolbarEventL( TInt aCommand ) |
|
2632 { |
|
2633 switch ( aCommand ) |
|
2634 { |
|
2635 case ESmsViewerToolbarReply: |
|
2636 HandleCommandL( ESmsViewerReplyViaMessage ); |
|
2637 break; |
|
2638 case ESmsViewerToolbarForward: |
|
2639 HandleCommandL( ESmsViewerForward ); |
|
2640 break; |
|
2641 case ESmsViewerToolbarDelete: |
|
2642 HandleCommandL( ESmsViewerDelete ); |
|
2643 break; |
|
2644 } |
|
2645 } |
|
2646 |
|
2647 #endif |
|
2648 |
|
2649 // --------------------------------------------------------- |
|
2650 // CAudioMessageAppUi::HandleResourceChangeL |
|
2651 // --------------------------------------------------------- |
|
2652 // |
|
2653 |
|
2654 void CMsgSmsViewerAppUi::HandleResourceChangeL( TInt aType ) |
|
2655 { |
|
2656 // Base class call must be first |
|
2657 CMsgEditorAppUi::HandleResourceChangeL(aType); |
|
2658 |
|
2659 if ( aType == KAknsMessageSkinChange ) |
|
2660 { |
|
2661 if ( iAppIcon ) |
|
2662 { |
|
2663 delete iAppIcon; |
|
2664 iAppIcon = NULL; |
|
2665 } |
|
2666 |
|
2667 // Set path of bitmap file |
|
2668 TParse fileParse; |
|
2669 fileParse.Set( KSmsBitmapFileName, &KDC_APP_BITMAP_DIR, NULL ); |
|
2670 |
|
2671 iAppIcon = AknsUtils::CreateGulIconL( |
|
2672 AknsUtils::SkinInstance(), |
|
2673 KAknsIIDQgnPropMceSmsTitle, |
|
2674 fileParse.FullName(), |
|
2675 EMbmMuiuQgn_prop_mce_sms_title, |
|
2676 EMbmMuiuQgn_prop_mce_sms_title_mask ); |
|
2677 SetTitleIconL(); |
|
2678 } |
|
2679 |
|
2680 } |
|
2681 |
|
2682 |
|
2683 // --------------------------------------------------------- |
|
2684 // CAudioMessageAppUi::SetTitleIconL |
|
2685 // --------------------------------------------------------- |
|
2686 // |
|
2687 void CMsgSmsViewerAppUi::SetTitleIconL() |
|
2688 { |
|
2689 SetTitleIconSize(); |
|
2690 |
|
2691 // Create duplicates of the icon to be used |
|
2692 CFbsBitmap* bitmap = new( ELeave ) CFbsBitmap(); |
|
2693 CleanupStack::PushL( bitmap ); |
|
2694 //SetTitleIconSizeL(bitmap); |
|
2695 |
|
2696 |
|
2697 CFbsBitmap* bitmapMask = new( ELeave ) CFbsBitmap(); |
|
2698 CleanupStack::PushL( bitmapMask ); |
|
2699 |
|
2700 User::LeaveIfError( bitmap->Duplicate( iAppIcon->Bitmap()->Handle() ) ); |
|
2701 User::LeaveIfError( bitmapMask->Duplicate( iAppIcon->Mask()->Handle() ) ); |
|
2702 |
|
2703 CAknTitlePane* iTitlePane = STATIC_CAST( |
|
2704 CAknTitlePane*, |
|
2705 StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ))); |
|
2706 |
|
2707 iTitlePane->SetSmallPicture( bitmap, bitmapMask, ETrue ); |
|
2708 iTitlePane->DrawNow(); |
|
2709 |
|
2710 CleanupStack::Pop( bitmapMask ); |
|
2711 CleanupStack::Pop( bitmap ); |
|
2712 } |
|
2713 |
|
2714 |
|
2715 // --------------------------------------------------------- |
|
2716 // CAudioMessageAppUi::SetTitleIconSize |
|
2717 // |
|
2718 // Sets the correct size from LAF for title icon |
|
2719 // --------------------------------------------------------- |
|
2720 // |
|
2721 void CMsgSmsViewerAppUi::SetTitleIconSize() |
|
2722 { |
|
2723 TRect mainPane; |
|
2724 AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::ETitlePane, mainPane ); |
|
2725 TAknLayoutRect titleIconPaneLayoutRect; |
|
2726 |
|
2727 if ( AknStatuspaneUtils::StaconPaneActive() ) |
|
2728 { |
|
2729 titleIconPaneLayoutRect.LayoutRect( |
|
2730 mainPane, |
|
2731 AknLayoutScalable_Avkon::title_pane_stacon_g1( 0 ).LayoutLine() ); |
|
2732 } |
|
2733 else |
|
2734 { |
|
2735 titleIconPaneLayoutRect.LayoutRect( |
|
2736 mainPane, |
|
2737 AknLayoutScalable_Avkon::title_pane_g2( 0 ).LayoutLine() ); |
|
2738 } |
|
2739 |
|
2740 TSize iconSize = titleIconPaneLayoutRect.Rect().Size(); |
|
2741 AknIconUtils::SetSize( iAppIcon->Bitmap(), iconSize, EAspectRatioPreserved ); |
|
2742 } |
|
2743 |
|
2744 // --------------------------------------------------------- |
|
2745 // CMsgSmsViewerAppUi::EditorObserver |
|
2746 // --------------------------------------------------------- |
|
2747 // |
|
2748 void CMsgSmsViewerAppUi::EditorObserver( TMsgEditorObserverFunc aFunc, TAny* aArg1, |
|
2749 TAny* aArg2, TAny* aArg3 ) |
|
2750 { |
|
2751 TRAP_IGNORE( DoEditorObserverL( aFunc,aArg1,aArg2,aArg3 ) ); |
|
2752 } |
|
2753 |
|
2754 // --------------------------------------------------------- |
|
2755 // CMsgSmsViewerAppUi::DoEditorObserverL |
|
2756 // --------------------------------------------------------- |
|
2757 // |
|
2758 void CMsgSmsViewerAppUi::DoEditorObserverL( TMsgEditorObserverFunc aFunc, TAny* aArg1, |
|
2759 TAny* aArg2, TAny*/* aArg3*/ ) |
|
2760 { |
|
2761 |
|
2762 switch ( aFunc ) |
|
2763 { |
|
2764 |
|
2765 #ifdef RD_SCALABLE_UI_V2 |
|
2766 case MMsgEditorObserver::EMsgControlPointerEvent: |
|
2767 { |
|
2768 CMsgBaseControl* control = static_cast<CMsgBaseControl*>( aArg1 ); |
|
2769 if(control) |
|
2770 { |
|
2771 TInt id = control->ControlId(); |
|
2772 if(id == EMsgComponentIdFrom && iFlags.iValidSenderNumber) |
|
2773 { |
|
2774 //disable dialer |
|
2775 iAvkonAppUi->SetKeyEventFlags( |
|
2776 CAknAppUiBase::EDisableSendKeyShort | |
|
2777 CAknAppUiBase::EDisableSendKeyLong ); |
|
2778 } |
|
2779 else |
|
2780 { |
|
2781 //enable dialer |
|
2782 iAvkonAppUi->SetKeyEventFlags( 0x00); |
|
2783 } |
|
2784 } |
|
2785 } |
|
2786 break; |
|
2787 |
|
2788 #endif //RD_SCALABLE_UI_V2 |
|
2789 default: |
|
2790 break; |
|
2791 } |
|
2792 |
|
2793 } |
|
2794 |
|
2795 |
|
2796 // --------------------------------------------------------- |
|
2797 // CMsgSmsViewerAppUi::QuicklaunchViewL |
|
2798 // This is quick launch based on already existing view. Hence this function should |
|
2799 // be called only for Proper SMS Text message for fast and optimized navigation. |
|
2800 // In case called for any bio-type messages, this will leave with KErrCancel so that |
|
2801 // caller will TRAP the leave and call LaunchViewL() for complete launch. |
|
2802 // --------------------------------------------------------- |
|
2803 void CMsgSmsViewerAppUi::QuicklaunchViewL() |
|
2804 { |
|
2805 CAknInputBlock::NewLC(); |
|
2806 |
|
2807 /* Reset iFullyConstructed to false to avoid any irrational behaviours during quick launch |
|
2808 * And set back to true at the end of this function |
|
2809 */ |
|
2810 iFullyConstructed = EFalse; |
|
2811 |
|
2812 // get hands on entry |
|
2813 const CMsgSmsViewerDocument* doc = Document(); |
|
2814 TMsvEntry msvEntry = doc->Entry(); |
|
2815 if ( msvEntry.iBioType ) |
|
2816 { |
|
2817 /* If in case, any bio SMS while fast navigation, then leave immediately, so that MCE will |
|
2818 * handle the navigation. |
|
2819 * Leave with correct code, so that MsgEditorAppUi will perform the appropriate action to |
|
2820 * ensure the next/prev entry is launched from MCE. |
|
2821 */ |
|
2822 User::Leave( KErrCancel ); |
|
2823 } |
|
2824 |
|
2825 /* Reset all the necessary flags before proceeding further |
|
2826 * Other flags are either feature support types or based on bio-SMS types and hence |
|
2827 * no need to set/reset here |
|
2828 */ |
|
2829 iFlags.iIsEmailMessage = EFalse; |
|
2830 iFlags.iValidSenderNumber = EFalse; |
|
2831 iFlags.iVoIPNumber = EFalse; |
|
2832 SetAutomaticHighlightL( EFalse ); |
|
2833 |
|
2834 // Getting sender/receiver to From/To-field |
|
2835 // (just copies the content of iDetails to To/From-field, |
|
2836 // should work also with IR-messages...) |
|
2837 |
|
2838 //Copy only 50 chars with extremely long names |
|
2839 iRecipientstring = msvEntry.iDetails.Left( KPhCltNameBufferLength ); |
|
2840 |
|
2841 __ASSERT_DEBUG(msvEntry.Id() != |
|
2842 KMsvNullIndexEntryId, Panic( EMsgSmsNoMessage )); |
|
2843 |
|
2844 // Instead of using Sms Mtm, load the entry's values |
|
2845 // using store. This is because Sms Viewer is also used |
|
2846 // by bio messages and then sms mtm can't be used... |
|
2847 CPlainText* nullString = CPlainText::NewL(); |
|
2848 CleanupStack::PushL( nullString ); |
|
2849 delete iSmsHeader; |
|
2850 iSmsHeader = NULL; |
|
2851 iSmsHeader = CSmsHeader::NewL( CSmsPDU::ESmsDeliver, *nullString ); |
|
2852 CMsvStore* store = doc->CurrentEntry().ReadStoreL(); |
|
2853 CleanupStack::PushL(store); |
|
2854 |
|
2855 // This TRAPping is needed to find out if the entry's store has |
|
2856 // KUidMsvSMSHeaderStream. If it hasn't, we're most propably dealing |
|
2857 // with non sms message and we can assume it is received message. |
|
2858 TRAPD( err, iSmsHeader->RestoreL( *store )); |
|
2859 |
|
2860 // Check if we are dealing with E-mail sms message |
|
2861 // We use TP-PID as the only validation rule |
|
2862 CSmsPDU& pdu = iSmsHeader->Message().SmsPDU(); |
|
2863 if( pdu.ProtocolIdentifierPresent() ) |
|
2864 { |
|
2865 if( pdu.PIDType() == TSmsProtocolIdentifier::ESmsPIDTelematicInterworking && |
|
2866 pdu.TelematicDeviceIndicator() == TSmsProtocolIdentifier::ESmsTelematicDevice && |
|
2867 pdu.TelematicDeviceType() == TSmsProtocolIdentifier::ESmsInternetElectronicMail ) |
|
2868 { |
|
2869 iFlags.iIsEmailMessage = ETrue; |
|
2870 } |
|
2871 } |
|
2872 |
|
2873 if (err == KErrNone) |
|
2874 { |
|
2875 /* Yes, it is sms based message. |
|
2876 * Quick SMS msg handler shall set the body text and required control field without adding/removing |
|
2877 * any controls everytime unless required(if absent/present across different messages). |
|
2878 */ |
|
2879 QuickSmsMsgNaviHandlingL( store ); |
|
2880 } |
|
2881 else |
|
2882 { |
|
2883 /* Something wrong. Ideally this part of the code should not be hit. |
|
2884 * This is not a sms and sms pdu can't be checked. |
|
2885 * However this is most propably _received_ IR or BT message. |
|
2886 */ |
|
2887 iFlags.iIrBt = ETrue; |
|
2888 iControlId = EMsgComponentIdFrom; |
|
2889 } |
|
2890 CleanupStack::PopAndDestroy( 2 ); //store, nullString |
|
2891 |
|
2892 // Fill address ctrl |
|
2893 if ( !iFlags.iIsEmailMessage && KErrNotFound != iNumber.Match( iRecipientstring ) ) |
|
2894 { |
|
2895 iRecipientstring = KNullDesC; |
|
2896 } |
|
2897 |
|
2898 CMsgBaseControl* addressBase = iView->ControlById( iControlId ); |
|
2899 CMsgAddressControl* addressControl = STATIC_CAST( CMsgAddressControl*, addressBase ); |
|
2900 |
|
2901 MVPbkContactLink* link= NULL; |
|
2902 addressControl->Reset(); |
|
2903 addressControl->AddRecipientL( |
|
2904 iRecipientstring, |
|
2905 iNumber, |
|
2906 ETrue, |
|
2907 link ); |
|
2908 |
|
2909 // Message indication ( e.g. 2/32 ) |
|
2910 #ifdef RD_MSG_NAVIPANE_IMPROVEMENT |
|
2911 // Fetch pointer to the default navi pane control |
|
2912 iNaviPane = static_cast<CAknNavigationControlContainer*> |
|
2913 ( StatusPane( )->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) ) ); |
|
2914 |
|
2915 if( !iNaviDecorator ) |
|
2916 { |
|
2917 CreateViewerNaviPaneL( Document()->Entry().iDate, EMsgEditorMsgPriorityNormal, ETrue ); |
|
2918 iNaviPane->PushL( *iNaviDecorator ); // <- This has nothing to do with cleanup-stack! |
|
2919 } |
|
2920 else |
|
2921 { |
|
2922 //We end up here when fast msg opening is enabled |
|
2923 CMsgNaviPaneControl* naviControl = static_cast<CMsgNaviPaneControl*> |
|
2924 ( iNaviDecorator->DecoratedControl() ); |
|
2925 naviControl->SetTimeIndicatorL( Document()->Entry().iDate, ETrue ); |
|
2926 naviControl->SetNavigationIndicatorL( Document()->Session(), Document()->Entry() ); |
|
2927 } |
|
2928 |
|
2929 #else |
|
2930 UpdateNaviPaneL(); |
|
2931 #endif |
|
2932 //remove buttons from navipane |
|
2933 if( iNaviDecorator && iClass0CBA ) |
|
2934 { |
|
2935 iNaviDecorator->SetScrollButtonDimmed( CAknNavigationDecorator::ELeftButton, ETrue ); |
|
2936 iNaviDecorator->SetScrollButtonDimmed( CAknNavigationDecorator::ERightButton, ETrue ); |
|
2937 } |
|
2938 |
|
2939 #ifdef RD_SCALABLE_UI_V2 |
|
2940 if ( AknLayoutUtils::PenEnabled() ) |
|
2941 { |
|
2942 if ( iToolbar ) |
|
2943 { |
|
2944 //What buttons to dim |
|
2945 switch ( iSmsHeader->Type() ) |
|
2946 { |
|
2947 //Received Message(Inbox navigation) |
|
2948 case CSmsPDU::ESmsDeliver: |
|
2949 { |
|
2950 //Dim reply item if sender is unknown |
|
2951 if (msvEntry.iDetails.Length() == 0 || !iFlags.iValidSenderNumber ) |
|
2952 { |
|
2953 iToolbar->SetItemDimmed(ESmsViewerToolbarReply, ETrue, ETrue); |
|
2954 } |
|
2955 else |
|
2956 { |
|
2957 iToolbar->SetItemDimmed(ESmsViewerToolbarReply, EFalse, ETrue); |
|
2958 } |
|
2959 |
|
2960 break; |
|
2961 } |
|
2962 |
|
2963 //Sent Message (Sent folder navigation) |
|
2964 case CSmsPDU::ESmsSubmit: |
|
2965 { |
|
2966 //Dim the reply button, we would be replying to ourselves |
|
2967 iToolbar->SetItemDimmed(ESmsViewerToolbarReply, ETrue, ETrue); |
|
2968 break; |
|
2969 } |
|
2970 |
|
2971 default: |
|
2972 { |
|
2973 Panic( EMsgSmsViewerUnknownSmsPduType ); |
|
2974 break; |
|
2975 } |
|
2976 } // Switch |
|
2977 } // if ( iToolbar ) |
|
2978 } // if ( AknLayoutUtils::PenEnabled() ) |
|
2979 #endif /* RD_SCALABLE_UI_V2 */ |
|
2980 //Reset the focus to "from address" feild |
|
2981 iView->SetFocus( iControlId ); |
|
2982 |
|
2983 // Set the state of automatic highlighting for sms |
|
2984 SetAutomaticHighlightL( iFlags.iAutomaticHlValue ); |
|
2985 |
|
2986 iFullyConstructed = ETrue; |
|
2987 CleanupStack::PopAndDestroy();// CAknInputBlock |
|
2988 } |
|
2989 |
|
2990 // --------------------------------------------------------- |
|
2991 // CMsgSmsViewerAppUi::QuickSmsMsgNaviHandlingL |
|
2992 // This will set the body text and update the control fields if any changes |
|
2993 // as compared to previous SMS message. |
|
2994 // This function is called only for non-bio text messages for fast preview during navigation |
|
2995 // --------------------------------------------------------- |
|
2996 void CMsgSmsViewerAppUi::QuickSmsMsgNaviHandlingL( CMsvStore* aStore ) |
|
2997 { |
|
2998 // Initialize the richtext object... |
|
2999 CParaFormatLayer* paraFormat = iEikonEnv->SystemParaFormatLayerL(); // <- pointer only |
|
3000 CCharFormatLayer* charFormat = iEikonEnv->SystemCharFormatLayerL(); // <- pointer only |
|
3001 CRichText* textBody = CRichText::NewL( paraFormat, charFormat ); |
|
3002 CleanupStack::PushL( textBody ); |
|
3003 // ...and read bodytext |
|
3004 aStore->RestoreBodyTextL( *textBody ); |
|
3005 |
|
3006 // message is ordinary sms message |
|
3007 // so, let's get message body to viewer. |
|
3008 CMsgBaseControl* baseControl = iView->ControlById( EMsgComponentIdBody ); |
|
3009 CMsgBodyControl* bodyControl = STATIC_CAST( CMsgBodyControl*, baseControl ); |
|
3010 |
|
3011 CMsgTextUtils::ConvertLineBreaksL( *textBody, CMsgTextUtils::ECRLFtoLF ); |
|
3012 //First resetting the body control content |
|
3013 bodyControl->Reset(); |
|
3014 // Set body text and update the screen |
|
3015 bodyControl->SetTextContentL( *textBody ); |
|
3016 bodyControl->SetPlainTextMode( ETrue ); |
|
3017 bodyControl->SetCursorPosL( 0 ); |
|
3018 bodyControl->DrawNow(); |
|
3019 CleanupStack::PopAndDestroy(); //textBody |
|
3020 |
|
3021 // Class 0 handling... |
|
3022 TSmsDataCodingScheme::TSmsClass smsClass; |
|
3023 if ( iSmsHeader->Message().SmsPDU().Class( smsClass ) |
|
3024 && smsClass == TSmsDataCodingScheme::ESmsClass0 ) |
|
3025 { |
|
3026 // Create new softkeys |
|
3027 iClass0CBA = Cba(); // <- pointer only |
|
3028 if (iClass0CBA) |
|
3029 { // iClass0CBA shouldn't be NULL, but if.... |
|
3030 iClass0CBA->SetCommandSetL( R_SMSVIEWER_CLASS0_SOFTKEYS_OPTIONS_EXIT__CONTEXTOPTIONS ); |
|
3031 //Middle softkey |
|
3032 MenuBar()->SetContextMenuTitleResourceId( R_SMSV_OPTIONSCONTEXTMENUBAR_CLASS0 ); |
|
3033 MenuBar()->SetMenuTitleResourceId( R_SMSV_OPTIONSMENUBAR_CLASS0 ); |
|
3034 MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions); |
|
3035 } |
|
3036 } |
|
3037 else if ( iClass0CBA ) |
|
3038 { |
|
3039 //menubar and CBA is reset to the default resource. |
|
3040 //if iClass0CBA is not NULL, then resource id has been changed, hence needs to be reset |
|
3041 //setting the CBA to default |
|
3042 iClass0CBA->SetCommandSetL( R_SMSVIEWER_SOFTKEYS_OPTIONS_BACK__CONTEXTOPTIONS ); |
|
3043 //Since CBA is set to default iClass0CBA is set NULL |
|
3044 iClass0CBA = NULL; |
|
3045 //Setting the menubar to default |
|
3046 MenuBar()->SetContextMenuTitleResourceId( R_SMSV_CONTEXTMENUBAR ); |
|
3047 MenuBar()->SetMenuTitleResourceId( R_SMSV_OPTIONSMENUBAR ); |
|
3048 MenuBar()->SetMenuType(CEikMenuBar::EMenuOptions); |
|
3049 } |
|
3050 |
|
3051 // Deciding between To/From text in address control |
|
3052 const CSmsPDU::TSmsPDUType pduType = iSmsHeader->Type(); |
|
3053 switch ( pduType ) |
|
3054 { |
|
3055 case CSmsPDU::ESmsDeliver: |
|
3056 { |
|
3057 // Setting from-control |
|
3058 iControlId = EMsgComponentIdFrom; |
|
3059 if(pduType!= iTypeMsg) |
|
3060 { |
|
3061 iView->DeleteControlL(EMsgComponentIdTo); |
|
3062 iView->AddControlFromResourceL( |
|
3063 R_SMSV_FROM, |
|
3064 EMsgAddressControl, |
|
3065 EMsgAppendControl, |
|
3066 EMsgHeader ); |
|
3067 } |
|
3068 // take the number and verify it |
|
3069 iNumber = iSmsHeader->FromAddress(); |
|
3070 if ( !iFlags.iIsEmailMessage ) |
|
3071 { |
|
3072 iFlags.iValidSenderNumber = CommonPhoneParser::IsValidPhoneNumber( |
|
3073 iNumber, CommonPhoneParser::ESMSNumber ); |
|
3074 |
|
3075 if( !iFlags.iValidSenderNumber && iMsgVoIPExtension->IsVoIPSupported() ) |
|
3076 { |
|
3077 if( MsvUiServiceUtilities::IsValidEmailAddressL( iNumber ) ) |
|
3078 { |
|
3079 iFlags.iValidSenderNumber = ETrue; |
|
3080 iFlags.iVoIPNumber = ETrue; |
|
3081 } |
|
3082 } |
|
3083 |
|
3084 // Replypath indication |
|
3085 CMsgExpandableControl* replyPathControl = STATIC_CAST(CMsgExpandableControl*, |
|
3086 iView->ControlById(EMsgComponentIdCc)); |
|
3087 if ( iSmsHeader->Deliver().ReplyPath() ) |
|
3088 { |
|
3089 if( !replyPathControl ) |
|
3090 { |
|
3091 iView->AddControlFromResourceL( |
|
3092 R_SMSV_REPLYPATH, |
|
3093 EMsgExpandableControl, |
|
3094 EMsgAppendControl, |
|
3095 EMsgHeader ); |
|
3096 } |
|
3097 |
|
3098 HBufC* text = StringLoader::LoadLC( R_QTN_SMS_HEADING_REPLY_PATH, iCoeEnv ); |
|
3099 CRichText& replyPath = STATIC_CAST(CMsgExpandableControl*, |
|
3100 iView->ControlById(EMsgComponentIdCc))->TextContent(); |
|
3101 replyPath.Reset(); |
|
3102 replyPath.InsertL( 0, *text ); |
|
3103 CleanupStack::PopAndDestroy(); // text |
|
3104 } |
|
3105 else if( replyPathControl ) |
|
3106 { |
|
3107 // No reply path in curr SMS, if there was one in prev, remove the control |
|
3108 iView->DeleteControlL( EMsgComponentIdCc ); |
|
3109 } |
|
3110 } |
|
3111 else |
|
3112 { |
|
3113 iFlags.iValidSenderNumber = |
|
3114 MsvUiServiceUtilities::IsValidEmailAddressL( |
|
3115 iRecipientstring ); |
|
3116 } |
|
3117 } |
|
3118 break; |
|
3119 case CSmsPDU::ESmsSubmit: |
|
3120 // Setting To-control |
|
3121 iControlId = EMsgComponentIdTo; |
|
3122 if(pduType!= iTypeMsg) |
|
3123 { |
|
3124 iView->DeleteControlL(EMsgComponentIdFrom); |
|
3125 iView->AddControlFromResourceL( |
|
3126 R_SMSV_TO, |
|
3127 EMsgAddressControl, |
|
3128 EMsgAppendControl, |
|
3129 EMsgHeader ); |
|
3130 } |
|
3131 // take the number |
|
3132 iNumber = iSmsHeader->FromAddress(); |
|
3133 if ( !iFlags.iIsEmailMessage ) |
|
3134 { |
|
3135 iFlags.iValidSenderNumber = CommonPhoneParser::IsValidPhoneNumber( |
|
3136 iNumber, CommonPhoneParser::ESMSNumber ); |
|
3137 } |
|
3138 else |
|
3139 { |
|
3140 iFlags.iValidSenderNumber = |
|
3141 MsvUiServiceUtilities::IsValidEmailAddressL( |
|
3142 iRecipientstring ); |
|
3143 } |
|
3144 break; |
|
3145 default: |
|
3146 #if defined ( _DEBUG ) |
|
3147 Panic( EMsgSmsViewerUnknownSmsPduType ); |
|
3148 #else |
|
3149 User::Leave( KErrNotSupported ); |
|
3150 #endif |
|
3151 break; |
|
3152 } |
|
3153 // If we are dealing with Email message |
|
3154 // we add subject control for Email type subject |
|
3155 if ( iFlags.iIsEmailMessage ) |
|
3156 { |
|
3157 TPtrC subj( iSmsHeader->EmailFields().Subject() ); |
|
3158 if ( subj.Length() ) |
|
3159 { |
|
3160 // Add subject control if not present |
|
3161 AddSubjectControlL(); |
|
3162 // Set the Subject field text accordigly |
|
3163 SetSubjectL( subj ); |
|
3164 } |
|
3165 } |
|
3166 else if( iFlags.iEmailSubjectControlPresent && SubjectControl() ) |
|
3167 { |
|
3168 //remove subject control if in case prev messages is email over SMS message with subject |
|
3169 iView->DeleteControlL( EMsgComponentIdSubject ); |
|
3170 iFlags.iEmailSubjectControlPresent = EFalse; |
|
3171 } |
|
3172 iTypeMsg = pduType; //for successful launch save the PDU Type. |
|
3173 } |
|
3174 |
|
3175 // --------------------------------------------------------- |
|
3176 // CMsgSmsViewerAppUi::FindItemHighlighted |
|
3177 // Checks wheter current find item is highlighted |
|
3178 // --------------------------------------------------------- |
|
3179 // |
|
3180 TBool CMsgSmsViewerAppUi::FindItemHighlighted() |
|
3181 { |
|
3182 if ( iView->ItemFinder() && |
|
3183 iView->ItemFinder()->CurrentSelection().Length() ) |
|
3184 { |
|
3185 return ETrue; |
|
3186 } |
|
3187 return EFalse; |
|
3188 } |
|
3189 |
|
3190 // --------------------------------------------------------- |
|
3191 // CMsgSmsViewerAppUi::FocusedControlId |
|
3192 // Returns id of focused control |
|
3193 // --------------------------------------------------------- |
|
3194 // |
|
3195 TInt CMsgSmsViewerAppUi::FocusedControlId( ) |
|
3196 { |
|
3197 TInt controlType = EMsgComponentIdNull; |
|
3198 if ( iView && iView->FocusedControl( ) ) |
|
3199 { |
|
3200 controlType = iView->FocusedControl( )->ControlId( ); |
|
3201 } |
|
3202 return controlType; |
|
3203 } |
|
3204 |
|
3205 // End of File |