diff -r 2d2d25361590 -r d1838696558c iaupdate/IAD/ui/src/iaupdateapplistitem.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/iaupdate/IAD/ui/src/iaupdateapplistitem.cpp Thu Oct 14 14:11:30 2010 +0300 @@ -0,0 +1,109 @@ +/* +* 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: This module contains the implementation of IAUpdateAppListItem +* class member functions. +* +*/ +#include + +#include "iaupdateapplistitem.h" +#include "iaupdateapplistmodel.h" +#include "iaupdatedebug.h" + +IAUpdateAppListItem::IAUpdateAppListItem(QGraphicsItem * parent) : + HbListViewItem(parent) +{ + mProgressBar = NULL; + mIsProgress = false; + mSecondaryTextVisible = true; +} + +IAUpdateAppListItem::~IAUpdateAppListItem() +{ +} + +HbAbstractViewItem * IAUpdateAppListItem::createItem() +{ + return new IAUpdateAppListItem(*this); +} + + +void IAUpdateAppListItem::updateChildItems() +{ + HbListViewItem::updateChildItems(); + + mIsProgress = modelIndex().data(IAUpdateAppListModel::ProgressRole).toBool(); + if (mIsProgress) + { // progress state + if (mSecondaryTextVisible) + { + foreach (QGraphicsItem * item, childItems()) + { + if (HbStyle::itemName(item) == "text-2") + { + item->setVisible(false); + mSecondaryTextVisible = false; + break; + } + } + } + if (!mProgressBar) + { + mProgressBar = new HbProgressBar(this); + mProgressBar->setRange(0, 100); + HbStyle::setItemName(mProgressBar, "progress"); + } + if (!mProgressBar->isVisible()) + { + HbStyle::setItemName(mProgressBar, "progress"); + mProgressBar->setVisible(true); + } + QList list = modelIndex().data(IAUpdateAppListModel::ProgressValueRole).toList(); + int value = list.at(0).toInt(); + int total = list.at(1).toInt(); + mProgressBar->setRange(0,total); + mProgressBar->setProgressValue(value); + } + else + { //normal state + if (mProgressBar) + { + if (mProgressBar->isVisible()) + { + HbStyle::setItemName(mProgressBar, ""); + mProgressBar->setVisible(false); + } + if (!mSecondaryTextVisible) + { + foreach (QGraphicsItem * item, childItems()) + { + if (HbStyle::itemName(item) == "text-2") + { + item->setVisible(true); + mSecondaryTextVisible = true; + break; + } + } + } + } + } +} + + +void IAUpdateAppListItem::polish(HbStyleParameters& params) +{ + HbListViewItem::setProperty("progress", mIsProgress); + HbListViewItem::polish(params); +} +