src/hbwidgets/editors/hbabstractedit_p.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
--- a/src/hbwidgets/editors/hbabstractedit_p.cpp	Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbwidgets/editors/hbabstractedit_p.cpp	Mon Oct 04 00:38:12 2010 +0300
@@ -197,6 +197,8 @@
     HbWidgetPrivate(),
     doc(0),
     placeholderDoc(0),
+    previousCursorAnchor(-1),
+    previousCursorPosition(-1),
     validator(0),
     imEditInProgress(false),
     imPosition(0),
@@ -366,7 +368,6 @@
 
     ensureCursorVisible();
 
-    smileyEngineInstance()->setDocument(doc);
     if(q->isSmileysEnabled()) {
         smileyEngineInstance()->insertSmileys();
     }
@@ -666,13 +667,13 @@
 {
     Q_Q(HbAbstractEdit);
 
-    if (cursor.hasSelection()) {   
+    if (cursor.hasSelection()) {
         selectionControl = HbSelectionControl::attachEditor(q);
         selectionControl->showHandles();
     } else if (selectionControl){
         selectionControl->hideHandles();
     }
-    
+
     QTextCursor oldSelection(selectionCursor);
     selectionCursor = cursor;
     repaintOldAndNewSelection(oldSelection);
@@ -1049,6 +1050,9 @@
 
     doc = newDoc;
     cursor = QTextCursor(doc);
+    if(smileysEnabled) {
+        smileyEngineInstance()->setDocument(doc);
+    }
 
     QObject::connect(doc, SIGNAL(contentsChanged()), q, SLOT(_q_contentsChanged()));
     QObject::connect(doc, SIGNAL(contentsChange(int, int, int)), q, SLOT(_q_contentsChange(int, int, int)));