widgets/widgetapp/src/WidgetUiObserver.cpp
changeset 13 10e98eab6f85
parent 8 7c90e6132015
child 16 a359256acfc6
--- a/widgets/widgetapp/src/WidgetUiObserver.cpp	Fri May 08 08:25:06 2009 +0300
+++ b/widgets/widgetapp/src/WidgetUiObserver.cpp	Fri Jul 03 15:54:40 2009 +0100
@@ -190,8 +190,12 @@
         TBrCtlDefs::TBrCtlElementType elementtype =
                       iWindow->WindowManager().ActiveWindow()->Engine()->FocusedElementType();
         // Check if focused element type is editing type
-        if ((elementtype != TBrCtlDefs::EElementActivatedInputBox) &&
-                       (elementtype != TBrCtlDefs::EElementActivatedObjectBox))
+        if ((elementtype == TBrCtlDefs::EElementActivatedInputBox) ||
+                       (elementtype == TBrCtlDefs::EElementActivatedObjectBox))
+            {
+            iWindow->WindowManager().View()->ShowActivatedObject( ETrue );
+            }
+        else 
             {
             iWindow->WindowManager().View()->ShowActivatedObject( EFalse );
             }        
@@ -459,7 +463,6 @@
     TDataRecognitionResult dataType;
     RApaLsSession apaSession;
     TInt ret;
-    HBufC* contentTypeString = KNullDesC().AllocL();
 
     CleanupClosePushL(apaSession);
     User::LeaveIfError( apaSession.Connect() );
@@ -469,20 +472,19 @@
     apaSession.Close();
     CleanupStack::PopAndDestroy(1, &apaSession);
     
+    TPtrC8 mimeTypePtr = dataType.iDataType.Des8();
+    TInt len = mimeTypePtr.Length() + 1;
+    HBufC* contentTypeString = HBufC::NewLC( len );;
+
     if ( ret == KErrNone &&
         ( dataType.iConfidence == CApaDataRecognizerType::ECertain ) ||
         ( dataType.iConfidence == CApaDataRecognizerType::EProbable ) )
         {
         // If the file type was found, try to match it to a known file type
-        TPtrC8 mimeTypePtr = dataType.iDataType.Des8();
-        TInt len = mimeTypePtr.Length() + 1;
-        contentTypeString = HBufC::NewL( len );
         contentTypeString->Des().Copy( mimeTypePtr );
         contentTypeString->Des().ZeroTerminate();
         }
 
-    CleanupStack::PushL( contentTypeString );
-
     return contentTypeString;
     }