author | tille <tille> | 2002-04-27 21:02:53 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-27 21:02:53 (UTC) |
commit | 69e271e44d23befc74a96a98708ddb6ec754a4b6 (patch) (unidiff) | |
tree | 6f8300d8858d2c7659eb90066b58b302a2863e43 /noncore/unsupported/oipkg/packagelistview.cpp | |
parent | acdc33336307e48ac7089b146006fe7b36e321a5 (diff) | |
download | opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.zip opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.tar.gz opie-69e271e44d23befc74a96a98708ddb6ec754a4b6.tar.bz2 |
setDocument working and some changes in install gui
Diffstat (limited to 'noncore/unsupported/oipkg/packagelistview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.cpp | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/noncore/unsupported/oipkg/packagelistview.cpp b/noncore/unsupported/oipkg/packagelistview.cpp new file mode 100644 index 0000000..693ea6a --- a/dev/null +++ b/noncore/unsupported/oipkg/packagelistview.cpp | |||
@@ -0,0 +1,91 @@ | |||
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" | ||
19 | |||
20 | #include <qpopupmenu.h> | ||
21 | #include <qaction.h> | ||
22 | |||
23 | #include "packagelistitem.h" | ||
24 | #include "pksettings.h" | ||
25 | |||
26 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) | ||
27 | : QListView(p,n) | ||
28 | { | ||
29 | settings = s; | ||
30 | popupMenu = new QPopupMenu( this ); | ||
31 | destsMenu = new QPopupMenu( popupMenu ); | ||
32 | popupTimer = new QTimer( this ); | ||
33 | setSelectionMode(QListView::NoSelection); | ||
34 | addColumn( tr("Package") ); | ||
35 | setRootIsDecorated( true ); | ||
36 | |||
37 | connect( popupTimer, SIGNAL(timeout()), | ||
38 | this, SLOT(showPopup()) ); | ||
39 | connect( this, SIGNAL( pressed( QListViewItem* ) ), | ||
40 | this, SLOT( setCurrent( QListViewItem* ) ) ); | ||
41 | connect( this, SIGNAL( clicked( QListViewItem* ) ), | ||
42 | this, SLOT( stopTimer( QListViewItem* ) ) ); | ||
43 | |||
44 | } | ||
45 | |||
46 | //PackageListView::~PackageListView() | ||
47 | //{ | ||
48 | //} | ||
49 | |||
50 | void PackageListView::setCurrent( QListViewItem* p ) | ||
51 | { | ||
52 | if ( !p ) return; | ||
53 | activePackageListItem = (PackageListItem*)p; | ||
54 | activePackage = activePackageListItem->getPackage(); | ||
55 | pvDebug(5, "start timer"); | ||
56 | popupTimer->start( 750, true ); | ||
57 | } | ||
58 | |||
59 | |||
60 | void PackageListView::showPopup() | ||
61 | { | ||
62 | popupMenu->clear(); | ||
63 | destsMenu->clear(); | ||
64 | |||
65 | QAction *popupAction; | ||
66 | popupMenu->insertItem( QObject::tr("Install to"), destsMenu ); | ||
67 | QStringList dests = settings->getDestinationNames(); | ||
68 | for (uint i = 0; i < dests.count(); i++ ) | ||
69 | { | ||
70 | popupAction = new QAction( dests[i], QString::null, 0, this, 0 ); | ||
71 | popupAction->addTo( destsMenu ); | ||
72 | } | ||
73 | connect( destsMenu, SIGNAL( activated( int ) ), | ||
74 | this, SLOT( changePackageDest( int ) ) ); | ||
75 | popupMenu->popup( QCursor::pos() ); | ||
76 | } | ||
77 | |||
78 | void PackageListView::stopTimer( QListViewItem* ) | ||
79 | { | ||
80 | pvDebug( 5, "stop timer" ); | ||
81 | popupTimer->stop(); | ||
82 | } | ||
83 | |||
84 | |||
85 | void PackageListView::changePackageDest( int i ) | ||
86 | { | ||
87 | activePackage->setDest( destsMenu->text(i) ); | ||
88 | activePackage->setOn(); | ||
89 | activePackage->setLink( settings->createLinks() ); | ||
90 | activePackageListItem->displayDetails(); | ||
91 | } | ||