mobilemessaging/unieditor/application/src/UniEditorAppUi.cpp
branchRCL_3
changeset 77 da6ac9d688df
parent 66 fc3320e39880
--- a/mobilemessaging/unieditor/application/src/UniEditorAppUi.cpp	Wed Sep 15 12:08:45 2010 +0300
+++ b/mobilemessaging/unieditor/application/src/UniEditorAppUi.cpp	Wed Oct 13 14:27:34 2010 +0300
@@ -141,8 +141,6 @@
 #include <UniEditor.rsg>
 #include <MsgEditorAppUi.rsg>
 
-#include <akndiscreetpopup.h>
-#include <aknsconstants.hrh>
 
 #include "UniSendingSettings.h"
 #include "UniPluginApi.h"
@@ -267,11 +265,10 @@
     iWaitResId( -1 ),
     iOriginalSlide( -1 ),
     iNextFocus( EMsgComponentIdNull ),
-    iPopupChangedMmsBuffer(NULL),
-    iPopupChangedSmsBuffer(NULL),
     iEditorFlags( EShowInfoPopups ),
     iMskResId( R_UNIEDITOR_OPTIONS_CLOSE ),
-    iOptimizedFlow(EFalse)
+    iOptimizedFlow(EFalse),
+    iSingleJpegImageProcessing(EFalse)
     {
     }
     
@@ -454,18 +451,6 @@
 		iLongTapDetector->SetTimeDelayBeforeAnimation( KUniLongTapStartDelay );
 		iLongTapDetector->SetLongTapDelay( KUniLongTapTimeDelay );
 		iTapConsumed = EFalse;
-
-		//Korean Req: 415-5434
-		if ( iEditorFlags & EShowInfoPopups )
-     		{
-	        iPopupNote = CAknInfoPopupNoteController::NewL();
-            iPopupNote->SetTimeDelayBeforeShow( 0 );
-            iPopupNote->SetTimePopupInView( 3000 );
-
-			iPopupSmsSizeAboveLimitBuffer = StringLoader::LoadL( R_UNIEDITOR_POPUP_SMS_SIZE_ABOVE_LIMIT, Document()->SmsSizeWarningBytes(), iCoeEnv );
-			iPopupSmsSizeBelowLimitBuffer = StringLoader::LoadL( R_UNIEDITOR_POPUP_SMS_SIZE_UNDER_LIMIT, Document()->SmsSizeWarningBytes(), iCoeEnv );		
-	    	}
-
     }
 
 
@@ -478,7 +463,22 @@
     {
     iEditorFlags |= EEditorExiting;
     
-	
+	//sendui+jepg optimization changes
+    if(iLaunchOperation)
+        {
+        // check Is iLaunchOperation still attached to 
+        // iSlideLoader / iHeader
+        // Set the CUniEditorAppUi
+        // instance to NULL, to avoid crash.
+        if(iLaunchOperation->GetHeader())
+            {
+            iHeader = NULL;            
+            }
+        if(iLaunchOperation->GetSlideLoader())
+            {
+            iSlideLoader = NULL;            
+            }
+        }
     if ( iView )
         {
         // To prevent focus changes caused by input blocker deletion & toolbar extension
@@ -683,10 +683,31 @@
 //
 void CUniEditorAppUi::FinalizeLaunchL()
     {
+	// In all normal cases other then Sendui+Jepeg
+	// iOptimizedFlow will be false and flow should be 
+	// same as the normal launch
+    if(iOptimizedFlow)
+        {
+		//if iOptimizedFlow is True, it means
+		//sendui+Jepg and this is partial complete call
+        iSingleJpegImageProcessing = ETrue;
+        }
+		
     iFinalizeLaunchL = ETrue;
     iSmilModel = &Document()->DataModel()->SmilModel();
-    iHeader = iLaunchOperation->DetachHeader();
-    iSlideLoader = iLaunchOperation->DetachSlideLoader();
+	
+    if(!iOptimizedFlow)
+        {
+		//detach the iHeader and iSlideLoader
+        iHeader = iLaunchOperation->DetachHeader();
+        iSlideLoader = iLaunchOperation->DetachSlideLoader();
+        }
+    else
+        {
+		// get reference to complete partial lauch operation
+        iHeader = iLaunchOperation->GetHeader();
+        iSlideLoader = iLaunchOperation->GetSlideLoader();
+        }
     
     SetMessageTypeLockingL();
     
@@ -773,8 +794,16 @@
         
     if ( iEditorFlags & EShowInfoPopups )
         {
+        iPopupNote = CAknInfoPopupNoteController::NewL();
+        iPopupNote->SetTimeDelayBeforeShow( 0 );
+        iPopupNote->SetTimePopupInView( 3000 );
+
         iPopupChangedMmsBuffer = StringLoader::LoadL( R_UNIEDITOR_POPUP_MSG_CHANGED_MMS, iCoeEnv );
-		iPopupChangedSmsBuffer = StringLoader::LoadL( R_UNIEDITOR_POPUP_MSG_CHANGED_SMS, iCoeEnv );
+        iPopupChangedSmsBuffer = StringLoader::LoadL( R_UNIEDITOR_POPUP_MSG_CHANGED_SMS, iCoeEnv );
+
+        //Korean Req: 415-5434        
+        iPopupSmsSizeAboveLimitBuffer = StringLoader::LoadL( R_UNIEDITOR_POPUP_SMS_SIZE_ABOVE_LIMIT, Document()->SmsSizeWarningBytes(), iCoeEnv );
+        iPopupSmsSizeBelowLimitBuffer = StringLoader::LoadL( R_UNIEDITOR_POPUP_SMS_SIZE_UNDER_LIMIT, Document()->SmsSizeWarningBytes(), iCoeEnv );
 
         }
 
@@ -784,12 +813,41 @@
     MenuBar()->SetMenuType( CEikMenuBar::EMenuOptions );
     
     UpdateToolbarL();
-    
-    iEditorFlags |= ELaunchSuccessful;
-	
-    iView->ExecuteL( ClientRect(), focusedControlId );
+
+	// partial launch need to call execute to make
+	//the editor visible
+    if(iOptimizedFlow)
+        {
+        iView->ExecuteL( ClientRect(), focusedControlId );
+        }
+    else// not optmized Flow, common flow
+        {
+        // partial launch, dont set the flag
+        iEditorFlags |= ELaunchSuccessful;
+        
+		// in case of sendui+jepg , again finalize launch will be called 
+		//after image processing, no need to call iView->ExecuteL
+		// slide will be loaded already by slide loader.
+        if(!iSingleJpegImageProcessing)
+            {
+			//normal flow
+            iView->ExecuteL( ClientRect(), focusedControlId );
+            }
+        
+        //after the lauch complete for sendui+jepg
+        //rest it.
+        iSingleJpegImageProcessing = EFalse;        
+        }
+    
     delete iScreenClearer;
     iScreenClearer = NULL;
+   
+    // show note inserting 
+    if(iOptimizedFlow)
+        {
+        ShowWaitNoteL( R_QTN_UNI_WAIT_INSERTING );
+        }
+ 
 	
     }
     
@@ -1126,17 +1184,7 @@
                     {
                     // No absolute maximum characters defined -> Calculate
                     // character maximum using maximum SMS part limit.
-
-                    if( maxSmsParts > 1 )
-                        {
-                        maxSmsCharacters = maxSmsParts * lengthMany;
-                        }
-                    else
-                        {
-						// for korean variant
-                        maxSmsCharacters = lengthOne;
-                        }
-
+                    maxSmsCharacters = maxSmsParts * lengthMany;
                     }
                 CalculateSMSMsgLen(charsLeft,msgsParts);
                 if( model->ObjectList().Count() == 0 &&
@@ -1403,39 +1451,6 @@
         }
     }
     
-// ---------------------------------------------------------
-// CUniEditorAppUi::ProcessCommandL
-// ---------------------------------------------------------
-//
-void CUniEditorAppUi::ProcessCommandL(TInt aCommand)
-    {
-    switch(aCommand)
-        {
-        case EAknCmdExit:
-            {
-            /*
-            Exit command is handle handled here since handling the same in HandleCommandL is too late for
-            themes effect to shown when application is exiting while progress note is shown.
-            BeginFullScreen is called after ProcessCommandL and before HandleCommandL,  progress note is 
-            shown in ProcessCommandL ie before BeginFullScreen is made.  
-            */
-            
-            //Only after processing the command, option menu is removed
-            //ProcessCommandL is called with some false command id which is unique and not used in any other place
-            const TInt KRandomCommand(8975462);
-            CAknAppUi::ProcessCommandL( KRandomCommand );
-            RemoveWaitNote();
-            ExitAndSaveL();
-            break;
-            }
-        default:
-            break;
-        }
-    
-    CAknAppUi::ProcessCommandL( aCommand );
-    
-    }
-
 
 // ---------------------------------------------------------
 // CUniEditorAppUi::HandleCommandL
@@ -1658,9 +1673,6 @@
             }
         case EEikCmdExit:
             {
-            //Save message when unieditor is closed though FSW
-			//We won't get here when option->exit is selscted since while handling CAknCmdExit in overriden
-			//ProcessCommandL we call Exit() 
             RemoveWaitNote();
             ExitAndSaveL();
             break;
@@ -6482,8 +6494,9 @@
     if ( iEditorFlags & EEditorExiting )
         {
         // Do not handle any event if we are exiting from editor.
-		// rest values. 
+		// rest values.
         iOptimizedFlow = EFalse;
+        iSingleJpegImageProcessing = EFalse;
         return;
         }
     
@@ -6497,18 +6510,14 @@
             if(iLaunchOperation)
                 {
                 iOptimizedFlow = iLaunchOperation->IsOptimizedFlagSet();
-                if(iOptimizedFlow )
-                    {
-                    TRAP_IGNORE(ShowWaitNoteL( R_QTN_UNI_WAIT_INSERTING ));
-                    iOptimizedFlow = EFalse;
-                    return;
-                    }
-                }
-            }
-        
-        DeactivateInputBlocker();
-        iEditorFlags &= ~EMsgEditInProgress;   
-        
+                }
+            }
+		// sendui+jepg-> this required after image processing 
+        if(!iOptimizedFlow)
+            {
+            DeactivateInputBlocker();
+            iEditorFlags &= ~EMsgEditInProgress;   
+            }
         if ( aEvent == EUniEditorOperationCancel &&
              aOperation != EUniEditorOperationSend )
             {
@@ -6527,6 +6536,15 @@
     TRAPD( error, DoEditorOperationEventL( aOperation, aEvent ) );
     if ( error != KErrNone )
         {
+		// error handling
+        if(iOptimizedFlow)
+            {
+            DeactivateInputBlocker();
+            iEditorFlags &= ~EMsgEditInProgress;   
+            }
+        iOptimizedFlow = EFalse;
+        iSingleJpegImageProcessing = EFalse;
+        
         // Handle operation handling error.
         if ( error == KLeaveExit )
             {
@@ -6543,6 +6561,10 @@
                 }
             }
         }
+    //sendui+jepg-> after first call to finallizelauch,rest
+	// it, so that next call will cover the code finallizelaunch
+	//as happened for other launch cases.
+    iOptimizedFlow = EFalse;
     }
 
 // ---------------------------------------------------------
@@ -6695,11 +6717,19 @@
 //
 void CUniEditorAppUi::DoLaunchCompleteL()
     {
-    // Does no harm to call this even if no wait note is set.
-    RemoveWaitNote();        
-
+	//sendui+jepg -> this required after image processing 
+    if(!iOptimizedFlow)
+        {
+        // Does no harm to call this even if no wait note is set.
+        RemoveWaitNote();        
+        }
+		
     TBool shutDown( EFalse );
-    ShowLaunchNotesL( shutDown );
+	// sendui+jepg-> this required after image processing 
+    if(!iOptimizedFlow)
+		{
+        ShowLaunchNotesL( shutDown );
+		}
     
     if ( shutDown )
         {
@@ -7853,7 +7883,8 @@
                     iEditorFlags |= ESmsSizeWarningNoteShown;
                     if( iPopupNote )
                         {
-						ShowDiscreetPopUpL(iPopupSmsSizeAboveLimitBuffer->Des());
+                        iPopupNote->SetTextL( iPopupSmsSizeAboveLimitBuffer->Des() );
+                        iPopupNote->ShowInfoPopupNote();
                         }
                     }
                 }
@@ -7866,7 +7897,8 @@
                     iEditorFlags &= ~ESmsSizeWarningNoteShown;
                     if( iPopupNote )
                         {
-                        ShowDiscreetPopUpL(iPopupSmsSizeBelowLimitBuffer->Des());
+                        iPopupNote->SetTextL( iPopupSmsSizeBelowLimitBuffer->Des() );
+                        iPopupNote->ShowInfoPopupNote();
                         }                
                     }
                 }          
@@ -8099,7 +8131,16 @@
         TBool westernText = ETrue;
 
         CCnvCharacterSetConverter* conv = doc->CharConverter();    
-
+        CCnvCharacterSetConverter::TAvailability  availability;
+        availability = conv->PrepareToConvertToOrFromL(KCharacterSetIdentifierExtendedSms7Bit, FsSession());
+        if (availability == CCnvCharacterSetConverter::ENotAvailable)
+            {
+                availability = conv->PrepareToConvertToOrFromL(KCharacterSetIdentifierSms7Bit, FsSession());
+                if (availability == CCnvCharacterSetConverter::ENotAvailable)
+                    {
+                    UNILOGGER_WRITE( "CCnvCharacterSetConverter -> KCharacterSetIdentifierSms7Bit is not available" );
+                    }
+            }
         if ( conv )
             { 
             for( TInt index = 0; index < KUniEdNumberOfEditors; index++ )
@@ -8564,12 +8605,11 @@
 //
 void CUniEditorAppUi::ShowPopupNoteL( TBool aMms )
     {
-    if( iPopupNote && iPopupChangedMmsBuffer )
-        {
-        // additional check  iPopupChangedMmsBuffer is required as iPopupNote
-        // will be intialized in ConstructL but not iPopupChangedMmsBuffer.
-        // This change is done as part of Korean req.
-            ShowDiscreetPopUpL(aMms? iPopupChangedMmsBuffer->Des(): iPopupChangedSmsBuffer->Des());
+    if( iPopupNote )
+        {
+        iPopupNote->SetTextL( aMms? iPopupChangedMmsBuffer->Des():
+                                    iPopupChangedSmsBuffer->Des() );
+        iPopupNote->ShowInfoPopupNote();
         }
     }
  
@@ -10002,35 +10042,5 @@
     return bCanSave;
     }
 
-// ---------------------------------------------------------
-// CUniEditorAppUi::ShowDiscreetPopUpL
-// Shows the Popup note in ITUT, when message size exceeds or deceeds 
-// a certain limit or it changes from sms to mms and vice versa
-// ---------------------------------------------------------
-//
-void CUniEditorAppUi::ShowDiscreetPopUpL(const TDesC& aMessage)
-	{
-	TInt  bitmapId = KErrNotFound;
-	TInt  maskId = KErrNotFound;
-   
-   // No discreet popup => Uid 0
-   const TUid KDiscreetPopupUidNone =
-	   {
-	   0x0
-	   };
-	
-	CAknDiscreetPopup::ShowGlobalPopupL(aMessage, // 1st text row
-			KNullDesC, // second text row
-			KAknsIIDDefault, // icon skin id
-			KNullDesC, // bitmap file path
-			bitmapId, // bitmap id
-			maskId, // mask id
-			KAknDiscreetPopupDurationLong, // flags
-			0, // command id
-			NULL, // command observer
-			KDiscreetPopupUidNone, // application to be launched
-			KDiscreetPopupUidNone); // view to be activated
-	}
-
 // End of file