diff -r bab96b7ed1a4 -r f39ed5e045e0 phonesettings/cpphonesettingsplugins/divertplugin/src/cpdivertselectionitem.cpp --- a/phonesettings/cpphonesettingsplugins/divertplugin/src/cpdivertselectionitem.cpp Tue Jun 15 14:14:38 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * - */ -#include "cpdivertselectionitem.h" -#include "cpdivertselectioncustomitem.h" -#include -#include -#include -#include - - - -CpDivertSelectionItem::CpDivertSelectionItem(QGraphicsItem *parent ) -: HbDataFormViewItem(parent) -{ - DPRINT; -} - -CpDivertSelectionItem::~CpDivertSelectionItem() -{ - DPRINT; -} - -HbAbstractViewItem* CpDivertSelectionItem::createItem() -{ - DPRINT; - return new CpDivertSelectionItem(*this); -} - -bool CpDivertSelectionItem::canSetModelIndex(const QModelIndex &index) const -{ - DPRINT << "index:" << index; - int type = index.data(HbDataFormModelItem::ItemTypeRole).toInt(); - return type == CpDivertSelectionItemId; -} - -HbWidget *CpDivertSelectionItem::createCustomWidget() -{ - DPRINT << ": IN"; - - int type = modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt(); - - if (type == CpDivertSelectionItemId) { - CpDivertSelectionCustomitem *retWidget = - new CpDivertSelectionCustomitem(this); - - DPRINT << ": OUT, retWidget"; - return retWidget; - } - DPRINT << ": OUT, 0"; - return 0; -} - - -void CpDivertSelectionItem::restore() -{ - HbDataFormViewItem::restore(); - - if (dataItemContentWidget()) { - HbDataFormModelItem::DataItemType itemType = static_cast( - modelIndex().data(HbDataFormModelItem::ItemTypeRole).toInt()); - - if (CpDivertSelectionItemId == itemType) { - - QModelIndex itemIndex = modelIndex(); - HbDataFormModel *model = static_cast(itemView()->model()); - HbDataFormModelItem *modelItem = static_cast( - model->itemFromIndex(itemIndex)); - - const QMetaObject *metaObj = dataItemContentWidget()->metaObject(); - int count = metaObj->propertyCount(); - for (int i = 0; i < count; i++) { - QMetaProperty metaProperty = metaObj->property(i); - if (metaProperty.isValid() && metaProperty.isWritable()) { - metaProperty.write( - dataItemContentWidget(), - modelItem->contentWidgetData(metaProperty.name())); - } - } - } - } - -}