summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/packagelistitem.cpp
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/oipkg/packagelistitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp
index 2f81714..45aaf1d 100644
--- a/noncore/unsupported/oipkg/packagelistitem.cpp
+++ b/noncore/unsupported/oipkg/packagelistitem.cpp
@@ -11,48 +11,49 @@ static QPixmap *pm_uninstall=0;
static QPixmap *pm_install=0;
PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s)
: QCheckListItem(lv,pi->name(),CheckBox)
{
init(pi,s);
}
PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s)
: QCheckListItem(lvi,pi->name(),CheckBox)
{
init(pi,s);
}
void PackageListItem::init( Package *pi, PackageManagerSettings *s)
{
package = pi;
settings = s;
setExpandable( true );
QCheckListItem *item;
nameItem = new QCheckListItem( this, "" );
item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() );
destItem = new QCheckListItem( this, "" );
linkItem = new QCheckListItem( this, "" );
+ statusItem = new QCheckListItem( this, "" );
QCheckListItem *otherItem = new QCheckListItem( this, QObject::tr("other") );
item = new QCheckListItem( otherItem, QObject::tr("Description: ")+pi->desc() );
QDict<QString> *fields = pi->getFields();
QDictIterator<QString> it( *fields );
while ( it.current() ) {
item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) );
++it;
}
displayDetails();
if (!pm_uninstalled)
{
pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled"));
pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed"));
pm_install = new QPixmap(Resource::loadPixmap("oipkg/install"));
pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall"));
}
}
void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg,
int column, int width, int alignment )
{
if ( !p )
return;
@@ -108,33 +109,36 @@ QPixmap PackageListItem::statePixmap() const
QString PackageListItem::key( int column, bool ascending ) const
{
if ( column == 2 ) {
QString t = text(2);
double bytes=t.toDouble();
if ( t.contains('M') ) bytes*=1024*1024;
else if ( t.contains('K') || t.contains('k') ) bytes*=1024;
if ( !ascending ) bytes=999999999-bytes;
return QString().sprintf("%09d",(int)bytes);
} else {
return QListViewItem::key(column,ascending);
}
}
void PackageListItem::setOn( bool b )
{
QCheckListItem::setOn( b );
package->toggleProcess();
package->setLink( settings->createLinks() );
displayDetails();
}
void PackageListItem::displayDetails()
{
- QString sod = " ("+package->sizeUnits();
+ QString sod;
+ sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits());
+ //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest());
sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest());
- sod += ")";
+ sod = sod.isEmpty()?QString(""):QString(" ("+sod+")");
setText(0, package->name()+sod );
nameItem->setText( 0, QObject::tr("Name: ")+package->name());
linkItem->setText( 0, QObject::tr("Link: ")+QString(package->link()?QObject::tr("Yes"):QObject::tr("No")) );
destItem->setText( 0, QObject::tr("Destination: ")+package->dest() );
+ statusItem->setText( 0, QObject::tr("Status: ")+package->status() );
repaint();
}