Diffstat (limited to 'noncore/unsupported/oipkg/packagelistitem.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.cpp | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 149ba35..0c7c928 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp @@ -1,72 +1,57 @@ #include "packagelistitem.h" #include <qpe/resource.h> #include <qobject.h> #include "debug.h" static QPixmap *pm_uninstalled=0; static QPixmap *pm_installed=0; static QPixmap *pm_uninstall=0; static QPixmap *pm_install=0; PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) : QCheckListItem(lv,pi->name(),CheckBox) { package = pi; settings = s; setExpandable( true ); QCheckListItem *item; -#ifndef NEWLAYOUT - item = new QCheckListItem( this, QObject::tr("Name") ); - item->setText(1,pi->name()); - item = new QCheckListItem( this, QObject::tr("Description") ); - item->setText(1,pi->desc()+"\ntest multi\nline"); - item = new QCheckListItem( this, QObject::tr("Size") ); - item->setText(1,pi->size()); - item = new QCheckListItem( this, QObject::tr("Destination") ); - item->setText(1,pi->getDest()); -#endif -#ifdef NEWLAYOUT - item = new QCheckListItem( this, QObject::tr("Name: ")+pi->name() ); + nameItem = new QCheckListItem( this, "" ); item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); destItem = new QCheckListItem( this, "" ); linkItem = new QCheckListItem( this, "" ); displayDetails(); -#endif - if (!pm_uninstalled) { + 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")); } -#ifndef NEWLAYOUT - setText(1, package->shortDesc() ); - setText(2, package->size() ); -#endif } void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, int column, int width, int alignment ) { if ( !p ) return; p->fillRect( 0, 0, width, height(), isSelected()? cg.highlight() : cg.base() ); if ( column != 0 ) { // The rest is text QListViewItem::paintCell( p, cg, column, width, alignment ); return; } QListView *lv = listView(); if ( !lv ) return; int marg = lv->itemMargin(); int r = marg; QPixmap pm = statePixmap(); @@ -99,41 +84,39 @@ QPixmap PackageListItem::statePixmap() const return *pm_install; else return *pm_uninstall; } } 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(); -// if ( b ) -// { -// if ((package->dest()).isEmpty) -// package->setDest( settings->getDestinationName() ); -// }else{ -// package->setDest( QObject::tr("not installed")); -// } package->setLink( settings->createLinks() ); displayDetails(); } void PackageListItem::displayDetails() { + QString sod = " ("+package->sizeUnits(); + sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); + 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() ); repaint(); } |