354 mDialog->setTimeout(HbPopup::NoTimeout); |
354 mDialog->setTimeout(HbPopup::NoTimeout); |
355 mDialog->setAttribute(Qt::WA_DeleteOnClose); |
355 mDialog->setAttribute(Qt::WA_DeleteOnClose); |
356 mDialog->setDismissPolicy(HbPopup::NoDismiss); |
356 mDialog->setDismissPolicy(HbPopup::NoDismiss); |
357 mDialog->setModal(true); |
357 mDialog->setModal(true); |
358 mDialog->setContentWidget(mRadioButtonList); |
358 mDialog->setContentWidget(mRadioButtonList); |
359 HbAction *ok = new HbAction(QString("Ok")); |
359 HbAction *ok = new HbAction(hbTrId("txt_common_button_ok"), mDialog); |
360 mDialog->addAction(ok); |
360 mDialog->addAction(ok); |
361 HbAction *cancel = new HbAction(QString("Cancel")); |
361 HbAction *cancel = new HbAction(hbTrId("txt_common_button_cancel"), mDialog); |
362 connect(ok, SIGNAL(triggered()), mDialog,SLOT(accept())); |
362 connect(ok, SIGNAL(triggered()), mDialog,SLOT(accept())); |
363 mDialog->addAction(cancel); |
363 mDialog->addAction(cancel); |
364 mDialog->connect(cancel, SIGNAL(triggered()), mDialog, SLOT(reject())); |
364 mDialog->connect(cancel, SIGNAL(triggered()), mDialog, SLOT(reject())); |
365 mRadioButtonList->setSelected(mSelected); |
365 mRadioButtonList->setSelected(mSelected); |
366 mDialog->open(this,SLOT(dialogClosed(int))); |
366 mDialog->open(this,SLOT(dialogClosed(int))); |
369 |
369 |
370 |
370 |
371 void HbRadioItem::updateModel( int index ) |
371 void HbRadioItem::updateModel( int index ) |
372 { |
372 { |
373 mSelected = index; |
373 mSelected = index; |
374 if( index > -1 && mItems.count() < index ) { |
374 if( index > -1 && mItems.count() > index ) { |
375 emit valueChanged(mViewItem->modelIndex(), mItems.at(index)); |
375 emit valueChanged(mViewItem->modelIndex(), mItems.at(index)); |
376 } |
376 } |
377 // Disconnect modelchanged signal since visualization is already updated by user |
377 // Disconnect modelchanged signal since visualization is already updated by user |
378 // so if not disconnected , this will trigger visualization change again |
378 // so if not disconnected , this will trigger visualization change again |
379 disconnect( mModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), |
379 disconnect( mModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), |
380 HbDataFormViewItemPrivate::d_ptr(mViewItem)->mSharedData->mItemView, |
380 HbDataFormViewItemPrivate::d_ptr(mViewItem)->mSharedData->mItemView, |
705 void HbDataFormViewItemPrivate::createPrimitives() |
705 void HbDataFormViewItemPrivate::createPrimitives() |
706 { |
706 { |
707 Q_Q( HbDataFormViewItem ); |
707 Q_Q( HbDataFormViewItem ); |
708 |
708 |
709 if( !mBackgroundItem ) { |
709 if( !mBackgroundItem ) { |
710 mBackgroundItem = q->style()->createPrimitive( HbStyle::P_DataItem_background, q ); |
710 mBackgroundItem = HbStylePrivate::createPrimitive( HbStylePrivate::P_DataItem_background, q ); |
711 } |
711 } |
712 |
712 |
713 |
713 |
714 if( !mLabel.isEmpty() ) { |
714 if( !mLabel.isEmpty() ) { |
715 if( !mLabelItem ) { |
715 if( !mLabelItem ) { |
716 mLabelItem = q->style()->createPrimitive( HbStyle::P_DataItem_label, q ); |
716 mLabelItem = HbStylePrivate::createPrimitive( HbStylePrivate::P_DataItem_label, q ); |
717 } |
717 } |
718 } else { |
718 } else { |
719 if( mLabelItem ) { |
719 if( mLabelItem ) { |
720 HbStyle::setItemName( mLabelItem, NULL ); |
720 HbStyle::setItemName( mLabelItem, NULL ); |
721 delete mLabelItem; |
721 delete mLabelItem; |
725 } |
725 } |
726 |
726 |
727 if( !mIcon.isEmpty() ) { |
727 if( !mIcon.isEmpty() ) { |
728 q->setProperty( "hasIcon", true ); |
728 q->setProperty( "hasIcon", true ); |
729 if(!mIconItem) { |
729 if(!mIconItem) { |
730 mIconItem = q->style()->createPrimitive( HbStyle::P_DataItem_icon, q ); |
730 mIconItem = HbStylePrivate::createPrimitive( HbStylePrivate::P_DataItem_icon, q ); |
731 } |
731 } |
732 } else { |
732 } else { |
733 q->setProperty( "hasIcon", false ); |
733 q->setProperty( "hasIcon", false ); |
734 if( mIconItem ) { |
734 if( mIconItem ) { |
735 HbStyle::setItemName( mIconItem, NULL ); |
735 HbStyle::setItemName( mIconItem, NULL ); |
738 } |
738 } |
739 } |
739 } |
740 |
740 |
741 if(!mDescription.isEmpty()) { |
741 if(!mDescription.isEmpty()) { |
742 if(!mDescriptionItem) { |
742 if(!mDescriptionItem) { |
743 mDescriptionItem = q->style()->createPrimitive(HbStyle::P_DataItem_description, q); |
743 mDescriptionItem = HbStylePrivate::createPrimitive(HbStylePrivate::P_DataItem_description, q); |
744 } |
744 } |
745 } else { |
745 } else { |
746 if( mDescriptionItem ) { |
746 if( mDescriptionItem ) { |
747 HbStyle::setItemName( mDescriptionItem, NULL ); |
747 HbStyle::setItemName( mDescriptionItem, NULL ); |
748 delete mDescriptionItem; |
748 delete mDescriptionItem; |
793 |
798 |
794 HbStyleOptionDataFormViewItem options; |
799 HbStyleOptionDataFormViewItem options; |
795 q->initStyleOption(&options); |
800 q->initStyleOption(&options); |
796 |
801 |
797 if( mBackgroundItem ) { |
802 if( mBackgroundItem ) { |
798 q->style()->updatePrimitive( |
803 HbStylePrivate::updatePrimitive( |
799 mBackgroundItem, HbStyle::P_DataItem_background, &options ); |
804 mBackgroundItem, HbStylePrivate::P_DataItem_background, &options ); |
800 } |
805 } |
801 |
806 |
802 if( mLabelItem ) { |
807 if( mLabelItem ) { |
803 q->style()->updatePrimitive( mLabelItem, HbStyle::P_DataItem_label, &options ); |
808 HbStylePrivate::updatePrimitive( mLabelItem, HbStylePrivate::P_DataItem_label, &options ); |
804 } |
809 } |
805 |
810 |
806 if( mIconItem ) { |
811 if( mIconItem ) { |
807 q->style()->updatePrimitive( |
812 HbStylePrivate::updatePrimitive( |
808 mIconItem, HbStyle::P_DataItem_icon, &options ); |
813 mIconItem, HbStylePrivate::P_DataItem_icon, &options ); |
809 } |
814 } |
810 |
815 |
811 if(mDescriptionItem) { |
816 if(mDescriptionItem) { |
812 q->style()->updatePrimitive(mDescriptionItem, HbStyle::P_DataItem_description, &options); |
817 HbStylePrivate::updatePrimitive(mDescriptionItem, HbStylePrivate::P_DataItem_description, &options); |
813 } |
818 } |
814 } |
819 } |
815 |
820 |
816 /* |
821 /* |
817 Sets the label/ heading for the setting item . If no label set the label widget |
822 Sets the label/ heading for the setting item . If no label set the label widget |
895 } |
900 } |
896 |
901 |
897 void HbDataFormViewItemPrivate::setEnabled(bool enabled) |
902 void HbDataFormViewItemPrivate::setEnabled(bool enabled) |
898 { |
903 { |
899 Q_Q(HbDataFormViewItem); |
904 Q_Q(HbDataFormViewItem); |
900 |
905 Q_UNUSED(enabled); |
901 QGraphicsItem::GraphicsItemFlags itemFlags = q->flags(); |
906 QGraphicsItem::GraphicsItemFlags itemFlags = q->flags(); |
902 Qt::ItemFlags indexFlags = mIndex.flags(); |
907 Qt::ItemFlags indexFlags = mIndex.flags(); |
903 |
908 |
904 if (indexFlags & Qt::ItemIsEnabled) { |
909 if (indexFlags & Qt::ItemIsEnabled) { |
905 if (!(itemFlags & QGraphicsItem::ItemIsFocusable)) { |
910 if (!(itemFlags & QGraphicsItem::ItemIsFocusable)) { |
918 q->ungrabGesture(Qt::TapGesture); |
923 q->ungrabGesture(Qt::TapGesture); |
919 } |
924 } |
920 } |
925 } |
921 |
926 |
922 if( mContentWidget ) { |
927 if( mContentWidget ) { |
923 mContentWidget->setEnabled(enabled); |
928 //mContentWidget->setEnabled(enabled); |
924 //If slider is disabled then still panning should be possible. |
929 //If slider is disabled then still panning should be possible. |
925 if( ( mType == HbDataFormModelItem::SliderItem ) || |
930 if( ( mType == HbDataFormModelItem::SliderItem ) || |
926 ( mType == HbDataFormModelItem::VolumeSliderItem ) ) { |
931 ( mType == HbDataFormModelItem::VolumeSliderItem ) ) { |
927 HbSlider *slider = static_cast<HbSlider*>( mContentWidget ); |
932 HbSlider *slider = static_cast<HbSlider*>( mContentWidget ); |
928 if( enabled ) { |
933 if( slider && slider->isEnabled() ) { |
929 //grab pan gesture |
934 //grab pan gesture |
930 slider->primitive(HbStyle::P_SliderElement_touchgroove)->toGraphicsObject()->grabGesture( |
935 slider->primitive((HbStyle::Primitive)HbStylePrivate::P_SliderElement_touchgroove)->toGraphicsObject()->grabGesture( |
931 Qt::PanGesture); |
936 Qt::PanGesture); |
932 } else { |
937 } else { |
933 //ungrab pan gesture |
938 //ungrab pan gesture |
934 slider->primitive(HbStyle::P_SliderElement_touchgroove)->toGraphicsObject()->ungrabGesture( |
939 slider->primitive((HbStyle::Primitive)HbStylePrivate::P_SliderElement_touchgroove)->toGraphicsObject()->ungrabGesture( |
935 Qt::PanGesture); |
940 Qt::PanGesture); |
936 } |
941 } |
937 } |
942 } |
938 } |
943 } |
939 } |
944 } |
1060 |
1065 |
1061 //update only the background primitive |
1066 //update only the background primitive |
1062 HbStyleOptionDataFormViewItem options; |
1067 HbStyleOptionDataFormViewItem options; |
1063 q->initStyleOption(&options); |
1068 q->initStyleOption(&options); |
1064 if( mBackgroundItem ) { |
1069 if( mBackgroundItem ) { |
1065 q->style()->updatePrimitive( |
1070 HbStylePrivate::updatePrimitive( |
1066 mBackgroundItem, HbStyle::P_DataItem_background, &options ); |
1071 mBackgroundItem, HbStylePrivate::P_DataItem_background, &options ); |
1067 } |
1072 } |
1068 |
1073 |
1069 //if ( mContentWidget ) { |
1074 //if ( mContentWidget ) { |
1070 // QEvent polishEvent( QEvent::Polish ); |
1075 // QEvent polishEvent( QEvent::Polish ); |
1071 // QCoreApplication::sendEvent( mContentWidget, &polishEvent ); |
1076 // QCoreApplication::sendEvent( mContentWidget, &polishEvent ); |