mobilemessaging/mmsui/viewersrc/UniMmsViewerAppUi.cpp
changeset 2 0bf1d54f37d9
parent 1 d09ac5c1e252
child 9 1d7827e39b52
equal deleted inserted replaced
1:d09ac5c1e252 2:0bf1d54f37d9
   189 #include <akntoolbar.h>             
   189 #include <akntoolbar.h>             
   190 #include <MsgEditorAppUiExtension.h>// for iMsgEditorAppUiExtension
   190 #include <MsgEditorAppUiExtension.h>// for iMsgEditorAppUiExtension
   191 #include <MsgEditorSettingCacheUpdatePlugin.h>
   191 #include <MsgEditorSettingCacheUpdatePlugin.h>
   192 #include    <e32property.h>
   192 #include    <e32property.h>
   193 #include  <ctsydomainpskeys.h>
   193 #include  <ctsydomainpskeys.h>
       
   194 #include <aknstyluspopupmenu.h>
   194 // CONSTANTS
   195 // CONSTANTS
   195 
   196 
   196 // following is minimum value for player
   197 // following is minimum value for player
   197 const TInt KVolumeControlMinValuePlayer = 0;      
   198 const TInt KVolumeControlMinValuePlayer = 0;      
   198 // following are minimum values for avkon volume indicator component
   199 // following are minimum values for avkon volume indicator component
   412 	if( !iEikonEnv->StartedAsServerApp( ) )
   413 	if( !iEikonEnv->StartedAsServerApp( ) )
   413 		{
   414 		{
   414 	    Document( )->PrepareToLaunchL( this );
   415 	    Document( )->PrepareToLaunchL( this );
   415 		}
   416 		}
   416     LOGTEXT2(_L16("CMmsViewerAppUi::ConstructL read. iSupportedFeatures 0x%x"), iSupportedFeatures );
   417     LOGTEXT2(_L16("CMmsViewerAppUi::ConstructL read. iSupportedFeatures 0x%x"), iSupportedFeatures );
       
   418     iLongTapDetector = CAknLongTapDetector::NewL( this );
       
   419     iLongTapDetector->SetTimeDelayBeforeAnimation( KUniLongTapStartDelay );
       
   420     iLongTapDetector->SetLongTapDelay( KUniLongTapTimeDelay );
       
   421     iTapConsumed = EFalse;
   417     }
   422     }
   418 
   423 
   419 // ---------------------------------------------------------
   424 // ---------------------------------------------------------
   420 // Destructor
   425 // Destructor
   421 // ---------------------------------------------------------
   426 // ---------------------------------------------------------
   462     
   467     
   463     delete iProhibitMimeTypeBuffer;
   468     delete iProhibitMimeTypeBuffer;
   464     delete iSendReadReportOperation;
   469     delete iSendReadReportOperation;
   465     delete iIdle;
   470     delete iIdle;
   466     delete iAppIcon;
   471     delete iAppIcon;
       
   472     if(iLongTapDetector)
       
   473     {
       
   474     delete iLongTapDetector;
       
   475     }
       
   476     if(iEmbeddedObjectStylusPopup)
       
   477     {
       
   478     delete iEmbeddedObjectStylusPopup;
       
   479     iEmbeddedObjectStylusPopup = NULL;
       
   480     }
   467 
   481 
   468     LOGTEXT(_L8("CMmsViewerAppUi::~CMmsViewerAppUi end") );
   482     LOGTEXT(_L8("CMmsViewerAppUi::~CMmsViewerAppUi end") );
   469     }
   483     }
   470 
   484 
   471 // ---------------------------------------------------------
   485 // ---------------------------------------------------------
  2802 #ifdef RD_SCALABLE_UI_V2
  2816 #ifdef RD_SCALABLE_UI_V2
  2803             if ( AknLayoutUtils::PenEnabled() )
  2817             if ( AknLayoutUtils::PenEnabled() )
  2804                 {
  2818                 {
  2805                 TPointerEvent* pointerEvent = static_cast<TPointerEvent*>( aArg2 );
  2819                 TPointerEvent* pointerEvent = static_cast<TPointerEvent*>( aArg2 );
  2806                 CMsgBaseControl* baseControl = static_cast<CMsgBaseControl*>( aArg1 );
  2820                 CMsgBaseControl* baseControl = static_cast<CMsgBaseControl*>( aArg1 );
  2807 
  2821                 if(iLongTapDetector)
       
  2822                 {
       
  2823                     iLongTapDetector->EnableLongTapAnimation(ETrue);
       
  2824                     iLongTapDetector->PointerEventL( *pointerEvent );
       
  2825                 }
  2808                 if (    pointerEvent
  2826                 if (    pointerEvent
  2809                     &&  pointerEvent->iType == TPointerEvent::EButton1Down )
  2827                     &&  pointerEvent->iType == TPointerEvent::EButton1Down )
  2810                     {
  2828                     {
  2811                     // We are looking for a valid tap (button down and up)
  2829                     // We are looking for a valid tap (button down and up)
  2812                     // on a focused object.
  2830                     // on a focused object.
  2813                     iPointerTarget =
  2831                     iPointerTarget = baseControl;
  2814                         baseControl && baseControl->IsFocused() ? baseControl : NULL;
  2832                     iTapConsumed = EFalse;
  2815                     }
  2833                     }
  2816                 else if (   pointerEvent
  2834                 else if ( (!iTapConsumed) && (pointerEvent
  2817                         &&  pointerEvent->iType == TPointerEvent::EButton1Up )
  2835                         &&  pointerEvent->iType == TPointerEvent::EButton1Up) )
  2818                     {
  2836                     {
       
  2837                     iTapConsumed = ETrue;
  2819                     if ( baseControl && iPointerTarget == baseControl )
  2838                     if ( baseControl && iPointerTarget == baseControl )
  2820                         {
  2839                         {
  2821                         switch( iMskId )
  2840                         switch( iMskId )
  2822                             {
  2841                             {
  2823                             // Tapping on selected object functions as a
  2842                             // Tapping on selected object functions as a
  3424             else if (   aMedia == iAudio )
  3443             else if (   aMedia == iAudio )
  3425                 {
  3444                 {
  3426                 __ASSERT_ALWAYS(    ObjectByMediaControl( *iAudio ) || ObjectByMediaControl( *iAudio )->MediaInfo( ), 
  3445                 __ASSERT_ALWAYS(    ObjectByMediaControl( *iAudio ) || ObjectByMediaControl( *iAudio )->MediaInfo( ), 
  3427                                     Panic( EMmsViewerNullPointer ) );
  3446                                     Panic( EMmsViewerNullPointer ) );
  3428                 CUniObject* obj = ObjectByMediaControl( *iAudio );
  3447                 CUniObject* obj = ObjectByMediaControl( *iAudio );
  3429                 if (    iViewerFlags & EProhibitNonDrmMusic 
  3448                 // Coverty fix, Null pointer return, http://ousrv057/cov.cgi?cid=37099
       
  3449                 if (obj)
       
  3450                 	{
       
  3451                     if (    iViewerFlags & EProhibitNonDrmMusic 
  3430                     &&  !( obj->MediaInfo( )->Protection( ) &
  3452                     &&  !( obj->MediaInfo( )->Protection( ) &
  3431                         ( EFileProtSuperDistributable | EFileProtForwardLocked ) ) )
  3453                         ( EFileProtSuperDistributable | EFileProtForwardLocked ) ) )
  3432                     {
       
  3433                     // Prepare buffer for aMimeType
       
  3434                     HBufC* mimeBuffer = HBufC::NewLC( obj->MimeType().Length() + KMmsViewerSpace().Length() );
       
  3435                     TPtr mimeBufferPtr = mimeBuffer->Des();
       
  3436                     mimeBufferPtr.Copy( obj->MimeType() );
       
  3437 
       
  3438                     // FindF() would find "audio/3gpp" in "audio/3gpp2" without
       
  3439                     // the added space.
       
  3440                     mimeBufferPtr.Append( KMmsViewerSpace );
       
  3441 
       
  3442                     // If result is not KErrNotFound, this MIME-type is indeed on blocked list.
       
  3443                     if ( iProhibitMimeTypeBuffer->FindF( mimeBufferPtr ) >= 0 ) 
       
  3444                         {
  3454                         {
  3445                         ShowInformationNoteL( R_MMSVIEWER_PLAIN_MUSIC_PROHIBITED );
  3455                         // Prepare buffer for aMimeType
       
  3456                         HBufC* mimeBuffer = HBufC::NewLC( obj->MimeType().Length() + KMmsViewerSpace().Length() );
       
  3457                         TPtr mimeBufferPtr = mimeBuffer->Des();
       
  3458                         mimeBufferPtr.Copy( obj->MimeType() );
       
  3459 
       
  3460                         // FindF() would find "audio/3gpp" in "audio/3gpp2" without
       
  3461                         // the added space.
       
  3462                         mimeBufferPtr.Append( KMmsViewerSpace );
       
  3463 
       
  3464                         // If result is not KErrNotFound, this MIME-type is indeed on blocked list.
       
  3465                         if ( iProhibitMimeTypeBuffer->FindF( mimeBufferPtr ) >= 0 ) 
       
  3466                            {
       
  3467                            ShowInformationNoteL( R_MMSVIEWER_PLAIN_MUSIC_PROHIBITED );
       
  3468                            /* Allocated buffer must be destroyed and pop'd !!! */
       
  3469                            CleanupStack::PopAndDestroy( mimeBuffer );
       
  3470                             return;
       
  3471                            }
  3446                          /* Allocated buffer must be destroyed and pop'd !!! */
  3472                          /* Allocated buffer must be destroyed and pop'd !!! */
  3447                         CleanupStack::PopAndDestroy( mimeBuffer );
  3473                         CleanupStack::PopAndDestroy( mimeBuffer );
  3448                         return;
       
  3449                         }
  3474                         }
  3450                          /* Allocated buffer must be destroyed and pop'd !!! */
  3475                      }
  3451                         CleanupStack::PopAndDestroy( mimeBuffer );
       
  3452                     }
       
  3453                 if (    IsSilenceL( ) 
  3476                 if (    IsSilenceL( ) 
  3454                     &&  !ShowConfirmationQueryL( R_QTN_MMS_OBEY_SILENT_MODE ) )
  3477                     &&  !ShowConfirmationQueryL( R_QTN_MMS_OBEY_SILENT_MODE ) )
  3455                     {
  3478                     {
  3456                     return;
  3479                     return;
  3457                     }
  3480                     }
  5448     iTitlePane->DrawNow();
  5471     iTitlePane->DrawNow();
  5449     
  5472     
  5450     CleanupStack::Pop( bitmapMask );
  5473     CleanupStack::Pop( bitmapMask );
  5451     CleanupStack::Pop( bitmap );
  5474     CleanupStack::Pop( bitmap );
  5452     }
  5475     }
  5453 
  5476 // ---------------------------------------------------------
       
  5477 // CMmsViewerAppUi::HandleLongTapEventL
       
  5478 //  Function for handling the long tap events
       
  5479 // ---------------------------------------------------------
       
  5480 //
       
  5481 void CMmsViewerAppUi::HandleLongTapEventL(const TPoint& aPenEventLocation, 
       
  5482                                           const TPoint& aPenEventScreenLocation )
       
  5483     {
       
  5484     CMsgBaseControl* ctrl = iView->FocusedControl(); // ctrl can be NULL.
       
  5485     if ( ctrl && 
       
  5486          ( ctrl->ControlId() == EMsgComponentIdAudio ||
       
  5487                  ctrl->ControlId() == EMsgComponentIdImage ||
       
  5488                  ctrl->ControlId() == EMsgComponentIdVideo ||
       
  5489                  ctrl->ControlId() == EMsgComponentIdSvg )&&
       
  5490                  ((Document()->SmilType()!=ETemplateSmil)&&(Document()->SmilType()!=E3GPPSmil) )) 
       
  5491         {
       
  5492         TRect rect = ctrl->Rect();
       
  5493        
       
  5494         
       
  5495      
       
  5496         if ((!iTapConsumed)&&rect.Contains(aPenEventLocation))
       
  5497             {
       
  5498             if (iEmbeddedObjectStylusPopup)
       
  5499                 {
       
  5500                 delete iEmbeddedObjectStylusPopup;
       
  5501                 iEmbeddedObjectStylusPopup = NULL;
       
  5502                 }
       
  5503             iEmbeddedObjectStylusPopup = CAknStylusPopUpMenu::NewL(this,aPenEventLocation);
       
  5504             TResourceReader reader;
       
  5505             iCoeEnv->CreateResourceReaderLC(reader,R_MMSVIEWER_EMBEDDED_OBJECT_STYLUS_MENU );
       
  5506             iEmbeddedObjectStylusPopup->ConstructFromResourceL(reader);
       
  5507             CleanupStack::PopAndDestroy();
       
  5508             iEmbeddedObjectStylusPopup->SetPosition(aPenEventLocation);
       
  5509             iEmbeddedObjectStylusPopup->ShowMenu();
       
  5510             iTapConsumed = ETrue;
       
  5511             }
       
  5512         }   
       
  5513     }  
  5454 //  End of File
  5514 //  End of File
  5455 
  5515