|
1 /* |
|
2 * Copyright (c) 2002-2006 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: BIO control for Ringing Tones. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 |
|
22 #include "RingingToneBioControl.h" // for CRingingToneBioControl |
|
23 #include "RingBCToneConverter.h" // for CComNSMConverter |
|
24 #include "RingBC.hrh" |
|
25 #include "RingBCLog.h" |
|
26 |
|
27 #include <biocmtm.h> // for CBIOClientMtm |
|
28 #include <coeutils.h> // for ConeUtils |
|
29 #include <msgbiocontrolObserver.h> // for MMsgBioControlObserver |
|
30 #include <StringLoader.h> // for StringLoader |
|
31 #include <AknsUtils.h> |
|
32 #include <RingBC.rsg> // for resouce identifiers |
|
33 #include <ringbc.mbg> // for icons indexes |
|
34 #include <ProfileEngineSDKCRKeys.h> |
|
35 #include <MsgBioUtils.h> // for MsgBioUtils |
|
36 #include <eikrted.h> // for CEikRichTextEditor |
|
37 #include <txtrich.h> // for CRichText |
|
38 #include <aknnotewrappers.h> // for CAknInformationNote |
|
39 #include <Profile.hrh> // for EProfileRingingTypeSilent |
|
40 #include <bldvariant.hrh> |
|
41 #include <pathinfo.h> |
|
42 #include <featmgr.h> // Feature manager |
|
43 #include <csxhelp/smart.hlp.hrh> |
|
44 #include <data_caging_path_literals.hrh> |
|
45 #include <applayout.cdl.h> // LAF |
|
46 #include <aknlayoutscalable_apps.cdl.h> |
|
47 #include <mmsvattachmentmanager.h> |
|
48 |
|
49 #include <msgaudiocontrol.h> //AudioControl |
|
50 #include <MsgEditorCommon.h> //MsgEditorCommons utilities |
|
51 |
|
52 // CONSTANTS |
|
53 |
|
54 _LIT(KRingingToneFileExtension,".rng"); |
|
55 _LIT(KResourceName, "ringbc.rsc" ); |
|
56 _LIT(KRingBCMbmFileName, "ringbc.mif"); |
|
57 |
|
58 // LOCAL CONSTANTS AND MACROS |
|
59 const TInt KComponentCountZero = 0; |
|
60 const TInt KNoOverWriteOrRecurse = 0; |
|
61 const TInt KLengthOfTitleRow = 100; |
|
62 const TInt KTextNameQueryMaxLength = 50; |
|
63 |
|
64 |
|
65 const TInt KRichEditor = 1; |
|
66 const TInt KAudioControl = 0; |
|
67 |
|
68 const TInt KRingVolumeZero = 0; |
|
69 |
|
70 const TInt KShowNoNotes = 0; |
|
71 const TInt KShowNotes = 1; |
|
72 |
|
73 const TInt KFrameExpansion = 10; |
|
74 |
|
75 // MODULE DATA STRUCTURES |
|
76 |
|
77 enum TOptionListLocation |
|
78 { |
|
79 EFirstMenuItem = 0, |
|
80 ESecondMenuItem |
|
81 }; |
|
82 |
|
83 // ================= MEMBER FUNCTIONS ======================= |
|
84 |
|
85 // Two-phased constructor. |
|
86 EXPORT_C CMsgBioControl* CRingingToneBioControl::NewL( |
|
87 MMsgBioControlObserver& aObserver, |
|
88 CMsvSession* aSession, |
|
89 TMsvId aId, |
|
90 TMsgBioMode aEditorOrViewerMode, |
|
91 const RFile* aFile) |
|
92 { |
|
93 CRingingToneBioControl* self = |
|
94 new( ELeave ) CRingingToneBioControl( |
|
95 aObserver, |
|
96 aSession, aId, aEditorOrViewerMode, |
|
97 aFile); |
|
98 |
|
99 CleanupStack::PushL( self ); |
|
100 self->ConstructL(); |
|
101 CleanupStack::Pop(self); // self |
|
102 |
|
103 return self; |
|
104 |
|
105 } |
|
106 |
|
107 // Destructor |
|
108 CRingingToneBioControl::~CRingingToneBioControl() |
|
109 { |
|
110 FeatureManager::UnInitializeLib(); |
|
111 delete iRichEditor; |
|
112 delete iAudioControl; |
|
113 delete iToneTitle; |
|
114 } |
|
115 |
|
116 // C++ default constructor. |
|
117 CRingingToneBioControl::CRingingToneBioControl( |
|
118 MMsgBioControlObserver& aObserver, |
|
119 CMsvSession* aSession, |
|
120 TMsvId aId, |
|
121 TMsgBioMode aEditorOrViewerMode, |
|
122 const RFile* aFile): |
|
123 CMsgBioControl(aObserver, |
|
124 aSession, |
|
125 aId, |
|
126 aEditorOrViewerMode, |
|
127 aFile) |
|
128 { |
|
129 } |
|
130 |
|
131 // Symbian OS default constructor can leave. |
|
132 void CRingingToneBioControl::ConstructL() |
|
133 { |
|
134 if( IsEditor() ) //Editor mode is not supported |
|
135 { |
|
136 User::Leave( KErrNotSupported ); |
|
137 } |
|
138 |
|
139 FeatureManager::InitializeLibL(); |
|
140 |
|
141 LoadStandardBioResourceL(); |
|
142 LoadResourceL( KResourceName ); |
|
143 |
|
144 // checks if the message is valid |
|
145 CheckMsgValidityL(); |
|
146 TakeTitleL(); |
|
147 |
|
148 } |
|
149 |
|
150 // ---------------------------------------------------------------------------- |
|
151 // CRingingToneBioControl::CheckMsgValidityL |
|
152 // ---------------------------------------------------------------------------- |
|
153 // |
|
154 void CRingingToneBioControl::CheckMsgValidityL() |
|
155 { |
|
156 RFile file; |
|
157 |
|
158 CMsvEntry* entry = this->MsvSession(). GetEntryL(iId); |
|
159 CleanupStack::PushL( entry ); |
|
160 |
|
161 CMsvStore* store = entry->ReadStoreL(); |
|
162 CleanupStack::PushL(store); |
|
163 |
|
164 MMsvAttachmentManager& manager = store->AttachmentManagerL(); |
|
165 file = manager.GetAttachmentFileL(0); |
|
166 |
|
167 CleanupClosePushL(file); |
|
168 |
|
169 TInt size; |
|
170 User::LeaveIfError(file.Size(size)); |
|
171 if (!size) |
|
172 { |
|
173 //the empty ringing tone is considered a corrupted message |
|
174 User::Leave(KErrMsgBioMessageNotValid); |
|
175 } |
|
176 |
|
177 HBufC8* dataBuf = HBufC8::NewLC(size); |
|
178 TPtr8 data(dataBuf->Des()); |
|
179 User::LeaveIfError(file.Read(data, size)); |
|
180 |
|
181 CRingBCNSMConverter* conv = CRingBCNSMConverter::NewL(); |
|
182 CleanupStack::PushL( conv ); |
|
183 TBool res = conv->IsRingToneMimeTypeL(data); |
|
184 |
|
185 if (!res) |
|
186 { |
|
187 User::Leave(KErrMsgBioMessageNotValid); |
|
188 } |
|
189 |
|
190 CleanupStack::PopAndDestroy(5,entry); // entry,conv,store,file,dataBuf |
|
191 } |
|
192 |
|
193 |
|
194 // ---------------------------------------------------------------------------- |
|
195 // CRingingToneBioControl::ProcessCommandL |
|
196 // ---------------------------------------------------------------------------- |
|
197 // |
|
198 void CRingingToneBioControl::ProcessCommandL( TInt aCommandId ) |
|
199 { |
|
200 if ( aCommandId == ESoftkeyStop ) |
|
201 { |
|
202 StopPlayback(); |
|
203 } |
|
204 } |
|
205 |
|
206 // ---------------------------------------------------------------------------- |
|
207 // CRingingToneBioControl::SetAndGetSizeL |
|
208 // ---------------------------------------------------------------------------- |
|
209 // |
|
210 void CRingingToneBioControl::SetAndGetSizeL( TSize& aSize ) |
|
211 { |
|
212 //the heightadjustment calculates the height for the header elements and |
|
213 //the space between components |
|
214 TInt heightAdjustment = (MsgEditorCommons::MsgBaseLineDelta()*2)+ |
|
215 MsgEditorCommons::MsgBaseLineOffset(); |
|
216 |
|
217 aSize.iHeight -= heightAdjustment; |
|
218 SetSizeWithoutNotification( aSize ); |
|
219 } |
|
220 |
|
221 // ---------------------------------------------------------------------------- |
|
222 // CRingingToneBioControl::SetMenuCommandSetL |
|
223 // ---------------------------------------------------------------------------- |
|
224 // |
|
225 void CRingingToneBioControl::SetMenuCommandSetL( CEikMenuPane& aMenuPane ) |
|
226 { |
|
227 // if playing, do not show context sensitive menu. |
|
228 if ( iPlayerState != EMsgAsyncControlStatePlaying ) |
|
229 { |
|
230 AddMenuItemL(aMenuPane, R_SM_PLAYBACK, ERingtPlayback, EFirstMenuItem); |
|
231 AddMenuItemL(aMenuPane, |
|
232 R_SM_ADD_COMPOSER, ERingtAddComposer, ESecondMenuItem); |
|
233 } |
|
234 } |
|
235 |
|
236 // ---------------------------------------------------------------------------- |
|
237 // CRingingToneBioControl::CurrentLineRect |
|
238 // ---------------------------------------------------------------------------- |
|
239 // |
|
240 TRect CRingingToneBioControl::CurrentLineRect() const |
|
241 { |
|
242 return iAudioControl->CurrentLineRect(); |
|
243 } |
|
244 |
|
245 // ---------------------------------------------------------------------------- |
|
246 // CRingingToneBioControl::IsFocusChangePossible |
|
247 // ---------------------------------------------------------------------------- |
|
248 // |
|
249 TBool CRingingToneBioControl::IsFocusChangePossible( |
|
250 TMsgFocusDirection aDirection ) const |
|
251 { |
|
252 return iAudioControl->IsFocusChangePossible( aDirection ); |
|
253 } |
|
254 |
|
255 // ---------------------------------------------------------------------------- |
|
256 // CRingingToneBioControl::HeaderTextL |
|
257 // ---------------------------------------------------------------------------- |
|
258 // |
|
259 HBufC* CRingingToneBioControl::HeaderTextL() const |
|
260 { |
|
261 return iCoeEnv->AllocReadResourceL( R_SM_TITLE_RINGING_TONE ); |
|
262 } |
|
263 |
|
264 // ---------------------------------------------------------------------------- |
|
265 // CRingingToneBioControl::HandleBioCommandL |
|
266 // ---------------------------------------------------------------------------- |
|
267 // |
|
268 TBool CRingingToneBioControl::HandleBioCommandL(TInt aCommand) |
|
269 { |
|
270 aCommand -= iBioControlObserver.FirstFreeCommand(); |
|
271 TBool retValue(EFalse); |
|
272 switch ( aCommand ) |
|
273 { |
|
274 case ERingtPlayback: |
|
275 PlaybackL(); |
|
276 retValue = ETrue; |
|
277 break; |
|
278 case ERingtAddComposer: |
|
279 TrySaveToneL(); |
|
280 retValue = ETrue; |
|
281 break; |
|
282 default: |
|
283 retValue = EFalse; |
|
284 break; |
|
285 } |
|
286 return retValue; |
|
287 } |
|
288 |
|
289 // ---------------------------------------------------------------------------- |
|
290 // CRingingToneLogoBioControl::OptionMenuPermissionsL |
|
291 // ---------------------------------------------------------------------------- |
|
292 // |
|
293 TUint32 CRingingToneBioControl::OptionMenuPermissionsL() const |
|
294 { |
|
295 if ( iPlayerState != EMsgAsyncControlStatePlaying ) |
|
296 { |
|
297 return EMsgBioDelete |
|
298 | EMsgBioMessInfo |
|
299 | EMsgBioMove |
|
300 | EMsgBioHelp |
|
301 | EMsgBioExit; |
|
302 } |
|
303 else |
|
304 { |
|
305 // do not show context sensitive menu. |
|
306 return 0; |
|
307 } |
|
308 } |
|
309 |
|
310 |
|
311 |
|
312 // ---------------------------------------------------------------------------- |
|
313 // CRingingToneBioControl::OfferKeyEventL |
|
314 // ---------------------------------------------------------------------------- |
|
315 // |
|
316 TKeyResponse CRingingToneBioControl::OfferKeyEventL( |
|
317 const TKeyEvent& /*aKeyEvent*/, |
|
318 TEventCode /*aType*/ ) |
|
319 { |
|
320 return EKeyWasConsumed; |
|
321 } |
|
322 |
|
323 // ---------------------------------------------------------------------------- |
|
324 // CRingingToneBioControl::GetHelpContext |
|
325 // ---------------------------------------------------------------------------- |
|
326 // |
|
327 void CRingingToneBioControl::GetHelpContext( |
|
328 TCoeHelpContext& aHelpContext) const |
|
329 { |
|
330 if ( FeatureManager::FeatureSupported( KFeatureIdHelp ) ) |
|
331 { |
|
332 const TUid KUidSmart = {0x101F4CDA}; |
|
333 |
|
334 aHelpContext.iContext = KSMART_HLP_RINGVIEWER(); |
|
335 aHelpContext.iMajor = KUidSmart; |
|
336 } |
|
337 } |
|
338 |
|
339 // ---------------------------------------------------------------------------- |
|
340 // CRingingToneBioControl::CountComponentControls |
|
341 // ---------------------------------------------------------------------------- |
|
342 // |
|
343 TInt CRingingToneBioControl::CountComponentControls() const |
|
344 { |
|
345 TInt componentCount( KComponentCountZero ); |
|
346 if ( iAudioControl ) |
|
347 { |
|
348 componentCount++; |
|
349 } |
|
350 if ( iRichEditor ) |
|
351 { |
|
352 componentCount++; |
|
353 } |
|
354 return componentCount; |
|
355 } |
|
356 |
|
357 // ---------------------------------------------------------------------------- |
|
358 // CRingingToneBioControl::ComponentControl |
|
359 // ---------------------------------------------------------------------------- |
|
360 // |
|
361 CCoeControl* CRingingToneBioControl::ComponentControl( TInt aIndex ) const |
|
362 { |
|
363 if ( aIndex == KRichEditor ) |
|
364 { |
|
365 return iRichEditor; |
|
366 } |
|
367 if ( aIndex == KAudioControl ) |
|
368 { |
|
369 return iAudioControl; |
|
370 } |
|
371 else |
|
372 { |
|
373 return NULL; |
|
374 } |
|
375 } |
|
376 |
|
377 // ---------------------------------------------------------------------------- |
|
378 // CRingingToneBioControl::HandleResourceChange |
|
379 // ---------------------------------------------------------------------------- |
|
380 // |
|
381 void CRingingToneBioControl::HandleResourceChange( TInt aType ) |
|
382 { |
|
383 if(aType == KEikDynamicLayoutVariantSwitch) |
|
384 { |
|
385 TRAP_IGNORE( |
|
386 CorrectFormatToRichEditorL(); |
|
387 iRichEditor->SetTextL( iToneTitle ); |
|
388 FillBitmapMaskL(); |
|
389 ); |
|
390 } |
|
391 iAudioControl->HandleResourceChange( aType ); |
|
392 } |
|
393 |
|
394 // ---------------------------------------------------------------------------- |
|
395 // CRingingToneBioControl::SizeChanged |
|
396 // ---------------------------------------------------------------------------- |
|
397 // |
|
398 void CRingingToneBioControl::SizeChanged() |
|
399 { |
|
400 TRect rect = Rect(); |
|
401 TRect bitmapRect; |
|
402 TAknWindowComponentLayout layout = |
|
403 AknLayoutScalable_Apps::mce_image_pane_g5(); |
|
404 TAknLayoutRect LayoutRect; |
|
405 LayoutRect.LayoutRect( rect, layout.LayoutLine() ); |
|
406 bitmapRect = LayoutRect.Rect(); |
|
407 TInt formattedHeight = iRichEditor->TextLayout()->FormattedHeightInPixels(); |
|
408 bitmapRect.Move(0,formattedHeight); |
|
409 |
|
410 //the rectangle is grown to so that focused frame is visible |
|
411 bitmapRect.Grow( KFrameExpansion, KFrameExpansion ); |
|
412 |
|
413 // rect for richtext is positioned on the top of audio control |
|
414 rect.iBr.iY = bitmapRect.iTl.iY; |
|
415 iRichEditor->SetRect( rect ); |
|
416 iAudioControl->SetRect( bitmapRect ); |
|
417 } |
|
418 |
|
419 // ---------------------------------------------------------------------------- |
|
420 // CRingingToneBioControl::FocusChanged |
|
421 // ---------------------------------------------------------------------------- |
|
422 // |
|
423 void CRingingToneBioControl::FocusChanged( TDrawNow aDrawNow ) |
|
424 { |
|
425 iAudioControl->SetFocus(IsFocused()); |
|
426 iRichEditor->FocusChanged(aDrawNow); |
|
427 } |
|
428 |
|
429 // ---------------------------------------------------------------------------- |
|
430 // CRingingToneBioControl::SetContainerWindowL |
|
431 // ---------------------------------------------------------------------------- |
|
432 // |
|
433 void CRingingToneBioControl::SetContainerWindowL( |
|
434 const CCoeControl& aContainer ) |
|
435 { |
|
436 CCoeControl::SetContainerWindowL( aContainer ); |
|
437 |
|
438 //The reason for creating the audio control here is that the construction |
|
439 //requires a parent with a window. So it cannot be done in ConstructL() |
|
440 iAudioControl = CMsgAudioControl::NewL( *reinterpret_cast<CMsgEditorView*>(this), this, EMdaPriorityNormal, EMdaPriorityPreferenceQuality ); |
|
441 FillBitmapMaskL(); |
|
442 |
|
443 CreateRichEditorL(); |
|
444 } |
|
445 |
|
446 // ---------------------------------------------------------------------------- |
|
447 // CRingingToneBioControl ::Draw() |
|
448 // ---------------------------------------------------------------------------- |
|
449 // |
|
450 void CRingingToneBioControl::Draw(const TRect& /*aRect*/) const |
|
451 { |
|
452 } |
|
453 |
|
454 // ---------------------------------------------------------------------------- |
|
455 // CRingingToneBioControl ::CorrectFormatToRichEditorL() |
|
456 // ---------------------------------------------------------------------------- |
|
457 // |
|
458 void CRingingToneBioControl::CorrectFormatToRichEditorL() |
|
459 { |
|
460 CRichText* rich = iRichEditor->RichText(); |
|
461 TInt pos(rich->DocumentLength()); |
|
462 |
|
463 // font correction. |
|
464 TCharFormat format; |
|
465 TCharFormatMask mask; |
|
466 |
|
467 TAknTextLineLayout editorLayout = AppLayout::Smart_Messages_Line_2( 0 ); |
|
468 const CFont* editorFont = AknLayoutUtils::FontFromId( editorLayout.FontId() ); |
|
469 format.iFontSpec = editorFont->FontSpecInTwips(); |
|
470 |
|
471 TRgb textColor; |
|
472 if ( AknsUtils::GetCachedColor( |
|
473 AknsUtils::SkinInstance(), |
|
474 textColor, |
|
475 KAknsIIDQsnTextColors, |
|
476 EAknsCIQsnTextColorsCG6 ) != KErrNone ) |
|
477 { |
|
478 textColor = AKN_LAF_COLOR_STATIC( 215 ); |
|
479 } |
|
480 |
|
481 format.iFontPresentation.iTextColor = textColor; |
|
482 |
|
483 mask.ClearAll(); |
|
484 mask.SetAttrib( EAttColor ); |
|
485 mask.SetAttrib(EAttFontStrokeWeight); |
|
486 mask.SetAttrib(EAttFontHeight); |
|
487 mask.SetAttrib(EAttFontTypeface); |
|
488 |
|
489 rich->SetInsertCharFormatL(format, mask, pos); |
|
490 |
|
491 // this is needed to set ringing tone title centered. |
|
492 CParaFormat* paraFormat = CParaFormat::NewLC(); |
|
493 TParaFormatMask paraMask; |
|
494 |
|
495 paraFormat->Reset(); |
|
496 paraFormat->iHorizontalAlignment = CParaFormat::ECenterAlign; |
|
497 paraFormat->iVerticalAlignment = CParaFormat::ECenterAlign; |
|
498 |
|
499 paraMask.SetAttrib(EAttAlignment); |
|
500 paraMask.SetAttrib(EAttFontHeight); |
|
501 paraMask.SetAttrib(EAttColor); |
|
502 |
|
503 rich->ApplyParaFormatL(paraFormat, paraMask, 0, pos); |
|
504 |
|
505 CleanupStack::PopAndDestroy(paraFormat); |
|
506 } |
|
507 |
|
508 void CRingingToneBioControl::OpenFileL() |
|
509 { |
|
510 RFile file; |
|
511 |
|
512 CMsvEntry* entry = this->MsvSession(). GetEntryL(iId); |
|
513 CleanupStack::PushL( entry ); |
|
514 |
|
515 CMsvStore* store = entry->ReadStoreL(); |
|
516 CleanupStack::PushL(store); |
|
517 |
|
518 MMsvAttachmentManager& manager = store->AttachmentManagerL(); |
|
519 file = manager.GetAttachmentFileL(0); |
|
520 CleanupClosePushL(file); |
|
521 |
|
522 //asynchronous loading of file |
|
523 //the audio control takes a copy of the file |
|
524 iAudioControl->LoadL(file); |
|
525 |
|
526 //wait for the opening of file to complete |
|
527 //in MsgMediaControlStateChanged |
|
528 CActiveScheduler::Start(); |
|
529 |
|
530 CleanupStack::PopAndDestroy(3, entry); |
|
531 } |
|
532 |
|
533 // ---------------------------------------------------------------------------- |
|
534 // CRingingToneBioControl::PlaybackL |
|
535 // ---------------------------------------------------------------------------- |
|
536 // |
|
537 void CRingingToneBioControl::PlaybackL() |
|
538 { |
|
539 if( iPlayerState != EMsgAsyncControlStateOpening || |
|
540 iPlayerState != EMsgAsyncControlStateAboutToPlay || |
|
541 iPlayerState != EMsgAsyncControlStatePlaying || |
|
542 iPlayerState != EMsgAsyncControlStateBuffering ) |
|
543 { |
|
544 |
|
545 OpenFileL(); |
|
546 |
|
547 //any other state than EMsgAsyncControlStateReady |
|
548 //constitutes a failed opening of media file |
|
549 if(iPlayerState == EMsgAsyncControlStateReady) |
|
550 { |
|
551 GetAndSetRingingToneVolumeL(); |
|
552 iAudioControl->PlayL(); |
|
553 |
|
554 iStopCba = CEikButtonGroupContainer::NewL ( |
|
555 CEikButtonGroupContainer::ECba, CEikButtonGroupContainer::EHorizontal, |
|
556 this, R_RINGCONTROL_SOFTKEYS_STOP ); |
|
557 |
|
558 const TSize screenSize = CCoeEnv::Static()->ScreenDevice()->SizeInPixels(); |
|
559 iStopCba->SetBoundingRect( TRect( screenSize ) ); |
|
560 } |
|
561 } |
|
562 } |
|
563 |
|
564 void CRingingToneBioControl::StopPlayback() |
|
565 { |
|
566 iAudioControl->Stop(); |
|
567 |
|
568 //after playback the file must be closed so that moving the ring tone |
|
569 //message to another folder is possible |
|
570 iAudioControl->Close(); |
|
571 } |
|
572 |
|
573 // ---------------------------------------------------------------------------- |
|
574 // CRingingToneBioControl::GetAndSetRingingToneVolumeL |
|
575 // ---------------------------------------------------------------------------- |
|
576 // |
|
577 void CRingingToneBioControl::GetAndSetRingingToneVolumeL() |
|
578 { |
|
579 TInt ringingVol; |
|
580 TInt ringingType; |
|
581 |
|
582 CRepository* repository = CRepository::NewLC( KCRUidProfileEngine ); |
|
583 |
|
584 User::LeaveIfError( repository->Get( KProEngActiveRingingVolume, ringingVol )); |
|
585 User::LeaveIfError( repository->Get( KProEngActiveRingingType, ringingType )); |
|
586 |
|
587 CleanupStack::PopAndDestroy(repository); //repository |
|
588 |
|
589 //Some emulator versions crash in volume setting |
|
590 #ifndef __WINS__ |
|
591 if (ringingType == EProfileRingingTypeSilent) |
|
592 { |
|
593 RDebug::Print(_L("Profile: Ring type silent")); |
|
594 iAudioControl->SetVolume(KRingVolumeZero); |
|
595 } |
|
596 else |
|
597 { |
|
598 RDebug::Print(_L("Ringing volume : %d"), ringingVol); |
|
599 iAudioControl->SetVolume(ringingVol); |
|
600 } |
|
601 #endif |
|
602 } |
|
603 |
|
604 |
|
605 |
|
606 // ---------------------------------------------------------------------------- |
|
607 // CRingingToneBioControl::CreateRichEditorL |
|
608 // ---------------------------------------------------------------------------- |
|
609 // |
|
610 void CRingingToneBioControl::CreateRichEditorL() |
|
611 { |
|
612 iRichEditor = new( ELeave ) CEikRichTextEditor(TGulBorder::ENone); |
|
613 |
|
614 TInt edwinFlags = |
|
615 CEikEdwin::ENoHorizScrolling | |
|
616 CEikEdwin::ENoAutoSelection | |
|
617 CEikEdwin::EWidthInPixels | |
|
618 CEikEdwin::EReadOnly | |
|
619 CEikEdwin::EEdwinAlternativeWrapping; |
|
620 |
|
621 iRichEditor->ConstructL(this,2 , 0, edwinFlags); |
|
622 |
|
623 iRichEditor->SetMaximumHeightInLines(2); |
|
624 |
|
625 // corrects font and alignment to centered. |
|
626 CorrectFormatToRichEditorL(); |
|
627 |
|
628 iRichEditor->SetTextL( iToneTitle ); |
|
629 } |
|
630 |
|
631 // ---------------------------------------------------------------------------- |
|
632 // CRingingToneBioControl::FillBitmapMaskL |
|
633 // ---------------------------------------------------------------------------- |
|
634 // |
|
635 void CRingingToneBioControl::FillBitmapMaskL() |
|
636 { |
|
637 |
|
638 TParse *fp = new(ELeave) TParse(); |
|
639 fp->Set( KRingBCMbmFileName, &KDC_APP_BITMAP_DIR, NULL ); |
|
640 CleanupStack::PushL( fp ); |
|
641 |
|
642 iAudioControl->LoadIconL( fp->FullName(), |
|
643 KAknsIIDQgnPropOtaTone, |
|
644 EMbmRingbcQgn_prop_ota_tone, |
|
645 EMbmRingbcQgn_prop_ota_tone_mask); |
|
646 |
|
647 CleanupStack::PopAndDestroy(fp); |
|
648 |
|
649 TAknWindowComponentLayout layout = |
|
650 AknLayoutScalable_Apps::mce_image_pane_g5(); |
|
651 TAknLayoutRect LayoutRect; |
|
652 LayoutRect.LayoutRect( Rect(), layout.LayoutLine() ); |
|
653 TRect bitmapRect; |
|
654 bitmapRect = LayoutRect.Rect(); |
|
655 iAudioControl->SetIconSizeL(bitmapRect.Size()); |
|
656 iAudioControl->SetIconVisible(ETrue); |
|
657 } |
|
658 |
|
659 |
|
660 // ---------------------------------------------------------------------------- |
|
661 // CRingingToneBioControl::AddSongTitleToArrayL |
|
662 // ---------------------------------------------------------------------------- |
|
663 // |
|
664 void CRingingToneBioControl::AddSongTitleToArrayL(CDesCArray& aItemArray) const |
|
665 { |
|
666 //Add titlerow to array |
|
667 HBufC* dataRow = HBufC::NewLC(KLengthOfTitleRow); |
|
668 TPtr rowPtr = dataRow->Des(); |
|
669 HBufC* baseString = StringLoader::LoadLC( R_BASE_STRING ); |
|
670 |
|
671 TInt maxLength(KLengthOfTitleRow - baseString->Length()); |
|
672 |
|
673 HBufC* tempName = HBufC::NewLC(KMaxFileName); |
|
674 |
|
675 TPtr tempTPtr = tempName->Des(); |
|
676 tempTPtr.Copy(iToneTitle->Des()); |
|
677 |
|
678 if (iToneTitle->Length() > maxLength) |
|
679 { |
|
680 tempTPtr = iToneTitle->Des().Left(maxLength); |
|
681 } |
|
682 |
|
683 rowPtr.Format(*baseString, tempName); |
|
684 CleanupStack::PopAndDestroy( 2, baseString ); //tempName, baseString |
|
685 aItemArray.AppendL( rowPtr ); |
|
686 CleanupStack::PopAndDestroy(dataRow); //dataRow |
|
687 } |
|
688 |
|
689 // ---------------------------------------------------------------------------- |
|
690 // CRingingToneBioControl ::IsOnlyDots |
|
691 // ---------------------------------------------------------------------------- |
|
692 // |
|
693 TBool CRingingToneBioControl::IsOnlyDots(TDes& aTitle) |
|
694 { |
|
695 const TChar KSingleDot = '.'; |
|
696 _LIT(KDoubleDots,".."); |
|
697 |
|
698 if(aTitle.Length()==1) |
|
699 { |
|
700 |
|
701 if( aTitle.Locate(KSingleDot) != KErrNotFound ) |
|
702 { |
|
703 return ETrue; |
|
704 } |
|
705 } |
|
706 |
|
707 else if(aTitle.Length()==2) |
|
708 { |
|
709 |
|
710 if( aTitle.Find(KDoubleDots) != KErrNotFound ) |
|
711 { |
|
712 return ETrue; |
|
713 } |
|
714 } |
|
715 |
|
716 return EFalse; |
|
717 } |
|
718 |
|
719 // ---------------------------------------------------------------------------- |
|
720 // CRingingToneBioControl::IsValidL |
|
721 // ---------------------------------------------------------------------------- |
|
722 // |
|
723 TBool CRingingToneBioControl::IsValidL(TDes& aTitle, TBool aNotes) |
|
724 { |
|
725 RFs fileServer; |
|
726 User::LeaveIfError( fileServer.Connect() ); |
|
727 |
|
728 //If name includes solely single dot or double dot, this note should be |
|
729 //showed (Folders spec) |
|
730 if( IsOnlyDots(aTitle) ) |
|
731 { |
|
732 |
|
733 fileServer.Close(); |
|
734 if(aNotes) |
|
735 { |
|
736 InformationNoteL(R_FLDR_BAD_FILE_NAME); |
|
737 } |
|
738 return EFalse; |
|
739 |
|
740 } |
|
741 |
|
742 //only because of IsValidName does not check backslash, but file |
|
743 //is not valid with it. |
|
744 if( aTitle.Locate('\\') != KErrNotFound ) |
|
745 { |
|
746 |
|
747 fileServer.Close(); |
|
748 if(aNotes) |
|
749 { |
|
750 InformationNoteL(R_FLDR_ILLEGAL_CHARACTERS); |
|
751 } |
|
752 return EFalse; |
|
753 |
|
754 } |
|
755 if( aTitle.Locate('\n') != KErrNotFound ) |
|
756 { |
|
757 fileServer.Close(); |
|
758 if(aNotes) |
|
759 { |
|
760 InformationNoteL(R_FLDR_ILLEGAL_CHARACTERS); |
|
761 } |
|
762 return EFalse; |
|
763 } |
|
764 |
|
765 // check is there any special chars between 00h to 1Fh |
|
766 for (TInt i=0; i<32; i++) |
|
767 { |
|
768 if (aTitle.Locate(i) !=KErrNotFound ) |
|
769 { |
|
770 fileServer.Close(); |
|
771 if(aNotes) |
|
772 { |
|
773 InformationNoteL(R_FLDR_ILLEGAL_CHARACTERS); |
|
774 } |
|
775 return EFalse; |
|
776 |
|
777 } |
|
778 |
|
779 } |
|
780 |
|
781 //Checking if filename is valid for saving purpose |
|
782 if( !fileServer.IsValidName(aTitle) ) |
|
783 { |
|
784 |
|
785 fileServer.Close(); |
|
786 if(aNotes) |
|
787 { |
|
788 InformationNoteL(R_FLDR_ILLEGAL_CHARACTERS); |
|
789 } |
|
790 return EFalse; |
|
791 |
|
792 } |
|
793 |
|
794 fileServer.Close(); |
|
795 return ETrue; //File name is valid |
|
796 |
|
797 } |
|
798 |
|
799 // ---------------------------------------------------------------------------- |
|
800 // CRingingToneBioControl::InformationNoteL |
|
801 // ---------------------------------------------------------------------------- |
|
802 // |
|
803 void CRingingToneBioControl::InformationNoteL(TInt aStringResource) |
|
804 { |
|
805 HBufC* buf = StringLoader::LoadLC(aStringResource); |
|
806 |
|
807 CAknInformationNote* note = new (ELeave) CAknInformationNote(ETrue); |
|
808 note->ExecuteLD(*buf); |
|
809 |
|
810 CleanupStack::PopAndDestroy(buf); //buf |
|
811 } |
|
812 |
|
813 |
|
814 // ---------------------------------------------------------------------------- |
|
815 // CRingingToneBioControl::ExistsL |
|
816 // ---------------------------------------------------------------------------- |
|
817 // |
|
818 TBool CRingingToneBioControl::ExistsL(TDes& aTitle) |
|
819 { |
|
820 HBufC* path = CreatePathForSavingLC(aTitle); |
|
821 |
|
822 if ( ConeUtils::FileExists(*path) ) |
|
823 { |
|
824 CleanupStack::PopAndDestroy(path); //path; |
|
825 |
|
826 return ETrue; |
|
827 } |
|
828 |
|
829 CleanupStack::PopAndDestroy(path); //path; |
|
830 return EFalse; |
|
831 } |
|
832 |
|
833 // ---------------------------------------------------------------------------- |
|
834 // CRingingToneBioControl::AskNameL |
|
835 // ---------------------------------------------------------------------------- |
|
836 // |
|
837 TBool CRingingToneBioControl::AskNameL(TDes& aTitle) |
|
838 { |
|
839 IncrementFileNameL( aTitle ); |
|
840 |
|
841 if (!NameQueryL(aTitle)) |
|
842 { |
|
843 return EFalse; |
|
844 } |
|
845 |
|
846 return ETrue; |
|
847 } |
|
848 |
|
849 // ---------------------------------------------------------------------------- |
|
850 // CRingingToneBioControl::AskNameAndValidNameL |
|
851 // ---------------------------------------------------------------------------- |
|
852 // |
|
853 TBool CRingingToneBioControl::AskAndValidNameL(TDes& aTitle) |
|
854 { |
|
855 do |
|
856 { |
|
857 if(!AskNameL(aTitle)) |
|
858 { |
|
859 return EFalse; |
|
860 } |
|
861 |
|
862 } while (!IsValidL(aTitle,KShowNotes)) ; |
|
863 |
|
864 return ETrue; |
|
865 } |
|
866 |
|
867 |
|
868 // ---------------------------------------------------------------------------- |
|
869 // CRingingToneBioControl::TrySaveToneL |
|
870 // ---------------------------------------------------------------------------- |
|
871 // |
|
872 void CRingingToneBioControl::TrySaveToneL() |
|
873 { |
|
874 HBufC* saveTitle = HBufC::NewLC(KMaxFileName); |
|
875 TPtr saveTitlePtr(saveTitle->Des()); |
|
876 |
|
877 saveTitlePtr.Copy(*iToneTitle); //initialize saveTitle |
|
878 |
|
879 TBool okSave = ETrue; //No cancel pressed |
|
880 |
|
881 //First case is special, cause if message have wrong kind of title, |
|
882 //there will be default name in data query and no rename query. |
|
883 if( !IsValidL(saveTitlePtr,KShowNoNotes) ) |
|
884 { |
|
885 SetDefaultNameL(saveTitlePtr); |
|
886 |
|
887 okSave = AskAndValidNameL(saveTitlePtr); |
|
888 } |
|
889 |
|
890 //Have to check if title already exists. If not, then save. But if |
|
891 //it exists already, should ask if rename (rename query) and then ask |
|
892 //for new name until user press cancel or give valid name. After that |
|
893 //we should check if that already exists... |
|
894 if(okSave) |
|
895 { |
|
896 while (ExistsL(saveTitlePtr)) |
|
897 { |
|
898 if (!RenameQueryL(saveTitlePtr)) |
|
899 { |
|
900 okSave = EFalse; |
|
901 break; |
|
902 } |
|
903 |
|
904 if(!AskAndValidNameL(saveTitlePtr)) |
|
905 { |
|
906 okSave = EFalse; |
|
907 break; |
|
908 } |
|
909 }; |
|
910 } |
|
911 |
|
912 //User did not press cancel in any place and it is saving time. |
|
913 if(okSave) |
|
914 { |
|
915 SaveToneL(saveTitlePtr); |
|
916 MsgBioUtils::ConfirmationNoteL(R_SM_NOTE_TONE_COPIED); |
|
917 } |
|
918 |
|
919 CleanupStack::PopAndDestroy(saveTitle); //saveTitle |
|
920 } |
|
921 |
|
922 // ---------------------------------------------------------------------------- |
|
923 // CRingingToneBioControl::CreatePathForSavingLC |
|
924 // ---------------------------------------------------------------------------- |
|
925 // |
|
926 HBufC* CRingingToneBioControl::CreatePathForSavingLC(const TDesC& aName) |
|
927 { |
|
928 HBufC* targetPathAndName = TargetPathLC(); |
|
929 |
|
930 TPtr targetPathAndNamePtr = targetPathAndName->Des(); |
|
931 |
|
932 targetPathAndNamePtr.Append(aName); |
|
933 targetPathAndNamePtr.Append(KRingingToneFileExtension); |
|
934 |
|
935 return targetPathAndName; |
|
936 } |
|
937 |
|
938 // ---------------------------------------------------------------------------- |
|
939 // CRingingToneBioControl::RenameQueryL |
|
940 // ---------------------------------------------------------------------------- |
|
941 // |
|
942 TBool CRingingToneBioControl::RenameQueryL(TDes& aTitle) |
|
943 { |
|
944 if ( !MsgBioUtils::ConfirmationQueryOkCancelL( |
|
945 *StringLoader::LoadLC( R_FLDR_RENAME_QUERY, aTitle ) ) ) |
|
946 { |
|
947 |
|
948 CleanupStack::PopAndDestroy(); //StringLoader; |
|
949 return EFalse; |
|
950 |
|
951 } |
|
952 CleanupStack::PopAndDestroy(); //StringLoader; |
|
953 |
|
954 return ETrue; |
|
955 } |
|
956 |
|
957 // ---------------------------------------------------------------------------- |
|
958 // CRingingToneBioControl::SaveToneL |
|
959 // ---------------------------------------------------------------------------- |
|
960 // |
|
961 TBool CRingingToneBioControl::SaveToneL(TDes& aTitle) |
|
962 { |
|
963 CFileMan* files = CFileMan::NewL(CCoeEnv::Static()->FsSession()); |
|
964 CleanupStack::PushL( files ); |
|
965 |
|
966 HBufC* targetPathAndName = CreatePathForSavingLC(aTitle); |
|
967 |
|
968 CMsvEntry* entry = this->MsvSession(). GetEntryL(iId); |
|
969 CleanupStack::PushL( entry ); |
|
970 |
|
971 CMsvStore* store = entry->ReadStoreL(); |
|
972 CleanupStack::PushL(store); |
|
973 |
|
974 MMsvAttachmentManager& manager = store->AttachmentManagerL(); |
|
975 |
|
976 RFile ringFile; |
|
977 ringFile = manager.GetAttachmentFileL(0); |
|
978 |
|
979 CleanupStack::PopAndDestroy(2, entry); |
|
980 CleanupClosePushL(ringFile); |
|
981 |
|
982 TInt err = files->Copy( |
|
983 ringFile, *targetPathAndName, KNoOverWriteOrRecurse ); |
|
984 User::LeaveIfError(err); |
|
985 |
|
986 CleanupStack::PopAndDestroy(3, files); //targetPathAndName, ringFile, files |
|
987 return ETrue; |
|
988 } |
|
989 |
|
990 // ---------------------------------------------------------------------------- |
|
991 // CRingingToneBioControl::SetDefaultNameL |
|
992 // ---------------------------------------------------------------------------- |
|
993 // |
|
994 void CRingingToneBioControl::SetDefaultNameL(TDes& aName) |
|
995 { |
|
996 aName.Copy(*StringLoader::LoadLC( R_SM_TONE_NAME )); |
|
997 CleanupStack::PopAndDestroy(); //stringloader |
|
998 } |
|
999 |
|
1000 // ---------------------------------------------------------------------------- |
|
1001 // CRingingToneBioControl::NameQueryL |
|
1002 // ---------------------------------------------------------------------------- |
|
1003 // |
|
1004 TBool CRingingToneBioControl::NameQueryL(TDes& aName) |
|
1005 { |
|
1006 if (aName.Length() > KTextNameQueryMaxLength) |
|
1007 { |
|
1008 User::Leave(KErrOverflow); |
|
1009 } |
|
1010 |
|
1011 CAknTextQueryDialog* queryDlg = new ( ELeave ) |
|
1012 CAknTextQueryDialog( aName ); |
|
1013 return queryDlg->ExecuteLD( R_SM_QUERY_RINGING_TONE ); |
|
1014 } |
|
1015 |
|
1016 // ---------------------------------------------------------------------------- |
|
1017 // CRingingToneBioControl::TakeTitleL |
|
1018 // ---------------------------------------------------------------------------- |
|
1019 // |
|
1020 void CRingingToneBioControl::TakeTitleL() |
|
1021 { |
|
1022 //Read stream from file |
|
1023 |
|
1024 RFile ringFile; |
|
1025 |
|
1026 CMsvEntry* entry = this->MsvSession(). GetEntryL(iId); |
|
1027 CleanupStack::PushL( entry ); |
|
1028 |
|
1029 CMsvStore* store = entry->ReadStoreL(); |
|
1030 CleanupStack::PushL(store); |
|
1031 |
|
1032 MMsvAttachmentManager& manager = store->AttachmentManagerL(); |
|
1033 ringFile = manager.GetAttachmentFileL(0); |
|
1034 |
|
1035 CleanupStack::PopAndDestroy(2,entry); //entry, store |
|
1036 CleanupClosePushL(ringFile); |
|
1037 |
|
1038 |
|
1039 TInt filelen; |
|
1040 User::LeaveIfError(ringFile.Size(filelen)); |
|
1041 |
|
1042 HBufC8* filedata8 = HBufC8::NewMaxLC(filelen); |
|
1043 TPtr8 dataPtr8 = filedata8->Des(); |
|
1044 User::LeaveIfError(ringFile.Read(dataPtr8,filelen)); |
|
1045 |
|
1046 CleanupStack::Pop( filedata8 ); // pop the filedata temporarily |
|
1047 CleanupStack::PopAndDestroy(); // close and destory ringFile |
|
1048 CleanupStack::PushL( filedata8 ); // put the filedata back |
|
1049 |
|
1050 CRingBCNSMConverter* conv = CRingBCNSMConverter::NewL(); |
|
1051 CleanupStack::PushL( conv ); |
|
1052 |
|
1053 if ( iToneTitle ) |
|
1054 { |
|
1055 delete iToneTitle; |
|
1056 iToneTitle = NULL; |
|
1057 } |
|
1058 iToneTitle = conv->TitleLC(dataPtr8); //The ownership changes here |
|
1059 |
|
1060 CleanupStack::Pop(iToneTitle); |
|
1061 CleanupStack::PopAndDestroy(2, filedata8); //conv, filedata8 |
|
1062 |
|
1063 // checks if there is no name for ringing tone |
|
1064 if (iToneTitle->Length() == 0) |
|
1065 { |
|
1066 delete iToneTitle; |
|
1067 iToneTitle = NULL; |
|
1068 |
|
1069 // sets default name |
|
1070 iToneTitle = StringLoader::LoadL( R_SM_TONE_NAME ); |
|
1071 |
|
1072 // check that default name is not too long. |
|
1073 if (iToneTitle->Length() > KMaxFileName ) |
|
1074 { |
|
1075 |
|
1076 HBufC* tempName = HBufC::NewLC(KMaxFileName); |
|
1077 TPtr tempTPtr = tempName->Des(); |
|
1078 |
|
1079 tempTPtr.Copy(iToneTitle->Des().Left(KMaxFileName)); |
|
1080 |
|
1081 CleanupStack::Pop(tempName); |
|
1082 |
|
1083 delete iToneTitle; |
|
1084 iToneTitle = tempName; |
|
1085 } |
|
1086 } |
|
1087 } |
|
1088 // ---------------------------------------------------------------------------- |
|
1089 // CRingingToneBioControl::IncrementFileName |
|
1090 // ---------------------------------------------------------------------------- |
|
1091 // |
|
1092 void CRingingToneBioControl::IncrementFileNameL(TDes& aFileName) |
|
1093 { |
|
1094 HBufC* path = CreatePathForSavingLC(aFileName); |
|
1095 |
|
1096 while (ConeUtils::FileExists(*path)) |
|
1097 { |
|
1098 |
|
1099 MsgBioUtils::IncrementNameL(aFileName,KMaxFileName); |
|
1100 |
|
1101 CleanupStack::PopAndDestroy(path); //path |
|
1102 path = CreatePathForSavingLC(aFileName); |
|
1103 |
|
1104 } |
|
1105 |
|
1106 CleanupStack::PopAndDestroy(path); //path; |
|
1107 } |
|
1108 |
|
1109 |
|
1110 // ---------------------------------------------------------------------------- |
|
1111 // CRingingToneBioControl ::TargetPathLC |
|
1112 // ---------------------------------------------------------------------------- |
|
1113 // |
|
1114 HBufC* CRingingToneBioControl::TargetPathLC() |
|
1115 { |
|
1116 TFileName path = PathInfo::PhoneMemoryRootPath(); |
|
1117 path.Append( PathInfo::SimpleSoundsPath() ); |
|
1118 ConeUtils::EnsurePathExistsL(path); |
|
1119 HBufC* savePath = HBufC::NewLC(KMaxPath + KMaxFileName); |
|
1120 TPtr ptr = savePath->Des(); |
|
1121 ptr = path; |
|
1122 return savePath; |
|
1123 } |
|
1124 |
|
1125 // ---------------------------------------------------------------------------- |
|
1126 // CRingingToneBioControl ::VirtualHeight |
|
1127 // ---------------------------------------------------------------------------- |
|
1128 // |
|
1129 TInt CRingingToneBioControl::VirtualHeight() |
|
1130 { |
|
1131 return 0; |
|
1132 } |
|
1133 |
|
1134 // ---------------------------------------------------------------------------- |
|
1135 // CRingingToneBioControl ::VirtualVisibleTop |
|
1136 // ---------------------------------------------------------------------------- |
|
1137 // |
|
1138 TInt CRingingToneBioControl::VirtualVisibleTop() |
|
1139 { |
|
1140 return 0; |
|
1141 } |
|
1142 |
|
1143 void CRingingToneBioControl::MsgAsyncControlStateChanged( CMsgBaseControl& /*aControl*/, |
|
1144 TMsgAsyncControlState aNewState, |
|
1145 TMsgAsyncControlState aOldState ) |
|
1146 { |
|
1147 iPlayerState = aNewState; |
|
1148 |
|
1149 if(aOldState == EMsgAsyncControlStateOpening) |
|
1150 { |
|
1151 //last state was opening so we go ahead with playing by stopping |
|
1152 //the active scheduler that was started in OpenFileL -function |
|
1153 CActiveScheduler::Stop(); |
|
1154 } |
|
1155 |
|
1156 switch( aNewState ) |
|
1157 { |
|
1158 //intentional fallthrough |
|
1159 case EMsgAsyncControlStateIdle: |
|
1160 case EMsgAsyncControlStateStopped: |
|
1161 case EMsgAsyncControlStateCorrupt: |
|
1162 case EMsgAsyncControlStateNoRights: |
|
1163 { |
|
1164 //the Stop CBA has to be removed here because |
|
1165 //playing could be stopped when the tune has finished or |
|
1166 //the tune is corrupt |
|
1167 delete iStopCba; |
|
1168 iStopCba = NULL; |
|
1169 break; |
|
1170 } |
|
1171 } |
|
1172 } |
|
1173 |
|
1174 |
|
1175 #ifdef RD_SCALABLE_UI_V2 |
|
1176 void CRingingToneBioControl::HandlePointerEventL( const TPointerEvent& aPointerEvent ) |
|
1177 { |
|
1178 if ( AknLayoutUtils::PenEnabled() ) |
|
1179 { |
|
1180 switch ( aPointerEvent.iType ) |
|
1181 { |
|
1182 case TPointerEvent::EButton1Down: |
|
1183 { |
|
1184 TBool hitted = iAudioControl->HitRegionContains( |
|
1185 aPointerEvent.iPosition, *this ); |
|
1186 if( hitted ) |
|
1187 { |
|
1188 if( !iAudioControl->IsFocused() ) |
|
1189 { |
|
1190 //stylus touch to audio control sets it focused |
|
1191 iAudioControl->SetFocus( IsFocused() ); |
|
1192 } |
|
1193 else if ( iPlayerState != EMsgAsyncControlStatePlaying && iAudioControl->IsFocused() ) |
|
1194 { |
|
1195 //playback is triggered when focused control is touched with stylus |
|
1196 PlaybackL(); |
|
1197 } |
|
1198 else if ( iPlayerState == EMsgAsyncControlStatePlaying && iAudioControl->IsFocused() ) |
|
1199 { |
|
1200 //stylus hit to audio control when playback is in |
|
1201 //progress stops the playing |
|
1202 StopPlayback(); |
|
1203 } |
|
1204 } |
|
1205 else if ( iAudioControl->IsFocused() ) |
|
1206 { |
|
1207 //hitting anywhere else than the control removes the focus from it |
|
1208 iAudioControl->SetFocus( EFalse ); |
|
1209 } |
|
1210 break; |
|
1211 } |
|
1212 default: |
|
1213 break; |
|
1214 } |
|
1215 } |
|
1216 |
|
1217 } |
|
1218 #else |
|
1219 void CRingingToneBioControl::HandlePointerEventL( const TPointerEvent& /*aPointerEvent*/ ) |
|
1220 { |
|
1221 //no op |
|
1222 } |
|
1223 #endif // RD_SCALABLE_UI_V2 |
|
1224 |
|
1225 void CRingingToneBioControl::MsgAsyncControlResourceChanged( CMsgBaseControl& /*aControl*/, |
|
1226 TInt /*aType*/ ) |
|
1227 { |
|
1228 //no op |
|
1229 } |
|
1230 // End of File |