cmmanager/cpdestinationplugin/src/cpiapitem.cpp
changeset 29 1f1fcd7e941c
parent 28 860702281757
child 30 8dde790cab74
--- a/cmmanager/cpdestinationplugin/src/cpiapitem.cpp	Thu May 13 23:10:21 2010 +0300
+++ b/cmmanager/cpdestinationplugin/src/cpiapitem.cpp	Thu May 13 23:17:48 2010 +0300
@@ -76,7 +76,8 @@
     int destId,
     bool apProtected,
     CpBearerApPluginInterface *bearerPlugin) :
-    CpSettingFormEntryItemData(itemDataHelper), 
+    CpSettingFormEntryItemData(CpSettingFormEntryItemData::ButtonEntryItem, itemDataHelper), 
+    mItemDataHelper(&itemDataHelper),
     mIapId(iapId), 
     mIapName(iapName),
     mDestId(destId),
@@ -233,10 +234,7 @@
         deleteSuccessful = false;
     }
     if (deleteSuccessful) {
-        HbDataForm *form = static_cast<HbDataForm*>(QObject::parent()->parent());
-        QModelIndex index = static_cast<HbDataFormModel*>(QObject::parent())->indexFromItem(this);
-        HbAbstractViewItem *viewItem = form->itemByIndex(index);
-        viewItem->deleteLater();
+        this->deleteLater();
         OstTrace0(TRACE_NORMAL, CPIAPITEM_DELETECONFIRMED, "CpIapItem::deleteConfirmed: Emit access point changed signal");
         emit iapChanged();
     } else {
@@ -261,12 +259,12 @@
     }
     // Disconnect because we need to do this only after returning
     // from accees point settings view
-    HbDataForm *form = static_cast<HbDataForm*>(QObject::parent()->parent());
-    disconnect(
-        form, 
+    CpItemDataHelper *itemDataHelper = new CpItemDataHelper();
+    itemDataHelper->disconnectFromForm( 
         SIGNAL(itemShown(const QModelIndex)),
         this, 
         SLOT(updateIap(const QModelIndex)));
+    delete itemDataHelper;
     OstTrace0( TRACE_FLOW, DUP1_CPIAPITEM_UPDATEIAP_EXIT, "CpIapItem::updateIap exit" );
 }
 
@@ -279,16 +277,16 @@
 {
     OstTraceFunctionEntry0(CPIAPITEM_CREATESETTINGVIEW_ENTRY);
     CpBaseSettingView *view = NULL;
+    CpItemDataHelper *itemDataHelper = new CpItemDataHelper();
     if (mBearerPlugin != NULL) {
-        HbDataForm *form = static_cast<HbDataForm*>(QObject::parent()->parent()); 
-        bool connected = connect(
-            form, 
+        CpIapItem *iap = const_cast<CpIapItem*>(this);
+        itemDataHelper->connectToForm( 
             SIGNAL(itemShown(const QModelIndex)),
-            this, 
+            iap, 
             SLOT(updateIap(const QModelIndex)));
-        Q_ASSERT(connected);
         view = mBearerPlugin->createSettingView(mIapId);
     }
+    delete itemDataHelper;
     OstTraceFunctionExit0(CPIAPITEM_CREATESETTINGVIEW_EXIT);
     return view;
 }