diff -r 627c4a0fd0e7 -r c3690ec91ef8 src/hbinput/inputwidgets/hbinputcheckboxlist.cpp --- a/src/hbinput/inputwidgets/hbinputcheckboxlist.cpp Fri Jun 11 13:58:22 2010 +0300 +++ b/src/hbinput/inputwidgets/hbinputcheckboxlist.cpp Wed Jun 23 18:33:25 2010 +0300 @@ -22,14 +22,13 @@ ** Nokia at developer.feedback@nokia.com. ** ****************************************************************************/ +#include "hbinputcheckboxlist_p.h" #include #include #include #include -#include "hbinputcheckboxlist_p.h" - /// @cond class HbInputCheckBoxListPrivate @@ -44,7 +43,7 @@ Constructs checkbox list */ HbInputCheckBoxList::HbInputCheckBoxList(QGraphicsItem *parent) - : HbDataFormViewItem(parent), d_ptr(new HbInputCheckBoxListPrivate()) + : HbDataFormViewItem(parent), d_ptr(new HbInputCheckBoxListPrivate()) { } @@ -59,21 +58,21 @@ /*! Returns a new copy of this object */ -HbAbstractViewItem* HbInputCheckBoxList::createItem() +HbAbstractViewItem *HbInputCheckBoxList::createItem() { return new HbInputCheckBoxList(*this); } /*! \reimp -Returns true if \a model index is supported, otherwise returns false. +Returns true if \a index is supported, otherwise returns false. */ bool HbInputCheckBoxList::canSetModelIndex(const QModelIndex &index) const { - HbDataFormModelItem::DataItemType itemType = + HbDataFormModelItem::DataItemType itemType = static_cast(index.data(HbDataFormModelItem::ItemTypeRole).toInt()); - if(itemType == HbDataFormModelItem::CustomItemBase) { + if (itemType == HbDataFormModelItem::CustomItemBase) { return true; } else { return false; @@ -87,8 +86,8 @@ { Q_D(HbInputCheckBoxList); QModelIndex itemIndex = modelIndex(); - HbDataFormModelItem *modelItem = static_cast( - static_cast(itemView()->model())->itemFromIndex(itemIndex)); + HbDataFormModelItem *modelItem = static_cast( + static_cast(itemView()->model())->itemFromIndex(itemIndex)); QList selectedValues = modelItem->contentWidgetData(QString("selectedItems")).toList(); selectedValues.replace(index.row(), !selectedValues.at(index.row()).toBool()); @@ -100,27 +99,27 @@ } else { d->mListWidget->setCurrentIndex(viewItem->modelIndex(), QItemSelectionModel::Deselect); } - } +} /*! Creates a widget for showing checkbox list */ -HbWidget* HbInputCheckBoxList::createCustomWidget() +HbWidget *HbInputCheckBoxList::createCustomWidget() { Q_D(HbInputCheckBoxList); QModelIndex itemIndex = modelIndex(); - HbDataFormModelItem *modelItem = static_cast( - static_cast(itemView()->model())->itemFromIndex(itemIndex)); + HbDataFormModelItem *modelItem = static_cast( + static_cast(itemView()->model())->itemFromIndex(itemIndex)); d->mListWidget = new HbListWidget(); d->mListWidget->setSelectionMode(HbAbstractItemView::MultiSelection); d->mListWidget->contentWidget()->setContentsMargins(10, 10, 10, 10); d->mListWidget->setBackgroundItem(HbStyle::P_DataItem_background); d->mListWidget->setScrollDirections(0); - + QStringList items = modelItem->contentWidgetData(QString("items")).toStringList(); - foreach(QString itemName, items) { + foreach(const QString &itemName, items) { HbListWidgetItem *item = new HbListWidgetItem(); item->setData(QVariant(itemName), Qt::DisplayRole); d->mListWidget->addItem(item); @@ -139,14 +138,14 @@ connect(d->mListWidget, SIGNAL(activated(const QModelIndex &)), this, SLOT(itemActivated(const QModelIndex &))); - return d->mListWidget; + return d->mListWidget; } /*! Copy constructor for private use. */ HbInputCheckBoxList::HbInputCheckBoxList(const HbInputCheckBoxList &other) - : HbDataFormViewItem(other), d_ptr(new HbInputCheckBoxListPrivate()) + : HbDataFormViewItem(other), d_ptr(new HbInputCheckBoxListPrivate()) { }