Revision: 201023 RCL_3 PDK_3.0.1
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 21 Jun 2010 15:42:09 +0300
branchRCL_3
changeset 16 99b535de1dda
parent 14 a616540b95d9
child 18 a7d8840c0b8c
Revision: 201023 Kit: 2010125
extras/calcsoft/inc/CalcCont.h
extras/calcsoft/inc/CalcFunc.h
extras/calcsoft/inc/CalcOutSheet.h
extras/calcsoft/src/CalcCont.cpp
extras/calcsoft/src/CalcDoc.cpp
extras/calcsoft/src/CalcFunc.cpp
extras/calcsoft/src/CalcOutSheet.cpp
extras/calcsoft/src/CalcView.cpp
--- a/extras/calcsoft/inc/CalcCont.h	Wed Jun 09 09:43:27 2010 +0300
+++ b/extras/calcsoft/inc/CalcCont.h	Mon Jun 21 15:42:09 2010 +0300
@@ -121,30 +121,30 @@
         */
         void SetClearKeyEnable();
 
-		/**
+        /**
         * Show square root button only if no 0 in editor.
         */
-		void SetSqrtEnableL();
+        void SetSqrtEnableL();
 
-		/**
+        /**
         * Show percent button only if no 0 in editor.
         */
-		void SetPercentEnableL();
+        void SetPercentEnableL();
 
-		/**
+        /**
         * Redraw square root button.
         */
-		void ShowSqrtButton(TBool aEnable);
+        void ShowSqrtButton(TBool aEnable);
 
-		/**
+        /**
         * Redraw percent button.
         */
-		void ShowPercentButton(TBool aEnable);
+        void ShowPercentButton(TBool aEnable);
 
-		/**
-		* Returns the state of the calculator.
-		*/
-		CCalcView::TStateNo GetState();
+        /**
+        * Returns the state of the calculator.
+        */
+        CCalcView::TStateNo GetState();
 
         /**
         * Time out CallBack function for *-key press
@@ -173,6 +173,12 @@
         */
         void NotifyChangeDecimal(TChar aOld, TChar aNew);
         
+        /**
+        * Called  when an error is displayed.
+        * @param aErrorCode : an error code  from  CCalcContainer
+        */
+        void SetErrorCode(TInt aErrorCode);
+        
     public: // Functions from base classes
         /**
         * From CCoeControl : Get help context
@@ -180,38 +186,38 @@
         */
         void GetHelpContext(TCoeHelpContext& aContext) const;
 
-		/**
-		*Returns functionMap subpane
-		*/
-		inline CCalcFuncmapSubPane* FunctionSubPane() const; 
-		
-		/**
+        /**
+        *Returns functionMap subpane
+        */
+        inline CCalcFuncmapSubPane* FunctionSubPane() const; 
+        
+        /**
         * HandleMiddleSoftKey
         * Handled when MSK is selected 
-        */	
-		void HandleMiddleSoftKey();
+        */    
+        void HandleMiddleSoftKey();
 
-		/**
+        /**
         * SetOperatorFromTouch
         * To handle the addition of Touch Input values for digits
-        */	
-		void SetOperatorFromTouchL(TInt akey);
-		
-		/**
+        */    
+        void SetOperatorFromTouchL(TInt akey);
+        
+        /**
         * ClearInputKey
         * To handle the clear input key through the touch UI 
-        */	
-		void ClearInputKeyL(TInt aRepeat = 0);
-		
-		/**
+        */    
+        void ClearInputKeyL(TInt aRepeat = 0);
+        
+        /**
         * ClearInputKey
         * To handle the '.' key press
-        */	
-		
-		void SetSeparatorFromTouchL();
+        */    
+        
+        void SetSeparatorFromTouchL();
 
-		// From CCoeControl		
-		void ActivateL();
+        // From CCoeControl        
+        void ActivateL();
     private:  // New functions 
         /**
         * C++ default constructor.
--- a/extras/calcsoft/inc/CalcFunc.h	Wed Jun 09 09:43:27 2010 +0300
+++ b/extras/calcsoft/inc/CalcFunc.h	Mon Jun 21 15:42:09 2010 +0300
@@ -45,12 +45,12 @@
 //  FORWARD DECLARATIONS
 //class   CCalcCommandButton;
 //Use of new AknButtons
-class 	CAknButton;
+class     CAknButton;
 class   CCalcContainer;
 class   CCalcAppEnv;
 class   CPtiEngine;
 class   CPtiQwertyKeyMappings;
-class 	CPtiCoreLanguage;
+class     CPtiCoreLanguage;
 #ifdef RD_INTELLIGENT_TEXT_INPUT 
 class   CPtiHalfQwertyKeyMappings;
 #endif
@@ -59,8 +59,8 @@
 
 /**
 CCalcFuncmapSubPane : 'FunctionMap Sub-Pane' class
-										: Class also derived from MCoeControlObserver to get events
-										  from Avkon buttons
+                                        : Class also derived from MCoeControlObserver to get events
+                                          from Avkon buttons
 */
 class   CCalcFuncmapSubPane
         :public CCoeControl , public MCoeControlObserver
@@ -73,14 +73,14 @@
                ECmdTSeven,        
                ECmdTFour,         
                ECmdTOne,          
-			   ECmdTZero,         
-			   ECmdTSqrt, 		 
+               ECmdTZero,         
+               ECmdTSqrt,          
                ECmdTEight,        
                ECmdTFive,         
                ECmdTTwo,          
-			   ECmdTSeparator,    
-			   ECmdTPercent,		 
-			   ECmdTNine,         
+               ECmdTSeparator,    
+               ECmdTPercent,         
+               ECmdTNine,         
                ECmdTSix,          
                ECmdTThree,        
                ECmdTChangeSign,   
@@ -101,11 +101,11 @@
             EMinusButton,           // -
             EMultiplyButton,        // *
             EDivideButton,          // /
-			EChangeSignButton,      // +/-
+            EChangeSignButton,      // +/-
             EEqualButton,           // =
-			ESqrtButton,			// sqrt
-			EPercentButton,			// %
-			EScrollUp,              // << 
+            ESqrtButton,            // sqrt
+            EPercentButton,            // %
+            EScrollUp,              // << 
             EScrollDown             // >> 
             };
    public:  // Constructors and destructor
@@ -132,26 +132,26 @@
         * @param aEnable : Flag of ChangeSign enable
         */
         void SetChangeSignEnable(TBool aEnable);
-		
-		/**
+        
+        /**
         * Redraw Sqrt button on Sqrt enable.
         * @param aEnable : Flag of SqrtEnable enable
         */
-		void SetSqrtEnable (TBool aEnable);
+        void SetSqrtEnable (TBool aEnable);
 
         /**
         * Redraw Clear button on Clear enable.
         * @param aEnable : Flag of ClearEnable enable
         */
         void SetClearKeyEnable( TBool aEnable );
-		
-		/**
+        
+        /**
         * Redraw Sqrt button on Percent enable.
         * @param aEnable : Flag of PercentEnable enable
         */
-		void SetPercentEnable(TBool aEnable);
+        void SetPercentEnable(TBool aEnable);
 
-		/**
+        /**
         * If no key is pressed until timeout of *-key,
         * this function is called.
         */
@@ -186,8 +186,18 @@
         * 
         */
         TBool IsKeyLongPressed();
-
         
+        /**
+        * Called  when an error is displayed.
+        * @param aErrorCode : an error code  from  CCalcContainer
+        */
+        void SetErrorCode(TInt aErrorCode);
+        
+        /**
+        * Called  when there is a release event  .
+        * @param aErrorCode : an error code ,it used to display dialog
+        */
+        void ErrorMsgL(TInt aErrorCode);
     public:   // Functions from base classes
     
         /**
@@ -204,19 +214,19 @@
         */
         TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType);
 
-		/**
-		*Refresh with latest button Icons when the skin change event has occured.
-	    */
-		void RefreshButtonIcons();
-		
-		 /**
+        /**
+        *Refresh with latest button Icons when the skin change event has occured.
+        */
+        void RefreshButtonIcons();
+        
+         /**
         * CCalcFuncmapSubPane::GetButtonBitmapControl
-		* This function is called when the size changes.
+        * This function is called when the size changes.
         * 
         */
-		    CAknButton* GetButtonBitmapControl(TInt aIndex); //Return iButtons
-		
-		 /**
+            CAknButton* GetButtonBitmapControl(TInt aIndex); //Return iButtons
+        
+         /**
         * From CCoeControl : Handling pointer event
         * Handles all pen input events on function pane.
         * 
@@ -235,14 +245,14 @@
         */
         void HandleMiddleSoftKeyOREKeyOKL();             
 
-				/**
+                /**
         * GetChangeSignButtonState
         * Gets the state of the Sign Button
         */
         TBool GetChangeSignButtonState();
         
         
-				/**
+                /**
         * GetSqrtButtonState
         * Gets the state of the Squareroot Button
         */
@@ -319,7 +329,16 @@
         * @param aOldId : The button chosen before
         * @param aNewId : The button chosen newly
         */
-        void RedrawHighlight(TUint aOldId, TUint aNewId) const;
+        void RedrawHighlight(TUint aOldId, TUint aNewId) ;
+        
+        /**
+        * An old highlight rectangle and 
+        * a new highlight rectangle are redrawn.
+        * @param aOldId : The button chosen before
+        * @param aNewId : The button chosen newly
+        * @param aShowHightlight: control hightlight display
+        */
+        void RedrawHighlight(TUint aOldId, TUint aNewId,TBool aShowHightlight) ;
         
         /**
         * Set functionmap button layout. 
@@ -383,20 +402,20 @@
         CCalcAppEnv*    iCalcAppEnv;   // Not own
         RProperty       iQwertyModeStatusProperty; // To check the Qwerty keypad active 
         
-        TPtiTextCase	  iShiftKeyPressed;
+        TPtiTextCase      iShiftKeyPressed;
         CPtiEngine*     iEngine;
-        CRepository* 	  iCRKey;
+        CRepository*       iCRKey;
         CPtiCoreLanguage* iCoreLanguage;
         CPtiQwertyKeyMappings* iQwertyKeyMappings;
 #ifdef RD_INTELLIGENT_TEXT_INPUT       
         CPtiHalfQwertyKeyMappings* iHalfQwertyKeyMappings;
 #endif
 
-        TInt 			      iLanguage;
+        TInt                   iLanguage;
         TInt                  iUiLanguage;
-        TInt 			      iShiftKey;
-        TBool 			    iValue;
-        TInt            iCountOfButtons;	//keeps track of the count of buttons
+        TInt                   iShiftKey;
+        TBool                 iValue;
+        TInt            iCountOfButtons;    //keeps track of the count of buttons
         TInt            iButtonsInRow;   //Number of buttons in the row
         TInt            iButtonsInColumn; //Number of buttons in the Column
         TBool           iIsSqrtDimmed;  //Holds the state of the squareroot button
@@ -407,6 +426,9 @@
         TBool           iIsKeyLongPress;     //Checks if the button is Long Pressed or not
         TInt            iKeyboardType;
         TBool           iIsShiftKeyPressed;
+        TInt            iErrorCode;
+        TBool           iShowDrawHight;
+        TBool           iInputData;
     };
 
 #endif      //  CALCFUNC_H
--- a/extras/calcsoft/inc/CalcOutSheet.h	Wed Jun 09 09:43:27 2010 +0300
+++ b/extras/calcsoft/inc/CalcOutSheet.h	Mon Jun 21 15:42:09 2010 +0300
@@ -101,26 +101,26 @@
         */
         void ScrollDown();
 
-		/**
-		* Refresh PaperBitmap Icon when the skin change event has occured.
-		*/
-		inline void RefreshPaperBitmap() ;
-		/**
-		* Refresh ScalablePaperBitmap Icon when the skin change event has occured.
-		*/
-		inline void RefreshScalablePaperBitmap() ;
+        /**
+        * Refresh PaperBitmap Icon when the skin change event has occured.
+        */
+        inline void RefreshPaperBitmap() ;
+        /**
+        * Refresh ScalablePaperBitmap Icon when the skin change event has occured.
+        */
+        inline void RefreshScalablePaperBitmap() ;
 
 
-		inline void RefreshResultsLineBitmap() ;
-		
-		/**
-		* From MEikScrollBarObserver: to Handle scrollbar events
-		* @param CEikScrollBar* : Pointer to the scrollbar
-		* @param TEikScrollEvent : Event on the Scrollbar
-		*/
-		void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType);
-		
-		
+        inline void RefreshResultsLineBitmap() ;
+        
+        /**
+        * From MEikScrollBarObserver: to Handle scrollbar events
+        * @param CEikScrollBar* : Pointer to the scrollbar
+        * @param TEikScrollEvent : Event on the Scrollbar
+        */
+        void HandleScrollEventL(CEikScrollBar* aScrollBar, TEikScrollEvent aEventType);
+        
+        
         /**
         * From CCoeControl : Notifier for changing language
         * @param aType : Type of resource change
@@ -128,7 +128,7 @@
         void HandleResourceChange(TInt aType);
         void HandleResourceChangeOutSheetL(TInt aType);
  
-		
+        
     private:    // New functions
         /**
         * C++ default constructor.
@@ -157,7 +157,7 @@
         */
         void Draw(const TRect& aRect) const;
         
-  		/**
+          /**
         * Function used to dynamically update scrollbar indicators.
         */
         void UpdateScrollIndicatorL();
@@ -166,26 +166,27 @@
     private:    // Data
         TInt iScrollOffset;     // Scroll position
         const CGulIcon* iCalcPaper; // Not own
-		const CGulIcon* iCalcScalablePaper[KCountOfPaperBitmaps];
-		const CGulIcon* iCalcResultsLine;
+        const CGulIcon* iCalcScalablePaper[KCountOfPaperBitmaps];
+        const CGulIcon* iCalcResultsLine;
         CCalcHistory*   iCalcHistory;    // Not own
         CCalcContainer* iCalcContainer;  // Not own
         CCalcAppEnv*    iCalcAppEnv;     // Not own
-		TAknLayoutRect iCalcPaperLayout[KCountOfPaperBitmaps];
-		TInt iCalcOutputSheetLines;
-		CAknsBasicBackgroundControlContext* iOpSheetContext;
-		CArrayFixFlat<TAknLayoutText>* iOperatorLayout;
-		CArrayFixFlat<TAknLayoutText>* iOperandLayout;
-		CArrayFixFlat<TAknLayoutRect>* iResultsLineLayout;
-		CArrayFixFlat<TAknLayoutRect>* iEqualLineLayout;
-		CRepository* 	iCRKey;
-		TInt 			iLanguage;
+        TAknLayoutRect iCalcPaperLayout[KCountOfPaperBitmaps];
+        TInt iCalcOutputSheetLines;
+        CAknsBasicBackgroundControlContext* iOpSheetContext;
+        CArrayFixFlat<TAknLayoutText>* iOperatorLayout;
+        CArrayFixFlat<TAknLayoutText>* iOperandLayout;
+        CArrayFixFlat<TAknLayoutRect>* iResultsLineLayout;
+        CArrayFixFlat<TAknLayoutRect>* iEqualLineLayout;
+        CRepository*     iCRKey;
+        TInt             iLanguage;
         TInt            iUiLanguage;
-		CEikScrollBarFrame *iSBFrame;		//own -> pointer used for scrollbar frame
-		TAknLayoutRect  iPaperPaneRect;
-		TInt            iPrevThumbPosition;
-		            
-       
+        CEikScrollBarFrame *iSBFrame;        //own -> pointer used for scrollbar frame
+        TAknLayoutRect  iPaperPaneRect;
+        TInt            iPrevThumbPosition;
+                    
+        // the bottom right coordinate of scrollbar  
+        TPoint          iSBBrPoint;
     };
 
 #include "CalcOutSheet.inl"
--- a/extras/calcsoft/src/CalcCont.cpp	Wed Jun 09 09:43:27 2010 +0300
+++ b/extras/calcsoft/src/CalcCont.cpp	Mon Jun 21 15:42:09 2010 +0300
@@ -23,7 +23,7 @@
 #include    <AknUtils.h>   // AknLayoutUtils::LayoutControl 
 #include    <Calcsoft.rsg>
 
-#include	<layoutmetadata.cdl.h>
+#include    <layoutmetadata.cdl.h>
 
 // For skin support. 
 #include    <AknsDrawUtils.h>
@@ -43,7 +43,7 @@
 #include    "CalcOutSheet.h"
 #include    "calc.hrh"
 #include    "CalcView.h"
-#include	"CalcEnv.h"
+#include    "CalcEnv.h"
 #include    "CalcHistory.h"
 #include    "CalcDrawingConst.laf" // for layout information
 
@@ -71,7 +71,7 @@
     {
     ECalcControlFunctionMap,
     ECalcControlOutputSheet,
-	ECalcControlEditorPane
+    ECalcControlEditorPane
     };
 
 // If const TChar is used, complie error occurs in THUMB build.
@@ -103,15 +103,15 @@
     delete iTimeout;
 
     if ( iTimeoutChr )
-    	{
+        {
         delete iTimeoutChr;
         iTimeoutChr = NULL;
-    	}
+        }
     if ( iTimeoutShift )
-    	{
+        {
         delete iTimeoutShift;
         iTimeoutShift = NULL;
-    	}
+        }
 
     delete iSkinContext;
     }
@@ -247,15 +247,15 @@
 //
 void CCalcContainer::SetSqrtEnableL()
     {
-	TCalcEditLine editLine(iEditorPane->EditLine());
-	TBool sqrtEnable(ETrue);
+    TCalcEditLine editLine(iEditorPane->EditLine());
+    TBool sqrtEnable(ETrue);
     
-    if (editLine.NumberL() == 0.0)
+    if ( editLine.NumberL() == 0.0 )
         {
         sqrtEnable = EFalse;    
-		}
-	iFuncmapPane->SetSqrtEnable(sqrtEnable);
-	}
+        }
+    iFuncmapPane->SetSqrtEnable(sqrtEnable);
+    }
 
 // ---------------------------------------------------------
 // CCalcContainer::SetPercentEnableL
@@ -265,15 +265,15 @@
 //
 void CCalcContainer::SetPercentEnableL()
     {
-	TCalcEditLine editLine(iEditorPane->EditLine());
-	TBool percentEnable(ETrue);
+    TCalcEditLine editLine(iEditorPane->EditLine());
+    TBool percentEnable(ETrue);
     
     if (editLine.NumberL() == 0.0)
         {
         percentEnable = EFalse;    
-		}
-	iFuncmapPane->SetPercentEnable(percentEnable);
-	}
+        }
+    iFuncmapPane->SetPercentEnable(percentEnable);
+    }
 
 
 // ---------------------------------------------------------
@@ -328,7 +328,16 @@
     iEditorPane->NotifyChangeDecimal(aOld, aNew);
     iSheetPane->DrawNow();
     }
-
+    
+// ---------------------------------------------------------
+// CCalcContainer::SetErrorCode
+// Call from view  when an error code is display.
+// ---------------------------------------------------------
+//        
+void  CCalcContainer::SetErrorCode(TInt aError)
+    {
+    iFuncmapPane->SetErrorCode( aError );
+    }
 
 // ---------------------------------------------------------
 // CCalcContainer::GetHelpContext
@@ -366,7 +375,7 @@
     
     iFuncmapPane = CCalcFuncmapSubPane::NewL(this);
     iSheetPane = CCalcOutputSheet::NewL(this);
-	iEditorPane = CCalcEditorSubPane::NewL(this);
+    iEditorPane = CCalcEditorSubPane::NewL(this);
 
     iTimeout = CPeriodic::NewL(KCallBackPriority);
  
@@ -687,7 +696,7 @@
             else
                 {
                 if ( iFuncmapPane->GetKeyboardType() == EPtiKeyboardHalfQwerty )
-                	{
+                    {
                     if ( HandleChrKeyTimeoutForKeyPressL( aKeyEvent, aType ) )
                         {
                         return EKeyWasConsumed;
@@ -699,7 +708,6 @@
                     }
                 }
 #endif
-
             iValue =1 ;
             break;
             }
@@ -707,7 +715,7 @@
             {
             if(!(iFuncmapPane->IsQwertyKeypadActive()))
              {
-            	
+                
             if (iPrevInput == KCalcAsteriskBtn && !iTimeout->IsActive() && iValue ==1 )
                 {
                 TCallBack callback(TimeoutCallbackL, this);
@@ -720,7 +728,7 @@
             else
                 {
                 if ( iFuncmapPane->GetKeyboardType() == EPtiKeyboardHalfQwerty )
-                	{
+                    {
                     if ( aKeyEvent.iScanCode == EStdKeyLeftFunc && !iTimeoutChr->IsActive() && iValue == 1 )
                         {
                         TCallBack callback( TimeoutCallbackChrL, this );
@@ -735,7 +743,7 @@
                                      ( TTimeIntervalMicroSeconds32 ) KCallBackInterval, 
                                      callback );
                         }
-            	    }
+                    }
                 }
 #endif
 
@@ -759,9 +767,9 @@
              iEditorPane->IsQwertyActive();
              }
         else
-        	{
-        	iEditorPane->IsQwertyNotActive();	
-        	}
+            {
+            iEditorPane->IsQwertyNotActive();    
+            }
         // Edit buffer of line
         keyResponse = iEditorPane->OfferKeyEventL(aKeyEvent, aType);
         }
@@ -789,14 +797,14 @@
     {
     if ((aType == KEikDynamicLayoutVariantSwitch) || (aType == KAknsMessageSkinChange) )
         {
-         	    
-	     TRect mainPaneRect ;
-	     TRect statusPaneRect;
-	     TBool signstate = EFalse;
-	     TBool sqrtstate = EFalse;
-	     TBool percentstate = EFalse;
+                 
+         TRect mainPaneRect ;
+         TRect statusPaneRect;
+         TBool signstate = EFalse;
+         TBool sqrtstate = EFalse;
+         TBool percentstate = EFalse;
         TBool clearstate = EFalse;
-        	     
+                 
         if ( Layout_Meta_Data::IsLandscapeOrientation() )
             {
             // when calculator is in Landscape layout, the statuspane displays     
@@ -810,37 +818,37 @@
             AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EStatusPane, statusPaneRect );
             mainPaneRect.iTl = statusPaneRect.iTl;
             }
-	    
-	    
-	    //check if funcpane already exists
+        
+        
+        //check if funcpane already exists
 
       TInt selected = 0;
-	    if(iFuncmapPane)
-	    {
-	    	//store the  states of the buttons
-	        signstate = iFuncmapPane->GetChangeSignButtonState();
-	        sqrtstate = iFuncmapPane->GetSqrtButtonState();
-	        percentstate = iFuncmapPane->GetPercentButtonState();
+        if(iFuncmapPane)
+        {
+            //store the  states of the buttons
+            signstate = iFuncmapPane->GetChangeSignButtonState();
+            sqrtstate = iFuncmapPane->GetSqrtButtonState();
+            percentstate = iFuncmapPane->GetPercentButtonState();
 
             selected = iFuncmapPane->GetSelectedButtonId();
             
             clearstate = iFuncmapPane->GetClearButtonState(); 
-         	
-         	//delete the function pane
-	        delete(iFuncmapPane);
-	        iFuncmapPane =  NULL;
-	        
-	    }
+             
+             //delete the function pane
+            delete(iFuncmapPane);
+            iFuncmapPane =  NULL;
+            
+        }
         //Reload the bitmaps
         (CCalcAppEnv::Static())->SetSkinChangedValue(EFalse);
         (CCalcAppEnv::Static())->UpdateAknConstArrayForFuncMap();
         (CCalcAppEnv::Static())->LoadFuncMapBitmapL();
-	    
+        
         //Create the new pane
         iFuncmapPane = CCalcFuncmapSubPane::NewL(this); 
 
         if ( AknLayoutUtils::PenEnabled() )
-        {		    
+        {            
         iFuncmapPane->SetHighlightButton( 0, selected );   
         }
         
@@ -858,7 +866,7 @@
         
         //Update scroll bar here
         ScrollArrowUpdate();
-				iSheetPane->HandleResourceChange(aType);
+                iSheetPane->HandleResourceChange(aType);
         }
     else
         {
@@ -886,66 +894,66 @@
         }
 
     
-	if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() )
-		{
-    		 
-    		// Set layout of function map subpane, output sheet  and editor sub pane.		
-    	    if( AknLayoutUtils::PenEnabled() )
-    	    {
-    	        if (Layout_Meta_Data::IsLandscapeOrientation())
-    	        {
-    	        
-    	        	AknLayoutUtils::LayoutControl(
-    			    iFuncmapPane, parentRect, AknLayoutScalable_Apps::grid_calc_pane(enTouch_with_lsc).LayoutLine());
-    			    
-    	            AknLayoutUtils::LayoutControl(
-    		    	iSheetPane, parentRect,AknLayoutScalable_Apps::calc_paper_pane(enTouch_with_lsc).LayoutLine());
-    		    		
-    		        AknLayoutUtils::LayoutControl(
-    			    iEditorPane, parentRect,AknLayoutScalable_Apps::calc_display_pane(enTouch_with_lsc).LayoutLine());
-    	        }
-    	        else
-    	        {
-    	            AknLayoutUtils::LayoutControl(
-    			    iFuncmapPane, parentRect, AknLayoutScalable_Apps::grid_calc_pane(enTouch_with_prt).LayoutLine());
-    			    
-    	            AknLayoutUtils::LayoutControl(
-    		    	iSheetPane, parentRect,AknLayoutScalable_Apps::calc_paper_pane(enTouch_with_prt).LayoutLine());
-    		    	
-    		    	AknLayoutUtils::LayoutControl(
-    			    iEditorPane, parentRect,AknLayoutScalable_Apps::calc_display_pane(enTouch_with_prt).LayoutLine());
-    	        }
-    	    }
-    	    else
-    	    {
-    	        AknLayoutUtils::LayoutControl(
-    			    iFuncmapPane, parentRect, AknLayoutScalable_Apps::grid_calc_pane(enTouch_disabled).LayoutLine());
-    			    
-    		    AknLayoutUtils::LayoutControl(
-    			iSheetPane, parentRect,AknLayoutScalable_Apps::calc_paper_pane(enTouch_disabled).LayoutLine());
-    			
-    			AknLayoutUtils::LayoutControl(
-    			iEditorPane, parentRect,AknLayoutScalable_Apps::calc_display_pane(enTouch_disabled).LayoutLine());
-    		    
-    	    }	
+    if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() )
+        {
+             
+            // Set layout of function map subpane, output sheet  and editor sub pane.        
+            if( AknLayoutUtils::PenEnabled() )
+            {
+                if (Layout_Meta_Data::IsLandscapeOrientation())
+                {
+                
+                    AknLayoutUtils::LayoutControl(
+                    iFuncmapPane, parentRect, AknLayoutScalable_Apps::grid_calc_pane(enTouch_with_lsc).LayoutLine());
+                    
+                    AknLayoutUtils::LayoutControl(
+                    iSheetPane, parentRect,AknLayoutScalable_Apps::calc_paper_pane(enTouch_with_lsc).LayoutLine());
+                        
+                    AknLayoutUtils::LayoutControl(
+                    iEditorPane, parentRect,AknLayoutScalable_Apps::calc_display_pane(enTouch_with_lsc).LayoutLine());
+                }
+                else
+                {
+                    AknLayoutUtils::LayoutControl(
+                    iFuncmapPane, parentRect, AknLayoutScalable_Apps::grid_calc_pane(enTouch_with_prt).LayoutLine());
+                    
+                    AknLayoutUtils::LayoutControl(
+                    iSheetPane, parentRect,AknLayoutScalable_Apps::calc_paper_pane(enTouch_with_prt).LayoutLine());
+                    
+                    AknLayoutUtils::LayoutControl(
+                    iEditorPane, parentRect,AknLayoutScalable_Apps::calc_display_pane(enTouch_with_prt).LayoutLine());
+                }
+            }
+            else
+            {
+                AknLayoutUtils::LayoutControl(
+                    iFuncmapPane, parentRect, AknLayoutScalable_Apps::grid_calc_pane(enTouch_disabled).LayoutLine());
+                    
+                AknLayoutUtils::LayoutControl(
+                iSheetPane, parentRect,AknLayoutScalable_Apps::calc_paper_pane(enTouch_disabled).LayoutLine());
+                
+                AknLayoutUtils::LayoutControl(
+                iEditorPane, parentRect,AknLayoutScalable_Apps::calc_display_pane(enTouch_disabled).LayoutLine());
+                
+            }    
 
-		}
-	else
-		{
+        }
+    else
+        {
     // Set layout of function map subpane.
     AknLayoutUtils::LayoutControl(
-	iFuncmapPane, parentRect, AppLayout::grid_calc_pane());	
-	
-	
+    iFuncmapPane, parentRect, AppLayout::grid_calc_pane());    
+    
+    
     // Set layout of output sheet.
     AknLayoutUtils::LayoutControl(
-		 iSheetPane, parentRect,AppLayout::gqn_graf_calc_paper());
-	
-	// Set layout of editor subpane.
+         iSheetPane, parentRect,AppLayout::gqn_graf_calc_paper());
+    
+    // Set layout of editor subpane.
     AknLayoutUtils::LayoutControl(
         iEditorPane, parentRect,AppLayout::Calculator_elements_Line_1());
-		}	
-	}
+        }    
+    }
 
 // ---------------------------------------------------------
 // CCalcContainer::Draw
@@ -993,9 +1001,18 @@
 // ---------------------------------------------------------
 //
 void CCalcContainer::ShowSqrtButton(TBool aEnable)
-	{
-		iFuncmapPane->SetSqrtEnable(aEnable);
-	}	
+    {
+    TCalcEditLine editLine( iEditorPane->EditLine() );
+    TBool sqrtEnable(ETrue);
+    TRAP_IGNORE(
+    if ( editLine.NumberL() == 0 )
+        {
+        sqrtEnable = EFalse;    
+        }
+    )
+
+    iFuncmapPane->SetSqrtEnable( sqrtEnable );
+    }    
 
 // ---------------------------------------------------------
 // CCalcContainer::ShowPercentButton()
@@ -1004,9 +1021,9 @@
 // ---------------------------------------------------------
 //
 void CCalcContainer::ShowPercentButton(TBool aEnable)
-	{
-		iFuncmapPane->SetPercentEnable(aEnable);
-	}
+    {
+    iFuncmapPane->SetPercentEnable(aEnable);
+    }
 
 // ---------------------------------------------------------
 // CCalcContainer::GetState()
@@ -1016,7 +1033,7 @@
 //
 CCalcView::TStateNo CCalcContainer::GetState()
 {
-	return (iView->State());
+    return (iView->State());
 }
 
 // ---------------------------------------------------------
@@ -1040,9 +1057,9 @@
 //
 void CCalcContainer::HandleMiddleSoftKey()
                 
-	{
-	TRAP_IGNORE( iFuncmapPane->HandleMiddleSoftKeyOREKeyOKL() );
-	}
+    {
+    TRAP_IGNORE( iFuncmapPane->HandleMiddleSoftKeyOREKeyOKL() );
+    }
 
 // ---------------------------------------------------------
 // ---------------------------------------------------------
@@ -1052,15 +1069,15 @@
 //
 void CCalcContainer::SetOperatorFromTouchL(TInt akey )
 {
-	  //Simulate events as events are occurring from the KB Events
-	  TKeyEvent eventkey;
-	  TEventCode keycode;
+      //Simulate events as events are occurring from the KB Events
+      TKeyEvent eventkey;
+      TEventCode keycode;
     keycode = EEventKeyDown;
     eventkey.iCode = 0;
     eventkey.iScanCode = ASCII_ZERO + akey;
     
     //First send Keydown event
-   	OfferKeyEventL(eventkey,keycode);
+       OfferKeyEventL(eventkey,keycode);
 #ifdef RD_INTELLIGENT_TEXT_INPUT
     eventkey.iCode = ASCII_ZERO + akey;
 #else
@@ -1086,9 +1103,9 @@
 //
 void CCalcContainer::ClearInputKeyL(TInt aRepeat)
 {
-	  //Simulate events as events are occurring from the KB Events
-	TKeyEvent eventkey;
-	TEventCode keycode;
+      //Simulate events as events are occurring from the KB Events
+    TKeyEvent eventkey;
+    TEventCode keycode;
     keycode = EEventKeyDown;
     eventkey.iCode = 0; 
     eventkey.iScanCode = 1; //for clear input key
@@ -1127,14 +1144,14 @@
         eventkey.iCode = 0;
 #ifdef RD_INTELLIGENT_TEXT_INPUT  
         if ( iFuncmapPane->GetKeyboardType() == EPtiKeyboardHalfQwerty )
-        	{
+            {
             eventkey.iScanCode = 126;  //scan code for separator
-        	}
+            }
         else
 #endif
-        	{
+            {
             eventkey.iScanCode = 122;  //scan code for separator
-        	}
+            }
 
         // First send Keydown event
         OfferKeyEventL( eventkey, keycode );
@@ -1146,7 +1163,7 @@
         }
     else
         {
-        // Simulate events as events are occurring from the KB Events	
+        // Simulate events as events are occurring from the KB Events    
         TKeyEvent eventkey;
         TEventCode keycode = EEventKeyDown;
         eventkey.iCode = 0;
--- a/extras/calcsoft/src/CalcDoc.cpp	Wed Jun 09 09:43:27 2010 +0300
+++ b/extras/calcsoft/src/CalcDoc.cpp	Mon Jun 21 15:42:09 2010 +0300
@@ -265,6 +265,10 @@
         case  TCalcEditLine::ECalcAdd:
             {
             result += aOperand;
+            if( Abs(result)<= KCalcDefaultZero )
+            	{
+            	result = 0;
+            	}
             break;
             }
         case  TCalcEditLine::ECalcSubtract:
--- a/extras/calcsoft/src/CalcFunc.cpp	Wed Jun 09 09:43:27 2010 +0300
+++ b/extras/calcsoft/src/CalcFunc.cpp	Mon Jun 21 15:42:09 2010 +0300
@@ -46,7 +46,7 @@
 #include <AknFepInternalCRKeys.h>
 #include <aknbutton.h>
 #include <AknsDrawUtils.h>
-
+#include <aknnotewrappers.h> 
 #include <featmgr.h>      // Feature Manager
 
 //enum to hold the values of button states
@@ -68,14 +68,14 @@
                ECalcCmdSeven,          // 7
                ECalcCmdFour,          // 4
                ECalcCmdOne,          // 1
-			   ECalcCmdZero,          // 0
-			   ECalcCmdSqrt, 		 // Sqrt
+               ECalcCmdZero,          // 0
+               ECalcCmdSqrt,          // Sqrt
                ECalcCmdEight,          // 8
                ECalcCmdFive,          // 5
                ECalcCmdTwo,          // 2
-			   ECalcCmdSeparator,          // .
-			   ECalcCmdPercent,		 // %	
-			   ECalcCmdNine,          // 9
+               ECalcCmdSeparator,          // .
+               ECalcCmdPercent,         // %    
+               ECalcCmdNine,          // 9
                ECalcCmdSix,          // 6
                ECalcCmdThree,          // 3
                ECalcCmdChangeSign,   // +/- 
@@ -84,8 +84,8 @@
                ECalcCmdSubtract,     // -
                ECalcCmdAdd,          // +
                ECalcCmdResult       // =
-				};
-				
+                };
+                
 const TInt KButtonsIdTbl[] =         // The command ID of a button in non Touch Layout
                { 
                ECalcCmdAdd,          // +
@@ -94,11 +94,11 @@
                ECalcCmdDivide,       // /
                ECalcCmdChangeSign,   // +/- 
                ECalcCmdResult,       // =
-			   ECalcCmdSqrt, 		 // Sqrt
-			   ECalcCmdPercent,		 // %
+               ECalcCmdSqrt,          // Sqrt
+               ECalcCmdPercent,         // %
                ECalcCmdScrollUp,     // Scroll-up
                ECalcCmdScrollDown    // Scroll-down
-				};
+                };
 
 
 // If const TChar is used, complie error occurs in THUMB build.
@@ -163,8 +163,8 @@
                             (TBool aEnable)
     {
 
-				/*Get the selected pointer 
-				button -> different layouts, different values*/
+                /*Get the selected pointer 
+                button -> different layouts, different values*/
         CAknButton* button = NULL;
         if( AknLayoutUtils::PenEnabled() )
         {
@@ -213,28 +213,28 @@
 void CCalcFuncmapSubPane::NotifyTimeoutL()
     {
 
-	  /*Get the selected pointer 
-		button -> different layouts, different values*/
+      /*Get the selected pointer 
+        button -> different layouts, different values*/
     CAknButton* button = iButtons[iSelected];    
     if( !AknLayoutUtils::PenEnabled() )
         {
 #ifdef RD_INTELLIGENT_TEXT_INPUT  
         if ( iKeyboardType == EPtiKeyboardHalfQwerty )
-        	{
+            {
             if( ( iLastKeyCode == EStdKeyLeftShift && iDecimalPoint ) || ( iLastKeyCode == EStdKeyLeftFunc && iDecimalPoint ))
-    	        {
+                {
                 iContainer->SetSeparatorFromTouchL();
-        	    }
+                }
             else
                 {
                 iContainer->View()->HandleCommandL( KButtonsIdTbl[iSelected] );
                 }
-        	}
+            }
         else
 #endif
-        	{
+            {
             iContainer->View()->HandleCommandL( KButtonsIdTbl[iSelected] );
-        	}
+            }
         }
     else
         {
@@ -243,9 +243,9 @@
    
 #ifdef RD_INTELLIGENT_TEXT_INPUT  
     if ( iKeyboardType == EPtiKeyboardHalfQwerty )
-    	{
+        {
         iLastKeyCode = 0;
-    	}
+        }
 #endif
     
     //Set to dimmed state
@@ -262,10 +262,10 @@
 //
 void CCalcFuncmapSubPane::NotifyReleaseKeyL()
     {
-				/*Get the selected pointer 
-				button -> different layouts, different values*/
+                /*Get the selected pointer 
+                button -> different layouts, different values*/
         CAknButton* button = iButtons[iSelected];
-        CAknButtonState* state = button->State(EnNormal);      	
+        CAknButtonState* state = button->State(EnNormal);          
         
         if(state->Flags() == EnPressed)
         {
@@ -274,12 +274,12 @@
           TEventCode aType = EEventKeyUp;
           //trigger offerkeyeventl to this button
           button->OfferKeyEventL(aKeyEvent,aType);
-	      state->SetFlags(EnNormal);    
-	      button->DrawNow();
+          state->SetFlags(EnNormal);    
+          button->DrawNow();
         }
       if( !AknLayoutUtils::PenEnabled() )
-       	{
-       	  if(iSelected == EScrollUp)
+           {
+             if(iSelected == EScrollUp)
             {
                 CCalcOutputSheet* outputSheet = iContainer->OutputSheet();
                 if(!outputSheet->CanUp())
@@ -299,9 +299,9 @@
                 }
             }
             
-       	}
+           }
 
-	   }
+       }
 
 // ---------------------------------------------------------
 // CCalcFuncmapSubPane::NotifyOtherThanOkKeyPressed
@@ -348,7 +348,7 @@
 //
  TInt CCalcFuncmapSubPane::IsQwertyKeypadActive()
   {
- 	TInt value = 0;
+     TInt value = 0;
     
     iQwertyModeStatusProperty.Get(value);
     
@@ -388,7 +388,7 @@
     
     if ( !button->IsDimmed() )
         {
-        		//handles all the commands for the buttons
+                //handles all the commands for the buttons
             if( !AknLayoutUtils::PenEnabled() )
             {
             iContainer->View()->HandleCommandL(KButtonsIdTbl[iSelected]);
@@ -413,10 +413,18 @@
             }
             else
             {
-            iContainer->View()->HandleCommandL(KButtonsIdTblTouch[iSelected]);
+             if ( iIsKeyLongPress )
+                {
+                iContainer->View()->HandleCommandL(KButtonsIdTblTouch[iSelected]);
+                }
             }   
 
-        }    
+        } 
+    if( iErrorCode != KErrNone )
+        {
+        ErrorMsgL( iErrorCode );
+        iErrorCode = KErrNone;
+        }
     }
 
 // ---------------------------------------------------------
@@ -435,7 +443,7 @@
         {
 #ifdef RD_INTELLIGENT_TEXT_INPUT  
         if ( iKeyboardType == EPtiKeyboardHalfQwerty )
-        	{
+            {
             TBuf<KMaxNumCharsPerCase> keys;
             TInt firstoperator(-1);
             TInt secondoperator(-1);
@@ -448,7 +456,7 @@
                  iEngine->MappingDataForKey( keyQwertyValue, keys, EPtiCaseFnLower  );
                  MapDataForChrShiftKey( keys, firstoperator, secondoperator);
                  if ( (secondoperator == -1) && (firstoperator != -1))
-                	 {
+                     {
                      if ( AknLayoutUtils::PenEnabled() )
                          {
                          iSelected = firstoperator;    
@@ -456,18 +464,18 @@
                      else
                          {
                          if ( firstoperator == ECmdTSeparator )
-                        	 {
-                        	 iDecimalPoint = ETrue;
-                        	 }
+                             {
+                             iDecimalPoint = ETrue;
+                             }
                          else
-                        	 {
-                        	 iSelected = firstoperator;
-                        	 iDecimalPoint = EFalse;
-                        	 }
-                         }                	 
-                	 }
+                             {
+                             iSelected = firstoperator;
+                             iDecimalPoint = EFalse;
+                             }
+                         }                     
+                     }
                  else if ( (firstoperator == -1) && (secondoperator != -1) )
-                	 {
+                     {
                      if ( AknLayoutUtils::PenEnabled() )
                          {
                          iSelected = secondoperator;    
@@ -475,18 +483,18 @@
                      else
                          {
                          if ( secondoperator == ECmdTSeparator )
-                        	 {
-                        	 iDecimalPoint = ETrue;
-                        	 }
+                             {
+                             iDecimalPoint = ETrue;
+                             }
                          else
-                        	 {
-                        	 iSelected = secondoperator;
-                        	 iDecimalPoint = EFalse;
-                        	 }
-                         }                	 
-                	 }
+                             {
+                             iSelected = secondoperator;
+                             iDecimalPoint = EFalse;
+                             }
+                         }                     
+                     }
                  else if ( (firstoperator != -1) && (secondoperator != -1) )
-                	 {
+                     {
                      if ( iLastKeyCode == aKeyEvent.iScanCode )
                          {
                          if ( AknLayoutUtils::PenEnabled() )
@@ -501,28 +509,28 @@
                                  }
                              }
                          else
-                        	 {
+                             {
                               if ( firstoperator == ECmdTSeparator || secondoperator == ECmdTSeparator )
-                            	  {
-                            	  if ( iDecimalPoint )
-                            		  {
-                            		  iDecimalPoint = EFalse;
-                            		  if ( firstoperator == ECmdTSeparator )
-                            			  {
-                            			  iSelected = secondoperator;
-                            			  }
-                            		  else
-                            			  {
-                            			  iSelected = firstoperator;
-                            			  }                 		  
-                            		  }
-                            	  else
-                            		  {
-                            		  iDecimalPoint = ETrue;
-                            		  }
-                            	  }
+                                  {
+                                  if ( iDecimalPoint )
+                                      {
+                                      iDecimalPoint = EFalse;
+                                      if ( firstoperator == ECmdTSeparator )
+                                          {
+                                          iSelected = secondoperator;
+                                          }
+                                      else
+                                          {
+                                          iSelected = firstoperator;
+                                          }                           
+                                      }
+                                  else
+                                      {
+                                      iDecimalPoint = ETrue;
+                                      }
+                                  }
                               else
-                            	  {
+                                  {
                                   if ( iSelected == firstoperator )
                                       {
                                       iSelected = secondoperator;
@@ -530,9 +538,9 @@
                                   else
                                       {
                                       iSelected = firstoperator;
-                                      }                	  
-                            	  }
-                        	 }
+                                      }                      
+                                  }
+                             }
                          }
                      else
                          {
@@ -543,14 +551,14 @@
                          else
                              {
                              if ( firstoperator == ECmdTSeparator )
-                            	 {
-                            	 iDecimalPoint = ETrue;
-                            	 }
+                                 {
+                                 iDecimalPoint = ETrue;
+                                 }
                              else
-                            	 {
-                            	 iSelected = firstoperator;
-                            	 iDecimalPoint = EFalse;
-                            	 }
+                                 {
+                                 iSelected = firstoperator;
+                                 iDecimalPoint = EFalse;
+                                 }
                              }
 
                          }
@@ -564,52 +572,52 @@
             }
          else
 #endif
-        	{
-        	//For Multiplication operator in Qwerty keypad
-        	if(((aKeyEvent.iScanCode == EStdKeyLeftShift) || (aKeyEvent.iScanCode == EStdKeyRightShift)) && aType == EEventKeyDown)
-        	    {
-        	     if(iShiftKeyPressed == EPtiCaseLower )
-        		     {
-        		   	 iShiftKeyPressed = EPtiCaseUpper;
-        		   	 iShiftKey = 0;
-        		   	 iValue = ETrue;
-        		     }
-        	      
-        	     else
-        	     	{
-        			iShiftKeyPressed = EPtiCaseLower;
-        	     	}
-        	    exitCode = EKeyWasConsumed; 	
-        	    
-        	    iIsShiftKeyPressed = ETrue;
-        	    }
-        	else if((aKeyEvent.iScanCode == EStdKeyLeftShift || aKeyEvent.iScanCode == EStdKeyRightShift)&& aType == EEventKeyUp)
-        		{
+            {
+            //For Multiplication operator in Qwerty keypad
+            if(((aKeyEvent.iScanCode == EStdKeyLeftShift) || (aKeyEvent.iScanCode == EStdKeyRightShift)) && aType == EEventKeyDown)
+                {
+                 if(iShiftKeyPressed == EPtiCaseLower )
+                     {
+                        iShiftKeyPressed = EPtiCaseUpper;
+                        iShiftKey = 0;
+                        iValue = ETrue;
+                     }
+                  
+                 else
+                     {
+                    iShiftKeyPressed = EPtiCaseLower;
+                     }
+                exitCode = EKeyWasConsumed;     
+                
+                iIsShiftKeyPressed = ETrue;
+                }
+            else if((aKeyEvent.iScanCode == EStdKeyLeftShift || aKeyEvent.iScanCode == EStdKeyRightShift)&& aType == EEventKeyUp)
+                {
                         /*if(((iLanguage == ELangFrench) || (iLanguage == ELangTaiwanChinese) || 
                             (iLanguage == ELangCzech) || (iLanguage == ELangSlovak))&& iShiftKey >= 1)*/
                                 if( iShiftKey >= 1 )
-        			{
-        			iShiftKeyPressed = EPtiCaseLower;
-        			}
-        		iValue = EFalse;
-        	    exitCode = EKeyWasConsumed; 
-        	    
-        	    iIsShiftKeyPressed = ETrue;
-        	    }
-        	}
-	      //else
+                    {
+                    iShiftKeyPressed = EPtiCaseLower;
+                    }
+                iValue = EFalse;
+                exitCode = EKeyWasConsumed; 
+                
+                iIsShiftKeyPressed = ETrue;
+                }
+            }
+          //else
      if ( !iIsShiftKeyPressed )
-		{
-		if (aType != EEventKey)
+        {
+        if (aType != EEventKey)
         {
-	        if (aType == EEventKeyDown)
-			    {
-			        iIsOfferKeyEvent = ETrue;        
-			    }
-			    else if (aType == EEventKeyUp)
-			    {
-			        iIsOfferKeyEvent = EFalse;        
-			    }
+            if (aType == EEventKeyDown)
+                {
+                    iIsOfferKeyEvent = ETrue;        
+                }
+                else if (aType == EEventKeyUp)
+                {
+                    iIsOfferKeyEvent = EFalse;        
+                }
             // when users press send key, EKeyWasNotConsumed is returned to system
             // to open dialer 
             if ( aKeyEvent.iScanCode == EStdKeyYes )
@@ -625,14 +633,14 @@
             iShiftKeyPressed = EPtiCaseLower;
             }
 #else
-		if(MapNumericCharL(keyQwertyValue,iShiftKeyPressed))
-			{
-			exitCode = EKeyWasConsumed;
-			iShiftKeyPressed = EPtiCaseLower;		
-			}
+        if(MapNumericCharL(keyQwertyValue,iShiftKeyPressed))
+            {
+            exitCode = EKeyWasConsumed;
+            iShiftKeyPressed = EPtiCaseLower;        
+            }
 #endif
-		else 
-			{
+        else 
+            {
 #ifdef RD_INTELLIGENT_TEXT_INPUT
             if( MapNumerics( aKeyEvent ) || aKeyEvent.iCode == EKeyBackspace )
                 {
@@ -651,34 +659,34 @@
                     }
                 }
 #else
-			if(MapNumerics(keyQwertyValue,iShiftKeyPressed) || aKeyEvent.iCode == EKeyBackspace)
-				{
-				exitCode = EKeyWasNotConsumed;
-				iShiftKeyPressed = EPtiCaseLower;
+            if(MapNumerics(keyQwertyValue,iShiftKeyPressed) || aKeyEvent.iCode == EKeyBackspace)
+                {
+                exitCode = EKeyWasNotConsumed;
+                iShiftKeyPressed = EPtiCaseLower;
 
                                 /*if((iLanguage == ELangFrench) || (iLanguage == ELangTaiwanChinese) || 
                                          (iLanguage == ELangCzech) || (iLanguage == ELangSlovak))*/
-					{
-					if(!iValue)
-					iShiftKeyPressed = EPtiCaseLower;
-					
-					else
-					iShiftKeyPressed = EPtiCaseUpper;
-					iShiftKey++;	
-					}
-				}
+                    {
+                    if(!iValue)
+                    iShiftKeyPressed = EPtiCaseLower;
+                    
+                    else
+                    iShiftKeyPressed = EPtiCaseUpper;
+                    iShiftKey++;    
+                    }
+                }
 #endif
-			else
-				{
-				exitCode = EKeyWasConsumed;	
-				iShiftKeyPressed = EPtiCaseLower;
-				}
-			
-			}
+            else
+                {
+                exitCode = EKeyWasConsumed;    
+                iShiftKeyPressed = EPtiCaseLower;
+                }
+            
+            }
 
-		}	    
+        }        
 
-    // handle Enter key event	
+    // handle Enter key event    
     if ( aKeyEvent.iCode == EKeyEnter )
         {
         exitCode = EKeyWasConsumed;
@@ -687,11 +695,11 @@
         return exitCode;
         }
     
-	iIsShiftKeyPressed = EFalse;
-		
-	}
+    iIsShiftKeyPressed = EFalse;
+        
+    }
  
-/*	if(aKeyEvent.iCode == EKeyOK)
+/*    if(aKeyEvent.iCode == EKeyOK)
     {
        
         HandleMiddleSoftKeyOREKeyOKL();
@@ -729,7 +737,7 @@
 
                 }while( iButtons[iSelected]->IsDimmed() );
                 
-                RedrawHighlight(oldSelect, iSelected);
+                RedrawHighlight( oldSelect, iSelected, ETrue );
 
                 exitCode = EKeyWasConsumed;
                 break;
@@ -757,7 +765,7 @@
 
                 }while( iButtons[iSelected]->IsDimmed() );
                 
-                RedrawHighlight(oldSelect, iSelected);
+                RedrawHighlight( oldSelect, iSelected, ETrue );
                 exitCode = EKeyWasConsumed;
                 break;
             }
@@ -767,7 +775,7 @@
                 
                 SetNextCursorPosForUpArrow(oldSelect);
 
-                RedrawHighlight(oldSelect, iSelected);
+                RedrawHighlight( oldSelect, iSelected, ETrue );
                 exitCode = EKeyWasConsumed;
                 break;
             }
@@ -777,7 +785,7 @@
                 
                 SetNextCursorPosForDownArrow(oldSelect);
  
-                RedrawHighlight(oldSelect, iSelected);
+                RedrawHighlight( oldSelect, iSelected, ETrue );
                 exitCode = EKeyWasConsumed;
                 break;
             }
@@ -837,7 +845,7 @@
                             }    
                         
                     }
-                    RedrawHighlight(oldSelect, iSelected);
+                    RedrawHighlight( oldSelect, iSelected);
                     exitCode = EKeyWasConsumed;
                 }
              }
@@ -876,7 +884,9 @@
     iSelected = 0;    
     iContainer = aContainer;
     iIsOfferKeyEvent = EFalse;
-
+    iErrorCode = KErrNone;
+    iShowDrawHight = EFalse;
+    iInputData = EFalse;
     SetContainerWindowL(*iContainer);
     // Read character sequence tables, such as -, +.
     iCalcAppEnv = CCalcAppEnv::Static();
@@ -949,7 +959,7 @@
     User::LeaveIfError(iQwertyModeStatusProperty.Attach(KCRUidAvkon, KAknQwertyInputModeActive));
    
     iShiftKeyPressed = EPtiCaseLower;
-    iShiftKey		 = 0;
+    iShiftKey         = 0;
 
      // Try to get the English key mappings. If those are not available, use the 
     // mappings of the current input language. The order is this because all mappings
@@ -959,7 +969,7 @@
     iCoreLanguage = static_cast<CPtiCoreLanguage*>(iEngine->GetLanguage( iLanguage ));
 
     if( !iCoreLanguage )
-    	{
+        {
         iCRKey = CRepository::NewL(KCRUidAknFep);
         TInt ret = iCRKey->Get(KAknFepInputTxtLang,iLanguage);
         if( ret!= KErrNone )
@@ -1010,7 +1020,7 @@
 
     }
 
-//	---------------------------------------------------------
+//    ---------------------------------------------------------
 // CCalcFuncmapSubPane::RefreshButtonIcons
 // This function is called by CCalcContainer::OfferKeyEventL
 // (other items were commented in a header).
@@ -1018,11 +1028,11 @@
 //
 void CCalcFuncmapSubPane::RefreshButtonIcons()
 {
-	/*for (TInt count(0); count < iCountOfButtons; count++)
+    /*for (TInt count(0); count < iCountOfButtons; count++)
         {
         iButtons[count]->SetBitmapIcons(iCalcAppEnv->UnpressedButtonBmp(count),
-			iCalcAppEnv->PressedButtonBmp(count),
-			iCalcAppEnv->InactiveButtonBmp(count));
+            iCalcAppEnv->PressedButtonBmp(count),
+            iCalcAppEnv->InactiveButtonBmp(count));
         }*/
 }
 // ---------------------------------------------------------
@@ -1034,7 +1044,7 @@
 void CCalcFuncmapSubPane::SetScrollupEnable
                      (TBool aEnable)  
     {
-		//Enabling/Disabling of scroll up buttons only for Non-Touch   
+        //Enabling/Disabling of scroll up buttons only for Non-Touch   
     if(!AknLayoutUtils::PenEnabled())
     {
         CAknButton* scrollUp = iButtons[EScrollUp];
@@ -1054,7 +1064,7 @@
 void CCalcFuncmapSubPane::SetScrolldownEnable
                      (TBool aEnable) 
     {
-	//Enabling/Disabling of scroll down buttons only for Non-Touch
+    //Enabling/Disabling of scroll down buttons only for Non-Touch
     if(!AknLayoutUtils::PenEnabled())
     {       
     CAknButton* scrollDown = iButtons[EScrollDown];
@@ -1135,11 +1145,11 @@
 //
 void CCalcFuncmapSubPane::RedrawHighlight
       (TUint aOldId,            // The button chosen before
-       TUint aNewId) const      // The button chosen newly
+       TUint aNewId)            // The button chosen newly
     {
     // The State of each button is set.
     CAknButton* button = iButtons[aOldId];
-    CAknButtonState* state = button->State(EnNormal);      	
+    CAknButtonState* state = button->State(EnNormal);          
         
     if(state->Flags() == EnPressed)
         {
@@ -1148,16 +1158,47 @@
         TEventCode aType = EEventKeyUp;
         //trigger offerkeyeventl to this button
         TRAP_IGNORE(button->OfferKeyEventL(aKeyEvent,aType));
-	    state->SetFlags(EnNormal);
-     	}
+        state->SetFlags(EnNormal);
+         }
+
     if( aOldId != aNewId )
-    	{
+        {
+        button = iButtons[aNewId];        
+        }
+    }
+
+// ---------------------------------------------------------
+// CCalcFuncmapSubPane::RedrawHighlight
+// An old highlight rectangle is erased and 
+// a new highlight rectangle is drawn.
+// (other items were commented in a header).
+// ---------------------------------------------------------
+//
+void CCalcFuncmapSubPane::RedrawHighlight
+      (TUint aOldId,            // The button chosen before
+       TUint aNewId,
+       TBool aShowHightlight)       // The button chosen newly
+    {
+    // The State of each button is set.
+    CAknButton* button = iButtons[aOldId];
+    CAknButtonState* state = button->State(EnNormal);          
+    iShowDrawHight = ETrue;
+    if( state->Flags() == EnPressed )
+        {
+        TKeyEvent aKeyEvent;
+        aKeyEvent.iScanCode = EStdKeyEnter;
+        TEventCode aType = EEventKeyUp;
+        //trigger offerkeyeventl to this button
+        TRAP_IGNORE(button->OfferKeyEventL(aKeyEvent,aType));
+        state->SetFlags(EnNormal);
+         }
+        if( aOldId != aNewId )
+        {       
         button->SetFocus( EFalse, EDrawNow );      
         button = iButtons[aNewId];        
         button->SetFocus( ETrue, EDrawNow );
-    	}
+        }
     }
-
 // ---------------------------------------------------------
 // CCalcFuncmapSubPane::SetLayout
 // Set functionmap button layout.
@@ -1170,42 +1211,42 @@
     {
     TRect parentRect(Rect());    
     
-	 TInt t = 0;
-	 if( AknLayoutUtils::PenEnabled()  )
-	    {
-	        for (TInt count(0); count < KButtonsInColumnTouch; count++)
+     TInt t = 0;
+     if( AknLayoutUtils::PenEnabled()  )
+        {
+            for (TInt count(0); count < KButtonsInColumnTouch; count++)
             {
             for (TInt row(0); row < 5; row++)   
-      	        { 
-      	        
-      	         TAknWindowLineLayout area;
+                  { 
+                  
+                   TAknWindowLineLayout area;
                  TAknWindowLineLayout area1;
 
                  TAknWindowLineLayout areaG2;
                  TAknWindowLineLayout areaGraphics;
-     	        
-     	            area= AknLayoutScalable_Apps::toolbar_button_pane_cp01(1).LayoutLine();
+                 
+                     area= AknLayoutScalable_Apps::toolbar_button_pane_cp01(1).LayoutLine();
                    areaG2= AknLayoutScalable_Apps::cell_calc_pane_g2(1).LayoutLine();
-    		         if (Layout_Meta_Data::IsLandscapeOrientation())
-    		            {
-    		                area1 = AknLayoutScalable_Apps::cell_calc_pane(count,row,enTouch_with_prt).LayoutLine();
-    		            }
-    		         else
-    		            {
-    		               area1 = AknLayoutScalable_Apps::cell_calc_pane(count,row,enTouch_enabled).LayoutLine();
-    		            }   
+                     if (Layout_Meta_Data::IsLandscapeOrientation())
+                        {
+                            area1 = AknLayoutScalable_Apps::cell_calc_pane(count,row,enTouch_with_prt).LayoutLine();
+                        }
+                     else
+                        {
+                           area1 = AknLayoutScalable_Apps::cell_calc_pane(count,row,enTouch_enabled).LayoutLine();
+                        }   
 
                     areaGraphics = area1;
                     areaGraphics.iW = areaGraphics.iW - areaG2.il - areaG2.ir;
                     areaGraphics.iH = areaG2.iH;
-    		    
-    		        area1.il = area1.il + area.il;
-    		        area1.ir = area1.ir - area.ir;
-    		        area1.it = area1.it + area.it;
-    		        area1.ib = area1.ib - area.ib;
-    		        area1.iW = area1.iW - area.il - area.ir;
-    		        area1.iH = area1.iH - area.it - area.ib;
-    		    
+                
+                    area1.il = area1.il + area.il;
+                    area1.ir = area1.ir - area.ir;
+                    area1.it = area1.it + area.it;
+                    area1.ib = area1.ib - area.ib;
+                    area1.iW = area1.iW - area.il - area.ir;
+                    area1.iH = area1.iH - area.it - area.ib;
+                
                  
                 //A change in values here
                 if ( Layout_Meta_Data::IsLandscapeOrientation() )
@@ -1232,26 +1273,26 @@
                 iButtons[t]->SetHighlightRect( rect );
                 }
                 t++;
-      	        }
+                  }
             }
             
        }
             
-	    
-	    else
-	        {
+        
+        else
+            {
              for (TInt count(0); count < KButtonsInColumn; count++)
                 {
                 for (TInt row(0); row < 5; row++)   
-           	        {   	        
-               	        AknLayoutUtils::LayoutControl(
+                       {               
+                           AknLayoutUtils::LayoutControl(
                         iButtons[t], parentRect, AknLayoutScalable_Apps::cell_calc_pane( count, row ).LayoutLine());
                         iButtons[t]->SetHighlightRect( iButtons[t]->Rect() );
                         t++;
-           	        }
-           	        
+                       }
+                       
                 }
-	        }
+            }
                 
         
     }
@@ -1290,9 +1331,9 @@
 //
 /*CCalcCommandButton*/CAknButton* CCalcFuncmapSubPane::GetButtonBitmapControl
                                     (TInt aIndex)
-	{
-		return iButtons[aIndex];
-	}
+    {
+        return iButtons[aIndex];
+    }
 
 // ---------------------------------------------------------
 // CCalcFuncmapSubPane::SizeChanged
@@ -1314,23 +1355,23 @@
 //
 void CCalcFuncmapSubPane::SetSqrtEnable(TBool aEnable)
 {
-	//Get the sqrt button
-	CAknButton* button = NULL;
-	 if( !AknLayoutUtils::PenEnabled()  )
-	    {
-	     button = iButtons[ESqrtButton];     
-	    }
-	  else
-	    {
-	     button = iButtons[ECmdTSqrt];    
-	    }  
-	if( button )
-	    {
+    //Get the sqrt button
+    CAknButton* button = NULL;
+     if( !AknLayoutUtils::PenEnabled()  )
+        {
+         button = iButtons[ESqrtButton];     
+        }
+      else
+        {
+         button = iButtons[ECmdTSqrt];    
+        }  
+    if( button )
+        {
          button->SetDimmed(!aEnable);   
          button->DrawNow();
         }
     iIsSqrtDimmed = aEnable;
-	}
+    }
 
 
 // ---------------------------------------------------------
@@ -1341,22 +1382,22 @@
 //
 void CCalcFuncmapSubPane::SetPercentEnable(TBool aEnable)
 {
-	//Get the percent button
-	CAknButton* button = NULL;
-	 if( !AknLayoutUtils::PenEnabled()  )
-	    {
-	     button = iButtons[EPercentButton];     
-	    }
-	  else
-	    {
-	     button = iButtons[ECmdTPercent];    
-	    }  
+    //Get the percent button
+    CAknButton* button = NULL;
+     if( !AknLayoutUtils::PenEnabled()  )
+        {
+         button = iButtons[EPercentButton];     
+        }
+      else
+        {
+         button = iButtons[ECmdTPercent];    
+        }  
     if( button )
-	    {
+        {
          button->SetDimmed(!aEnable);   
          button->DrawNow();
-	   }
-	iIsPercentDimmed = aEnable;
+       }
+    iIsPercentDimmed = aEnable;
 }
 
 // ---------------------------------------------------------
@@ -1364,7 +1405,7 @@
 // Redraw percent button, either normal or dimmed.
 // (other items were commented in a header).
 // ---------------------------------------------------------
-//		
+//        
 #ifdef RD_INTELLIGENT_TEXT_INPUT
 TBool CCalcFuncmapSubPane::MapNumericCharL( TKeyEvent aKeyEvent )
     {
@@ -1439,11 +1480,11 @@
     }
 
 #else
-TBool CCalcFuncmapSubPane::MapNumericCharL( TPtiKey aKey, TPtiTextCase aCase )	
+TBool CCalcFuncmapSubPane::MapNumericCharL( TPtiKey aKey, TPtiTextCase aCase )    
     {
     TBuf<KMaxNumCharsPerCase> keys;
 
-    iQwertyKeyMappings->GetDataForKey( aKey, keys, aCase );				
+    iQwertyKeyMappings->GetDataForKey( aKey, keys, aCase );                
 
     if ( keys.Length() > 0 )
         {
@@ -1505,13 +1546,13 @@
     return EFalse;
     }
 #endif       
-	
+    
 // ---------------------------------------------------------
 // CCalcFuncmapSubPane::MapNumericChar
 // Redraw percent button, either normal or dimmed.
 // (other items were commented in a header).
 // ---------------------------------------------------------
-//		
+//        
 #ifdef RD_INTELLIGENT_TEXT_INPUT
 TBool CCalcFuncmapSubPane::MapNumerics( TKeyEvent aKeyEvent )
     {
@@ -1552,12 +1593,12 @@
     }
 
 #else
-TBool CCalcFuncmapSubPane::MapNumerics( TPtiKey aKey, TPtiTextCase aCase )	
+TBool CCalcFuncmapSubPane::MapNumerics( TPtiKey aKey, TPtiTextCase aCase )    
     {
 
     TBuf<KMaxNumCharsPerCase> keys;
 
-    iQwertyKeyMappings->GetDataForKey( aKey, keys, aCase );				
+    iQwertyKeyMappings->GetDataForKey( aKey, keys, aCase );                
 
     if ( keys.Length() > 0 )
         {
@@ -1585,7 +1626,7 @@
     return EFalse;
     }
 #endif
-		
+        
 // ---------------------------------------------------------
 // CCalcFuncmapSubPane::HandlePointerEventL
 // Handles apen input in Function Pane. .
@@ -1608,11 +1649,78 @@
             {
             RedrawHighlight( oldSelect, iSelected );
             }
+        if( aPointerEvent.iType == TPointerEvent::EButton1Down )
+            {
+            iContainer->View()->HandleCommandL(KButtonsIdTblTouch[iSelected]);
+            iInputData = ETrue;
+            }
+        if( aPointerEvent.iType == TPointerEvent::EButton1Up )
+            {
+            iInputData = EFalse;
+            if( iErrorCode != KErrNone )
+                {
+                ErrorMsgL( iErrorCode );
+                iErrorCode = KErrNone;
+                }
+            }
         }
-    CCoeControl::HandlePointerEventL( aPointerEvent );
+
+        CCoeControl::HandlePointerEventL( aPointerEvent );
+        
     }
     
 // ---------------------------------------------------------
+// CCalcFuncmapSubPane::SetErrorCode
+// Call from container  when an error code is display.
+// ---------------------------------------------------------
+//        
+void  CCalcFuncmapSubPane::SetErrorCode(TInt aError)
+    {
+    iErrorCode = aError;
+    }
+
+// ---------------------------------------------------------
+// CCalcFuncmapSubPane::ErrorMsgL
+// Call when there is an error release event.
+// ---------------------------------------------------------
+//    
+void CCalcFuncmapSubPane::ErrorMsgL(TInt aErrorCode) 
+    {
+    TInt resourceId(0);
+
+    switch (aErrorCode)
+        {
+        case KErrOverflow:
+            {
+            resourceId = R_CALC_ERROR_OUTOFRANGE;
+            break;
+            }
+        case KErrDivideByZero:
+            {
+            resourceId = R_CALC_ERROR_DIVISIONBYZERO;
+
+             // UpdateState( EOperator );
+            break;
+            }
+        case KErrNotSupported:
+            {
+            resourceId = R_CALC_ERROR_NEGATIVEVALUESQRT;
+            break;
+            }
+        default:
+            {
+            return;
+            }
+        }
+    
+    //Localisation of scalable UI.
+    HBufC* message = iCoeEnv->AllocReadResourceLC( resourceId ) ;
+    CAknErrorNote* note = new (ELeave) CAknErrorNote();
+    note->ExecuteLD( *message );
+    CleanupStack::PopAndDestroy( message );
+    
+    }
+// ---------------------------------------------------------
 // CCalcFuncmapSubPane::FunctionPaneRect
 // This function gives the layout of Function Pnae.
 // (other items were commented in a header).
@@ -1622,7 +1730,7 @@
 TRect CCalcFuncmapSubPane::FunctionPaneRect()
    {
    TRect parentRect(Rect()); 
-   return 	parentRect;
+   return     parentRect;
    }
    
 // ---------------------------------------------------------
@@ -1633,17 +1741,17 @@
 //
 
 TInt CCalcFuncmapSubPane::CalculatingCorrectButton
-					(const TPointerEvent& aPointerEvent)
+                    (const TPointerEvent& aPointerEvent)
    {
     TInt selected = iSelected;
     
     //Function that calculates the correct button where the pointer event had occurred
     for(TInt i = 0; i<iCountOfButtons; i++)
     {
-   		if(iButtons[i]->Rect().Contains(aPointerEvent.iPosition))
-   		{
-   			selected = i;
-   		}
+           if(iButtons[i]->Rect().Contains(aPointerEvent.iPosition))
+           {
+               selected = i;
+           }
     }
     return selected;
    }
@@ -1656,23 +1764,22 @@
 
 void CCalcFuncmapSubPane::HandleMiddleSoftKeyOREKeyOKL()
    {
-     	//get the selected button id
-	    CAknButton* button = iButtons[iSelected];
-	    //put the button in the pressed state
+         //get the selected button id
+        CAknButton* button = iButtons[iSelected];
+        //put the button in the pressed state
         CAknButtonState* state = button->State(EnNormal);
-    	//Put the button in pressed state
+        //Put the button in pressed state
         
         TKeyEvent aKeyEvent;
         aKeyEvent.iScanCode = EStdKeyEnter;
         TEventCode aType = EEventKeyDown;
         button->OfferKeyEventL(aKeyEvent,aType);
-	    //put to pressed state
-	    state->SetFlags(EnPressed);
+        //put to pressed state
+        state->SetFlags(EnPressed);
         button->DrawNow();
         
-	    if(!iIsOfferKeyEvent)
+        if(!iIsOfferKeyEvent)
         {
-            
             NotifyReleaseKeyL();
         }
    }
@@ -1754,17 +1861,17 @@
 // ---------------------------------------------------------
 //
 void CCalcFuncmapSubPane::MapDataForChrShiftKey( TDes& aOperators, TInt& aFirstOperator, TInt& aSecondOperator)
-	{ 
-	if( aOperators.Length() > 0 )
-		{
-		TUint16 firstChar = aOperators[0];
-		TUint16 secondChar = firstChar;
-		
-		if ( aOperators.Length() > 1 )
-			{
-			secondChar = aOperators[1];
-			}
-		
+    { 
+    if( aOperators.Length() > 0 )
+        {
+        TUint16 firstChar = aOperators[0];
+        TUint16 secondChar = firstChar;
+        
+        if ( aOperators.Length() > 1 )
+            {
+            secondChar = aOperators[1];
+            }
+        
         switch ( firstChar )
             {
             case KPtiPinyinMarker:
@@ -1778,22 +1885,22 @@
                     secondChar = aOperators[2];
                     }
                 else
-                	{
-                	firstChar = aOperators[1];
-                	secondChar = firstChar;
-                	}
+                    {
+                    firstChar = aOperators[1];
+                    secondChar = firstChar;
+                    }
                 break;
             default:
                 break;
-		
-		}
+        
+        }
         
        MapOperators( firstChar, aFirstOperator );
 
        MapOperators( secondChar, aSecondOperator );
        
        }
-	}
+    }
 
 // ---------------------------------------------------------
 // CCalcFuncmapSubPane::MapOperators
@@ -1801,83 +1908,83 @@
 // ---------------------------------------------------------
 //
 TBool CCalcFuncmapSubPane::MapOperators( TUint16 aOperator, TInt& aResult)
-	{
+    {
     TInt loc1 = KAllowedOperatorPlus().Locate( aOperator );
     if ( loc1 != KErrNotFound )
         {
         if ( AknLayoutUtils::PenEnabled() )
-        	{
+            {
             aResult = ECmdTAdd;
-        	}
+            }
         else
-        	{
-        	aResult = EPlusButton;
-        	}
+            {
+            aResult = EPlusButton;
+            }
         return ETrue;
         }
     TInt loc2 = KAllowedOperatorMinus().Locate( aOperator );
     if ( loc2 != KErrNotFound )
         {
         if ( AknLayoutUtils::PenEnabled() )
-        	{
+            {
             aResult = ECmdTSubtract;
-        	}
+            }
         else
-        	{
-        	aResult = EMinusButton;
-        	}
+            {
+            aResult = EMinusButton;
+            }
         return ETrue;
         }
     TInt loc3 = KAllowedOperatorStar().Locate( aOperator );
     if ( loc3 != KErrNotFound )
         {
         if ( AknLayoutUtils::PenEnabled() )
-        	{
+            {
             aResult = ECmdTMultiply;
-        	}
+            }
         else
-        	{
-        	aResult = EMultiplyButton;
-        	}
+            {
+            aResult = EMultiplyButton;
+            }
         return ETrue;
         }
     TInt loc4 = KAllowedOperatorDivide().Locate( aOperator );
     if ( loc4 != KErrNotFound )
         {
         if ( AknLayoutUtils::PenEnabled() )
-        	{
+            {
             aResult = ECmdTDivide;
-        	}
+            }
         else
-        	{
-        	aResult = EDivideButton;
-        	}
+            {
+            aResult = EDivideButton;
+            }
         return ETrue;
         }
     TInt loc5 = KAllowedOperatorEquals().Locate( aOperator );
     if ( loc5 != KErrNotFound )
         {
         if ( AknLayoutUtils::PenEnabled() )
-        	{
+            {
             aResult = ECmdTResult;
-        	}
+            }
         else
-        	{
-        	aResult = EEqualButton;
-        	}
+            {
+            aResult = EEqualButton;
+            }
         return ETrue;
         }
     TInt loc6 = KAllowedOperatorPercent().Locate( aOperator );
     if ( loc6 != KErrNotFound )
         {
         if ( AknLayoutUtils::PenEnabled() )
-        	{
+            {
             aResult = ECmdTPercent;
-        	}
+            }
         else
-        	{ 
-        	aResult = EPercentButton;
-        	}
+            { 
+            aResult = EPercentButton;
+            }
         return ETrue;
         }
     TInt loc7 = KAllowedOperatorDecimal().Locate( aOperator );
@@ -1887,7 +1994,7 @@
         return ETrue;
         }
     return EFalse;
-	}
+    }
 
 // ---------------------------------------------------------
 // CCalcFuncmapSubPane::GetKeyboardType
--- a/extras/calcsoft/src/CalcOutSheet.cpp	Wed Jun 09 09:43:27 2010 +0300
+++ b/extras/calcsoft/src/CalcOutSheet.cpp	Mon Jun 21 15:42:09 2010 +0300
@@ -24,9 +24,9 @@
 #include    <AknUtils.h>
 #include    <Calcsoft.rsg>
 #include    <applayout.cdl.h>
-#include 	<AknsDrawUtils.h>
-#include	<layoutmetadata.cdl.h>
-#include	"CalcEnv.h"
+#include     <AknsDrawUtils.h>
+#include    <layoutmetadata.cdl.h>
+#include    "CalcEnv.h"
 #include    "CalcCont.h"    
 #include    "CalcOutSheet.h"
 #include    "CalcDoc.h"
@@ -64,37 +64,37 @@
     {
     delete iOpSheetContext;
     if(iOperatorLayout)
-	    {
-	    iOperatorLayout->Reset();
-	    delete iOperatorLayout;	
-	    }
-	if(iOperandLayout)
-	    {
-	    iOperandLayout->Reset();
-	    delete iOperandLayout;	
-	    }
-	if(iEqualLineLayout)
-	    {
-	    iEqualLineLayout->Reset();
-	    delete iEqualLineLayout;	
-	    }
-	if(iResultsLineLayout)
-	    {
-	    iResultsLineLayout->Reset();
-	    delete iResultsLineLayout;	
-	    }
-	if (iCRKey)
-		{
-		delete iCRKey;
-		iCRKey = NULL;
-		}
-		
-	//Delete the scrollbar frame
-	if(iSBFrame)
-	    {
-	    delete iSBFrame;
-	    iSBFrame = NULL;
-	    }
+        {
+        iOperatorLayout->Reset();
+        delete iOperatorLayout;    
+        }
+    if(iOperandLayout)
+        {
+        iOperandLayout->Reset();
+        delete iOperandLayout;    
+        }
+    if(iEqualLineLayout)
+        {
+        iEqualLineLayout->Reset();
+        delete iEqualLineLayout;    
+        }
+    if(iResultsLineLayout)
+        {
+        iResultsLineLayout->Reset();
+        delete iResultsLineLayout;    
+        }
+    if (iCRKey)
+        {
+        delete iCRKey;
+        iCRKey = NULL;
+        }
+        
+    //Delete the scrollbar frame
+    if(iSBFrame)
+        {
+        delete iSBFrame;
+        iSBFrame = NULL;
+        }
     }
 
 // ---------------------------------------------------------
@@ -126,7 +126,7 @@
     iScrollOffset = 0;
     if( AknLayoutUtils::PenEnabled()  )
     {
-    	UpdateScrollIndicatorL();	
+        UpdateScrollIndicatorL();    
     }
     DrawNow();
     }
@@ -212,9 +212,9 @@
     
     iCalcAppEnv = CCalcAppEnv::Static();
     iCalcPaper = iCalcAppEnv->PaperBitmap();
-	iCalcAppEnv->ScalablePaperBitmaps(iCalcScalablePaper);
+    iCalcAppEnv->ScalablePaperBitmaps(iCalcScalablePaper);
 #ifdef __SCALABLE_ICONS
-	iCalcResultsLine = iCalcAppEnv->ResultsLineBitmap();
+    iCalcResultsLine = iCalcAppEnv->ResultsLineBitmap();
 #endif
 
     CCalcAppUi* appui = iCalcAppEnv->AppUi();
@@ -264,197 +264,198 @@
     }
     iCalcOutputSheetLines   = (listLimits.LastRow()-listLimits.FirstRow()) + 1;
     iOperatorLayout->ResizeL(iCalcOutputSheetLines);
-	iOperandLayout->ResizeL(iCalcOutputSheetLines);
-	iResultsLineLayout->ResizeL(iCalcOutputSheetLines-1);
-	iEqualLineLayout->ResizeL(iCalcOutputSheetLines-1);
-	
+    iOperandLayout->ResizeL(iCalcOutputSheetLines);
+    iResultsLineLayout->ResizeL(iCalcOutputSheetLines-1);
+    iEqualLineLayout->ResizeL(iCalcOutputSheetLines-1);
+    
     iOperatorLayout->Reset();
-	iOperandLayout->Reset();
-	iResultsLineLayout->Reset();
-	iEqualLineLayout->Reset();
+    iOperandLayout->Reset();
+    iResultsLineLayout->Reset();
+    iEqualLineLayout->Reset();
     
     TAknLayoutRect rectParent;
-	TAknWindowLineLayout layoutOfParentResultsLine;
-	TAknLayoutRect rectListCalcPane;
-	
+    TAknWindowLineLayout layoutOfParentResultsLine;
+    TAknLayoutRect rectListCalcPane;
+    
  
     
     if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() )
-		{
-			TAknWindowLineLayout  calcPaperPane;
-			
-			//For Touch UI Layouts, different configuration
-			if( AknLayoutUtils::PenEnabled() )
-	        {
-	            if (Layout_Meta_Data::IsLandscapeOrientation())
-	            {
-	                calcPaperPane = AknLayoutScalable_Apps::calc_paper_pane(enTouch_with_lsc).LayoutLine();
-	            }
-	            else
-	            {
-	                calcPaperPane = AknLayoutScalable_Apps::calc_paper_pane(enTouch_with_prt).LayoutLine();
-	            }
-	        }
-	        else
-	        {
-		        calcPaperPane = AknLayoutScalable_Apps::calc_paper_pane(enTouch_disabled).LayoutLine();
-	        }
-			TAknLayoutRect rectcalcPaperPane;	
-			rectcalcPaperPane.LayoutRect(parentRect,calcPaperPane);
-			TAknWindowLineLayout layoutListCalcPane;
-			if( AknLayoutUtils::PenEnabled() )
-	        {
-	            layoutListCalcPane = AknLayoutScalable_Apps::list_calc_pane(enTouch_enabled).LayoutLine();
-	        }
-	        else
-	        {
-	            layoutListCalcPane = AknLayoutScalable_Apps::list_calc_pane(enTouch_disabled).LayoutLine();
-	        }
-			
-			rectListCalcPane.LayoutRect(rectcalcPaperPane.Rect(),layoutListCalcPane);
-		}
+        {
+            TAknWindowLineLayout  calcPaperPane;
+            
+            //For Touch UI Layouts, different configuration
+            if( AknLayoutUtils::PenEnabled() )
+            {
+                if (Layout_Meta_Data::IsLandscapeOrientation())
+                {
+                    calcPaperPane = AknLayoutScalable_Apps::calc_paper_pane(enTouch_with_lsc).LayoutLine();
+                }
+                else
+                {
+                    calcPaperPane = AknLayoutScalable_Apps::calc_paper_pane(enTouch_with_prt).LayoutLine();
+                }
+            }
+            else
+            {
+                calcPaperPane = AknLayoutScalable_Apps::calc_paper_pane(enTouch_disabled).LayoutLine();
+            }
+            TAknLayoutRect rectcalcPaperPane;    
+            rectcalcPaperPane.LayoutRect(parentRect,calcPaperPane);
+            iSBBrPoint = rectcalcPaperPane.Rect().iBr;
+            TAknWindowLineLayout layoutListCalcPane;
+            if( AknLayoutUtils::PenEnabled() )
+            {
+                layoutListCalcPane = AknLayoutScalable_Apps::list_calc_pane(enTouch_enabled).LayoutLine();
+            }
+            else
+            {
+                layoutListCalcPane = AknLayoutScalable_Apps::list_calc_pane(enTouch_disabled).LayoutLine();
+            }
+            
+            rectListCalcPane.LayoutRect(rectcalcPaperPane.Rect(),layoutListCalcPane);
+        }
     
-	TInt nTimes=(iCalcOutputSheetLines-1);
+    TInt nTimes=(iCalcOutputSheetLines-1);
     for (TInt cnt(0); cnt < iCalcOutputSheetLines; cnt++)
         {
         if (AknLayoutUtils::ScalableLayoutInterfaceAvailable())
-		{
-		if(AknLayoutUtils::PenEnabled())
-		{
-			if (Layout_Meta_Data::IsLandscapeOrientation())
-			{
-				layoutOfParentResultsLine =  AknLayoutScalable_Apps::list_calc_item_pane(nTimes,enTouch_enabled).LayoutLine();	
-			}
-			else
-			{
-				layoutOfParentResultsLine =  AknLayoutScalable_Apps::list_calc_item_pane(nTimes,enTouch_enabled).LayoutLine();
-			}
-	
-		}
-		else
-		{
-		    layoutOfParentResultsLine =  AknLayoutScalable_Apps::list_calc_item_pane(nTimes,enTouch_disabled).LayoutLine();    
-		}
-		
-		
-		rectParent.LayoutRect(rectListCalcPane.Rect(),layoutOfParentResultsLine) ;
-			
-		TAknLayoutText operatorLayout;
-		TAknLayoutText operendLayout;
-		if(AknLayoutUtils::PenEnabled())
-		{
-		    operatorLayout.LayoutText(rectParent.Rect(),AknLayoutScalable_Apps::list_calc_item_pane_t2(enTouch_with_prt).LayoutLine(),iCalcAppEnv->OutSheetOperatorFont()); 
-		    iOperatorLayout->AppendL(operatorLayout);
-		
-		    operendLayout.LayoutText(rectParent.Rect(),AknLayoutScalable_Apps::list_calc_item_pane_t1(enTouch_with_lsc).LayoutLine(),iCalcAppEnv->OutSheetOperatorFont()); 
-		    iOperandLayout->AppendL(operendLayout);
-		}
-		else
-		{
-		    operatorLayout.LayoutText(rectParent.Rect(),AknLayoutScalable_Apps::list_calc_item_pane_t2(enTouch_disabled).LayoutLine(),iCalcAppEnv->OutSheetOperatorFont()); 
-		    iOperatorLayout->AppendL(operatorLayout);
-		
-		    operendLayout.LayoutText(rectParent.Rect(),AknLayoutScalable_Apps::list_calc_item_pane_t1(enTouch_disabled).LayoutLine(),iCalcAppEnv->OutSheetOperatorFont()); 
-		    iOperandLayout->AppendL(operendLayout);    
-		}
-		
-	  // aCustomFont
+        {
+        if(AknLayoutUtils::PenEnabled())
+        {
+            if (Layout_Meta_Data::IsLandscapeOrientation())
+            {
+                layoutOfParentResultsLine =  AknLayoutScalable_Apps::list_calc_item_pane(nTimes,enTouch_enabled).LayoutLine();    
+            }
+            else
+            {
+                layoutOfParentResultsLine =  AknLayoutScalable_Apps::list_calc_item_pane(nTimes,enTouch_enabled).LayoutLine();
+            }
+    
+        }
+        else
+        {
+            layoutOfParentResultsLine =  AknLayoutScalable_Apps::list_calc_item_pane(nTimes,enTouch_disabled).LayoutLine();    
+        }
+        
+        
+        rectParent.LayoutRect(rectListCalcPane.Rect(),layoutOfParentResultsLine) ;
+            
+        TAknLayoutText operatorLayout;
+        TAknLayoutText operendLayout;
+        if(AknLayoutUtils::PenEnabled())
+        {
+            operatorLayout.LayoutText(rectParent.Rect(),AknLayoutScalable_Apps::list_calc_item_pane_t2(enTouch_with_prt).LayoutLine(),iCalcAppEnv->OutSheetOperatorFont()); 
+            iOperatorLayout->AppendL(operatorLayout);
+        
+            operendLayout.LayoutText(rectParent.Rect(),AknLayoutScalable_Apps::list_calc_item_pane_t1(enTouch_with_lsc).LayoutLine(),iCalcAppEnv->OutSheetOperatorFont()); 
+            iOperandLayout->AppendL(operendLayout);
+        }
+        else
+        {
+            operatorLayout.LayoutText(rectParent.Rect(),AknLayoutScalable_Apps::list_calc_item_pane_t2(enTouch_disabled).LayoutLine(),iCalcAppEnv->OutSheetOperatorFont()); 
+            iOperatorLayout->AppendL(operatorLayout);
+        
+            operendLayout.LayoutText(rectParent.Rect(),AknLayoutScalable_Apps::list_calc_item_pane_t1(enTouch_disabled).LayoutLine(),iCalcAppEnv->OutSheetOperatorFont()); 
+            iOperandLayout->AppendL(operendLayout);    
+        }
+        
+      // aCustomFont
      --nTimes;
-		
-		}
-	  
-	  else
-	  {
-	  	  
-	    
-	  //Scalable UI.
+        
+        }
+      
+      else
+      {
+            
+        
+      //Scalable UI.
 
-	  	TAknLayoutText operatorLayout;
-		TAknLayoutText operendLayout;
-	  	operatorLayout.LayoutText(parentRect,AppLayout::Calculator_texts_Line_8(nTimes),iCalcAppEnv->OutSheetOperatorFont()); // aCustomFont
-	    iOperatorLayout->AppendL(operatorLayout);        
+          TAknLayoutText operatorLayout;
+        TAknLayoutText operendLayout;
+          operatorLayout.LayoutText(parentRect,AppLayout::Calculator_texts_Line_8(nTimes),iCalcAppEnv->OutSheetOperatorFont()); // aCustomFont
+        iOperatorLayout->AppendL(operatorLayout);        
 
-		operendLayout.LayoutText(parentRect,AppLayout::Calculator_texts_Line_7(nTimes), NULL);
-		iOperandLayout->AppendL(operendLayout);            
+        operendLayout.LayoutText(parentRect,AppLayout::Calculator_texts_Line_7(nTimes), NULL);
+        iOperandLayout->AppendL(operendLayout);            
      --nTimes;
-	  }
+      }
     }
     
     //Scalable UI.
-	nTimes = iCalcOutputSheetLines - 2;	  
+    nTimes = iCalcOutputSheetLines - 2;      
     for (TInt ii(0); ii < (iCalcOutputSheetLines - 1); ii++)
         {
 
 
-		if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() )
-			{
-#ifdef __SCALABLE_ICONS		
-			layoutOfParentResultsLine =  AknLayoutScalable_Apps::list_calc_item_pane(nTimes).LayoutLine();
+        if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() )
+            {
+#ifdef __SCALABLE_ICONS        
+            layoutOfParentResultsLine =  AknLayoutScalable_Apps::list_calc_item_pane(nTimes).LayoutLine();
 
-			rectParent.LayoutRect(rectListCalcPane.Rect(),layoutOfParentResultsLine) ;
-			TAknWindowLineLayout   layoutOfResultsLine = AknLayoutScalable_Apps::list_calc_item_pane_g1().LayoutLine(); 
-			TAknLayoutRect lineLayout;
-			lineLayout.LayoutRect(rectParent.Rect(),layoutOfResultsLine);
-			iResultsLineLayout->AppendL(lineLayout);
+            rectParent.LayoutRect(rectListCalcPane.Rect(),layoutOfParentResultsLine) ;
+            TAknWindowLineLayout   layoutOfResultsLine = AknLayoutScalable_Apps::list_calc_item_pane_g1().LayoutLine(); 
+            TAknLayoutRect lineLayout;
+            lineLayout.LayoutRect(rectParent.Rect(),layoutOfResultsLine);
+            iResultsLineLayout->AppendL(lineLayout);
 #else
-			TAknLayoutRect lineLayout;
-			lineLayout.LayoutRect(parentRect,AppLayout::Calculator_elements_Line_3(nTimes)); 
-			iEqualLineLayout->AppendL(lineLayout);
+            TAknLayoutRect lineLayout;
+            lineLayout.LayoutRect(parentRect,AppLayout::Calculator_elements_Line_3(nTimes)); 
+            iEqualLineLayout->AppendL(lineLayout);
 #endif
-			}
-			else
-			{
-			TAknLayoutRect lineLayout;
-			lineLayout.LayoutRect(parentRect,AppLayout::Calculator_elements_Line_3(nTimes)); 
-			iEqualLineLayout->AppendL(lineLayout);
-			}
-			
-		--nTimes;
+            }
+            else
+            {
+            TAknLayoutRect lineLayout;
+            lineLayout.LayoutRect(parentRect,AppLayout::Calculator_elements_Line_3(nTimes)); 
+            iEqualLineLayout->AppendL(lineLayout);
+            }
+            
+        --nTimes;
         }
 
     TAknLayoutRect  paperRect;
-	if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() )
-			{
-			TAknLayoutRect rectCalcPaperPane;	
-			TAknLayoutRect rectbgCalcPaperPane;
-			//Different configuration for Touch Layouts
-			if( AknLayoutUtils::PenEnabled() )
-			{
-					//In landscape mode different configuration is needed
-			     if (Layout_Meta_Data::IsLandscapeOrientation())
-			     {
-			        rectCalcPaperPane.LayoutRect(parentRect,AknLayoutScalable_Apps::calc_paper_pane(enTouch_with_lsc).LayoutLine());  
-			     }
-			     else
-			     {
-			        rectCalcPaperPane.LayoutRect(parentRect,AknLayoutScalable_Apps::calc_paper_pane(enTouch_with_prt).LayoutLine());      
-			     }
-			     rectbgCalcPaperPane.LayoutRect(rectCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane(enTouch_enabled).LayoutLine());
-			}
-			else
-			{
-			    rectCalcPaperPane.LayoutRect(parentRect,AknLayoutScalable_Apps::calc_paper_pane(enTouch_disabled).LayoutLine());    
-			    rectbgCalcPaperPane.LayoutRect(rectCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane().LayoutLine());
-			}
-			
-			iPaperPaneRect  = rectCalcPaperPane;
-			
-			
-			iCalcPaperLayout[0].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g1().LayoutLine());
-			iCalcPaperLayout[1].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g2().LayoutLine());
-			iCalcPaperLayout[2].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g3().LayoutLine());
-			iCalcPaperLayout[3].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g4().LayoutLine());
-		    iCalcPaperLayout[4].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g5().LayoutLine());
-			iCalcPaperLayout[5].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g6().LayoutLine());
-			iCalcPaperLayout[6].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g7().LayoutLine());
-    		iCalcPaperLayout[7].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g8().LayoutLine());
-			iCalcPaperLayout[8].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::calc_bg_paper_pane_g9().LayoutLine());
-			}
-			
-	   iOpSheetContext->SetRect(Rect());
-		
-		//Only for touch UI, scrollbars are present
-	   if( AknLayoutUtils::PenEnabled()  )
+    if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() )
+            {
+            TAknLayoutRect rectCalcPaperPane;    
+            TAknLayoutRect rectbgCalcPaperPane;
+            //Different configuration for Touch Layouts
+            if( AknLayoutUtils::PenEnabled() )
+            {
+                    //In landscape mode different configuration is needed
+                 if (Layout_Meta_Data::IsLandscapeOrientation())
+                 {
+                    rectCalcPaperPane.LayoutRect(parentRect,AknLayoutScalable_Apps::calc_paper_pane(enTouch_with_lsc).LayoutLine());  
+                 }
+                 else
+                 {
+                    rectCalcPaperPane.LayoutRect(parentRect,AknLayoutScalable_Apps::calc_paper_pane(enTouch_with_prt).LayoutLine());      
+                 }
+                 rectbgCalcPaperPane.LayoutRect(rectCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane(enTouch_enabled).LayoutLine());
+            }
+            else
+            {
+                rectCalcPaperPane.LayoutRect(parentRect,AknLayoutScalable_Apps::calc_paper_pane(enTouch_disabled).LayoutLine());    
+                rectbgCalcPaperPane.LayoutRect(rectCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane().LayoutLine());
+            }
+            
+            iPaperPaneRect  = rectCalcPaperPane;
+            
+            
+            iCalcPaperLayout[0].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g1().LayoutLine());
+            iCalcPaperLayout[1].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g2().LayoutLine());
+            iCalcPaperLayout[2].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g3().LayoutLine());
+            iCalcPaperLayout[3].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g4().LayoutLine());
+            iCalcPaperLayout[4].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g5().LayoutLine());
+            iCalcPaperLayout[5].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g6().LayoutLine());
+            iCalcPaperLayout[6].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g7().LayoutLine());
+            iCalcPaperLayout[7].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::bg_calc_paper_pane_g8().LayoutLine());
+            iCalcPaperLayout[8].LayoutRect(rectbgCalcPaperPane.Rect(),AknLayoutScalable_Apps::calc_bg_paper_pane_g9().LayoutLine());
+            }
+            
+       iOpSheetContext->SetRect(Rect());
+        
+        //Only for touch UI, scrollbars are present
+       if( AknLayoutUtils::PenEnabled()  )
         {
           UpdateScrollIndicatorL();
         }
@@ -467,8 +468,8 @@
         }
         
         }
-		
-		}
+        
+        }
 
 
 // ---------------------------------------------------------
@@ -478,13 +479,13 @@
 // ---------------------------------------------------------
 void CCalcOutputSheet::UpdateScrollIndicatorL()
     {
-    	
-    	if( !AknLayoutUtils::PenEnabled()  )
-    	{
-    		return;
-    	}
-    	
-        TAknLayoutRect rectCalcScrollPane;	
+        
+        if( !AknLayoutUtils::PenEnabled()  )
+        {
+            return;
+        }
+        
+        TAknLayoutRect rectCalcScrollPane;    
 
         //Get the layout information for the scrollbar
         if( AknLayoutUtils::PenEnabled() )
@@ -499,7 +500,7 @@
          }
 
         }
-				//Create scrollbar if not created already
+                //Create scrollbar if not created already
         if ( !iSBFrame )
         {
         //Make this class as the observer class as well
@@ -509,16 +510,16 @@
         CAknAppUi* appUi = iAvkonAppUi;
         if (AknLayoutUtils::DefaultScrollBarType(appUi) == CEikScrollBarFrame::EDoubleSpan)
         {
-        	// For EDoubleSpan type scrollbar
-        	iSBFrame->CreateDoubleSpanScrollBarsL(ETrue, EFalse); // non-window owning scrollbar            
-        	iSBFrame->SetTypeOfVScrollBar(CEikScrollBarFrame::EDoubleSpan);
+            // For EDoubleSpan type scrollbar
+            iSBFrame->CreateDoubleSpanScrollBarsL(ETrue, EFalse); // non-window owning scrollbar            
+            iSBFrame->SetTypeOfVScrollBar(CEikScrollBarFrame::EDoubleSpan);
         }
         else
         {
-        	// For EArrowHead type scrollbar
-        	iSBFrame->SetTypeOfVScrollBar(CEikScrollBarFrame::EArrowHead);
+            // For EArrowHead type scrollbar
+            iSBFrame->SetTypeOfVScrollBar(CEikScrollBarFrame::EArrowHead);
         }  
-        iSBFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto);
+        iSBFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EOff);
         }
 
         TEikScrollBarModel hSbarModel;
@@ -533,7 +534,7 @@
         }
         else
         {
-        		//span calculator if no of lines exceeds one page
+                //span calculator if no of lines exceeds one page
             vSbarModel.iScrollSpan = 1 + iCalcHistory->Count() - iCalcOutputSheetLines;  
         }
 
@@ -542,6 +543,16 @@
 
         TRect clientRect( iAvkonAppUi->ClientRect() );
         TRect rec(rectCalcScrollPane.Rect()); 
+        TPoint point = rectCalcScrollPane.Rect().iBr;
+        TInt width = rectCalcScrollPane.Rect().Width();
+        TInt rightPointRectX = iSBBrPoint.iX;
+        TInt pointRectX = point.iX;
+        TInt pointRectY = point.iY;
+        pointRectX = rightPointRectX;
+        TPoint newPoint;
+        newPoint.SetXY( pointRectX, pointRectY );
+        TRect rect;
+        rect.SetRect( rec.iTl, newPoint );
 
         TEikScrollBarFrameLayout layout;
         layout.iTilingMode = TEikScrollBarFrameLayout::EInclusiveRectConstant;
@@ -557,13 +568,24 @@
 
         TAknDoubleSpanScrollBarModel hDsSbarModel(hSbarModel);
         TAknDoubleSpanScrollBarModel vDsSbarModel(vSbarModel);
+        
+        if (iCalcHistory->Count() <= iCalcOutputSheetLines )
+        {
+        iSBFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
+                CEikScrollBarFrame::EOff);
+        }
+        else
+        {
+        iSBFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
+                CEikScrollBarFrame::EOn);
+        }
 
-        iSBFrame->TileL(&hDsSbarModel, &vDsSbarModel, clientRect, rec, layout);               
+        iSBFrame->TileL(&hDsSbarModel, &vDsSbarModel, clientRect, rect, layout);               
         iSBFrame->SetVFocusPosToThumbPos(vDsSbarModel.FocusPosition());
         }  
         else
         {
-        iSBFrame->TileL( &hSbarModel, &vSbarModel, clientRect, rec, layout );
+        iSBFrame->TileL( &hSbarModel, &vSbarModel, clientRect, rect, layout );
         iSBFrame->SetVFocusPosToThumbPos( vSbarModel.iThumbPosition );
         }
         }
@@ -580,7 +602,7 @@
     {
     
     CWindowGc& gc = SystemGc();
-	gc.Clear(aRect);
+    gc.Clear(aRect);
     gc.SetClippingRect(aRect);
     TRect rect(Rect());
     
@@ -593,31 +615,31 @@
            
     gc.SetBrushStyle(CGraphicsContext::ENullBrush);
     gc.SetPenStyle(CGraphicsContext::ENullPen);
-	//set the size of the bitmap. SVG-T upgrade.
-	CAknsItemData* idata = NULL;    				
+    //set the size of the bitmap. SVG-T upgrade.
+    CAknsItemData* idata = NULL;                    
     if (skin)
-    	{
+        {
         idata = skin->GetCachedItemData( KAknsIIDQsnFrCalcPaper);
-    	}
-    	
+        }
+        
     if ( idata && idata->Type() == EAknsITImageTable )
-    	{
+        {
             if ( AknLayoutUtils::PenEnabled() ) 
             {//when touch input,the paper become bigger,so it needs only one paper 
                 AknIconUtils::SetSize(iCalcScalablePaper[0]->Bitmap(),iCalcPaperLayout[0].Rect().Size(),EAspectRatioNotPreserved); 
                 AknIconUtils::SetSize(iCalcScalablePaper[0]->Mask(),iCalcPaperLayout[0].Rect().Size(),EAspectRatioNotPreserved);
-                iCalcPaperLayout[0].DrawImage(gc, iCalcScalablePaper[0]->Bitmap(),iCalcScalablePaper[0]->Mask());	
+                iCalcPaperLayout[0].DrawImage(gc, iCalcScalablePaper[0]->Bitmap(),iCalcScalablePaper[0]->Mask());    
             }
             else
             {
                 for(TInt Cnt=0;Cnt < 9; Cnt++)
-            	{
+                {
                 AknIconUtils::SetSize(iCalcScalablePaper[Cnt]->Bitmap(),iCalcPaperLayout[Cnt].Rect().Size(),EAspectRatioNotPreserved); 
-            	AknIconUtils::SetSize(iCalcScalablePaper[Cnt]->Mask(),iCalcPaperLayout[Cnt].Rect().Size(),EAspectRatioNotPreserved);
-            	iCalcPaperLayout[Cnt].DrawImage(gc, iCalcScalablePaper[Cnt]->Bitmap(),iCalcScalablePaper[Cnt]->Mask());
+                AknIconUtils::SetSize(iCalcScalablePaper[Cnt]->Mask(),iCalcPaperLayout[Cnt].Rect().Size(),EAspectRatioNotPreserved);
+                iCalcPaperLayout[Cnt].DrawImage(gc, iCalcScalablePaper[Cnt]->Bitmap(),iCalcScalablePaper[Cnt]->Mask());
                 }
             }
-  		}
+          }
     else
         {
             // Make outsheet displayed in Jingmask is the same size as in other themes
@@ -629,10 +651,10 @@
             else
                 {
                 AknsDrawUtils::Background( AknsUtils:: SkinInstance(), iOpSheetContext, this, gc, rect );
-                }	
+                }    
         }
-  		
-	
+          
+    
     for (TInt loop(iCalcOutputSheetLines - 1); loop >= 0; loop--)
         {
         const TCalcEditLine& history = (*iCalcHistory)[loop + iScrollOffset];
@@ -641,78 +663,78 @@
         
         if (loop < iCalcOutputSheetLines - 1)
             {
-			// When an operator is Equal, a line is drawn at an upper end.
-			if (TCalcEditLine::ECalcEqual == operatorType)
-				{
-					TRgb ResultsLineolor;
+            // When an operator is Equal, a line is drawn at an upper end.
+            if (TCalcEditLine::ECalcEqual == operatorType)
+                {
+                    TRgb ResultsLineolor;
                     TInt error1 = AknsUtils::GetCachedColor( skin, ResultsLineolor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG29);
                     if(error1 == KErrNone)
                     {
                         AknIconUtils::SetIconColor(iCalcResultsLine->Bitmap(),ResultsLineolor);
                     }
-				if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() )
-					{
+                if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() )
+                    {
 #ifdef __SCALABLE_ICONS
-					TAknLayoutRect& lineLayout = iResultsLineLayout->At(loop);
-					AknIconUtils::SetSize(iCalcResultsLine->Bitmap(),lineLayout.Rect().Size(),EAspectRatioNotPreserved);
-					AknIconUtils::SetSize(iCalcResultsLine->Mask(),lineLayout.Rect().Size(),EAspectRatioNotPreserved);
-					lineLayout.DrawImage(gc, iCalcResultsLine->Bitmap(),iCalcResultsLine->Mask()); 
+                    TAknLayoutRect& lineLayout = iResultsLineLayout->At(loop);
+                    AknIconUtils::SetSize(iCalcResultsLine->Bitmap(),lineLayout.Rect().Size(),EAspectRatioNotPreserved);
+                    AknIconUtils::SetSize(iCalcResultsLine->Mask(),lineLayout.Rect().Size(),EAspectRatioNotPreserved);
+                    lineLayout.DrawImage(gc, iCalcResultsLine->Bitmap(),iCalcResultsLine->Mask()); 
 #else
-					TAknLayoutRect& equalLineLayout= iEqualLineLayout->At(loop);
-					TRect rectLine = equalLineLayout.Rect();
-					equalLineLayout.DrawRect(gc);
+                    TAknLayoutRect& equalLineLayout= iEqualLineLayout->At(loop);
+                    TRect rectLine = equalLineLayout.Rect();
+                    equalLineLayout.DrawRect(gc);
 #endif
-					}
-				else 
-					{ 
-					TAknLayoutRect& equalLineLayout= iEqualLineLayout->At(loop);
-					TRect rectLine = equalLineLayout.Rect();
-					equalLineLayout.DrawRect(gc);
-					}
-				}
+                    }
+                else 
+                    { 
+                    TAknLayoutRect& equalLineLayout= iEqualLineLayout->At(loop);
+                    TRect rectLine = equalLineLayout.Rect();
+                    equalLineLayout.DrawRect(gc);
+                    }
+                }
             }
             TRgb color;
             TInt error = AknsUtils::GetCachedColor( skin, color, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG29);
-			if(error == KErrNone)
-			{
-				gc.SetPenColor(color);
-			}
-			
-		//change TBuf<10> to TBuf<KCalcMaxNumberWidth>
+            if(error == KErrNone)
+            {
+                gc.SetPenColor(color);
+            }
+            
+        //change TBuf<10> to TBuf<KCalcMaxNumberWidth>
        TBuf<KCalcMaxNumberWidth> keyvalue;
        
        keyvalue.Append(history.NumberString());
        AknTextUtils::LanguageSpecificNumberConversion  (keyvalue);
         // An operand's drawing
-		TAknLayoutText& operendLayout = iOperandLayout->At(loop);
+        TAknLayoutText& operendLayout = iOperandLayout->At(loop);
 
                     if ( iUiLanguage == ELangFarsi || iUiLanguage == ELangHindi || 
                         iUiLanguage == ELangUrdu || iUiLanguage == ELangArabic )
                         {
                          if( iUiLanguage == ELangUrdu || iUiLanguage == ELangArabic )
-		         {
-			    	TInt len = keyvalue.Length();
-				    TInt pos = KErrNotFound;
-				    TBuf<1> ch;
-				    ch.Append(iCalcAppEnv->MinusIndicator());
-				    if( (pos = keyvalue.Locate(iCalcAppEnv->MinusIndicator())) != KErrNotFound &&
-				         pos == keyvalue.LocateReverse(iCalcAppEnv->MinusIndicator()))
-				    {
-				     keyvalue.Delete( pos, 1 );
-				     keyvalue.Insert( 0, ch );	 
-				    }
-		         }
-			operendLayout.DrawText(gc,keyvalue,EFalse,color);
-		    }
-		else
-			{
-			operendLayout.DrawText(gc,history.NumberString(),EFalse,color);	
-			}
+                 {
+                    TInt len = keyvalue.Length();
+                    TInt pos = KErrNotFound;
+                    TBuf<1> ch;
+                    ch.Append(iCalcAppEnv->MinusIndicator());
+                    if( (pos = keyvalue.Locate(iCalcAppEnv->MinusIndicator())) != KErrNotFound &&
+                         pos == keyvalue.LocateReverse(iCalcAppEnv->MinusIndicator()))
+                    {
+                     keyvalue.Delete( pos, 1 );
+                     keyvalue.Insert( 0, ch );     
+                    }
+                 }
+            operendLayout.DrawText(gc,keyvalue,EFalse,color);
+            }
+        else
+            {
+            operendLayout.DrawText(gc,history.NumberString(),EFalse,color);    
+            }
         // An operator's drawing
         TPtrC operatorString(
             iCalcAppEnv->OutSheetOperator(operatorType));
-		TAknLayoutText& operatorLayout = iOperatorLayout->At(loop);
-		operatorLayout.DrawText(gc, operatorString , EFalse, color);
+        TAknLayoutText& operatorLayout = iOperatorLayout->At(loop);
+        operatorLayout.DrawText(gc, operatorString , EFalse, color);
         }
         
         
@@ -736,7 +758,7 @@
            
            if(iPrevThumbPosition >aScrollBar->ThumbPosition() )
            {
-           		  //Move the scroll bar n times up
+                     //Move the scroll bar n times up
                 while(iPrevThumbPosition != aScrollBar->ThumbPosition())
                 {
                     ScrollUp();
@@ -781,19 +803,19 @@
     if ( aType == KEikDynamicLayoutVariantSwitch )
         {
         if (AknLayoutUtils::PenEnabled())
-			{
-			ScrollToBottomL();
-			}
-		}
-	if ( aType == KAknsMessageSkinChange )
-		{
-		if (AknLayoutUtils::PenEnabled())
-			{
-			delete (iSBFrame);
-			iSBFrame = NULL;
+            {
+            ScrollToBottomL();
+            }
+        }
+    if ( aType == KAknsMessageSkinChange )
+        {
+        if (AknLayoutUtils::PenEnabled())
+            {
+            delete (iSBFrame);
+            iSBFrame = NULL;
 
-			UpdateScrollIndicatorL();
-			}
-		}
+            UpdateScrollIndicatorL();
+            }
+        }
 }
 //  End of File  
--- a/extras/calcsoft/src/CalcView.cpp	Wed Jun 09 09:43:27 2010 +0300
+++ b/extras/calcsoft/src/CalcView.cpp	Mon Jun 21 15:42:09 2010 +0300
@@ -95,11 +95,11 @@
     delete iContainer;
       if(iServiceHandler)
       {
-   		 delete iServiceHandler;
-   		 iServiceHandler = NULL;
+            delete iServiceHandler;
+            iServiceHandler = NULL;
       }
      
- 	}
+     }
 
 // ---------------------------------------------------------
 // CCalcView::State
@@ -153,11 +153,11 @@
                 }
             break;
             }
-		case EOperatorResult:
-			{
-			iState = EOperatorOnlyResult;
-			break;
-			}
+        case EOperatorResult:
+            {
+            iState = EOperatorOnlyResult;
+            break;
+            }
         case EOperator:
             {
             iState = EOperandAndOperator;
@@ -221,22 +221,22 @@
              // UpdateState( EOperator );
             break;
             }
-		case KErrNotSupported:
-			{
-			resourceId = R_CALC_ERROR_NEGATIVEVALUESQRT;
-			break;
-			}
+        case KErrNotSupported:
+            {
+            resourceId = R_CALC_ERROR_NEGATIVEVALUESQRT;
+            break;
+            }
         default:
             {
             return;
             }
         }
     
-	//Localisation of scalable UI.
-	HBufC* message = iCoeEnv->AllocReadResourceLC(resourceId) ;
+    //Localisation of scalable UI.
+    HBufC* message = iCoeEnv->AllocReadResourceLC(resourceId) ;
     CAknErrorNote* note = new (ELeave) CAknErrorNote();
     note->ExecuteLD(*message);
-	CleanupStack::PopAndDestroy(message);
+    CleanupStack::PopAndDestroy(message);
     
     }
 
@@ -272,18 +272,18 @@
                 aMenuPane->DeleteMenuItem(ECalcCmdClearCalcAndHistory);
                 }
              if(iLastResultSetected)
-             	{
-                aMenuPane->DeleteMenuItem(ECalcCmdLastResult); 	
-             	}
+                 {
+                aMenuPane->DeleteMenuItem(ECalcCmdLastResult);     
+                 }
             break;
             }
         case EOperandAndOperator:
         case EOperandAndOperatorAndOperand:
              if(iLastResultSetected)
-             	{
-                aMenuPane->DeleteMenuItem(ECalcCmdLastResult); 	
-             	}
-            break; 	 
+                 {
+                aMenuPane->DeleteMenuItem(ECalcCmdLastResult);     
+                 }
+            break;      
         default:
             {
             break;
@@ -373,24 +373,34 @@
             }
         case ECalcCmdPercent:
             {
-			HandleOperatorL(TCalcEditLine::ECalcPercent);
-			// The result is always is displayed
-			// after the percent button is pressed.
+            HandleOperatorL(TCalcEditLine::ECalcPercent);
+            // The result is always is displayed
+            // after the percent button is pressed.
             // But if there was a error in the calculation
             // this if will enable us to not call the
             // HandleResultL and thus making sure that
             // the state of the buttons is identical to the
             // situation before the calculation.
-			if (iState == EOperatorOnlyResult)
+            if (iState == EOperatorOnlyResult)
                 HandleResultL();
             break;
             }
         case ECalcCmdSqrt:
             {
-			HandleOperatorL(TCalcEditLine::ECalcSqrt);
-			// HandleResultL only if sqrt was pressed after single operand.
-			if (iState == EOperatorOnlyResult)
-				HandleResultL();
+//            TRequestStatus trs;
+//            RTimer timer;
+//            timer.CreateLocal();
+//            timer.After(trs, 1000*2);
+//            while ( trs == KRequestPending) {
+//                  User::WaitForAnyRequest();
+//            }
+//            timer.Cancel();
+//            timer.Close();
+            HandleOperatorL(TCalcEditLine::ECalcSqrt);
+            // HandleResultL only if sqrt was pressed after single operand.
+            if (iState == EOperatorOnlyResult)
+                HandleResultL();
+
             break;
             }
         case ECalcCmdMemorySave:
@@ -439,11 +449,11 @@
             break;
             }
         case EAknSoftkeySelect:
-        	{
-        	iContainer->HandleMiddleSoftKey();
-        	break;
-        	}
-        	
+            {
+            iContainer->HandleMiddleSoftKey();
+            break;
+            }
+            
         //Below cases are possible only for Touch UI Layouts
         case ECalcCmdOne:
             {
@@ -514,21 +524,21 @@
     /****** If none of the cases handle the Aiw Help then it will come to the default case ****/
         default:
             {
-		 		CArrayFix<TCoeHelpContext>* buf = AppUi()->AppHelpContextL();
-		 		TCoeHelpContext& helpContext = buf->At(0); 		
- 		  		TAiwVariant uidVariant;
-		 		TAiwVariant contextVariant; 		
-		 		uidVariant.Set(helpContext.iMajor); 		
-		 		TAiwGenericParam uidParam(EGenericParamHelpItem, uidVariant); 				 		contextVariant.Set(helpContext.iContext); 		
-		 		contextVariant.Set(helpContext.iContext); 		
-		 		TAiwGenericParam contextParam(EGenericParamHelpItem, contextVariant); 	
-		 		CAiwGenericParamList* list = CAiwGenericParamList::NewLC(); 		
-		 		list->AppendL(uidParam);
-		 		list->AppendL(contextParam); 
-		 	    iServiceHandler->ExecuteMenuCmdL(aCommand,*list,iServiceHandler->OutParamListL()); 	
-		 		CleanupStack::PopAndDestroy(list);
-		 		delete buf;
-		 		buf= NULL;
+                 CArrayFix<TCoeHelpContext>* buf = AppUi()->AppHelpContextL();
+                 TCoeHelpContext& helpContext = buf->At(0);         
+                   TAiwVariant uidVariant;
+                 TAiwVariant contextVariant;         
+                 uidVariant.Set(helpContext.iMajor);         
+                 TAiwGenericParam uidParam(EGenericParamHelpItem, uidVariant);                          contextVariant.Set(helpContext.iContext);         
+                 contextVariant.Set(helpContext.iContext);         
+                 TAiwGenericParam contextParam(EGenericParamHelpItem, contextVariant);     
+                 CAiwGenericParamList* list = CAiwGenericParamList::NewLC();         
+                 list->AppendL(uidParam);
+                 list->AppendL(contextParam); 
+                 iServiceHandler->ExecuteMenuCmdL(aCommand,*list,iServiceHandler->OutParamListL());     
+                 CleanupStack::PopAndDestroy(list);
+                 delete buf;
+                 buf= NULL;
             break;
             }
         }
@@ -556,7 +566,7 @@
     iContainer = CCalcContainer::NewL(this);
     
     iContainer->SetMopParent(this);
-	    
+        
     TRect mainPaneRect ;
     TRect statusPaneRect;
     
@@ -567,7 +577,7 @@
         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane,mainPaneRect);
         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,statusPaneRect);
         mainPaneRect.iTl= statusPaneRect.iTl;
-      	
+          
       }
       
       else
@@ -578,11 +588,11 @@
         AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStatusPane,statusPaneRect);
        
        mainPaneRect.iTl= statusPaneRect.iTl;
-      	      		      		      	
+                                                
       } 
     
-	
-	iContainer->SetRect(mainPaneRect);	
+    
+    iContainer->SetRect(mainPaneRect);    
     iEditorSubPane = iContainer->EditorPane();
     iOutputSheet = iContainer->OutputSheet();
     }
@@ -600,8 +610,8 @@
         {
         iEditorSubPane->DrawNow();
         UpdateState(EEqual);
-        iContainer->SetChangeSignEnableL();
-		iContainer->SetSqrtEnableL();
+
+        iContainer->SetSqrtEnableL();
         iContainer->ShowPercentButton(EFalse);
         iContainer->SetClearKeyEnable();             
         }
@@ -644,7 +654,7 @@
         UpdateState(EAllClear);
         }
     iContainer->SetChangeSignEnableL();
-	iContainer->SetSqrtEnableL();
+    iContainer->SetSqrtEnableL();
     iContainer->SetClearKeyEnable(); 
 
     //highlighting the sign "%".
@@ -690,7 +700,7 @@
     iEditorSubPane->DrawNow();
     UpdateState(kindOfInput);
     iContainer->SetChangeSignEnableL();
-	iContainer->SetSqrtEnableL();
+    iContainer->SetSqrtEnableL();
     }
 
 // ---------------------------------------------------------
@@ -801,135 +811,135 @@
     TReal64 result(editorNumber);
 
     this->iLastResultSetected = EFalse;
-	// User has pressed %
+    // User has pressed %
     if (aOperator == TCalcEditLine::ECalcPercent)
-        {	
+        {    
         if (iState == EOperandAndOperatorAndOperand)
             {
-			editLine.TrimZeroL();
-			// Save the previous operator
-			TCalcEditLine::TCalcOperatorType previousOperator = editLine.Operator();
-			// Set the operator to percent
-			editLine.SetOperator(TCalcEditLine::ECalcPercent);
-			
+            editLine.TrimZeroL();
+            // Save the previous operator
+            TCalcEditLine::TCalcOperatorType previousOperator = editLine.Operator();
+            // Set the operator to percent
+            editLine.SetOperator(TCalcEditLine::ECalcPercent);
+            
             
             // Calculate
             TRAPD(errorCode3, 
-			    result = iCalcDocument->CalculateAndModifyHistoryL(
+                result = iCalcDocument->CalculateAndModifyHistoryL(
                 editorNumber, editLine, previousOperator));
-			
+            
             if (errorCode3)
-				{
-				ErrorMsgL(errorCode3);
-				return;
-				}
+                {
+                iContainer->SetErrorCode(errorCode3);
+                return;
+                }
 
             iOutputSheet->ScrollToBottomL();
-			// Show the correct operand in the output sheet
-			aOperator = previousOperator;
-			// Set the state to EOperatorResult so that the HandleResult knows what to do
-			UpdateState(EOperatorResult);
-			}	
-		}
+            // Show the correct operand in the output sheet
+            aOperator = previousOperator;
+            // Set the state to EOperatorResult so that the HandleResult knows what to do
+            UpdateState(EOperatorResult);
+            }    
+        }
 
-	// User has pressed sqrt
-	else if (aOperator == TCalcEditLine::ECalcSqrt)
-		{
-		// We are in a middle of calculation chain
-		if (iState == EOperandAndOperatorAndOperand)
-			{
-			editLine.TrimZeroL();
-			// Save the previous operator
-			TCalcEditLine::TCalcOperatorType previousOperator = editLine.Operator();
-			// Set the operator to sqrt
-			editLine.SetOperator(TCalcEditLine::ECalcSqrt);
-			
-			// First calculate the sqrt
-			TRAPD(errorCode, 
-				result = iCalcDocument->CalculateAndNoHistoryL(
-				editorNumber, editLine));
+    // User has pressed sqrt
+    else if (aOperator == TCalcEditLine::ECalcSqrt)
+        {
+        // We are in a middle of calculation chain
+        if (iState == EOperandAndOperatorAndOperand)
+            {
+            editLine.TrimZeroL();
+            // Save the previous operator
+            TCalcEditLine::TCalcOperatorType previousOperator = editLine.Operator();
+            // Set the operator to sqrt
+            editLine.SetOperator(TCalcEditLine::ECalcSqrt);
+            
+            // First calculate the sqrt
+            TRAPD(errorCode, 
+                result = iCalcDocument->CalculateAndNoHistoryL(
+                editorNumber, editLine));
                                                  
-			if (errorCode)
-				{
-				ErrorMsgL(errorCode);
-				return;
-				}
-			
-			// Set the operator to previous one
-			editLine.SetOperator(previousOperator);
-			// Result goes to the outputsheet
-			editLine.SetNumber(result);
+            if (errorCode)
+                {
+                iContainer->SetErrorCode(errorCode);
+                return;
+                }
+            
+            // Set the operator to previous one
+            editLine.SetOperator(previousOperator);
+            // Result goes to the outputsheet
+            editLine.SetNumber(result);
 
-			// Calculate again
-			TRAPD(errorCode2, 
-				result = iCalcDocument->CalculateAndAddHistoryL(
-				result, editLine));
+            // Calculate again
+            TRAPD(errorCode2, 
+                result = iCalcDocument->CalculateAndAddHistoryL(
+                result, editLine));
                                                  
-			if (errorCode2)
-				{
-				ErrorMsgL(errorCode2);
-				return;
-				}
-			// Set this so that we will display correct operator in the output sheet
-			aOperator = previousOperator;
-			iOutputSheet->ScrollToBottomL();
-			UpdateState(EOperator);
-			// Dimm the square root and percent
-			iContainer->ShowSqrtButton(EFalse);
-			iContainer->ShowPercentButton(EFalse);
-			}
-		// Only operand and sqrt
-		else
-			{
-			editLine.SetOperator(aOperator);
-		
-			// Trap harness, because the CalculateAndHistoryL leaves in case of negative operand
-			TRAPD(errorCode,
-				result = iCalcDocument->CalculateAndAddHistoryL(
-				editorNumber, editLine));
-			
-			if (errorCode)
-				{
-				ErrorMsgL(errorCode);
-				return;
-				}
+            if (errorCode2)
+                {
+                iContainer->SetErrorCode(errorCode2);
+                return;
+                }
+            // Set this so that we will display correct operator in the output sheet
+            aOperator = previousOperator;
+            iOutputSheet->ScrollToBottomL();
+            UpdateState(EOperator);
+            // Dimm the square root and percent
+            iContainer->ShowSqrtButton(EFalse);
+            iContainer->ShowPercentButton(EFalse);
+            }
+        // Only operand and sqrt
+        else
+            {
+            editLine.SetOperator(aOperator);
+                    
+            // Trap harness, because the CalculateAndHistoryL leaves in case of negative operand
+            TRAPD(errorCode,
+                result = iCalcDocument->CalculateAndAddHistoryL(
+                editorNumber, editLine));
+            
+            if (errorCode)
+                {
+                iContainer->SetErrorCode(errorCode);
+                return;
+                }
 
-			iOutputSheet->ScrollToBottomL();
-			//Set the state to EOperatorResult so that we know to call HandleResult later
-			UpdateState(EOperatorResult);
-			}
-		}
+            iOutputSheet->ScrollToBottomL();
+            //Set the state to EOperatorResult so that we know to call HandleResult later
+            UpdateState(EOperatorResult);
+            }
+        }
     //  Current state is state4 and previous input is MS,
     // provisional result is get and show this the editor.
     // And a line is not added to OutputSheet because a line
     // is already added.
     
-	else if (iState == ESelectResult)
+    else if (iState == ESelectResult)
         {
         iCalcDocument->AddEmptyLine();
         editLine.SetOperator(TCalcEditLine::ECalcOperatorNone);
-		//  Because the state is "User has selected result",
+        //  Because the state is "User has selected result",
         // this function does not occur leave.
         result = iCalcDocument->CalculateAndAddHistoryL(
                  editorNumber, editLine);
         iOutputSheet->ScrollToBottomL();
-		UpdateState(EOperator);	
-		iContainer->SetSqrtEnableL();
-		}
-		
+        UpdateState(EOperator);    
+        iContainer->SetSqrtEnableL();
+        }
+        
     //  If a input is a operator and state is updated,
     // calculate and update history.
     else if (iState != EOperandAndOperator)  
         {
         editLine.TrimZeroL();
 
-		// If the number in the EditLine is not a operand
-		// we need to dim square root and percent buttons
-		if (iState == EOperandAndOperatorAndOperand)
-			{
-			iContainer->ShowSqrtButton(EFalse);
-			iContainer->ShowPercentButton(EFalse);
-			}
+        // If the number in the EditLine is not a operand
+        // we need to dim square root and percent buttons
+        if (iState == EOperandAndOperatorAndOperand)
+            {
+            iContainer->ShowSqrtButton(EFalse);
+            iContainer->ShowPercentButton(EFalse);
+            }
         // Calculate by user's input
         TRAPD(errorCode, 
               result = iCalcDocument->CalculateAndAddHistoryL(
@@ -937,12 +947,12 @@
                                                  
         if (errorCode)
             {
-            ErrorMsgL(errorCode);
+            iContainer->SetErrorCode(errorCode);
             return;
             }
         iOutputSheet->ScrollToBottomL();
-		UpdateState(EOperator);
-		}
+        UpdateState(EOperator);
+        }
     
     iEditorSubPane->SetEditorNumber(result);
     iEditorSubPane->SetOperator(aOperator);
@@ -952,14 +962,14 @@
         iEditorSubPane->DrawNow();  
         }
     iContainer->ScrollArrowUpdate();
-    iContainer->SetChangeSignEnableL();
+ 
     iContainer->SetClearKeyEnable(); 
-	if (aOperator == TCalcEditLine::ECalcAdd ||aOperator == TCalcEditLine::ECalcSubtract ||
-		 aOperator == TCalcEditLine::ECalcMultiply ||aOperator == TCalcEditLine::ECalcDivide )
-		{
-		iContainer->SetChangeSignDisable();
-		}  
-	
+    if (aOperator == TCalcEditLine::ECalcAdd ||aOperator == TCalcEditLine::ECalcSubtract ||
+         aOperator == TCalcEditLine::ECalcMultiply ||aOperator == TCalcEditLine::ECalcDivide )
+        {
+        iContainer->SetChangeSignDisable();
+        }  
+    
     }
 
 
@@ -978,16 +988,16 @@
 
     if (iState == EOperandAndOperator || iState == EOperatorOnlyResult)
         {
-		// User has selected equal or operand and sqrt, or percent
+        // User has selected equal or operand and sqrt, or percent
         result = iCalcDocument->ProvisionalResult();
         }
     else 
         {
         editLine.TrimZeroL();
-		// We are calculating the intermediate result. 
-		// So we need to dim the sqrt and percent buttons.
-		iContainer->ShowSqrtButton(EFalse);
-		iContainer->ShowPercentButton(EFalse);
+        // We are calculating the intermediate result. 
+        // So we need to dim the sqrt and percent buttons.
+        iContainer->ShowSqrtButton(EFalse); 
+        iContainer->ShowPercentButton(EFalse);
         
         if (iState == ESelectResult)
             {
@@ -1003,8 +1013,7 @@
     // error message is displayed.
     if (calculationError)
         {
-        ErrorMsgL(calculationError);
-
+        iContainer->SetErrorCode(calculationError);
         }
     else
         {
@@ -1073,48 +1082,48 @@
     {
     if(iServiceHandler->HandleSubmenuL(*aMenuPane))
         {
-        	return;
+            return;
         }
     switch (aResourceId)
         {
         case (R_CALC_POPUPMENU):
             {
-		        
-    	       		DynInitMainMenuPane(aMenuPane);
-			        
-		        /***** Get the context of the Help topic from here *****/
-		      	CArrayFix<TCoeHelpContext>* buf= AppUi()->AppHelpContextL();
-		       	TInt i= buf->Count();
-		       	if(i!=0)
-		       		{
-		       		/***** Check whether our flag is defined or not *****/
-		       	    #ifdef RD_HELP_AIW_INTEGRATION
-		       	    
-		       	    /***** Call the AiwProvider's AddItemsL  to attach the mnu items********/
-		       	    	
-		       		 	iServiceHandler->InitializeMenuPaneL(*aMenuPane,aResourceId,
-		        						ECmdLast,iServiceHandler->InParamListL()); 
-		        	/**** Set the old embedded help as dimmed one ****/ 
-		        		aMenuPane->SetItemDimmed(ECalcCmdHelp, ETrue);				 	
-		        	#else
-		        	/**** Set the Aiw Help as dimmed one as our feature flag is not defined ****/ 
-		        		aMenuPane->SetItemDimmed(ECmdAiwPlaceHolder,ETrue);	
-		        	#endif
-		       		}
-		        else 
-		            {
-		         /**** If the Feature flag is not defined dont show the Aiw Help ****/
-		        	aMenuPane->SetItemDimmed(ECmdAiwPlaceHolder,ETrue);
-		            }
-		            
-		        /******* Delete the buffer and make it to NULL *****/
-		       	delete buf;
-		        buf = NULL;   
-		        if (!FeatureManager::FeatureSupported( KFeatureIdHelp ))
-			        {
-			        aMenuPane->DeleteMenuItem(ECalcCmdHelp);
-			        aMenuPane->DeleteMenuItem(ECmdAiwPlaceHolder);
-			        }  
+                
+                       DynInitMainMenuPane(aMenuPane);
+                    
+                /***** Get the context of the Help topic from here *****/
+                  CArrayFix<TCoeHelpContext>* buf= AppUi()->AppHelpContextL();
+                   TInt i= buf->Count();
+                   if(i!=0)
+                       {
+                       /***** Check whether our flag is defined or not *****/
+                       #ifdef RD_HELP_AIW_INTEGRATION
+                       
+                       /***** Call the AiwProvider's AddItemsL  to attach the mnu items********/
+                           
+                            iServiceHandler->InitializeMenuPaneL(*aMenuPane,aResourceId,
+                                        ECmdLast,iServiceHandler->InParamListL()); 
+                    /**** Set the old embedded help as dimmed one ****/ 
+                        aMenuPane->SetItemDimmed(ECalcCmdHelp, ETrue);                     
+                    #else
+                    /**** Set the Aiw Help as dimmed one as our feature flag is not defined ****/ 
+                        aMenuPane->SetItemDimmed(ECmdAiwPlaceHolder,ETrue);    
+                    #endif
+                       }
+                else 
+                    {
+                 /**** If the Feature flag is not defined dont show the Aiw Help ****/
+                    aMenuPane->SetItemDimmed(ECmdAiwPlaceHolder,ETrue);
+                    }
+                    
+                /******* Delete the buffer and make it to NULL *****/
+                   delete buf;
+                buf = NULL;   
+                if (!FeatureManager::FeatureSupported( KFeatureIdHelp ))
+                    {
+                    aMenuPane->DeleteMenuItem(ECalcCmdHelp);
+                    aMenuPane->DeleteMenuItem(ECmdAiwPlaceHolder);
+                    }  
             break;
             }
 
@@ -1135,33 +1144,33 @@
 // ---------------------------------------------------------
 //
 void CCalcView::HandleForegroundEventL(TBool aForeground)
-	{
-	if( (aForeground) && (STATIC_CAST(CCalcAppUi*, AppUi())->IsSkinChanged()) )
-		{
-		iEditorSubPane->RefreshDisplaySideLBitmap();
-		iEditorSubPane->RefreshDisplayCenterBitmap();
-		iEditorSubPane->RefreshDisplaySideRBitmap();	
-		
-		iEditorSubPane->DrawNow();
+    {
+    if( (aForeground) && (STATIC_CAST(CCalcAppUi*, AppUi())->IsSkinChanged()) )
+        {
+        iEditorSubPane->RefreshDisplaySideLBitmap();
+        iEditorSubPane->RefreshDisplayCenterBitmap();
+        iEditorSubPane->RefreshDisplaySideRBitmap();    
+        
+        iEditorSubPane->DrawNow();
 
-		iOutputSheet->RefreshPaperBitmap();
-		iOutputSheet->RefreshScalablePaperBitmap();
+        iOutputSheet->RefreshPaperBitmap();
+        iOutputSheet->RefreshScalablePaperBitmap();
 #ifdef __SCALABLE_ICONS
-		iOutputSheet->RefreshResultsLineBitmap();
+        iOutputSheet->RefreshResultsLineBitmap();
 #endif
-		iOutputSheet->DrawNow();
+        iOutputSheet->DrawNow();
 
-		iContainer->FunctionSubPane()->RefreshButtonIcons();		
-		for(TInt i =0; i< 10; i++)
-			{
-			iContainer->FunctionSubPane()->GetButtonBitmapControl(i)->DrawNow();
-			}
-		}
-	else
-		{
-		CAknView::HandleForegroundEventL(aForeground);
-		}
-	}
+        iContainer->FunctionSubPane()->RefreshButtonIcons();        
+        for(TInt i =0; i< 10; i++)
+            {
+            iContainer->FunctionSubPane()->GetButtonBitmapControl(i)->DrawNow();
+            }
+        }
+    else
+        {
+        CAknView::HandleForegroundEventL(aForeground);
+        }
+    }
 
 
 //  End of File