Diffstat (limited to 'noncore/unsupported/oipkg/packagelistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp index 3c7435d..98ebf88 100644 --- a/noncore/unsupported/oipkg/packagelistview.cpp +++ b/noncore/unsupported/oipkg/packagelistview.cpp | |||
@@ -1,118 +1,118 @@ | |||
1 | /*************************************************************************** | 1 | /*************************************************************************** |
2 | * * | 2 | * * |
3 | * This program is free software; you can redistribute it and/or modify * | 3 | * This program is free software; you can redistribute it and/or modify * |
4 | * it under the terms of the GNU General Public License as published by * | 4 | * it under the terms of the GNU General Public License as published by * |
5 | * the Free Software Foundation; either version 2 of the License, or * | 5 | * the Free Software Foundation; either version 2 of the License, or * |
6 | * (at your option) any later version. * | 6 | * (at your option) any later version. * |
7 | * * | 7 | * * |
8 | ***************************************************************************/ | 8 | ***************************************************************************/ |
9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> | 9 | // (c) 2002 Patrick S. Vogt <tille@handhelds.org> |
10 | #include "packagelistview.h" | 10 | #include "packagelistview.h" |
11 | 11 | ||
12 | #include <qpopupmenu.h> | 12 | #include <qpopupmenu.h> |
13 | #include <qaction.h> | 13 | #include <qaction.h> |
14 | 14 | ||
15 | #include "listviewitemoipkg.h" | 15 | #include "listviewitemoipkg.h" |
16 | #include "packagelistitem.h" | 16 | #include "packagelistitem.h" |
17 | #include "pksettings.h" | 17 | #include "pksettings.h" |
18 | 18 | ||
19 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) | 19 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) |
20 | : QListView(p,n) | 20 | : QListView(p,n) |
21 | { | 21 | { |
22 | settings = s; | 22 | settings = s; |
23 | popupTimer = new QTimer( this ); | 23 | popupTimer = new QTimer( this ); |
24 | setSelectionMode(QListView::NoSelection); | 24 | setSelectionMode(QListView::NoSelection); |
25 | addColumn( tr("Package") ); | 25 | addColumn( tr("Package") ); |
26 | setRootIsDecorated( true ); | 26 | setRootIsDecorated( true ); |
27 | 27 | ||
28 | connect( popupTimer, SIGNAL(timeout()), | 28 | connect( popupTimer, SIGNAL(timeout()), |
29 | this, SLOT(showPopup()) ); | 29 | this, SLOT(showPopup()) ); |
30 | connect( this, SIGNAL( pressed( QListViewItem* ) ), | 30 | connect( this, SIGNAL( pressed(QListViewItem*) ), |
31 | this, SLOT( setCurrent( QListViewItem* ) ) ); | 31 | this, SLOT( setCurrent(QListViewItem*) ) ); |
32 | connect( this, SIGNAL( clicked( QListViewItem* ) ), | 32 | connect( this, SIGNAL( clicked(QListViewItem*) ), |
33 | this, SLOT( stopTimer( QListViewItem* ) ) ); | 33 | this, SLOT( stopTimer(QListViewItem*) ) ); |
34 | 34 | ||
35 | } | 35 | } |
36 | 36 | ||
37 | //PackageListView::~PackageListView() | 37 | //PackageListView::~PackageListView() |
38 | //{ | 38 | //{ |
39 | //} | 39 | //} |
40 | 40 | ||
41 | void PackageListView::setCurrent( QListViewItem* p ) | 41 | void PackageListView::setCurrent( QListViewItem* p ) |
42 | { | 42 | { |
43 | qDebug("PackageListView::setCurrent "); | 43 | qDebug("PackageListView::setCurrent "); |
44 | activeItem = (ListViewItemOipkg*)p; | 44 | activeItem = (ListViewItemOipkg*)p; |
45 | 45 | ||
46 | if ( activeItem != 0 ) popupTimer->start( 750, true ); | 46 | if ( activeItem != 0 ) popupTimer->start( 750, true ); |
47 | 47 | ||
48 | // if ( activeItem->getType() != ListViewItemOipkg::Package ){ | 48 | // if ( activeItem->getType() != ListViewItemOipkg::Package ){ |
49 | // qDebug("PackageListView::setCurrent !p "); | 49 | // qDebug("PackageListView::setCurrent !p "); |
50 | // activePackage = 0; | 50 | // activePackage = 0; |
51 | // activePackageListItem = 0; | 51 | // activePackageListItem = 0; |
52 | // qDebug("PackageListView::setCurrent returning "); | 52 | // qDebug("PackageListView::setCurrent returning "); |
53 | // return; | 53 | // return; |
54 | // }; | 54 | // }; |
55 | // activePackageListItem = (PackageListItem*)p; | 55 | // activePackageListItem = (PackageListItem*)p; |
56 | // activePackage = activePackageListItem->getPackage(); | 56 | // activePackage = activePackageListItem->getPackage(); |
57 | // if (activePackage == 0 ) | 57 | // if (activePackage == 0 ) |
58 | // { | 58 | // { |
59 | // qDebug("PackageListView::setCurrent if (!activePackage)"); | 59 | // qDebug("PackageListView::setCurrent if (!activePackage)"); |
60 | // return; | 60 | // return; |
61 | // } | 61 | // } |
62 | 62 | ||
63 | 63 | ||
64 | qDebug("PackageListView::setCurrent popupTimer->start"); | 64 | qDebug("PackageListView::setCurrent popupTimer->start"); |
65 | } | 65 | } |
66 | 66 | ||
67 | 67 | ||
68 | void PackageListView::showPopup() | 68 | void PackageListView::showPopup() |
69 | { | 69 | { |
70 | qDebug("PackageListView::showPopup"); | 70 | qDebug("PackageListView::showPopup"); |
71 | QPopupMenu *popup = activeItem->getPopupMenu(); | 71 | QPopupMenu *popup = activeItem->getPopupMenu(); |
72 | if (popup == 0) return; | 72 | if (popup == 0) return; |
73 | popup->popup( QCursor::pos() ); | 73 | popup->popup( QCursor::pos() ); |
74 | qDebug("PackageListView::showPopup"); | 74 | qDebug("PackageListView::showPopup"); |
75 | } | 75 | } |
76 | 76 | ||
77 | void PackageListView::stopTimer( QListViewItem* ) | 77 | void PackageListView::stopTimer( QListViewItem* ) |
78 | { | 78 | { |
79 | popupTimer->stop(); | 79 | popupTimer->stop(); |
80 | } | 80 | } |
81 | 81 | ||
82 | 82 | ||
83 | void PackageListView::display() | 83 | void PackageListView::display() |
84 | { | 84 | { |
85 | QDictIterator<PackageList> list( PackageLists ); | 85 | QDictIterator<PackageList> list( PackageLists ); |
86 | PackageList *packlist; | 86 | PackageList *packlist; |
87 | OipkgPackage *pack; | 87 | OipkgPackage *pack; |
88 | PackageListItem *item; | 88 | PackageListItem *item; |
89 | ListViewItemOipkg *rootItem; | 89 | ListViewItemOipkg *rootItem; |
90 | QListViewItem* it; | 90 | QListViewItem* it; |
91 | QListViewItem* itdel; | 91 | QListViewItem* itdel; |
92 | while ( list.current() ) { | 92 | while ( list.current() ) { |
93 | packlist = list.current(); | 93 | packlist = list.current(); |
94 | rootItem = rootItems.find( list.currentKey() ); | 94 | rootItem = rootItems.find( list.currentKey() ); |
95 | //rootItem->clear(); | 95 | //rootItem->clear(); |
96 | it=rootItem->firstChild(); | 96 | it=rootItem->firstChild(); |
97 | while ( it ) | 97 | while ( it ) |
98 | { | 98 | { |
99 | itdel = it; | 99 | itdel = it; |
100 | it = it->nextSibling(); | 100 | it = it->nextSibling(); |
101 | delete itdel; | 101 | delete itdel; |
102 | } | 102 | } |
103 | pack = packlist->first(); | 103 | pack = packlist->first(); |
104 | while( pack ) | 104 | while( pack ) |
105 | { | 105 | { |
106 | item = new PackageListItem( rootItem, pack, settings ); | 106 | item = new PackageListItem( rootItem, pack, settings ); |
107 | pack = packlist->next(); | 107 | pack = packlist->next(); |
108 | } | 108 | } |
109 | ++list; | 109 | ++list; |
110 | } | 110 | } |
111 | } | 111 | } |
112 | 112 | ||
113 | void PackageListView::addList( QString n, PackageList* pl) | 113 | void PackageListView::addList( QString n, PackageList* pl) |
114 | { | 114 | { |
115 | PackageLists.insert(n, pl); | 115 | PackageLists.insert(n, pl); |
116 | ListViewItemOipkg *item = new ListViewItemOipkg(this,n,ListViewItemOipkg::Feed); | 116 | ListViewItemOipkg *item = new ListViewItemOipkg(this,n,ListViewItemOipkg::Feed); |
117 | rootItems.insert(n, item); | 117 | rootItems.insert(n, item); |
118 | } | 118 | } |