src/hbwidgets/dataform/hbdataformviewitem.cpp
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 3 11d3954df52a
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
    25 
    25 
    26 
    26 
    27 #include <hbdataformviewitem.h>
    27 #include <hbdataformviewitem.h>
    28 #include <hbstyleoptiondataformviewitem.h>
    28 #include <hbstyleoptiondataformviewitem_p.h>
    29 
    29 
    30 #include "hbdataformmodelitem_p.h"
    30 #include "hbdataformmodelitem_p.h"
    31 #include "hbdataformviewitem_p.h"
    31 #include "hbdataformviewitem_p.h"
    32 #include "hbdataform_p.h"
    32 #include "hbdataform_p.h"
    33 #include "hbdatagroup_p.h"
    33 #include "hbdatagroup_p.h"
   131 
   131 
   132     \endcode
   132     \endcode
   133 
   133 
   134     The signals emitted by this class are:
   134     The signals emitted by this class are:
   135     \li itemShown(const QModelIndex&) This signal is emitted when ever this item becomes visible.
   135     \li itemShown(const QModelIndex&) This signal is emitted when ever this item becomes visible.
   136     \deprecated HbDataFormViewItem::itemDestroyed(QPersistentModelIndex)
   136     
   137         This signal is deprecated.
       
   138 
       
   139     \deprecated HbDataFormViewItem::itemModified(QPersistentModelIndex, QVariant)
       
   140         This signal is deprecated . Use dataChanged(QModelIndex,QModelIndex) signal of model instead 
       
   141         and fetch the new value from corresponding modelItem.
       
   142 
       
   143     Refer HbDataForm documentation for sample code.
   137     Refer HbDataForm documentation for sample code.
   144 
   138 
   145     \sa HbDataForm, HbDataFormModel, HbDataFormModelItem
   139     \sa HbDataForm, HbDataFormModel, HbDataFormModelItem
   146 */
   140 */
   147 
       
   148 /*!
       
   149     \deprecated HbDataFormViewItem::StateKey
       
   150         is deprecated. Please use string based state keys.
       
   151 
       
   152     \enum HbDataFormViewItem::StateKey
       
   153 
       
   154     HbDataFormViewItem's user defined state keys.
       
   155 
       
   156     \sa HbAbstractViewItem::transientState()
       
   157 */
       
   158 
       
   159 /*!
       
   160     \deprecated HbDataFormViewItem::ExpansionKey
       
   161         is deprecated. Please use string based state keys. This key is replaced by "expanded".
       
   162 
       
   163     \var HbDataFormViewItem::ExpansionKey
       
   164     Predefined key for expansion/collapsion state of a view item. Default state is collapsed.
       
   165 */
       
   166 
       
   167 
   141 
   168 /*!
   142 /*!
   169     Constructs HbDataFormViewItem with given \a parent.
   143     Constructs HbDataFormViewItem with given \a parent.
   170     \param parent parent .
   144     \param parent parent .
   171  */
   145  */
   258 #ifdef HB_EFFECTS
   232 #ifdef HB_EFFECTS
   259     //HbEffectInternal::add( HB_DATAFORMVIEWITEM_TYPE,"dataform_expand", "expanded" );
   233     //HbEffectInternal::add( HB_DATAFORMVIEWITEM_TYPE,"dataform_expand", "expanded" );
   260     //HbEffect::start( settingItem, HB_DATAFORMVIEWITEM_TYPE, "expanded" );  
   234     //HbEffect::start( settingItem, HB_DATAFORMVIEWITEM_TYPE, "expanded" );  
   261 #endif
   235 #endif
   262 
   236 
   263     load( );
   237     restore( );
   264 
   238 
   265     // Establish Signal Connections set in HbDataFormModel to th contentWidget of this item
   239     // Establish Signal Connections set in HbDataFormModel to th contentWidget of this item
   266     HbDataFormPrivate::d_ptr(
   240     HbDataFormPrivate::d_ptr(
   267         static_cast<HbDataForm*>(d->mSharedData->mItemView))->makeConnection(
   241         static_cast<HbDataForm*>(d->mSharedData->mItemView))->makeConnection(
   268         d->mIndex.operator const QModelIndex & ());
   242         d->mIndex.operator const QModelIndex & ());
   297 {
   271 {
   298     Q_D(HbDataFormViewItem);
   272     Q_D(HbDataFormViewItem);
   299     *d = *source.d_func();
   273     *d = *source.d_func();
   300     setProperty( "hasIcon", false );
   274     setProperty( "hasIcon", false );
   301     return *this;
   275     return *this;
   302 }
       
   303 
       
   304 /*!
       
   305     \deprecated HbDataFormViewItem::load()
       
   306         is deprecated. Please use HbDataFormViewItem::restore() instead.
       
   307 
       
   308     Loads the data from the central repository and assign to the widget.
       
   309     The property for loading and storing the data need to be initialized when the 
       
   310     DataItem is created.
       
   311 
       
   312     \sa store restore
       
   313 */
       
   314 void HbDataFormViewItem::load()
       
   315 {
       
   316     restore();
       
   317 }
       
   318 
       
   319 /*!
       
   320     \deprecated HbDataFormViewItem::store()
       
   321         is deprecated. Please use HbDataFormViewItem::save() instead.
       
   322 
       
   323     Store the current data to the central repository .
       
   324     The property for loading and storing the data need to be initialized when the 
       
   325     DataItem is created 
       
   326 
       
   327     \sa load save
       
   328 */
       
   329 void HbDataFormViewItem::store()
       
   330 {
       
   331     save();
       
   332 }
   276 }
   333 
   277 
   334 /*!
   278 /*!
   335     @alpha
   279     @alpha
   336     Restores the data from the model and assign to the widget.
   280     Restores the data from the model and assign to the widget.
   401 
   345 
   402             disconnect( d->mModel, SIGNAL( dataChanged( QModelIndex,QModelIndex ) ),
   346             disconnect( d->mModel, SIGNAL( dataChanged( QModelIndex,QModelIndex ) ),
   403                 d->mSharedData->mItemView, SLOT( dataChanged( QModelIndex,QModelIndex ) ) );
   347                 d->mSharedData->mItemView, SLOT( dataChanged( QModelIndex,QModelIndex ) ) );
   404 
   348 
   405             d->mModelItem->setContentWidgetData(
   349             d->mModelItem->setContentWidgetData(
   406                 d->mProperty, d->mContentWidget->property(d->mProperty.toAscii( ).data( ) ) );
   350                 d->mProperty, d->mContentWidget->property(d->mProperty.toAscii( ).data( ) ) );            
   407             emit itemModified(d->mIndex, d->mContentWidget->property(d->mProperty.toAscii( ).data( )));
       
   408 
   351 
   409             connect( d->mModel, SIGNAL( dataChanged( QModelIndex,QModelIndex ) ),
   352             connect( d->mModel, SIGNAL( dataChanged( QModelIndex,QModelIndex ) ),
   410                 d->mSharedData->mItemView, SLOT( dataChanged( QModelIndex,QModelIndex ) ) );
   353                 d->mSharedData->mItemView, SLOT( dataChanged( QModelIndex,QModelIndex ) ) );
   411         }
   354         }
   412     }
   355     }
   461     } 
   404     } 
   462     return false;
   405     return false;
   463 }
   406 }
   464 
   407 
   465 /*!
   408 /*!
   466      \deprecated HbDataFormViewItem::state() 
       
   467         is deprecated. 
       
   468     
       
   469     \reimp
       
   470 */
       
   471 QMap<int,QVariant> HbDataFormViewItem::state() const
       
   472 {
       
   473     return HbAbstractViewItem::state();
       
   474 }
       
   475 
       
   476 /*!
       
   477     \deprecated HbDataFormViewItem::setState(const QMap<int, QVariant>&)
       
   478         is deprecated. 
       
   479 
       
   480     \reimp
       
   481 */
       
   482 void HbDataFormViewItem::setState(const QMap<int,QVariant> &state)
       
   483 {
       
   484     HbAbstractViewItem::setState(state);
       
   485 }
       
   486 
       
   487 /*!
       
   488     \deprecated  HbDataFormViewItem::contentWidget() const
       
   489         is deprecated. Use dataItemContentWidget() instead
       
   490 
       
   491     Return the content widget of HbDataFormViewItem.    
       
   492     \sa dataItemContentWidget
       
   493 */
       
   494 HbWidget* HbDataFormViewItem::contentWidget()const
       
   495 {
       
   496     return 0;
       
   497 }
       
   498 /*!
       
   499     This API is valid only if HbDataFormViewItem represents a data item. Returns the 
   409     This API is valid only if HbDataFormViewItem represents a data item. Returns the 
   500     content widget of data item. For example if data item is of type SliderItem then
   410     content widget of data item. For example if data item is of type SliderItem then
   501     this API will return the instance of HbSlider. 
   411     this API will return the instance of HbSlider. 
   502     If user wants to connect to some signals of content widget in data item then this 
   412     If user wants to connect to some signals of content widget in data item then this 
   503     API can be used to fetch the instance of the widget. It will return the instance only
   413     API can be used to fetch the instance of the widget. It will return the instance only