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, 4 insertions, 4 deletions
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp
index 1610a37..1b4812d 100644
--- a/noncore/unsupported/oipkg/packagelistitem.cpp
+++ b/noncore/unsupported/oipkg/packagelistitem.cpp
@@ -118,123 +118,123 @@ void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg,
void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg,
const QRect & r )
{
// Skip QCheckListItem
// (makes you wonder what we're getting from QCheckListItem)
QListViewItem::paintFocus(p,cg,r);
}
QPixmap PackageListItem::statePixmap() const
{
bool installed = package->installed();
bool old = package->isOld();
bool verinstalled = package->otherInstalled();
if ( !package->toProcess() ) {
if ( !installed )
if (old)
{
if (verinstalled) return *pm_uninstalled_old_installed_new;
else return *pm_uninstalled_old;
}
else
{
if (verinstalled) return *pm_uninstalled_installed_old;
else return *pm_uninstalled;
}
else
if (old) return *pm_installed_old;
else return *pm_installed;
} else { //toProcess() == true
if ( !installed )
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();
package->setLink( settings->createLinks() );
displayDetails();
}
void PackageListItem::displayDetails()
{
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.isEmpty()?QString(""):QString(" ("+sod+")");
setText(0, package->name()+sod );
nameItem->setText( 0, QObject::tr("Name: ")+package->name());
linkItem->setText( 0, QObject::tr("Link: ")+(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();
}
QPopupMenu* PackageListItem::getPopupMenu()
{
popupMenu->clear();
destsMenu->clear();
QAction *popupAction;
qDebug("PackageListItem::showPopup ");
if (!package->installed()){
popupMenu->insertItem( QObject::tr("Install to"), destsMenu );
QStringList dests = settings->getDestinationNames();
QString ad = settings->getDestinationName();
for (uint i = 0; i < dests.count(); i++ )
{
popupAction = new QAction( dests[i], QString::null, 0, popupMenu, 0 );
popupAction->addTo( destsMenu );
if ( dests[i] == ad && getPackage()->toInstall() )
{
popupAction->setToggleAction( true );
popupAction->setOn(true);
}
}
- connect( destsMenu, SIGNAL( activated( int ) ),
- this, SLOT( menuAction( int ) ) );
+ connect( destsMenu, SIGNAL( activated(int) ),
+ this, SLOT( menuAction(int) ) );
popupMenu->popup( QCursor::pos() );
}else{
popupMenu->insertItem( QObject::tr("Remove"));
- connect( popupMenu, SIGNAL( activated( int ) ),
- this, SLOT( menuAction( int ) ) );
+ connect( popupMenu, SIGNAL( activated(int) ),
+ this, SLOT( menuAction(int) ) );
popupMenu->popup( QCursor::pos() );
}
return popupMenu;
}
void PackageListItem::menuAction( int i )
{
if (!package->installed()){
package->setDest( destsMenu->text(i) );
package->setLink( settings->createLinks() );
}
package->setOn();
displayDetails();
}
//void PackageListItem::toggleProcess()
//{
// package->toggleProcess() ;
// displayDetails();
//}