src/hbwidgets/dataform/hbdataformviewitem_p.cpp
changeset 3 11d3954df52a
parent 2 06ff229162e9
child 5 627c4a0fd0e7
equal deleted inserted replaced
2:06ff229162e9 3:11d3954df52a
   114     // Toggle's the text and additionalText in HbDataFormModelItem and set the corresponding text 
   114     // Toggle's the text and additionalText in HbDataFormModelItem and set the corresponding text 
   115     // as the text of HbPushButton
   115     // as the text of HbPushButton
   116     QString additionalTxt = 
   116     QString additionalTxt = 
   117         mModelItem->contentWidgetData( QString("additionalText") ).toString();
   117         mModelItem->contentWidgetData( QString("additionalText") ).toString();
   118     QString txt = mModelItem->contentWidgetData(QString("text")).toString();
   118     QString txt = mModelItem->contentWidgetData(QString("text")).toString();
       
   119     HbDataFormModelItemPrivate *modelItem_priv = HbDataFormModelItemPrivate::d_ptr(mModelItem); 
       
   120     // Dont want to emit datachanged for this property so calling private function
       
   121     modelItem_priv->setContentWidgetData( QString("additionalText"), txt );
       
   122     // will emit datachanged
   119     mModelItem->setContentWidgetData( QString("text"), additionalTxt );
   123     mModelItem->setContentWidgetData( QString("text"), additionalTxt );
   120     emit valueChanged(mViewItem->modelIndex(), additionalTxt);
   124     emit valueChanged(mViewItem->modelIndex(), additionalTxt);
   121     // HbPushButton will not be updated with Additional Text when modelChanged signal is emitted
       
   122     mModelItem->setContentWidgetData( QString("additionalText"), txt );
       
   123 }
   125 }
   124 
   126 
   125 /*  
   127 /*  
   126     HbToggleItem holds a HbLabel and an HbRadioButtonList internally and toggles these 
   128     HbToggleItem holds a HbLabel and an HbRadioButtonList internally and toggles these 
   127     widget as the contentwidget when user clicks the contentwidget area .
   129     widget as the contentwidget when user clicks the contentwidget area .
   422         // create sting to be set on button
   424         // create sting to be set on button
   423         for ( int i = 0; i < mSelectedItems.count() ; i++ ) {
   425         for ( int i = 0; i < mSelectedItems.count() ; i++ ) {
   424             int selectionindex = mSelectedItems.at( i ).toInt();
   426             int selectionindex = mSelectedItems.at( i ).toInt();
   425             if( selectionindex< mItems.count()) {
   427             if( selectionindex< mItems.count()) {
   426                 if( i > 0) {// dont add ; in the starting of the string
   428                 if( i > 0) {// dont add ; in the starting of the string
   427                     newValue.append( ";" );
   429                     newValue.append( "," );
   428                 }
   430                 }
   429                 newValue.append( mItems.at( mSelectedItems.at( i ).toInt() ) );
   431                 newValue.append( mItems.at( mSelectedItems.at( i ).toInt() ) );
   430             } 
   432             } 
   431         }
   433         }
   432         mButton->setText( newValue );
   434         mButton->setText( newValue );
   549 
   551 
   550 void HbMultiSelectionItem::launchMultiSelectionList()
   552 void HbMultiSelectionItem::launchMultiSelectionList()
   551 {
   553 {
   552     if(!mSelectionDialog ) {
   554     if(!mSelectionDialog ) {
   553         mSelectionDialog = new HbSelectionDialog();
   555         mSelectionDialog = new HbSelectionDialog();
       
   556         QObject::connect(mSelectionDialog, SIGNAL(aboutToShow()),this ,SIGNAL(aboutToShow()));
       
   557         QObject::connect(mSelectionDialog, SIGNAL(aboutToHide()),this ,SIGNAL(aboutToHide()));
       
   558         QObject::connect(mSelectionDialog, SIGNAL(aboutToClose()),this ,SIGNAL(aboutToClose()));
       
   559         QObject::connect(mSelectionDialog, SIGNAL(finished(HbAction*)),this ,SIGNAL(finished(HbAction*)));
   554         mSelectionDialog->setSelectionMode( HbAbstractItemView::MultiSelection );
   560         mSelectionDialog->setSelectionMode( HbAbstractItemView::MultiSelection );
   555         mSelectionDialog->setStringItems( mItems, -1 ); 
   561         mSelectionDialog->setStringItems( mItems, -1 ); 
   556         mSelectionDialog->setSelectedItems( mSelectedItems );
   562         mSelectionDialog->setSelectedItems( mSelectedItems );
   557         mSelectionDialog->setAttribute(Qt::WA_DeleteOnClose);
   563         mSelectionDialog->setAttribute(Qt::WA_DeleteOnClose);
   558         mSelectionDialog->open(this,SLOT(dialogClosed(HbAction*)));   
   564         mSelectionDialog->open(this,SLOT(dialogClosed(HbAction*)));   
   573         mSelectedItems.clear();
   579         mSelectedItems.clear();
   574         for( int i = 0; i < selection.count(); i++ ) {
   580         for( int i = 0; i < selection.count(); i++ ) {
   575             mSelectedItems.append(selection.at(i));
   581             mSelectedItems.append(selection.at(i));
   576             newValue.append(mSelectionDialog->stringItems().at(selection.at(i)));
   582             newValue.append(mSelectionDialog->stringItems().at(selection.at(i)));
   577             if( i != selection.count() - 1 ) {
   583             if( i != selection.count() - 1 ) {
   578                 newValue.append( ";" );
   584                 newValue.append( "," );
   579             }
   585             }
   580         }        
   586         }        
   581         mButton->setText( newValue );
   587         mButton->setText( newValue );
   582         emit valueChanged(mViewItem->modelIndex(), newValue);
   588         emit valueChanged(mViewItem->modelIndex(), newValue);
   583 
   589 
   914 }
   920 }
   915 
   921 
   916 void HbDataFormViewItemPrivate::createContentWidget()
   922 void HbDataFormViewItemPrivate::createContentWidget()
   917 {
   923 {
   918     Q_Q(HbDataFormViewItem);
   924     Q_Q(HbDataFormViewItem);
   919     
   925 
   920     QObject::connect(q, SIGNAL(itemShown(const QModelIndex&)), 
   926     QObject::connect(q, SIGNAL(itemShown(const QModelIndex&)), 
   921                 mSharedData->mItemView, SIGNAL(activated(const QModelIndex&)));
   927                 mSharedData->mItemView, SIGNAL(itemShown(const QModelIndex&)));   
   922     QObject::connect(q, SIGNAL(itemShown(const QModelIndex&)), 
   928 
   923                 mSharedData->mItemView, SIGNAL(itemShown(const QModelIndex&)));
       
   924     switch( mType ) {
   929     switch( mType ) {
   925         // following are standard data item
   930         // following are standard data item
   926         case HbDataFormModelItem::SliderItem:
   931         case HbDataFormModelItem::SliderItem:
   927         case HbDataFormModelItem::VolumeSliderItem: {
   932         case HbDataFormModelItem::VolumeSliderItem: {
   928                 mContentWidget = new HbSlider( Qt::Horizontal, q );
   933                 mContentWidget = new HbSlider( Qt::Horizontal, q );