Diffstat (limited to 'noncore/unsupported/oipkg/packagelistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.cpp | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 2915ac6..610a0e1 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp | |||
@@ -1,107 +1,90 @@ | |||
1 | /*************************************************************************** | ||
2 | packagelistview.cpp - description | ||
3 | ------------------- | ||
4 | begin : Sat Apr 27 2002 | ||
5 | copyright : (C) 2002 by tille | ||
6 | email : tille@handhelds.org | ||
7 | ***************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | |||
18 | #include "packagelistview.h" | 1 | #include "packagelistview.h" |
19 | 2 | ||
20 | #include <qpopupmenu.h> | 3 | #include <qpopupmenu.h> |
21 | #include <qaction.h> | 4 | #include <qaction.h> |
22 | 5 | ||
23 | #include "packagelistitem.h" | 6 | #include "packagelistitem.h" |
24 | #include "pksettings.h" | 7 | #include "pksettings.h" |
25 | 8 | ||
26 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) | 9 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) |
27 | : QListView(p,n) | 10 | : QListView(p,n) |
28 | { | 11 | { |
29 | settings = s; | 12 | settings = s; |
30 | popupMenu = new QPopupMenu( this ); | 13 | popupMenu = new QPopupMenu( this ); |
31 | destsMenu = new QPopupMenu( popupMenu ); | 14 | destsMenu = new QPopupMenu( popupMenu ); |
32 | popupTimer = new QTimer( this ); | 15 | popupTimer = new QTimer( this ); |
33 | setSelectionMode(QListView::NoSelection); | 16 | setSelectionMode(QListView::NoSelection); |
34 | addColumn( tr("Package") ); | 17 | addColumn( tr("Package") ); |
35 | setRootIsDecorated( true ); | 18 | setRootIsDecorated( true ); |
36 | 19 | ||
37 | connect( popupTimer, SIGNAL(timeout()), | 20 | connect( popupTimer, SIGNAL(timeout()), |
38 | this, SLOT(showPopup()) ); | 21 | this, SLOT(showPopup()) ); |
39 | connect( this, SIGNAL( pressed( QListViewItem* ) ), | 22 | connect( this, SIGNAL( pressed( QListViewItem* ) ), |
40 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 23 | this, SLOT( setCurrent( QListViewItem* ) ) ); |
41 | connect( this, SIGNAL( clicked( QListViewItem* ) ), | 24 | connect( this, SIGNAL( clicked( QListViewItem* ) ), |
42 | this, SLOT( stopTimer( QListViewItem* ) ) ); | 25 | this, SLOT( stopTimer( QListViewItem* ) ) ); |
43 | 26 | ||
44 | } | 27 | } |
45 | 28 | ||
46 | //PackageListView::~PackageListView() | 29 | //PackageListView::~PackageListView() |
47 | //{ | 30 | //{ |
48 | //} | 31 | //} |
49 | 32 | ||
50 | void PackageListView::setCurrent( QListViewItem* p ) | 33 | void PackageListView::setCurrent( QListViewItem* p ) |
51 | { | 34 | { |
52 | if ( !p ) return; | 35 | if ( !p ) return; |
53 | activePackageListItem = (PackageListItem*)p; | 36 | activePackageListItem = (PackageListItem*)p; |
54 | activePackage = activePackageListItem->getPackage(); | 37 | activePackage = activePackageListItem->getPackage(); |
55 | if (!activePackage) return; | 38 | if (!activePackage) return; |
56 | popupTimer->start( 750, true ); | 39 | popupTimer->start( 750, true ); |
57 | } | 40 | } |
58 | 41 | ||
59 | 42 | ||
60 | void PackageListView::showPopup() | 43 | void PackageListView::showPopup() |
61 | { | 44 | { |
62 | popupMenu->clear(); | 45 | popupMenu->clear(); |
63 | destsMenu->clear(); | 46 | destsMenu->clear(); |
64 | 47 | ||
65 | QAction *popupAction; | 48 | QAction *popupAction; |
66 | if ( !activePackage->installed() ) | 49 | if ( !activePackage->installed() ) |
67 | { | 50 | { |
68 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); | 51 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); |
69 | QStringList dests = settings->getDestinationNames(); | 52 | QStringList dests = settings->getDestinationNames(); |
70 | QString ad = settings->getDestinationName(); | 53 | QString ad = settings->getDestinationName(); |
71 | for (uint i = 0; i < dests.count(); i++ ) | 54 | for (uint i = 0; i < dests.count(); i++ ) |
72 | { | 55 | { |
73 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | 56 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); |
74 | popupAction->addTo( destsMenu ); | 57 | popupAction->addTo( destsMenu ); |
75 | if ( dests[i] == ad && activePackage->toInstall() ) | 58 | if ( dests[i] == ad && activePackage->toInstall() ) |
76 | { | 59 | { |
77 | popupAction->setToggleAction( true ); | 60 | popupAction->setToggleAction( true ); |
78 | popupAction->setOn(true); | 61 | popupAction->setOn(true); |
79 | }; | 62 | }; |
80 | } | 63 | } |
81 | connect( destsMenu, SIGNAL( activated( int ) ), | 64 | connect( destsMenu, SIGNAL( activated( int ) ), |
82 | this, SLOT( changePackageDest( int ) ) ); | 65 | this, SLOT( changePackageDest( int ) ) ); |
83 | }else{ | 66 | }else{ |
84 | // popupActcat setOn( activePackage->toProcess() ); | 67 | // popupActcat setOn( activePackage->toProcess() ); |
85 | } | 68 | } |
86 | popupMenu->popup( QCursor::pos() ); | 69 | popupMenu->popup( QCursor::pos() ); |
87 | } | 70 | } |
88 | 71 | ||
89 | void PackageListView::stopTimer( QListViewItem* ) | 72 | void PackageListView::stopTimer( QListViewItem* ) |
90 | { | 73 | { |
91 | popupTimer->stop(); | 74 | popupTimer->stop(); |
92 | } | 75 | } |
93 | 76 | ||
94 | 77 | ||
95 | void PackageListView::changePackageDest( int i ) | 78 | void PackageListView::changePackageDest( int i ) |
96 | { | 79 | { |
97 | activePackage->setDest( destsMenu->text(i) ); | 80 | activePackage->setDest( destsMenu->text(i) ); |
98 | activePackage->setOn(); | 81 | activePackage->setOn(); |
99 | activePackage->setLink( settings->createLinks() ); | 82 | activePackage->setLink( settings->createLinks() ); |
100 | activePackageListItem->displayDetails(); | 83 | activePackageListItem->displayDetails(); |
101 | } | 84 | } |
102 | 85 | ||
103 | void PackageListView::toggleProcess() | 86 | void PackageListView::toggleProcess() |
104 | { | 87 | { |
105 | activePackage->toggleProcess() ; | 88 | activePackage->toggleProcess() ; |
106 | activePackageListItem->displayDetails(); | 89 | activePackageListItem->displayDetails(); |
107 | } | 90 | } |