mobilemessaging/unieditor/application/src/UniEditorAppUi.cpp
changeset 2 0bf1d54f37d9
parent 1 d09ac5c1e252
child 9 1d7827e39b52
equal deleted inserted replaced
1:d09ac5c1e252 2:0bf1d54f37d9
   181 #include "UniEditorAddHeaderDialog.h"
   181 #include "UniEditorAddHeaderDialog.h"
   182 #include "UniSendingSettingsDialog.h"
   182 #include "UniSendingSettingsDialog.h"
   183 #include "UniEditorLogging.h"
   183 #include "UniEditorLogging.h"
   184 
   184 
   185 #include <gsmuelem.h>     // Turkish SMS-PREQ2265 specific
   185 #include <gsmuelem.h>     // Turkish SMS-PREQ2265 specific
       
   186 #include <aknstyluspopupmenu.h> //Added for displaying object specific stylus menus in editor
   186 // ========== LOCAL CONSTANTS AND MACROS ===================
   187 // ========== LOCAL CONSTANTS AND MACROS ===================
   187 
   188 
   188 // SMS related
   189 // SMS related
   189 
   190 
   190 // Character count used in unicode check buffer
   191 // Character count used in unicode check buffer
   278 //       initialized at LaunchViewL.
   279 //       initialized at LaunchViewL.
   279 // ---------------------------------------------------------
   280 // ---------------------------------------------------------
   280 //
   281 //
   281 void CUniEditorAppUi::ConstructL()
   282 void CUniEditorAppUi::ConstructL()
   282     {
   283     {
       
   284     iFinalizeLaunchL = EFalse;
   283     // We don't have any app ui if launched from idle
   285     // We don't have any app ui if launched from idle
   284     if ( iEikonEnv->EikAppUi() )
   286     if ( iEikonEnv->EikAppUi() )
   285         {
   287         {
   286         ActivateInputBlockerL( NULL );
   288         ActivateInputBlockerL( NULL );
   287         }
   289         }
   442             iPeninputServer.AddPenUiActivationHandler( this, EPluginInputModeAll );
   444             iPeninputServer.AddPenUiActivationHandler( this, EPluginInputModeAll );
   443             iPrevSmsLength = -1;    
   445             iPrevSmsLength = -1;    
   444             iMsgLenToVKB = ETrue; 
   446             iMsgLenToVKB = ETrue; 
   445         }
   447         }
   446 #endif
   448 #endif
       
   449     	iLongTapDetector = CAknLongTapDetector::NewL( this );
       
   450 		iLongTapDetector->SetTimeDelayBeforeAnimation( KUniLongTapStartDelay );
       
   451 		iLongTapDetector->SetLongTapDelay( KUniLongTapTimeDelay );
       
   452 		iTapConsumed = EFalse;
   447     }
   453     }
   448 
   454 
   449 
   455 
   450 // ---------------------------------------------------------
   456 // ---------------------------------------------------------
   451 // CUniEditorAppUi::~CUniEditorAppUi
   457 // CUniEditorAppUi::~CUniEditorAppUi
   572     delete iPrevBuffer;
   578     delete iPrevBuffer;
   573     }
   579     }
   574 
   580 
   575     delete iPopupSmsSizeAboveLimitBuffer;
   581     delete iPopupSmsSizeAboveLimitBuffer;
   576     delete iPopupSmsSizeBelowLimitBuffer;
   582     delete iPopupSmsSizeBelowLimitBuffer;
       
   583 	if(iLongTapDetector)
       
   584 	{
       
   585     delete iLongTapDetector;
       
   586 	}
       
   587 	if(iEmbeddedObjectStylusPopup)
       
   588 	{
       
   589     delete iEmbeddedObjectStylusPopup;
       
   590 	iEmbeddedObjectStylusPopup = NULL;
       
   591 	}
   577    
   592    
   578     }
   593     }
   579 
   594 
   580 // ---------------------------------------------------------
   595 // ---------------------------------------------------------
   581 // CUniEditorAppUi::LaunchViewL
   596 // CUniEditorAppUi::LaunchViewL
   649 // Performs all the last actions before editor launch ends.
   664 // Performs all the last actions before editor launch ends.
   650 // ---------------------------------------------------------
   665 // ---------------------------------------------------------
   651 //
   666 //
   652 void CUniEditorAppUi::FinalizeLaunchL()
   667 void CUniEditorAppUi::FinalizeLaunchL()
   653     {
   668     {
       
   669     iFinalizeLaunchL = ETrue;
   654     iSmilModel = &Document()->DataModel()->SmilModel();
   670     iSmilModel = &Document()->DataModel()->SmilModel();
   655     iHeader = iLaunchOperation->DetachHeader();
   671     iHeader = iLaunchOperation->DetachHeader();
   656     iSlideLoader = iLaunchOperation->DetachSlideLoader();
   672     iSlideLoader = iLaunchOperation->DetachSlideLoader();
   657     
   673     
   658     SetMessageTypeLockingL();
   674     SetMessageTypeLockingL();
   692         iSmilModel->SetLayoutL( EUniImageFirst );
   708         iSmilModel->SetLayoutL( EUniImageFirst );
   693         }
   709         }
   694     
   710     
   695     TMsgControlId focusedControlId = ResolveLaunchFocusedControlL();
   711     TMsgControlId focusedControlId = ResolveLaunchFocusedControlL();
   696             
   712             
   697     iView->ExecuteL( ClientRect(), focusedControlId );
       
   698   
       
   699     delete iScreenClearer;
       
   700     iScreenClearer = NULL;
       
   701     
   713     
   702     CEikStatusPane* statusPane = StatusPane();
   714     CEikStatusPane* statusPane = StatusPane();
   703     
   715     
   704     if ( focusedControlId == EMsgComponentIdBody )
   716     if ( focusedControlId == EMsgComponentIdBody )
   705         {
   717         {
   763     MenuBar()->SetMenuType( CEikMenuBar::EMenuOptions );
   775     MenuBar()->SetMenuType( CEikMenuBar::EMenuOptions );
   764     
   776     
   765     UpdateToolbarL();
   777     UpdateToolbarL();
   766     
   778     
   767     iEditorFlags |= ELaunchSuccessful;
   779     iEditorFlags |= ELaunchSuccessful;
       
   780 	
       
   781     iView->ExecuteL( ClientRect(), focusedControlId );
       
   782     delete iScreenClearer;
       
   783     iScreenClearer = NULL;
       
   784 	
   768     }
   785     }
   769     
   786     
   770 // ---------------------------------------------------------
   787 // ---------------------------------------------------------
   771 // CUniEditorAppUi::ShowLaunchNotesL
   788 // CUniEditorAppUi::ShowLaunchNotesL
   772 //
   789 //
  1542         case EUniCmdRemoveSvg:
  1559         case EUniCmdRemoveSvg:
  1543             {
  1560             {
  1544             DoUserRemoveMediaL( EMsgComponentIdSvg, EUniRegionImage );
  1561             DoUserRemoveMediaL( EMsgComponentIdSvg, EUniRegionImage );
  1545             break;
  1562             break;
  1546             }
  1563             }
       
  1564         case EUniCmdRemove:
       
  1565             {
       
  1566             CMsgBaseControl* ctrl = iView->FocusedControl();  // ctrl can be NULL.
       
  1567 			if(ctrl)
       
  1568 			{
       
  1569             TMsgControlId controlId = TMsgControlId(ctrl->ControlId()); 
       
  1570 			if(controlId == EMsgComponentIdAudio)
       
  1571 			{
       
  1572                 DoUserRemoveMediaL( controlId, EUniRegionAudio );
       
  1573 			}
       
  1574             else if ( controlId == EMsgComponentIdImage ||
       
  1575 			          controlId == EMsgComponentIdVideo ||
       
  1576                       controlId == EMsgComponentIdSvg )
       
  1577 			{
       
  1578 				if( (Document()->DataModel()->SmilType() == ETemplateSmil) || (Document()->DataModel()->SmilType() == E3GPPSmil))
       
  1579 				   {
       
  1580 				     // focus is on SMIL presentation icon
       
  1581 				      RemoveTemplateL();
       
  1582 				   }
       
  1583 				else
       
  1584 				    {
       
  1585                 		DoUserRemoveMediaL( controlId, EUniRegionImage );
       
  1586 				    }
       
  1587 			}
       
  1588 			} 
       
  1589             break;
       
  1590             }
  1547         case EMsgDispSizeAutomatic:
  1591         case EMsgDispSizeAutomatic:
  1548         case EMsgDispSizeLarge:
  1592         case EMsgDispSizeLarge:
  1549         case EMsgDispSizeNormal:
  1593         case EMsgDispSizeNormal:
  1550         case EMsgDispSizeSmall:
  1594         case EMsgDispSizeSmall:
  1551             {
  1595             {
  1742             }
  1786             }
  1743         case MMsgEditorObserver::EMsgControlPointerEvent:
  1787         case MMsgEditorObserver::EMsgControlPointerEvent:
  1744             {
  1788             {
  1745             TPointerEvent* event = static_cast<TPointerEvent*>( aArg2 );
  1789             TPointerEvent* event = static_cast<TPointerEvent*>( aArg2 );
  1746             CMsgBaseControl* control = static_cast<CMsgBaseControl*>( aArg1 );
  1790             CMsgBaseControl* control = static_cast<CMsgBaseControl*>( aArg1 );
  1747 
  1791             if(iLongTapDetector)
       
  1792             {
       
  1793                 iLongTapDetector->EnableLongTapAnimation(ETrue);
       
  1794                 iLongTapDetector->PointerEventL( *event );
       
  1795             }
  1748             if ( event->iType == TPointerEvent::EButton1Down )
  1796             if ( event->iType == TPointerEvent::EButton1Down )
  1749                 {
  1797                 {
  1750                 iFocusedControl = control && control->IsFocused() ? control : NULL;
  1798                 iFocusedControl = control;
  1751                 }
  1799                 iTapConsumed = EFalse;
  1752             else if ( event->iType == TPointerEvent::EButton1Up )
  1800                 }
  1753                 {
  1801             else if ( (!iTapConsumed) && (event->iType == TPointerEvent::EButton1Up) )
       
  1802                 {
       
  1803                 iTapConsumed = ETrue;
  1754                 if ( control && 
  1804                 if ( control && 
  1755                      iFocusedControl == control &&
  1805                      iFocusedControl == control &&
  1756                      ( control->ControlId() == EMsgComponentIdAudio ||
  1806                      ( control->ControlId() == EMsgComponentIdAudio ||
  1757                        control->ControlId() == EMsgComponentIdImage ||
  1807                        control->ControlId() == EMsgComponentIdImage ||
  1758                        control->ControlId() == EMsgComponentIdVideo ||
  1808                        control->ControlId() == EMsgComponentIdVideo ||
  2068                 }
  2118                 }
  2069             case EMsgComponentIdVideo:
  2119             case EMsgComponentIdVideo:
  2070                 {
  2120                 {
  2071                 CUniObject* object = iSmilModel->GetObject( Document()->CurrentSlide(), region );
  2121                 CUniObject* object = iSmilModel->GetObject( Document()->CurrentSlide(), region );
  2072                 
  2122                 
  2073                 if ( object->DrmInfo() )
  2123                 // Coverty fix, Null pointer return, http://ousrv057/cov.cgi?cid=37172
  2074                     {
  2124                 if ( object )
  2075                     object->DrmInfo()->FreezeRights();
  2125                 	{
       
  2126                     if ( object->DrmInfo() )
       
  2127                        {
       
  2128                        object->DrmInfo()->FreezeRights();
       
  2129                        }
  2076                     }
  2130                     }
  2077                 
  2131                 
  2078                 TRAP_IGNORE( iSlideLoader->UpdateControlIconL( 
  2132                 TRAP_IGNORE( iSlideLoader->UpdateControlIconL( 
  2079                                                   *static_cast<CMsgMediaControl*>( ctrl ), 
  2133                                                   *static_cast<CMsgMediaControl*>( ctrl ), 
  2080                                                   object ) );
  2134                                                   object ) );
  4501     
  4555     
  4502     User::LeaveIfError( bitmap->Duplicate( image->Bitmap()->Handle() ) );
  4556     User::LeaveIfError( bitmap->Duplicate( image->Bitmap()->Handle() ) );
  4503     User::LeaveIfError( bitmapMask->Duplicate( image->Mask()->Handle() ) );
  4557     User::LeaveIfError( bitmapMask->Duplicate( image->Mask()->Handle() ) );
  4504 
  4558 
  4505     iTitlePane->SetSmallPicture( bitmap, bitmapMask, ETrue );
  4559     iTitlePane->SetSmallPicture( bitmap, bitmapMask, ETrue );
       
  4560     if(!iFinalizeLaunchL)
  4506     iTitlePane->DrawNow();
  4561     iTitlePane->DrawNow();
  4507     
  4562     
  4508     CleanupStack::Pop( 2, bitmap );
  4563     CleanupStack::Pop( 2, bitmap );
  4509     }
  4564     }
  4510 
  4565 
  5262             }
  5317             }
  5263         }
  5318         }
  5264 
  5319 
  5265     iWaitDialog = new( ELeave ) CAknWaitDialog( reinterpret_cast<CEikDialog**>( &iWaitDialog ),
  5320     iWaitDialog = new( ELeave ) CAknWaitDialog( reinterpret_cast<CEikDialog**>( &iWaitDialog ),
  5266                                                 waitNoteDelayOff );
  5321                                                 waitNoteDelayOff );
  5267     iWaitDialog->SetTextL( *string );
  5322                                                 
  5268     CleanupStack::PopAndDestroy( string ); 
  5323     // Coverty Fix, Forward Null, http://ousrv057/cov.cgi?cid=35691                                            
       
  5324     if(string)
       
  5325     	{
       
  5326     	iWaitDialog->SetTextL( *string );
       
  5327     	CleanupStack::PopAndDestroy( string ); 
       
  5328     	}
  5269     
  5329     
  5270     iWaitDialog->SetCallback( this );
  5330     iWaitDialog->SetCallback( this );
  5271     
  5331     
  5272     iWaitResId = aResourceId;
  5332     iWaitResId = aResourceId;
  5273     
  5333     
  5577         {
  5637         {
  5578         focusedId = iView->FocusedControl()->ControlId();
  5638         focusedId = iView->FocusedControl()->ControlId();
  5579         }
  5639         }
  5580         
  5640         
  5581     TInt index = EMsgAppendControl;
  5641     TInt index = EMsgAppendControl;
       
  5642     // Coverty fix: Forward NULL, http://ousrv057/cov.cgi?cid=35695
       
  5643     if(iView)
       
  5644     	{
  5582     CMsgBaseControl* ctrl = iView->RemoveControlL( EMsgComponentIdBody ); // Does not leave
  5645     CMsgBaseControl* ctrl = iView->RemoveControlL( EMsgComponentIdBody ); // Does not leave
  5583 
  5646 
  5584     if ( ctrl ) 
  5647     if ( ctrl ) 
  5585         {
  5648         {
  5586         switch( aLayout )
  5649         switch( aLayout )
  5610                 }
  5673                 }
  5611             }
  5674             }
  5612             
  5675             
  5613         iView->AddControlL( ctrl, EMsgComponentIdBody, index, EMsgBody );
  5676         iView->AddControlL( ctrl, EMsgComponentIdBody, index, EMsgBody );
  5614         }
  5677         }
       
  5678       }
  5615     
  5679     
  5616     if ( !( iHeader->IsAddressControl( focusedId ) ||  
  5680     if ( !( iHeader->IsAddressControl( focusedId ) ||  
  5617             focusedId == EMsgComponentIdSubject ||
  5681             focusedId == EMsgComponentIdSubject ||
  5618             focusedId == EMsgComponentIdAttachment ) &&
  5682             focusedId == EMsgComponentIdAttachment ) &&
  5619          iEditorFlags & ELaunchSuccessful )
  5683          iEditorFlags & ELaunchSuccessful )
  8376             case EMsgComponentIdImage:
  8440             case EMsgComponentIdImage:
  8377             case EMsgComponentIdVideo:
  8441             case EMsgComponentIdVideo:
  8378             case EMsgComponentIdSvg:
  8442             case EMsgComponentIdSvg:
  8379                 {
  8443                 {
  8380                 CUniObject* obj = iSmilModel->GetObject( Document()->CurrentSlide(), region );
  8444                 CUniObject* obj = iSmilModel->GetObject( Document()->CurrentSlide(), region );
  8381                 
  8445                 // Coverty fix, Null pointer return , http://ousrv057/cov.cgi?cid=37100
  8382                 if( obj->Corrupted() )
  8446                 if(obj)
       
  8447                 {
       
  8448                   if( obj->Corrupted() )
  8383                     { // Object is corrupt -> just show note
  8449                     { // Object is corrupt -> just show note
  8384                     ShowInformationNoteL( R_UNIEDITOR_CANNOT_OPEN_CORRUPT, EFalse );
  8450                     ShowInformationNoteL( R_UNIEDITOR_CANNOT_OPEN_CORRUPT, EFalse );
  8385                     }
  8451                     }
  8386                 else
  8452                   else
  8387                     {
  8453                     {
  8388                     RFile file = CUniDataUtils::GetAttachmentFileL( Document()->DataModel()->Mtm(), obj->AttachmentId() );
  8454                     RFile file = CUniDataUtils::GetAttachmentFileL( Document()->DataModel()->Mtm(), obj->AttachmentId() );
  8389                     CleanupClosePushL( file );
  8455                     CleanupClosePushL( file );
  8390                     TDataType dataType( obj->MimeType() );
  8456                     TDataType dataType( obj->MimeType() );
  8391                     
  8457                     
  8411                         {
  8477                         {
  8412                          iEditorFlags &= ~EMsgEditInProgress;   
  8478                          iEditorFlags &= ~EMsgEditInProgress;   
  8413                          //  DeactivateInputBlocker();
  8479                          //  DeactivateInputBlocker();
  8414                         }
  8480                         }
  8415                     }
  8481                     }
       
  8482                   }
  8416                 break;
  8483                 break;
  8417                 }
  8484                 }
  8418             default:
  8485             default:
  8419                 {
  8486                 {
  8420                 break;
  8487                 break;
  9714      EndActiveWait();
  9781      EndActiveWait();
  9715      RemoveWaitNote();
  9782      RemoveWaitNote();
  9716      TRAP_IGNORE(ShowConfirmableInfoL( R_UNIEDITOR_NOT_ENOUGH_MEMORY));     
  9783      TRAP_IGNORE(ShowConfirmableInfoL( R_UNIEDITOR_NOT_ENOUGH_MEMORY));     
  9717      Exit( EAknSoftkeyClose );
  9784      Exit( EAknSoftkeyClose );
  9718     }
  9785     }
       
  9786 // ---------------------------------------------------------
       
  9787 // CUniEditorAppUi::HandleLongTapEventL
       
  9788 //  Function for handling the long tap events
       
  9789 // ---------------------------------------------------------
       
  9790 //
       
  9791 void CUniEditorAppUi::HandleLongTapEventL(const TPoint& aPenEventLocation, 
       
  9792 										  const TPoint& aPenEventScreenLocation )
       
  9793     {
       
  9794     CMsgBaseControl* ctrl = iView->FocusedControl(); // ctrl can be NULL.
       
  9795     if ( ctrl && 
       
  9796          ( ctrl->ControlId() == EMsgComponentIdAudio ||
       
  9797                  ctrl->ControlId() == EMsgComponentIdImage ||
       
  9798                  ctrl->ControlId() == EMsgComponentIdVideo ||
       
  9799                  ctrl->ControlId() == EMsgComponentIdSvg ) )
       
  9800         {
       
  9801         TRect rect = ctrl->Rect();
       
  9802 
       
  9803         if ((!iTapConsumed)&&rect.Contains(aPenEventLocation))
       
  9804             {
       
  9805             if (iEmbeddedObjectStylusPopup)
       
  9806                 {
       
  9807                 delete iEmbeddedObjectStylusPopup;
       
  9808                 iEmbeddedObjectStylusPopup = NULL;
       
  9809                 }
       
  9810             iEmbeddedObjectStylusPopup = CAknStylusPopUpMenu::NewL(this,aPenEventLocation);
       
  9811             TResourceReader reader;
       
  9812             iCoeEnv->CreateResourceReaderLC(reader,R_UNIEDITOR_EMBEDDED_OBJECT_STYLUS_MENU );
       
  9813             iEmbeddedObjectStylusPopup->ConstructFromResourceL(reader);
       
  9814             CleanupStack::PopAndDestroy();
       
  9815             iEmbeddedObjectStylusPopup->SetPosition(aPenEventLocation);
       
  9816             iEmbeddedObjectStylusPopup->ShowMenu();
       
  9817             iTapConsumed = ETrue;
       
  9818             }
       
  9819         }   
       
  9820     }  
  9719 // End of file
  9821 // End of file
  9720 
  9822