summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/packagelistview.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/oipkg/packagelistview.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp91
1 files changed, 28 insertions, 63 deletions
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp
index 0d6fa80..3c7435d 100644
--- a/noncore/unsupported/oipkg/packagelistview.cpp
+++ b/noncore/unsupported/oipkg/packagelistview.cpp
@@ -14,2 +14,3 @@
14 14
15#include "listviewitemoipkg.h"
15#include "packagelistitem.h" 16#include "packagelistitem.h"
@@ -21,4 +22,2 @@ PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettin
21 settings = s; 22 settings = s;
22 popupMenu = new QPopupMenu( this );
23 destsMenu = new QPopupMenu( popupMenu );
24 popupTimer = new QTimer( this ); 23 popupTimer = new QTimer( this );
@@ -43,18 +42,24 @@ void PackageListView::setCurrent( QListViewItem* p )
43{ 42{
44 if ( !p ) return; 43 qDebug("PackageListView::setCurrent ");
45 activePackageListItem = (PackageListItem*)p; 44 activeItem = (ListViewItemOipkg*)p;
46 activePackage = activePackageListItem->getPackage(); 45
47 if (!activePackage) 46 if ( activeItem != 0 ) popupTimer->start( 750, true );
48 { 47
49 // QDictIterator<QCheckListItem> it( rootItems ); 48// if ( activeItem->getType() != ListViewItemOipkg::Package ){
50 // while ( it.current() ) 49// qDebug("PackageListView::setCurrent !p ");
50// activePackage = 0;
51 // activePackageListItem = 0;
52// qDebug("PackageListView::setCurrent returning ");
53// return;
54// };
55// activePackageListItem = (PackageListItem*)p;
56// activePackage = activePackageListItem->getPackage();
57// if (activePackage == 0 )
51// { 58// {
52 // if ( it.current()==p ) 59// qDebug("PackageListView::setCurrent if (!activePackage)");
53 // pvDebug(2,"current item"); 60// return;
54 // ++it;
55 // } 61 // }
56 62
57 return; 63
58 } 64 qDebug("PackageListView::setCurrent popupTimer->start");
59 popupTimer->start( 750, true );
60} 65}
@@ -64,33 +69,7 @@ void PackageListView::showPopup()
64{ 69{
65 popupMenu->clear(); 70 qDebug("PackageListView::showPopup");
66 destsMenu->clear(); 71 QPopupMenu *popup = activeItem->getPopupMenu();
67 72 if (popup == 0) return;
68 QAction *popupAction; 73 popup->popup( QCursor::pos() );
69 if ( !activePackage->installed() ) 74 qDebug("PackageListView::showPopup");
70 {
71 popupMenu->insertItem( tr("Install to"), destsMenu );
72 QStringList dests = settings->getDestinationNames();
73 QString ad = settings->getDestinationName();
74 for (uint i = 0; i < dests.count(); i++ )
75 {
76 popupAction = new QAction( dests[i], QString::null, 0, this, 0 );
77 popupAction->addTo( destsMenu );
78 if ( dests[i] == ad && activePackage->toInstall() )
79 {
80 popupAction->setToggleAction( true );
81 popupAction->setOn(true);
82 };
83 }
84 connect( destsMenu, SIGNAL( activated( int ) ),
85 this, SLOT( changePackageDest( int ) ) );
86 }else{
87 popupAction = new QAction( tr("Remove"),QString::null, 0, this, 0 );
88 popupAction->addTo( popupMenu );
89 connect( popupAction, SIGNAL( activated() ),
90 this , SLOT( toggleProcess() ) );
91 popupAction = new QAction( tr("Reinstall"),QString::null, 0, this, 0 );
92 popupAction->addTo( popupMenu );
93 popupAction->setEnabled( false );
94 }
95 popupMenu->popup( QCursor::pos() );
96} 75}
@@ -103,16 +82,2 @@ void PackageListView::stopTimer( QListViewItem* )
103 82
104void PackageListView::changePackageDest( int i )
105{
106 activePackage->setDest( destsMenu->text(i) );
107 activePackage->setOn();
108 activePackage->setLink( settings->createLinks() );
109 activePackageListItem->displayDetails();
110}
111
112void PackageListView::toggleProcess()
113{
114 activePackage->toggleProcess() ;
115 activePackageListItem->displayDetails();
116}
117
118void PackageListView::display() 83void PackageListView::display()
@@ -121,5 +86,5 @@ void PackageListView::display()
121 PackageList *packlist; 86 PackageList *packlist;
122 Package *pack; 87 OipkgPackage *pack;
123 PackageListItem *item; 88 PackageListItem *item;
124 QCheckListItem *rootItem; 89 ListViewItemOipkg *rootItem;
125 QListViewItem* it; 90 QListViewItem* it;
@@ -150,3 +115,3 @@ void PackageListView::addList( QString n, PackageList* pl)
150 PackageLists.insert(n, pl); 115 PackageLists.insert(n, pl);
151 QCheckListItem *item = new QCheckListItem(this,n); 116 ListViewItemOipkg *item = new ListViewItemOipkg(this,n,ListViewItemOipkg::Feed);
152 rootItems.insert(n, item); 117 rootItems.insert(n, item);