author | tille <tille> | 2002-05-01 22:19:05 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-01 22:19:05 (UTC) |
commit | 89b16f3378b783be9058852528e066dcadea953d (patch) (side-by-side diff) | |
tree | a66ab1808d96f326831bbf46e36a4fd7a214e215 | |
parent | 82ff405e40d4aa6cad8b5583f9d7e5b89a78f261 (diff) | |
download | opie-89b16f3378b783be9058852528e066dcadea953d.zip opie-89b16f3378b783be9058852528e066dcadea953d.tar.gz opie-89b16f3378b783be9058852528e066dcadea953d.tar.bz2 |
added popupmenu for installed packages
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 36d081b..26b1ce7 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp @@ -1,89 +1,96 @@ #include "packagelistview.h" #include <qpopupmenu.h> #include <qaction.h> #include "packagelistitem.h" #include "pksettings.h" PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) : QListView(p,n) { settings = s; popupMenu = new QPopupMenu( this ); destsMenu = new QPopupMenu( popupMenu ); popupTimer = new QTimer( this ); setSelectionMode(QListView::NoSelection); addColumn( tr("Package") ); setRootIsDecorated( true ); connect( popupTimer, SIGNAL(timeout()), this, SLOT(showPopup()) ); connect( this, SIGNAL( pressed( QListViewItem* ) ), this, SLOT( setCurrent( QListViewItem* ) ) ); connect( this, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( stopTimer( QListViewItem* ) ) ); } //PackageListView::~PackageListView() //{ //} void PackageListView::setCurrent( QListViewItem* p ) { if ( !p ) return; activePackageListItem = (PackageListItem*)p; activePackage = activePackageListItem->getPackage(); if (!activePackage) return; popupTimer->start( 750, true ); } void PackageListView::showPopup() { popupMenu->clear(); destsMenu->clear(); QAction *popupAction; if ( !activePackage->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, this, 0 ); popupAction->addTo( destsMenu ); if ( dests[i] == ad && activePackage->toInstall() ) { popupAction->setToggleAction( true ); popupAction->setOn(true); }; } connect( destsMenu, SIGNAL( activated( int ) ), this, SLOT( changePackageDest( int ) ) ); }else{ + popupAction = new QAction( QObject::tr("Remove"),QString::null, 0, this, 0 ); + popupAction->addTo( popupMenu ); + connect( popupAction, SIGNAL( activated() ), + this , SLOT( toggleProcess() ) ); + popupAction = new QAction( QObject::tr("Reinstall"),QString::null, 0, this, 0 ); + popupAction->addTo( popupMenu ); + popupAction->setEnabled( false ); } popupMenu->popup( QCursor::pos() ); } void PackageListView::stopTimer( QListViewItem* ) { popupTimer->stop(); } void PackageListView::changePackageDest( int i ) { activePackage->setDest( destsMenu->text(i) ); activePackage->setOn(); activePackage->setLink( settings->createLinks() ); activePackageListItem->displayDetails(); } void PackageListView::toggleProcess() { activePackage->toggleProcess() ; activePackageListItem->displayDetails(); } |