uifw/ganes/src/HgScroller.cpp
branchRCL_3
changeset 9 aabf2c525e0f
parent 4 8ca85d2f0db7
child 10 9f56a4e1b8ab
--- a/uifw/ganes/src/HgScroller.cpp	Fri Feb 19 23:04:46 2010 +0200
+++ b/uifw/ganes/src/HgScroller.cpp	Fri Mar 12 15:43:43 2010 +0200
@@ -80,8 +80,6 @@
     iIndicatorManager = CHgIndicatorManager::NewL();
 
     /*
-     * TODO: Vasco says it supports qwerty, so the variation cannot be done.
-     *          Commented out for the time being to fix a crash.
     // Enable key search only in non-touch or hybrid (touch + qwerty) devices
     if( !AknLayoutUtils::PenEnabled() ||
         CFeatureDiscovery::IsFeatureSupportedL(TUid::Uid(KFeatureIdQwertyInput)) )
@@ -372,7 +370,8 @@
 EXPORT_C CHgScroller::~CHgScroller ( )
     {
     iCoeEnv->RemoveForegroundObserver( *this );
-    
+    ReleasePopupFont();
+
     iItems.ResetAndDestroy();
 
     delete iManager;
@@ -492,8 +491,13 @@
     
     if( iPopupDrawer )
         {
-        iPopupDrawer->Init( Rect(), 
-                &ScreenFont( TCoeFont( KFocusTextFontSize, TCoeFont::EPlain ) ) );
+        ReleasePopupFont();
+
+        TFontSpec fontSpecTitle = AknLayoutUtils::FontFromId(EAknLogicalFontPrimaryFont)->FontSpecInTwips();
+        fontSpecTitle.iHeight = KFocusTextFontSize; // set height
+        iCoeEnv->ScreenDevice()->GetNearestFontInTwips(iPopupFont, fontSpecTitle);
+    
+        iPopupDrawer->Init( Rect(), iPopupFont );
         }
     
     if(iFirstTime)
@@ -771,25 +775,29 @@
             SetHighlightL();
             }
         
-        if( iFlags & EHgScrollerSelectionMode || iSelectionMode != ENoSelection ) 
-            // Marking mode or shift key pressed ( or hash )
+        // selection needs to be valid.
+        if( iSelectedIndex >= 0 && iSelectedIndex < iItems.Count() )
             {
-            if( iItems[iSelectedIndex]->Flags() & CHgItem::EHgItemFlagMarked )
-                {
-                UnMark( iSelectedIndex );
-                }
-            else
+            if( iFlags & EHgScrollerSelectionMode || iSelectionMode != ENoSelection ) 
+                // Marking mode or shift key pressed ( or hash )
                 {
-                Mark( iSelectedIndex );                    
+                if( iItems[iSelectedIndex]->Flags() & CHgItem::EHgItemFlagMarked )
+                    {
+                    UnMark( iSelectedIndex );
+                    }
+                else
+                    {
+                    Mark( iSelectedIndex );                    
+                    }
+                DrawDeferred();
                 }
-            DrawDeferred();
-            }
-        else // Selection
-            {
-            if( iSelectionToFocusedItem || !HasHighlight() )
+            else // Selection
                 {
-                if(iSelectionObserver)
-                    iSelectionObserver->HandleOpenL(iSelectedIndex);
+                if( iSelectionToFocusedItem || !HasHighlight() )
+                    {
+                    if(iSelectionObserver)
+                        iSelectionObserver->HandleOpenL(iSelectedIndex);
+                    }
                 }
             }
         }
@@ -1734,4 +1742,18 @@
     return (iActionMenu == NULL) || iShowHighlight || (iFlags & EHgScrollerForceDoubleClick);
     }
 
+// ---------------------------------------------------------------------------
+// CHgScroller::ReleasePopupFont()
+// ---------------------------------------------------------------------------
+//     
+void CHgScroller::ReleasePopupFont()
+    {
+    if (iPopupFont)
+        {
+        iCoeEnv->ScreenDevice()->ReleaseFont(iPopupFont);
+        iPopupFont = NULL;
+        }
+    }
+
+
 // End of File