/*!
	Returns true if the all day has been edited, false otherwise.
	\return true if the all day has been edited, false otherwise.
 */
bool CalenEditorDataHandler::isAllDayEdited() const
{
	OstTraceFunctionEntry0( CALENEDITORDATAHANDLER_ISALLDAYEDITED_ENTRY );
	HbDataFormModelItem* alldayItem = mCalenEditor->allDayCheckBoxItem();
	if (alldayItem) {
		if (CalenAgendaUtils::isAlldayEvent(*mOriginalEntry)) {
			if (alldayItem->contentWidgetData("checkState")
			        == Qt::Checked) {
				OstTraceFunctionExit0( CALENEDITORDATAHANDLER_ISALLDAYEDITED_EXIT );
				return false;
			} else {
				OstTraceFunctionExit0( DUP1_CALENEDITORDATAHANDLER_ISALLDAYEDITED_EXIT );
				return true;
			}
		} else if (mOriginalEntry->type() == AgendaEntry::TypeAppoinment) {
			if (alldayItem->contentWidgetData("checkState")
			        == Qt::Checked) {
				OstTraceFunctionExit0( DUP2_CALENEDITORDATAHANDLER_ISALLDAYEDITED_EXIT );
				return true;
			} else {
				OstTraceFunctionExit0( DUP3_CALENEDITORDATAHANDLER_ISALLDAYEDITED_EXIT );
				return false;
			}
		}
	}
	OstTraceFunctionExit0( DUP4_CALENEDITORDATAHANDLER_ISALLDAYEDITED_EXIT );
	return false;
}
// ---------------------------------------------------------------------------
// PosSettingsPushButtonItem:::restore
// ---------------------------------------------------------------------------
//
void PosSettingsPushButtonItem::restore()
{
    HbDataFormViewItem::restore();
    if (mWidget) {
        HbDataFormModelItem::DataItemType itemType = static_cast<HbDataFormModelItem::DataItemType>(
            modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt());

        if(itemType == PushButtonItem) {

            QModelIndex itemIndex = modelIndex();
            HbDataFormModel *model = static_cast<HbDataFormModel*>(itemView()->model());;
            HbDataFormModelItem *modelItem = static_cast<HbDataFormModelItem*>(
                model->itemFromIndex(itemIndex));

            const QMetaObject *metaObj = mWidget->metaObject();
            int count = metaObj->propertyCount();
            for (int i = 0; i < count; i++) {
                QMetaProperty metaProperty = metaObj->property(i);
                if (metaProperty.isValid() && metaProperty.isWritable()) {
                    metaProperty.write(mWidget,modelItem->contentWidgetData(metaProperty.name()));
                }
          }
      }
  }
}
Пример #3
0
void CpCertTrustView::saveTrustSettings()
	{
	RDEBUG("0", 0);
	CCTCertInfo& entry = *( mCertDataContainer.iCALabelEntries[ mCertificateIndex ]->iCAEntry );
	if ( entry.IsDeletable() )
		{
		TInt itemCount = mFormModel->rowCount();
		RArray<TUid> newUids;
		QT_TRAP_THROWING
			(	
			CleanupClosePushL( newUids );
			
			for(int index = 0;index<itemCount;++index)
				{
				HbDataFormModelItem *item = mFormModel->item(index);
				QString trustValue = item->contentWidgetData("text").toString();
				if(trustValue == "On")
					{
					newUids.Append(trusterId(mTrustedClients[index]));
					}
				}
			if(newUids.Count() > 0 )
				{
				mCertDataContainer.iWrapper->SetApplicabilityL( mCertDataContainer.CertManager(), entry, newUids );
				}
			CleanupStack::PopAndDestroy(&newUids);
			)
		}
void HgWidgetOptionsView::storeWidgetSize()
{
    QSettings settings(SETT_ORGANIZATION, SETT_APPLICATION);

    HbDataFormModelItem *item = item = mModel->itemFromIndex(mModel->index(ItemWidgetHeight, 0));
    if (item) {
        int value = item->contentWidgetData(QString("text")).toInt();
        settings.setValue(SETT_WIDGET_HEIGHT, value);
    }
    item = mModel->itemFromIndex(mModel->index(ItemWidgetWidth, 0));
    if (item) {
        int value = item->contentWidgetData(QString("text")).toInt();
        settings.setValue(SETT_WIDGET_WIDTH, value);
    }

    mUpdateWidgetSize = false;
}
/*!
  CpDivertPluginGroup::itemShown.
 */
void CpDivertPluginGroup::itemShown(const QModelIndex& item)
{
    DPRINT << ": IN";
    DPRINT << "item:" << item;
    
    HbDataFormModelItem* modelItem = 
        qobject_cast<const HbDataFormModel*>(item.model())->itemFromIndex(item);
    if (!isDivertSettingsItem(modelItem)) {
        return;
    }
    
    bool isInitialStatusQueryDoneForItem = 
        modelItem->contentWidgetData("text").isValid();
    if (!isInitialStatusQueryDoneForItem) {
        CpDivertItemData *pitem = static_cast<CpDivertItemData*>(modelItem); 
        if (qvariant_cast<PsCallDivertingCondition>(pitem->property("condition")) !=
                DivertConditionAllConditionalCases) {
            addToDivertingRequestQueue(CheckDivertStatus, *pitem);
        }
    }
    
    DPRINT << ": OUT";
}
void HgWidgetOptionsView::updateData(QModelIndex startIn, QModelIndex endIn)
{
    Q_UNUSED(endIn);

    if (!mContentReady) return;

    QSettings settings(SETT_ORGANIZATION, SETT_APPLICATION);

    HbDataFormModelItem *item = mModel->itemFromIndex(startIn);
    if( !item ) return;
    
    if (item->data(HbDataFormModelItem::LabelRole).toString() == WIDGET_TYPE) {
        int index = item->contentWidgetData(QString("currentIndex")).toInt();
        HgTestWidgetType type = HgWidgetNone;
        switch (index) {
            case 0:
                type = HgWidgetGrid;
                break;
            case 1:
                type = HgWidgetCoverflow;
                break;
            case 2:
                type = HgWidgetTBone;
                break;
            default: break;
        }

        setCoverflowEnabled(index == 1 || index  == 2);
        settings.setValue(SETT_WIDGET_TYPE, type);
        emit widgetTypeChanged(type);
    }
    else if (item->data(HbDataFormModelItem::LabelRole).toString() == SCROLLBAR_VISIBILITY) {
        int index = item->contentWidgetData(QString("currentIndex")).toInt();
        HgWidget::ScrollBarPolicy visibility = HgWidget::ScrollBarAutoHide;
        switch (index) {
            case 0:
                visibility = HgWidget::ScrollBarAutoHide;
                break;
            case 1:
                visibility = HgWidget::ScrollBarAlwaysOn;
                break;
            case 2:
                visibility = HgWidget::ScrollBarAlwaysOff;
                break;
            default: break;
        }

        settings.setValue(SETT_SCROLLBAR_VISIBILITY, visibility);
        emit scrollBarVisibilityChanged(visibility);
    }
    else if (item->data(HbDataFormModelItem::LabelRole).toString() == INTERACTIVE_SCROLLBAR) {
        QVariant data = item->contentWidgetData(QString("text"));
        bool value = data.toString() == "yes";
        settings.setValue(SETT_SCROLLBAR_INTERACTIVITY, value);
        if (value) {
            item = mModel->itemFromIndex(mModel->index(ItemScrollBarVisibility, 0));
            if (item) {
                item->setContentWidgetData(QString("currentIndex"), 1); // Set scroll bar always on
            }
        }
        emit scrollBarInteractivityChanged(value);
    }
    else if (item->data(HbDataFormModelItem::LabelRole).toString() == MODEL_IMAGE_TYPE) {
        int index = item->contentWidgetData(QString("currentIndex")).toInt();
        HgTestImageType type = ImageTypeNone;
        switch (index) {
            case 0:
                type = ImageTypeQImage;
                break;
            case 1:
                type = ImageTypeHbIcon;
                break;
            case 2:
                type = ImageTypeQIcon;
                break;
            case 3:
                type = ImageTypeQPixmap;
                break;
            default: break;
        }

        settings.setValue(SETT_MODEL_IMAGE_TYPE, type);
        emit imageTypeChanged(type);
    }
    else if (item->data(HbDataFormModelItem::LabelRole).toString() == WIDGET_HEIGHT) {
        emit widgetHeightChanged(item->contentWidgetData(QString("text")).toInt());
        storeWidgetSize();
    }
    else if (item->data(HbDataFormModelItem::LabelRole).toString() == WIDGET_WIDTH) {
        emit widgetWidthChanged(item->contentWidgetData(QString("text")).toInt());
        storeWidgetSize();

    }
    else if (item->data(HbDataFormModelItem::LabelRole).toString() == LOW_RES_IMAGES) {
        QVariant data = item->contentWidgetData(QString("text"));
        bool value = data.toString() == "yes";
        settings.setValue(SETT_LOW_RES_IMAGES, value);
        emit lowResImageUseChanged(value);
    }
    else if (item->data(HbDataFormModelItem::LabelRole).toString() == TITLE_FONT) {
        int index = item->contentWidgetData(QString("currentIndex")).toInt();
        HbFontSpec::Role role = HbFontSpec::Undefined;
        switch (index) {
            case 0:
                role = HbFontSpec::Primary;
                break;
            case 1:
                role = HbFontSpec::Secondary;
                break;
            case 2:
                role = HbFontSpec::Title;
                break;
            case 3:
                role = HbFontSpec::PrimarySmall;
                break;
            case 4:
                role = HbFontSpec::Digital;
                break;
            default: break;
        }
        settings.setValue(SETT_TITLE_FONT, role);
        emit titleFontChanged(HbFontSpec(role));
    }
    else if (item->data(HbDataFormModelItem::LabelRole).toString() == DESCRIPTION_FONT) {
        int index = item->contentWidgetData(QString("currentIndex")).toInt();
        HbFontSpec::Role role = HbFontSpec::Undefined;
        switch (index) {
            case 0:
                role = HbFontSpec::Primary;
                break;
            case 1:
                role = HbFontSpec::Secondary;
                break;
            case 2:
                role = HbFontSpec::Title;
                break;
            case 3:
                role = HbFontSpec::PrimarySmall;
                break;
            case 4:
                role = HbFontSpec::Digital;
                break;
            default: break;
        }
        settings.setValue(SETT_DESCRIPTION_FONT, role);
        emit descriptionFontChanged(HbFontSpec(role));
    }
    else if (item->data(HbDataFormModelItem::LabelRole).toString() == REFLECTIONS_ENABLED) {
        QVariant data = item->contentWidgetData(QString("text"));
        bool value = data.toString() == "yes";
        settings.setValue(SETT_REFLECTIONS_ENABLED, value);
        emit reflectionsEnabledChanged(value);
    }
    else if (item->data(HbDataFormModelItem::LabelRole).toString() == EFFECT3D_ENABLED) {
        QVariant data = item->contentWidgetData(QString("text"));
        bool value = data.toString() == "yes";
        settings.setValue(SETT_EFFECT3D_ENABLED, value);
        emit effect3dEnabledChanged(value);
    }
    else if (item->data(HbDataFormModelItem::LabelRole).toString() == ITEM_SIZE_POLICY) {
        QVariant data = item->contentWidgetData(QString("text"));
        HgWidget::ItemSizePolicy value = (data.toString() == "Automatic" ? HgWidget::ItemSizeAutomatic : HgWidget::ItemSizeUserDefined);
        settings.setValue(SETT_ITEM_SIZE_POLICY, value);
        emit itemSizePolicyChanged(value);
    }
}