diff -r 6e38e48ee756 -r a9afc3a8dbfa deviceupdatesui/deviceupdates/src/customviewitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deviceupdatesui/deviceupdates/src/customviewitem.cpp Thu Aug 19 17:35:23 2010 +0530 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2010 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: Custom list item implementation. + * + */ + +#include +#include +#include "customviewitem.h" +#include "dmadvancedview.h" + +CustomViewItem::CustomViewItem(DmAdvancedView* serversview, + QGraphicsItem * parent) : + HbListViewItem(parent), mButton(0), callBackView(serversview) + { + } + +CustomViewItem::~CustomViewItem() + { + } + +HbAbstractViewItem * CustomViewItem::createItem() + { + return new CustomViewItem(*this); + } + +void CustomViewItem::updateChildItems() + { + int itemType(modelIndex().data(Hb::ItemTypeRole).toInt()); + if ( itemType == CustomViewItem::ItemType ) + { + if ( mButton == 0 ) + { + QGraphicsLinearLayout * layout = new QGraphicsLinearLayout(); + mButton = new HbPushButton(this); + + mButton->setText(hbTrId( + "txt_device_update_button_new_server_profile")); + connect(mButton, SIGNAL(clicked()), callBackView, SLOT( + createNewProfile())); + layout->addItem(mButton); + layout->setContentsMargins(leftMargin, topAndBottomMargin, + rightMargin, topAndBottomMargin); + setStretchingStyle(HbListViewItem::StretchLandscape); + setLayout(layout); + } + } + else + { + HbListViewItem::updateChildItems(); + setStretchingStyle(HbListViewItem::StretchLandscape); + } + } + +bool CustomViewItem::canSetModelIndex(const QModelIndex &index) + { + Q_UNUSED(index); + return true; + } + +int CustomViewItem::type() const + { + return CustomViewItem::ItemType; + } +