mediasettings/videosettingsplugin/src/videosettingsaccesspointentry.cpp
changeset 67 72c709219fcd
parent 40 13331705e488
--- a/mediasettings/videosettingsplugin/src/videosettingsaccesspointentry.cpp	Tue Oct 05 09:26:49 2010 +0300
+++ b/mediasettings/videosettingsplugin/src/videosettingsaccesspointentry.cpp	Fri Oct 15 16:29:10 2010 +0300
@@ -11,7 +11,10 @@
  *
  * Contributors:
  *
- * Description:
+ * Description: This class is HbDataFormModelItem::ToggleValueItem type item which is
+ *              used to launch access point selection dialog. Toggle functionality is
+ *              not used. This class type is used just because it offers correct look
+ *              and offers data modify capabilities.
  *
  */
 
@@ -27,21 +30,22 @@
 // ---------------------------------------------------------------------------
 //
 VideoSettingsAccessPointEntry::VideoSettingsAccessPointEntry(
-    CpItemDataHelper &itemDataHelper,
-    const QString& text,
-    VideoSettingsGroup *parent) :
-    CpSettingFormEntryItemData(CpSettingFormEntryItemData::ButtonEntryItem, 
-        itemDataHelper, text, QString(), QString(), parent),
-    mParent(parent)
+        CpItemDataHelper &itemDataHelper,
+        const QString& labelText,
+        VideoSettingsGroup *parent) :
+CpSettingFormItemData(HbDataFormModelItem::ToggleValueItem, labelText, parent),
+mParent(parent)
 {
     MPX_ENTER_EXIT(_L("VideoSettingsAccessPointEntry::VideoSettingsAccessPointEntry()"));
-    
-    itemDataHelper.addConnection(this,SIGNAL(clicked()),this,SLOT(openSelectionDialogSlot()));
+
+    itemDataHelper.addConnection(this, SIGNAL(valueChanged(QPersistentModelIndex, QVariant)),
+            this, SLOT(openSelectionDialogSlot()));
+
     mApplSettings = new CmApplSettingsUi(this);
     connect(mApplSettings, SIGNAL(finished(uint)), this, SLOT(accessPointDialogFinished(uint)));
     mSelection.result = CmApplSettingsUi::SelectionTypeConnectionMethod;
     mSelection.id = 0;
-    mCmManager = new CmManagerShim();
+    mCmManager = new CmManagerShim();    
 }
 
 // ---------------------------------------------------------------------------
@@ -82,23 +86,16 @@
     
     if(!found)
     {
-        this->setDescription(hbTrId("txt_videos_dblist_none"));
+        QString name(hbTrId("txt_videos_dblist_none"));
+        
+        // Our widget is "toggle type", so we have to store data to both fields
+        // to keep it show the same value, no matter how user toggless it.
+        setContentWidgetData("text", QVariant(name));
+        setContentWidgetData("additionalText", QVariant(name));        
     }
 }
 
 // ---------------------------------------------------------------------------
-// createSettingView
-// ---------------------------------------------------------------------------
-//
-CpBaseSettingView* VideoSettingsAccessPointEntry::createSettingView() const
-{
-    MPX_ENTER_EXIT(_L("VideoSettingsAccessPointEntry::createSettingView()"));
-    
-    // does not create a new view.
-    return 0;
-}
-
-// ---------------------------------------------------------------------------
 // getConnectionMethod
 // ---------------------------------------------------------------------------
 //
@@ -126,7 +123,11 @@
     MPX_ENTER_EXIT(_L("VideoSettingsAccessPointEntry::setAccessPointName()"));
     
     QString name = connMethod->getStringAttribute(CMManagerShim::CmName);
-    this->setDescription(name);
+    
+    // Our widget is "toggle type", so we have to store data to both fields
+    // to keep it show the same value, no matter how user toggless it.
+    setContentWidgetData("text", QVariant(name));
+    setContentWidgetData("additionalText", QVariant(name));
 }
 
 // ---------------------------------------------------------------------------