-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 | |||
@@ -19,71 +19,78 @@ PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettin | |||
19 | 19 | ||
20 | connect( popupTimer, SIGNAL(timeout()), | 20 | connect( popupTimer, SIGNAL(timeout()), |
21 | this, SLOT(showPopup()) ); | 21 | this, SLOT(showPopup()) ); |
22 | connect( this, SIGNAL( pressed( QListViewItem* ) ), | 22 | connect( this, SIGNAL( pressed( QListViewItem* ) ), |
23 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 23 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
24 | connect( this, SIGNAL( clicked( QListViewItem* ) ), | 24 | connect( this, SIGNAL( clicked( QListViewItem* ) ), |
25 | this, SLOT( stopTimer( QListViewItem* ) ) ); | 25 | this, SLOT( stopTimer( QListViewItem* ) ) ); |
26 | 26 | ||
27 | } | 27 | } |
28 | 28 | ||
29 | //PackageListView::~PackageListView() | 29 | //PackageListView::~PackageListView() |
30 | //{ | 30 | //{ |
31 | //} | 31 | //} |
32 | 32 | ||
33 | void PackageListView::setCurrent( QListViewItem* p ) | 33 | void PackageListView::setCurrent( QListViewItem* p ) |
34 | { | 34 | { |
35 | if ( !p ) return; | 35 | if ( !p ) return; |
36 | activePackageListItem = (PackageListItem*)p; | 36 | activePackageListItem = (PackageListItem*)p; |
37 | activePackage = activePackageListItem->getPackage(); | 37 | activePackage = activePackageListItem->getPackage(); |
38 | if (!activePackage) return; | 38 | if (!activePackage) return; |
39 | popupTimer->start( 750, true ); | 39 | popupTimer->start( 750, true ); |
40 | } | 40 | } |
41 | 41 | ||
42 | 42 | ||
43 | void PackageListView::showPopup() | 43 | void PackageListView::showPopup() |
44 | { | 44 | { |
45 | popupMenu->clear(); | 45 | popupMenu->clear(); |
46 | destsMenu->clear(); | 46 | destsMenu->clear(); |
47 | 47 | ||
48 | QAction *popupAction; | 48 | QAction *popupAction; |
49 | if ( !activePackage->installed() ) | 49 | if ( !activePackage->installed() ) |
50 | { | 50 | { |
51 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); | 51 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); |
52 | QStringList dests = settings->getDestinationNames(); | 52 | QStringList dests = settings->getDestinationNames(); |
53 | QString ad = settings->getDestinationName(); | 53 | QString ad = settings->getDestinationName(); |
54 | for (uint i = 0; i < dests.count(); i++ ) | 54 | for (uint i = 0; i < dests.count(); i++ ) |
55 | { | 55 | { |
56 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | 56 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); |
57 | popupAction->addTo( destsMenu ); | 57 | popupAction->addTo( destsMenu ); |
58 | if ( dests[i] == ad && activePackage->toInstall() ) | 58 | if ( dests[i] == ad && activePackage->toInstall() ) |
59 | { | 59 | { |
60 | popupAction->setToggleAction( true ); | 60 | popupAction->setToggleAction( true ); |
61 | popupAction->setOn(true); | 61 | popupAction->setOn(true); |
62 | }; | 62 | }; |
63 | } | 63 | } |
64 | connect( destsMenu, SIGNAL( activated( int ) ), | 64 | connect( destsMenu, SIGNAL( activated( int ) ), |
65 | this, SLOT( changePackageDest( int ) ) ); | 65 | this, SLOT( changePackageDest( int ) ) ); |
66 | }else{ | 66 | }else{ |
67 | popupAction = new QAction( QObject::tr("Remove"),QString::null, 0, this, 0 ); | ||
68 | popupAction->addTo( popupMenu ); | ||
69 | connect( popupAction, SIGNAL( activated() ), | ||
70 | this , SLOT( toggleProcess() ) ); | ||
71 | popupAction = new QAction( QObject::tr("Reinstall"),QString::null, 0, this, 0 ); | ||
72 | popupAction->addTo( popupMenu ); | ||
73 | popupAction->setEnabled( false ); | ||
67 | } | 74 | } |
68 | popupMenu->popup( QCursor::pos() ); | 75 | popupMenu->popup( QCursor::pos() ); |
69 | } | 76 | } |
70 | 77 | ||
71 | void PackageListView::stopTimer( QListViewItem* ) | 78 | void PackageListView::stopTimer( QListViewItem* ) |
72 | { | 79 | { |
73 | popupTimer->stop(); | 80 | popupTimer->stop(); |
74 | } | 81 | } |
75 | 82 | ||
76 | 83 | ||
77 | void PackageListView::changePackageDest( int i ) | 84 | void PackageListView::changePackageDest( int i ) |
78 | { | 85 | { |
79 | activePackage->setDest( destsMenu->text(i) ); | 86 | activePackage->setDest( destsMenu->text(i) ); |
80 | activePackage->setOn(); | 87 | activePackage->setOn(); |
81 | activePackage->setLink( settings->createLinks() ); | 88 | activePackage->setLink( settings->createLinks() ); |
82 | activePackageListItem->displayDetails(); | 89 | activePackageListItem->displayDetails(); |
83 | } | 90 | } |
84 | 91 | ||
85 | void PackageListView::toggleProcess() | 92 | void PackageListView::toggleProcess() |
86 | { | 93 | { |
87 | activePackage->toggleProcess() ; | 94 | activePackage->toggleProcess() ; |
88 | activePackageListItem->displayDetails(); | 95 | activePackageListItem->displayDetails(); |
89 | } | 96 | } |