src/hbwidgets/editors/hbselectioncontrol_p.cpp
changeset 5 627c4a0fd0e7
parent 2 06ff229162e9
child 6 c3690ec91ef8
--- a/src/hbwidgets/editors/hbselectioncontrol_p.cpp	Thu May 27 13:10:59 2010 +0300
+++ b/src/hbwidgets/editors/hbselectioncontrol_p.cpp	Fri Jun 11 13:58:22 2010 +0300
@@ -91,6 +91,7 @@
     void panGestureFinished (HbPanGesture *gesture);
     void show();
     void _q_aboutToChangeView();
+    void detachEditor(bool updateAtthachedEditorState);
 
 public:
 
@@ -466,6 +467,21 @@
     }
 }
 
+void HbSelectionControlPrivate::detachEditor(bool updateAtthachedEditorState)
+{
+    Q_Q(HbSelectionControl);
+    if (mEdit) {
+        q->hideHandles();
+        reparentHandles(q);
+        if (updateAtthachedEditorState) {
+            mEdit->disconnect(q);
+            mEdit->d_func()->selectionControl = 0;
+            mEdit->deselect();
+        }
+        mEdit = 0;
+        mTopLevelAncestor = 0;
+    }
+}
 
 HbSelectionControl::HbSelectionControl() : HbWidget(*new HbSelectionControlPrivate(),0)
 
@@ -510,17 +526,14 @@
 void HbSelectionControl::detachEditor()
 {
     Q_D(HbSelectionControl);
-    if (d->mEdit) {
-        hideHandles();
-        d->reparentHandles(this);
-        d->mEdit->disconnect(this);
-        d->mEdit->d_func()->selectionControl = 0;        
-        d->mEdit->deselect();
-        d->mEdit = 0;
-        d->mTopLevelAncestor = 0;
-    }
+    d->detachEditor(true);
 }
 
+void HbSelectionControl::detachEditorFromDestructor()
+{
+    Q_D(HbSelectionControl);
+    d->detachEditor(false);
+}
 
 void HbSelectionControl::hideHandles()
 {