summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/listviewitemoipkg.cpp38
-rw-r--r--noncore/unsupported/oipkg/listviewitemoipkg.h33
-rw-r--r--noncore/unsupported/oipkg/mainwindow.h1
-rw-r--r--noncore/unsupported/oipkg/oipkg.pro4
-rw-r--r--noncore/unsupported/oipkg/package.cpp100
-rw-r--r--noncore/unsupported/oipkg/package.h22
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp34
-rw-r--r--noncore/unsupported/oipkg/packagelist.h20
-rw-r--r--noncore/unsupported/oipkg/packagelistdoclnk.cpp2
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp159
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.h32
-rw-r--r--noncore/unsupported/oipkg/packagelistlocal.cpp2
-rw-r--r--noncore/unsupported/oipkg/packagelistview.cpp141
-rw-r--r--noncore/unsupported/oipkg/packagelistview.h17
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp10
-rw-r--r--noncore/unsupported/oipkg/pmipkg.h8
16 files changed, 370 insertions, 253 deletions
diff --git a/noncore/unsupported/oipkg/listviewitemoipkg.cpp b/noncore/unsupported/oipkg/listviewitemoipkg.cpp
new file mode 100644
index 0000000..30b5a5e
--- a/dev/null
+++ b/noncore/unsupported/oipkg/listviewitemoipkg.cpp
@@ -0,0 +1,38 @@
1#include "listviewitemoipkg.h"
2#include "packagelistview.h"
3
4#include <qlistview.h>
5
6ListViewItemOipkg::ListViewItemOipkg(QListView *parent, QString name, QCheckListItem::Type qct, Type type)
7 : QCheckListItem(parent,name,qct)
8{
9 _type = type;
10}
11ListViewItemOipkg::ListViewItemOipkg(QListView *parent, QString name, Type type)
12 : QCheckListItem(parent,name,CheckBox)
13{
14 _type = type;
15}
16
17ListViewItemOipkg::ListViewItemOipkg(ListViewItemOipkg *parent, QString name, Type type)
18 : QCheckListItem(parent,name,CheckBox)
19{
20 _type = type;
21}
22
23ListViewItemOipkg::ListViewItemOipkg(PackageListView *parent, QString name, Type type)
24 : QCheckListItem(parent,name,Controller)
25{
26 _type = type;
27}
28
29ListViewItemOipkg::ListViewItemOipkg(ListViewItemOipkg *parent, Type type, QString name)
30 : QCheckListItem(parent,name,Controller)
31{
32 _type = type;
33}
34
35ListViewItemOipkg::~ListViewItemOipkg()
36{
37// delete _popupMenu;
38}
diff --git a/noncore/unsupported/oipkg/listviewitemoipkg.h b/noncore/unsupported/oipkg/listviewitemoipkg.h
new file mode 100644
index 0000000..4f7d2d7
--- a/dev/null
+++ b/noncore/unsupported/oipkg/listviewitemoipkg.h
@@ -0,0 +1,33 @@
1#ifndef LISTVIEWITEMOIPKG_H
2#define LISTVIEWITEMOIPKG_H
3
4#include <qpopupmenu.h>
5#include <qstring.h>
6#include <qlistview.h>
7#include <qcheckbox.h>
8
9class PackageListItem;
10class PackageListView;
11
12class ListViewItemOipkg : public QObject, public QCheckListItem
13{
14Q_OBJECT
15public:
16 enum Type {Package, Feed, Attribute};
17
18 ListViewItemOipkg(QListView *parent, QString name, QCheckListItem::Type qct, Type type);ListViewItemOipkg(QListView *parent, QString name, Type type);
19 ListViewItemOipkg(ListViewItemOipkg *parent, QString name, Type type);
20 ListViewItemOipkg(PackageListView *parent, QString name, Type type);
21 ListViewItemOipkg(ListViewItemOipkg *parent, Type type, QString name);
22 ~ListViewItemOipkg();
23
24 int getType() {return _type;};
25 virtual QPopupMenu* getPopupMenu() {return 0;};
26protected slots:
27 virtual void menuAction(int ) {};
28protected:
29 int _type;
30 static QPopupMenu* _popupMenu;
31};
32
33#endif
diff --git a/noncore/unsupported/oipkg/mainwindow.h b/noncore/unsupported/oipkg/mainwindow.h
index 354c585..f32352b 100644
--- a/noncore/unsupported/oipkg/mainwindow.h
+++ b/noncore/unsupported/oipkg/mainwindow.h
@@ -18,6 +18,7 @@
18#include <qtimer.h> 18#include <qtimer.h>
19#include <qpopupmenu.h> 19#include <qpopupmenu.h>
20 20
21#include "package.h"
21#include "packagelist.h" 22#include "packagelist.h"
22#include "packagelistremote.h" 23#include "packagelistremote.h"
23#include "packagelistlocal.h" 24#include "packagelistlocal.h"
diff --git a/noncore/unsupported/oipkg/oipkg.pro b/noncore/unsupported/oipkg/oipkg.pro
index 986cbcd..230df2c 100644
--- a/noncore/unsupported/oipkg/oipkg.pro
+++ b/noncore/unsupported/oipkg/oipkg.pro
@@ -8,6 +8,7 @@ HEADERS = mainwindow.h \
8 packagelistdoclnk.h \ 8 packagelistdoclnk.h \
9 installdialog.h \ 9 installdialog.h \
10 utils.h \ 10 utils.h \
11 listviewitemoipkg.h \
11 packagelistitem.h \ 12 packagelistitem.h \
12 packagelistremote.h \ 13 packagelistremote.h \
13 packagelist.h \ 14 packagelist.h \
@@ -20,6 +21,7 @@ SOURCES = main.cpp \
20 packagelistdoclnk.cpp \ 21 packagelistdoclnk.cpp \
21 packagelistview.cpp \ 22 packagelistview.cpp \
22 installdialog.cpp \ 23 installdialog.cpp \
24 listviewitemoipkg.cpp \
23 packagelistremote.cpp \ 25 packagelistremote.cpp \
24 packagelistlocal.cpp \ 26 packagelistlocal.cpp \
25 pksettings.cpp \ 27 pksettings.cpp \
@@ -32,7 +34,7 @@ DEPENDPATH += $(OPIEDIR)/ioclude
32LIBS += -lqpe 34LIBS += -lqpe
33LIBS += -lopie 35LIBS += -lopie
34 INTERFACES= runwindow.ui \ 36 INTERFACES= runwindow.ui \
35 pksettingsbase.ui 37 pksettingsbase.ui
36 TARGET = oipkg 38 TARGET = oipkg
37 39
38TRANSLATIONS = ../../../i18n/de/oipkg.ts \ 40TRANSLATIONS = ../../../i18n/de/oipkg.ts \
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 3effb73..e020601 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -18,24 +18,23 @@
18 18
19#include "debug.h" 19#include "debug.h"
20 20
21Package::Package( QObject *parent, const char *name ) 21OipkgPackage::OipkgPackage( QObject *parent, const char *name )
22 : QObject(parent,name) 22 : QObject(parent,name)
23{ 23{
24 24
25} 25}
26 26
27Package::~Package() 27OipkgPackage::~OipkgPackage()
28{ 28{
29} 29}
30 30
31Package::Package( PackageManagerSettings *s, QObject *parent, const char *name ) 31OipkgPackage::OipkgPackage( PackageManagerSettings *s, QObject *parent, const char *name )
32 : QObject(parent,name) 32 : QObject(parent,name)
33{ 33 {
34 Package(parent,name);
35 init(s); 34 init(s);
36} 35}
37 36
38void Package::init( PackageManagerSettings *s ) 37void OipkgPackage::init( PackageManagerSettings *s )
39{ 38{
40 settings = s; 39 settings = s;
41 _size = ""; 40 _size = "";
@@ -54,14 +53,14 @@ void Package::init( PackageManagerSettings *s )
54 _version=""; 53 _version="";
55} 54}
56 55
57Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) 56OipkgPackage::OipkgPackage( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name )
58 : QObject(parent,name) 57 : QObject(parent,name)
59{ 58{
60 init(s); 59 init(s);
61 parsePackage( pack ); 60 parsePackage( pack );
62} 61}
63 62
64Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) 63OipkgPackage::OipkgPackage( QString n, PackageManagerSettings *s, QObject *parent, const char *name )
65 : QObject(parent,name) 64 : QObject(parent,name)
66{ 65{
67 init(s); 66 init(s);
@@ -76,7 +75,7 @@ Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const c
76 } 75 }
77} 76}
78 77
79Package::Package( Package *pi, QObject *parent, const char *name ) 78OipkgPackage::OipkgPackage( OipkgPackage *pi, QObject *parent, const char *name )
80 : QObject(parent,name) 79 : QObject(parent,name)
81{ 80{
82 init(pi->settings); 81 init(pi->settings);
@@ -84,7 +83,7 @@ Package::Package( Package *pi, QObject *parent, const char *name )
84} 83}
85 84
86 85
87void Package::setValue( QString n, QString t ) 86void OipkgPackage::setValue( QString n, QString t )
88{ 87{
89 if ( n == "Package" ) 88 if ( n == "Package" )
90 { 89 {
@@ -137,20 +136,20 @@ void Package::setValue( QString n, QString t )
137 } 136 }
138} 137}
139 138
140QString Package::name() 139QString OipkgPackage::name()
141{ 140{
142 if (_displayName.isEmpty() ) return _name; 141 if (_displayName.isEmpty() ) return _name;
143 else return _displayName; 142 else return _displayName;
144} 143}
145 144
146 145
147QString Package::installName() 146QString OipkgPackage::installName()
148{ 147{
149 if (_useFileName) return _fileName; 148 if (_useFileName) return _fileName;
150 else return _name; 149 else return _name;
151} 150}
152 151
153QString Package::packageName() 152QString OipkgPackage::packageName()
154{ 153{
155 QString pn = installName(); 154 QString pn = installName();
156 pn = pn.right(pn.length()-pn.findRev("/")); 155 pn = pn.right(pn.length()-pn.findRev("/"));
@@ -158,7 +157,7 @@ QString Package::packageName()
158 return pn; 157 return pn;
159} 158}
160 159
161bool Package::installed() 160bool OipkgPackage::installed()
162{ 161{
163 if (_status.contains("installed")) 162 if (_status.contains("installed"))
164 { 163 {
@@ -172,7 +171,7 @@ bool Package::installed()
172 else 171 else
173 if (_versions) 172 if (_versions)
174 { 173 {
175 QDictIterator<Package> other( *_versions ); 174 QDictIterator<OipkgPackage> other( *_versions );
176 while ( other.current() ) 175 while ( other.current() )
177 { 176 {
178 if (other.current()->status().contains("installed") 177 if (other.current()->status().contains("installed")
@@ -184,11 +183,11 @@ bool Package::installed()
184 return false; 183 return false;
185} 184}
186 185
187bool Package::otherInstalled() 186bool OipkgPackage::otherInstalled()
188{ 187{
189 if (_versions) 188 if (_versions)
190 { 189 {
191 QDictIterator<Package> other( *_versions ); 190 QDictIterator<OipkgPackage> other( *_versions );
192 while ( other.current() ) 191 while ( other.current() )
193 { 192 {
194 if (other.current()->installed()) return true; 193 if (other.current()->installed()) return true;
@@ -198,34 +197,34 @@ bool Package::otherInstalled()
198 return false; 197 return false;
199} 198}
200 199
201void Package::setDesc( QString s ) 200void OipkgPackage::setDesc( QString s )
202{ 201{
203 _desc = s; 202 _desc = s;
204 _shortDesc = s.left( s.find("\n") ); 203 _shortDesc = s.left( s.find("\n") );
205} 204}
206 205
207QString Package::desc() 206QString OipkgPackage::desc()
208{ 207{
209 return _desc; 208 return _desc;
210} 209}
211 210
212QString Package::shortDesc() 211QString OipkgPackage::shortDesc()
213{ 212{
214 return _shortDesc; 213 return _shortDesc;
215} 214}
216 215
217QString Package::size() 216QString OipkgPackage::size()
218{ 217{
219 return _size; 218 return _size;
220} 219}
221 220
222 221
223QString Package::version() 222QString OipkgPackage::version()
224{ 223{
225 return _version; 224 return _version;
226} 225}
227 226
228QString Package::sizeUnits() 227QString OipkgPackage::sizeUnits()
229{ 228{
230 int i = _size.toInt(); 229 int i = _size.toInt();
231 int c = 0; 230 int c = 0;
@@ -241,31 +240,30 @@ QString Package::sizeUnits()
241 return ret; 240 return ret;
242} 241}
243 242
244bool Package::toProcess() 243bool OipkgPackage::toProcess()
245{ 244{
246 return _toProcess; 245 return _toProcess;
247} 246}
248 247
249bool Package::toRemove() 248bool OipkgPackage::toRemove()
250{ 249{
251 if ( _toProcess && installed() ) return true; 250 if ( _toProcess && installed() ) return true;
252 else return false; 251 else return false;
253} 252}
254 253
255bool Package::toInstall() 254bool OipkgPackage::toInstall()
256{ 255{
257 if ( _toProcess && !installed() ) return true; 256 if ( _toProcess && !installed() ) return true;
258 else return false; 257 else return false;
259} 258}
260 259
261void Package::toggleProcess() 260void OipkgPackage::toggleProcess()
262{ 261{
263 _toProcess = ! _toProcess; 262 _toProcess = ! _toProcess;
264} 263}
265 264
266 265
267 266void OipkgPackage::copyValues( OipkgPackage* pack )
268void Package::copyValues( Package* pack )
269{ 267{
270 if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size ); 268 if (_size.isEmpty() && !pack->_size.isEmpty()) _size = QString( pack->_size );
271 if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section ); 269 if (_section.isEmpty() && !pack->_section.isEmpty()) _section = QString( pack->_section );
@@ -281,12 +279,12 @@ void Package::copyValues( Package* pack )
281 if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status ); 279 if (!installed() && _status.isEmpty() && !pack->_status.isEmpty()) _status = QString( pack->_status );
282} 280}
283 281
284QString Package::section() 282QString OipkgPackage::section()
285{ 283{
286 return _section; 284 return _section;
287} 285}
288 286
289void Package::setSection( QString s) 287void OipkgPackage::setSection( QString s)
290{ 288{
291 int i = s.find("/"); 289 int i = s.find("/");
292 if ( i > 0 ) 290 if ( i > 0 )
@@ -299,12 +297,12 @@ void Package::setSection( QString s)
299 } 297 }
300} 298}
301 299
302QString Package::subSection() 300QString OipkgPackage::subSection()
303{ 301{
304 return _subsection; 302 return _subsection;
305} 303}
306 304
307void Package::parsePackage( QStringList pack ) 305void OipkgPackage::parsePackage( QStringList pack )
308{ 306{
309 if ( pack.isEmpty() ) return; 307 if ( pack.isEmpty() ) return;
310 int count = pack.count(); 308 int count = pack.count();
@@ -323,7 +321,7 @@ void Package::parsePackage( QStringList pack )
323 return; 321 return;
324} 322}
325 323
326QString Package::details() 324QString OipkgPackage::details()
327{ 325{
328 QString status; 326 QString status;
329 Process ipkg_status(QStringList() << "ipkg" << "info" << name() ); 327 Process ipkg_status(QStringList() << "ipkg" << "info" << name() );
@@ -362,7 +360,7 @@ QString Package::details()
362 return description; 360 return description;
363} 361}
364 362
365void Package::processed() 363void OipkgPackage::processed()
366{ 364{
367 _toProcess = false; 365 _toProcess = false;
368 //hack, but we're not writing status anyway... 366 //hack, but we're not writing status anyway...
@@ -370,36 +368,36 @@ void Package::processed()
370 else _status = "installed"; 368 else _status = "installed";
371} 369}
372 370
373QString Package::dest() 371QString OipkgPackage::dest()
374{ 372{
375 if ( installed()||(!installed() && _toProcess) ) 373 if ( installed()||(!installed() && _toProcess) )
376 return _dest!=""?_dest:settings->getDestinationName(); 374 return _dest!=""?_dest:settings->getDestinationName();
377 else return ""; 375 else return "";
378} 376}
379 377
380void Package::setDest( QString d ) 378void OipkgPackage::setDest( QString d )
381{ 379{
382 if ( d == "remote") _useFileName = true; 380 if ( d == "remote") _useFileName = true;
383 else _dest = d; 381 else _dest = d;
384} 382}
385 383
386void Package::setOn() 384void OipkgPackage::setOn()
387{ 385{
388 _toProcess = true; 386 _toProcess = true;
389} 387}
390 388
391bool Package::link() 389bool OipkgPackage::link()
392{ 390{
393 if ( _dest == "root" || (!installed() && !_toProcess) ) return false; 391 if ( _dest == "root" || (!installed() && !_toProcess) ) return false;
394 return _link; 392 return _link;
395} 393}
396 394
397void Package::setLink(bool b) 395void OipkgPackage::setLink(bool b)
398{ 396{
399 _link = b; 397 _link = b;
400} 398}
401 399
402void Package::parseIpkgFile( QString file) 400void OipkgPackage::parseIpkgFile( QString file)
403{ 401{
404// 20020830 402// 20020830
405// a quick hack to make oipkg understand the new ipk format 403// a quick hack to make oipkg understand the new ipk format
@@ -425,36 +423,36 @@ void Package::parseIpkgFile( QString file)
425 423
426} 424}
427 425
428//QString Package::getPackageName() 426//QString OipkgPackage::getPackageName()
429//{ 427//{
430 //if ( _packageName.isEmpty() ) return _name; 428 //if ( _packageName.isEmpty() ) return _name;
431 //else return _packageName; 429 //else return _packageName;
432//} 430//}
433 431
434void Package::instalFromFile(bool iff) 432void OipkgPackage::instalFromFile(bool iff)
435{ 433{
436 _useFileName = iff; 434 _useFileName = iff;
437} 435}
438 436
439void Package::setName(QString n) 437void OipkgPackage::setName(QString n)
440{ 438{
441 _displayName = n; 439 _displayName = n;
442} 440}
443 441
444QDict<QString>* Package::getFields() 442QDict<QString>* OipkgPackage::getFields()
445{ 443{
446 return &_values; 444 return &_values;
447} 445}
448 446
449QString Package::status() 447QString OipkgPackage::status()
450{ 448{
451 return _status; 449 return _status;
452} 450}
453 451
454bool Package::isOld() 452bool OipkgPackage::isOld()
455{ 453{
456 if (!_versions) return false; 454 if (!_versions) return false;
457 QDictIterator<Package> other( *_versions ); 455 QDictIterator<OipkgPackage> other( *_versions );
458 while ( other.current() ) { 456 while ( other.current() ) {
459 if (other.current()->version() > version() ) return true; 457 if (other.current()->version() > version() ) return true;
460 ++other; 458 ++other;
@@ -462,18 +460,18 @@ bool Package::isOld()
462 return false; 460 return false;
463} 461}
464 462
465bool Package::hasVersions() 463bool OipkgPackage::hasVersions()
466{ 464{
467 if (!_versions) return false; 465 if (!_versions) return false;
468 else return true; 466 else return true;
469} 467}
470 468
471QDict<Package>* Package::getOtherVersions() 469QDict<OipkgPackage>* OipkgPackage::getOtherVersions()
472{ 470{
473 return _versions; 471 return _versions;
474} 472}
475 473
476void Package::setOtherVersions(QDict<Package> *v) 474void OipkgPackage::setOtherVersions(QDict<OipkgPackage> *v)
477{ 475{
478 _versions=v; 476 _versions=v;
479} 477}
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h
index c147420..2334c31 100644
--- a/noncore/unsupported/oipkg/package.h
+++ b/noncore/unsupported/oipkg/package.h
@@ -19,19 +19,19 @@
19 19
20#include "pksettings.h" 20#include "pksettings.h"
21 21
22class Package : public QObject 22class OipkgPackage : public QObject
23{ 23{
24 Q_OBJECT 24 Q_OBJECT
25 public: 25 public:
26 Package(QObject *parent=0, const char *name=0); 26 OipkgPackage(QObject *parent=0, const char *name=0);
27 Package(PackageManagerSettings *s, QObject *parent=0, const char *name=0); 27 OipkgPackage(PackageManagerSettings *s, QObject *parent=0, const char *name=0);
28 ~Package(); 28 ~OipkgPackage();
29 Package( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); 29 OipkgPackage( QStringList, PackageManagerSettings *s, QObject *parent=0, const char *name=0 );
30 Package( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 ); 30 OipkgPackage( QString, PackageManagerSettings *s, QObject *parent=0, const char *name=0 );
31 Package( Package*s, QObject *parent=0, const char *name=0 ); 31 OipkgPackage( OipkgPackage*s, QObject *parent=0, const char *name=0 );
32 32
33 void setValue( QString, QString ); 33 void setValue( QString, QString );
34 void copyValues( Package* ); 34 void copyValues( OipkgPackage* );
35 35
36 QString name(); 36 QString name();
37 QString installName(); 37 QString installName();
@@ -66,8 +66,8 @@ class Package : public QObject
66 QDict<QString>* getFields(); 66 QDict<QString>* getFields();
67 QString status(); 67 QString status();
68 68
69 QDict<Package>* getOtherVersions(); 69 QDict<OipkgPackage>* getOtherVersions();
70 void setOtherVersions(QDict<Package>*); 70 void setOtherVersions(QDict<OipkgPackage>*);
71 71
72public slots: 72public slots:
73 void toggleProcess(); 73 void toggleProcess();
@@ -90,7 +90,7 @@ private:
90 QString _version; 90 QString _version;
91 QString _dest; 91 QString _dest;
92 QDict<QString> _values; 92 QDict<QString> _values;
93 QDict<Package> *_versions; 93 QDict<OipkgPackage> *_versions;
94 bool _useFileName; 94 bool _useFileName;
95 void parsePackage( QStringList ); 95 void parsePackage( QStringList );
96 void init(PackageManagerSettings *); 96 void init(PackageManagerSettings *);
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index edb9cc5..5f79ec1 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -16,14 +16,14 @@
16 16
17#include "debug.h" 17#include "debug.h"
18 18
19static QDict<Package> *packageListAll; 19static QDict<OipkgPackage> *packageListAll;
20static int packageListAllRefCount = 0; 20static int packageListAllRefCount = 0;
21 21
22PackageList::PackageList(QObject *parent, const char *name) 22PackageList::PackageList(QObject *parent, const char *name)
23 : QObject(parent,name), packageIter( packageList ) 23 : QObject(parent,name), packageIter( packageList )
24{ 24{
25 empty=true; 25 empty=true;
26 if (!packageListAll) packageListAll = new QDict<Package>(); 26 if (!packageListAll) packageListAll = new QDict<OipkgPackage>();
27 packageListAllRefCount++; 27 packageListAllRefCount++;
28 sections << "All"; 28 sections << "All";
29 subSections.insert("All", new QStringList() ); 29 subSections.insert("All", new QStringList() );
@@ -46,10 +46,10 @@ PackageList::~PackageList()
46} 46}
47 47
48/** Inserts a package into the list */ 48/** Inserts a package into the list */
49void PackageList::insertPackage( Package* pack ) 49void PackageList::insertPackage( OipkgPackage* pack )
50{ 50{
51 if (!pack) return; 51 if (!pack) return;
52 Package* p = packageListAll->find( pack->name() ); 52 OipkgPackage* p = packageListAll->find( pack->name() );
53 if ( p ) 53 if ( p )
54 { 54 {
55 if ( (p->version() == pack->version()) 55 if ( (p->version() == pack->version())
@@ -60,11 +60,11 @@ void PackageList::insertPackage( Package* pack )
60 delete pack; 60 delete pack;
61 pack = p; 61 pack = p;
62 } else { 62 } else {
63 QDict<Package> *packver = p->getOtherVersions(); 63 QDict<OipkgPackage> *packver = p->getOtherVersions();
64 // p->setName( pack->name()+"["+p->version()+"]" ); 64 // p->setName( pack->name()+"["+p->version()+"]" );
65 if (!packver) 65 if (!packver)
66 { 66 {
67 packver = new QDict<Package>(); 67 packver = new QDict<OipkgPackage>();
68 packver->insert( pack->name(), p ); 68 packver->insert( pack->name(), p );
69 p->setOtherVersions( packver ); 69 p->setOtherVersions( packver );
70 } 70 }
@@ -87,9 +87,9 @@ void PackageList::insertPackage( Package* pack )
87void PackageList::filterPackages( QString f ) 87void PackageList::filterPackages( QString f )
88 { 88 {
89 packageList.clear(); 89 packageList.clear();
90 QDictIterator<Package> filterIter( origPackageList ); 90 QDictIterator<OipkgPackage> filterIter( origPackageList );
91 filterIter.toFirst(); 91 filterIter.toFirst();
92 Package *pack= filterIter.current() ; 92 OipkgPackage *pack= filterIter.current() ;
93 while ( pack ) 93 while ( pack )
94 { 94 {
95 if ( 95 if (
@@ -105,18 +105,18 @@ void PackageList::filterPackages( QString f )
105 } 105 }
106} 106}
107 107
108Package* PackageList::find( QString n ) 108OipkgPackage* PackageList::find( QString n )
109{ 109{
110 return packageList.find( n ); 110 return packageList.find( n );
111} 111}
112 112
113Package* PackageList::first() 113OipkgPackage* PackageList::first()
114 { 114 {
115 packageIter.toFirst(); 115 packageIter.toFirst();
116 return packageIter.current(); 116 return packageIter.current();
117} 117}
118 118
119Package* PackageList::next() 119OipkgPackage* PackageList::next()
120{ 120{
121 ++packageIter; 121 ++packageIter;
122 return packageIter.current(); 122 return packageIter.current();
@@ -147,7 +147,7 @@ void PackageList::setSubSection( QString ssec )
147 aktSubSection = ssec; 147 aktSubSection = ssec;
148} 148}
149 149
150void PackageList::updateSections( Package* pack ) 150void PackageList::updateSections( OipkgPackage* pack )
151{ 151{
152 QString s = pack->section(); 152 QString s = pack->section();
153 if ( s.isEmpty() || s == "") return; 153 if ( s.isEmpty() || s == "") return;
@@ -182,7 +182,7 @@ void PackageList::readFileEntries( QString filename, QString dest )
182 //end of package 182 //end of package
183 if ( ! packEntry.isEmpty() ) 183 if ( ! packEntry.isEmpty() )
184 { 184 {
185 Package *p = new Package( packEntry, settings ); 185 OipkgPackage *p = new OipkgPackage( packEntry, settings );
186 if ( p ) 186 if ( p )
187 { 187 {
188 p->setDest( dest ); 188 p->setDest( dest );
@@ -197,7 +197,7 @@ void PackageList::readFileEntries( QString filename, QString dest )
197 //there might be no nl at the end of the package file 197 //there might be no nl at the end of the package file
198 if ( ! packEntry.isEmpty() ) 198 if ( ! packEntry.isEmpty() )
199 { 199 {
200 Package *p = new Package( packEntry, settings ); 200 OipkgPackage *p = new OipkgPackage( packEntry, settings );
201 if ( p ) 201 if ( p )
202 { 202 {
203 p->setDest( dest ); 203 p->setDest( dest );
@@ -214,7 +214,7 @@ void PackageList::setSettings( PackageManagerSettings *s )
214 settings = s; 214 settings = s;
215} 215}
216 216
217Package* PackageList::getByName( QString n ) 217OipkgPackage* PackageList::getByName( QString n )
218{ 218{
219 return origPackageList[n]; 219 return origPackageList[n];
220} 220}
@@ -228,9 +228,9 @@ void PackageList::clear()
228void PackageList::allPackages() 228void PackageList::allPackages()
229{ 229{
230 packageList.clear(); 230 packageList.clear();
231 QDictIterator<Package> filterIter( origPackageList ); 231 QDictIterator<OipkgPackage> filterIter( origPackageList );
232 filterIter.toFirst(); 232 filterIter.toFirst();
233 Package *pack= filterIter.current() ; 233 OipkgPackage *pack= filterIter.current() ;
234 while ( pack ) 234 while ( pack )
235 { 235 {
236 packageList.insert( pack->name(), pack ); 236 packageList.insert( pack->name(), pack );
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h
index 0c13688..88a8793 100644
--- a/noncore/unsupported/oipkg/packagelist.h
+++ b/noncore/unsupported/oipkg/packagelist.h
@@ -24,20 +24,20 @@ public:
24 PackageList (QObject *parent=0, const char *name=0); 24 PackageList (QObject *parent=0, const char *name=0);
25 PackageList( PackageManagerSettings *s, QObject *parent=0, const char *name=0); 25 PackageList( PackageManagerSettings *s, QObject *parent=0, const char *name=0);
26 virtual ~PackageList(); 26 virtual ~PackageList();
27 void insertPackage( Package* ); 27 void insertPackage( OipkgPackage* );
28 Package* find( QString ); 28 OipkgPackage* find( QString );
29 Package* next(); 29 OipkgPackage* next();
30 Package* first(); 30 OipkgPackage* first();
31 31
32 QStringList getSections(); 32 QStringList getSections();
33 QStringList getSubSections(); 33 QStringList getSubSections();
34 void setSettings( PackageManagerSettings* ); 34 void setSettings( PackageManagerSettings* );
35 void filterPackages( QString ); 35 void filterPackages( QString );
36 Package* getByName( QString ); 36 OipkgPackage* getByName( QString );
37 void clear(); 37 void clear();
38 void allPackages(); 38 void allPackages();
39 39
40 QDict<Package> *versions; 40 QDict<OipkgPackage> *versions;
41 41
42public slots: 42public slots:
43 void setSection(QString); 43 void setSection(QString);
@@ -49,9 +49,9 @@ protected:
49 int packageCount; 49 int packageCount;
50 50
51 PackageManagerSettings *settings; 51 PackageManagerSettings *settings;
52 QDict<Package> packageList; 52 QDict<OipkgPackage> packageList;
53 QDict<Package> origPackageList; 53 QDict<OipkgPackage> origPackageList;
54 QDictIterator<Package> packageIter; 54 QDictIterator<OipkgPackage> packageIter;
55 55
56 bool empty; 56 bool empty;
57 QString aktSection; 57 QString aktSection;
@@ -61,7 +61,7 @@ protected:
61 QDict<bool> sectionsDict; 61 QDict<bool> sectionsDict;
62 62
63 63
64 void updateSections( Package* ); 64 void updateSections( OipkgPackage* );
65 void readFileEntries( QString file, QString dest="" ); 65 void readFileEntries( QString file, QString dest="" );
66}; 66};
67 67
diff --git a/noncore/unsupported/oipkg/packagelistdoclnk.cpp b/noncore/unsupported/oipkg/packagelistdoclnk.cpp
index 76e91ff..a7a6f70 100644
--- a/noncore/unsupported/oipkg/packagelistdoclnk.cpp
+++ b/noncore/unsupported/oipkg/packagelistdoclnk.cpp
@@ -48,6 +48,6 @@ void PackageListDocLnk::update()
48 QList<DocLnk> packlist = doclnkset->children(); 48 QList<DocLnk> packlist = doclnkset->children();
49 for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() ) 49 for (DocLnk *pack =packlist.first(); pack != 0; pack=packlist.next() )
50 { 50 {
51 insertPackage( new Package(pack->file(), settings ) ); 51 insertPackage( new OipkgPackage(pack->file(), settings ) );
52 } 52 }
53} 53}
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp
index 03bf477..4380393 100644
--- a/noncore/unsupported/oipkg/packagelistitem.cpp
+++ b/noncore/unsupported/oipkg/packagelistitem.cpp
@@ -11,6 +11,8 @@
11 11
12#include <qpe/resource.h> 12#include <qpe/resource.h>
13#include <qobject.h> 13#include <qobject.h>
14#include <qpopupmenu.h>
15#include <qaction.h>
14 16
15#include "debug.h" 17#include "debug.h"
16 18
@@ -23,51 +25,64 @@ static QPixmap *pm_install=0;
23static QPixmap *pm_uninstalled_old_installed_new=0; 25static QPixmap *pm_uninstalled_old_installed_new=0;
24static QPixmap *pm_uninstalled_installed_old=0; 26static QPixmap *pm_uninstalled_installed_old=0;
25 27
26PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) 28PackageListItem::PackageListItem(ListViewItemOipkg *parent, QString name, Type ittype)
27 :QCheckListItem(lv,pi->name(),CheckBox) 29 : ListViewItemOipkg(parent,name,ittype)
28{ 30{
29 init(pi,s); 31
30} 32}
31 33
32PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) 34PackageListItem::PackageListItem(QListView* lv, OipkgPackage *pi, PackageManagerSettings *s)
33 :QCheckListItem(lvi,pi->name(),CheckBox) 35 :ListViewItemOipkg(lv,pi->name(),ListViewItemOipkg::Package)
34{ 36{
35 init(pi,s); 37 init(pi,s);
36} 38}
37 39
38void PackageListItem::init( Package *pi, PackageManagerSettings *s) 40PackageListItem::PackageListItem(ListViewItemOipkg *lvi, OipkgPackage *pi, PackageManagerSettings *s)
41 :ListViewItemOipkg(lvi,pi->name(),ListViewItemOipkg::Package)
42{
43 init(pi,s);
44}
45PackageListItem::~PackageListItem()
39{ 46{
47 delete popupMenu;
48 delete destsMenu;
49}
50
51void PackageListItem::init( OipkgPackage *pi, PackageManagerSettings *s)
52{
53 popupMenu = new QPopupMenu( 0 );
54 destsMenu = new QPopupMenu( 0 );
40 package = pi; 55 package = pi;
41 settings = s; 56 settings = s;
42 setExpandable( true ); 57 setExpandable( true );
43 QCheckListItem *item; 58 ListViewItemOipkg *item;
44 nameItem = new QCheckListItem( this, "" ); 59 nameItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute,"name" );
45 item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); 60 item = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("Description: ")+pi->desc() );
46 item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); 61 item = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("Size: ")+pi->size() );
47 destItem = new QCheckListItem( this, "" ); 62 destItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "dest" );
48 linkItem = new QCheckListItem( this, "" ); 63 linkItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "link" );
49 statusItem = new QCheckListItem( this, "" ); 64 statusItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "status" );
50 QCheckListItem *otherItem = new QCheckListItem( this, QObject::tr("other") ); 65 ListViewItemOipkg *otherItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("other") );
51 item = new QCheckListItem( otherItem, QObject::tr("Install Name: ")+pi->installName() ); 66 item = new ListViewItemOipkg( otherItem, ListViewItemOipkg::Attribute, QObject::tr("Install Name: ")+pi->installName() );
52 QDict<QString> *fields = pi->getFields(); 67 QDict<QString> *fields = pi->getFields();
53 QDictIterator<QString> it( *fields ); 68 QDictIterator<QString> it( *fields );
54 while ( it.current() ) { 69 while ( it.current() ) {
55 item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) ); 70 item = new ListViewItemOipkg( otherItem, ListViewItemOipkg::Attribute, QString(it.currentKey()+": "+*it.current()) );
56 ++it; 71 ++it;
57 } 72 }
58 displayDetails(); 73 displayDetails();
59 74
60 if (!pm_uninstalled) 75 if (!pm_uninstalled)
61 { 76 {
62 pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); 77 pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled"));
63 pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld")); 78 pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld"));
64 pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew")); 79 pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew"));
65 pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld")); 80 pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld"));
66 pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); 81 pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed"));
67 pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld")); 82 pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld"));
68 pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); 83 pm_install = new QPixmap(Resource::loadPixmap("oipkg/install"));
69 pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); 84 pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall"));
70 } 85 }
71} 86}
72 87
73void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, 88void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg,
@@ -115,19 +130,19 @@ QPixmap PackageListItem::statePixmap() const
115 bool verinstalled = package->otherInstalled(); 130 bool verinstalled = package->otherInstalled();
116 if ( !package->toProcess() ) { 131 if ( !package->toProcess() ) {
117 if ( !installed ) 132 if ( !installed )
118 if (old) 133 if (old)
119 { 134 {
120 if (verinstalled) return *pm_uninstalled_old_installed_new; 135 if (verinstalled) return *pm_uninstalled_old_installed_new;
121 else return *pm_uninstalled_old; 136 else return *pm_uninstalled_old;
122 } 137 }
123 else 138 else
124 { 139 {
125 if (verinstalled) return *pm_uninstalled_installed_old; 140 if (verinstalled) return *pm_uninstalled_installed_old;
126 else return *pm_uninstalled; 141 else return *pm_uninstalled;
127 } 142 }
128 else 143 else
129 if (old) return *pm_installed_old; 144 if (old) return *pm_installed_old;
130 else return *pm_installed; 145 else return *pm_installed;
131 } else { //toProcess() == true 146 } else { //toProcess() == true
132 if ( !installed ) 147 if ( !installed )
133 return *pm_install; 148 return *pm_install;
@@ -160,15 +175,65 @@ void PackageListItem::setOn( bool b )
160 175
161void PackageListItem::displayDetails() 176void PackageListItem::displayDetails()
162{ 177{
163 QString sod; 178 QString sod;
164 sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits()); 179 sod += package->sizeUnits().isEmpty()?QString(""):QString(package->sizeUnits());
165 //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest()); 180 //sod += QString(package->dest().isEmpty()?"":QObject::tr(" on ")+package->dest());
166 sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest()); 181 sod += package->dest().isEmpty()?QString(""):QString(QObject::tr(" on ")+package->dest());
167 sod = sod.isEmpty()?QString(""):QString(" ("+sod+")"); 182 sod = sod.isEmpty()?QString(""):QString(" ("+sod+")");
168 setText(0, package->name()+sod ); 183 setText(0, package->name()+sod );
169 nameItem->setText( 0, QObject::tr("Name: ")+package->name()); 184 nameItem->setText( 0, QObject::tr("Name: ")+package->name());
170 linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No"))); 185 linkItem->setText( 0, QObject::tr("Link: ")+(package->link()?QObject::tr("Yes"):QObject::tr("No")));
171 destItem->setText( 0, QObject::tr("Destination: ")+package->dest() ); 186 destItem->setText( 0, QObject::tr("Destination: ")+package->dest() );
172 statusItem->setText( 0, QObject::tr("Status: ")+package->status() ); 187 statusItem->setText( 0, QObject::tr("Status: ")+package->status() );
173 repaint(); 188 repaint();
174} 189}
190
191QPopupMenu* PackageListItem::getPopupMenu()
192{
193 popupMenu->clear();
194 destsMenu->clear();
195
196 QAction *popupAction;
197 qDebug("PackageListItem::showPopup ");
198
199 if (!package->installed()){
200 popupMenu->insertItem( QObject::tr("Install to"), destsMenu );
201 QStringList dests = settings->getDestinationNames();
202 QString ad = settings->getDestinationName();
203 for (uint i = 0; i < dests.count(); i++ )
204 {
205 popupAction = new QAction( dests[i], QString::null, 0, popupMenu, 0 );
206 popupAction->addTo( destsMenu );
207 if ( dests[i] == ad && getPackage()->toInstall() )
208 {
209 popupAction->setToggleAction( true );
210 popupAction->setOn(true);
211 }
212 }
213 connect( destsMenu, SIGNAL( activated( int ) ),
214 this, SLOT( menuAction( int ) ) );
215 popupMenu->popup( QCursor::pos() );
216 }else{
217 popupMenu->insertItem( QObject::tr("Remove"));
218 connect( popupMenu, SIGNAL( activated( int ) ),
219 this, SLOT( menuAction( int ) ) );
220 popupMenu->popup( QCursor::pos() );
221 }
222 return popupMenu;
223}
224
225void PackageListItem::menuAction( int i )
226{
227 if (package->installed()){
228 package->setDest( destsMenu->text(i) );
229 package->setLink( settings->createLinks() );
230 }
231 package->setOn();
232 displayDetails();
233}
234
235//void PackageListItem::toggleProcess()
236//{
237// package->toggleProcess() ;
238// displayDetails();
239//} \ No newline at end of file
diff --git a/noncore/unsupported/oipkg/packagelistitem.h b/noncore/unsupported/oipkg/packagelistitem.h
index dba44f7..ca0cf17 100644
--- a/noncore/unsupported/oipkg/packagelistitem.h
+++ b/noncore/unsupported/oipkg/packagelistitem.h
@@ -10,40 +10,54 @@
10#ifndef PK_LISTITEM_H 10#ifndef PK_LISTITEM_H
11#define PK_LISTITEM_H 11#define PK_LISTITEM_H
12 12
13#include "package.h"
14 13
15#include <qstring.h> 14#include <qstring.h>
16#include <qlistview.h> 15//#include <qlistview.h>
17#include <qpainter.h> 16#include <qpainter.h>
18#include <qpixmap.h> 17#include <qpixmap.h>
19#include <qdict.h> 18#include <qdict.h>
20 19
20#include "listviewitemoipkg.h"
21#include "package.h"
21#include "pksettings.h" 22#include "pksettings.h"
22 23
23class PackageListItem 24class QPopupMenu;
24: public QCheckListItem 25
26class PackageListItem : public ListViewItemOipkg
25{ 27{
26public: 28public:
27 PackageListItem(QListViewItem*, Package*, PackageManagerSettings*); 29 PackageListItem(ListViewItemOipkg *parent, QString name, Type ittype);
28 PackageListItem(QListView*, Package*, PackageManagerSettings*); 30 PackageListItem(
31 ListViewItemOipkg *parent,
32 OipkgPackage *pack,
33 PackageManagerSettings *s);
34 PackageListItem(QListView*, OipkgPackage*, PackageManagerSettings*);
35 ~PackageListItem();
29 void paintCell( QPainter*, const QColorGroup&, int, int, int ); 36 void paintCell( QPainter*, const QColorGroup&, int, int, int );
30 void paintFocus( QPainter*, const QColorGroup&, const QRect& ); 37 void paintFocus( QPainter*, const QColorGroup&, const QRect& );
31 QPixmap statePixmap() const; 38 QPixmap statePixmap() const;
32 QString key( int, bool ) const; 39 QString key( int, bool ) const;
33 Package* getPackage() { return package; } ; 40 OipkgPackage* getPackage() { return package; } ;
34 QString getName() { return package->name(); } ; 41 QString getName() { return package->name(); } ;
35 bool isInstalled(){ return package->installed(); }; 42 bool isInstalled(){ return package->installed(); };
36 virtual void setOn ( bool ); 43 virtual void setOn ( bool );
37 void displayDetails(); 44 void displayDetails();
38 45
39private: 46private:
40 void init(Package*, PackageManagerSettings*); 47 QPopupMenu *popupMenu;
48 QPopupMenu *destsMenu;
49 void init(OipkgPackage*, PackageManagerSettings*);
50 virtual QPopupMenu* getPopupMenu();
51 static QPopupMenu *_destsMenu;
41 QCheckListItem *nameItem; 52 QCheckListItem *nameItem;
42 QCheckListItem *destItem; 53 QCheckListItem *destItem;
43 QCheckListItem *linkItem; 54 QCheckListItem *linkItem;
44 QCheckListItem *statusItem; 55 QCheckListItem *statusItem;
45 PackageManagerSettings *settings; 56 PackageManagerSettings *settings;
46 Package *package; 57 OipkgPackage *package;
58protected slots:
59 // void toggleProcess();
60 virtual void menuAction( int );
47}; 61};
48 62
49 63
diff --git a/noncore/unsupported/oipkg/packagelistlocal.cpp b/noncore/unsupported/oipkg/packagelistlocal.cpp
index b8a19253..2fe75bc 100644
--- a/noncore/unsupported/oipkg/packagelistlocal.cpp
+++ b/noncore/unsupported/oipkg/packagelistlocal.cpp
@@ -69,7 +69,7 @@ void PackageListLocal::update()
69{ 69{
70 pvDebug( 2, "parseStatus"); 70 pvDebug( 2, "parseStatus");
71 parseStatus(); 71 parseStatus();
72 pvDebug( 2, "parseList"); 72 pvDebug( 2, "parseList "+listsDir);
73 parseList(); 73 parseList();
74 pvDebug( 2, "finished parsing"); 74 pvDebug( 2, "finished parsing");
75} 75}
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
@@ -12,25 +12,24 @@
12#include <qpopupmenu.h> 12#include <qpopupmenu.h>
13#include <qaction.h> 13#include <qaction.h>
14 14
15#include "listviewitemoipkg.h"
15#include "packagelistitem.h" 16#include "packagelistitem.h"
16#include "pksettings.h" 17#include "pksettings.h"
17 18
18PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) 19PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s)
19 : QListView(p,n) 20 : QListView(p,n)
20{ 21{
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 );
25 setSelectionMode(QListView::NoSelection); 24 setSelectionMode(QListView::NoSelection);
26 addColumn( tr("Package") ); 25 addColumn( tr("Package") );
27 setRootIsDecorated( true ); 26 setRootIsDecorated( true );
28 27
29 connect( popupTimer, SIGNAL(timeout()), 28 connect( popupTimer, SIGNAL(timeout()),
30 this, SLOT(showPopup()) ); 29 this, SLOT(showPopup()) );
31 connect( this, SIGNAL( pressed( QListViewItem* ) ), 30 connect( this, SIGNAL( pressed( QListViewItem* ) ),
32 this, SLOT( setCurrent( QListViewItem* ) ) ); 31 this, SLOT( setCurrent( QListViewItem* ) ) );
33 connect( this, SIGNAL( clicked( QListViewItem* ) ), 32 connect( this, SIGNAL( clicked( QListViewItem* ) ),
34 this, SLOT( stopTimer( QListViewItem* ) ) ); 33 this, SLOT( stopTimer( QListViewItem* ) ) );
35 34
36} 35}
@@ -41,113 +40,79 @@ PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettin
41 40
42void PackageListView::setCurrent( QListViewItem* p ) 41void 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; 61// }
55 // } 62
56 63
57 return; 64 qDebug("PackageListView::setCurrent popupTimer->start");
58 }
59 popupTimer->start( 750, true );
60} 65}
61 66
62 67
63void PackageListView::showPopup() 68void 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}
97 76
98void PackageListView::stopTimer( QListViewItem* ) 77void PackageListView::stopTimer( QListViewItem* )
99{ 78{
100 popupTimer->stop(); 79 popupTimer->stop();
101} 80}
102 81
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()
119{ 84{
120 QDictIterator<PackageList> list( PackageLists ); 85 QDictIterator<PackageList> list( PackageLists );
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;
126 QListViewItem* itdel; 91 QListViewItem* itdel;
127 while ( list.current() ) { 92 while ( list.current() ) {
128 packlist = list.current(); 93 packlist = list.current();
129 rootItem = rootItems.find( list.currentKey() ); 94 rootItem = rootItems.find( list.currentKey() );
130 //rootItem->clear(); 95 //rootItem->clear();
131 it=rootItem->firstChild(); 96 it=rootItem->firstChild();
132 while ( it ) 97 while ( it )
133 { 98 {
134 itdel = it; 99 itdel = it;
135 it = it->nextSibling(); 100 it = it->nextSibling();
136 delete itdel; 101 delete itdel;
137 } 102 }
138 pack = packlist->first(); 103 pack = packlist->first();
139 while( pack ) 104 while( pack )
140 { 105 {
141 item = new PackageListItem( rootItem, pack, settings ); 106 item = new PackageListItem( rootItem, pack, settings );
142 pack = packlist->next(); 107 pack = packlist->next();
143 } 108 }
144 ++list; 109 ++list;
145 } 110 }
146} 111}
147 112
148void PackageListView::addList( QString n, PackageList* pl) 113void PackageListView::addList( QString n, PackageList* pl)
149{ 114{
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);
153} 118}
diff --git a/noncore/unsupported/oipkg/packagelistview.h b/noncore/unsupported/oipkg/packagelistview.h
index 3c09ba8..17dcb95 100644
--- a/noncore/unsupported/oipkg/packagelistview.h
+++ b/noncore/unsupported/oipkg/packagelistview.h
@@ -18,12 +18,14 @@
18#include <qtimer.h> 18#include <qtimer.h>
19#include <qwidget.h> 19#include <qwidget.h>
20#include <qpopupmenu.h> 20#include <qpopupmenu.h>
21#include "listviewitemoipkg.h"
21#include "packagelist.h" 22#include "packagelist.h"
22#include "debug.h" 23#include "debug.h"
23 24
24class PackageListItem; 25class PackageListItem;
25class Package; 26class OipkgPackage;
26class PackageManagerSettings; 27class PackageManagerSettings;
28//class ListViewItemOipkg;
27 29
28class PackageListView : public QListView 30class PackageListView : public QListView
29{ 31{
@@ -35,19 +37,18 @@ public:
35 //~PackageListView(); 37 //~PackageListView();
36 QTimer *popupTimer; 38 QTimer *popupTimer;
37private: 39private:
38 QDict<PackageList> PackageLists; 40 QDict<PackageList> PackageLists;
39 QDict<QCheckListItem> rootItems; 41 QDict<ListViewItemOipkg> rootItems;
40 PackageManagerSettings *settings; 42 PackageManagerSettings *settings;
41 Package *activePackage; 43// OipkgPackage *activePackage;
42 PackageListItem *activePackageListItem; 44// PackageListItem *activePackageListItem;
45 ListViewItemOipkg *activeItem;
43 QPopupMenu *popupMenu; 46 QPopupMenu *popupMenu;
44 QPopupMenu *destsMenu; 47 QPopupMenu *destsMenu;
45public slots: 48public slots:
46 void showPopup(); 49 void showPopup();
47 void changePackageDest( int );
48 void setCurrent( QListViewItem* ); 50 void setCurrent( QListViewItem* );
49 void stopTimer( QListViewItem* ); 51 void stopTimer( QListViewItem* );
50 void toggleProcess();
51 void display(); 52 void display();
52}; 53};
53 54
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 2ed313c..cfaadbf 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -114,7 +114,7 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest )
114 return ret; 114 return ret;
115} 115}
116 116
117void PmIpkg::makeLinks(Package *pack) 117void PmIpkg::makeLinks(OipkgPackage *pack)
118{ 118{
119 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); 119 pvDebug( 2, "PmIpkg::makeLinks "+ pack->name());
120 QString pn = pack->name(); 120 QString pn = pack->name();
@@ -232,7 +232,7 @@ void PmIpkg::processLinkDir( QString file, QString dest )
232 232
233void PmIpkg::loadList( PackageList *pl ) 233void PmIpkg::loadList( PackageList *pl )
234 { 234 {
235 for( Package *pack = pl->first();pack ; (pack = pl->next()) ) 235 for( OipkgPackage *pack = pl->first();pack ; (pack = pl->next()) )
236 { 236 {
237 if ( pack && (pack->name() != "") && pack) 237 if ( pack && (pack->name() != "") && pack)
238 { 238 {
@@ -291,7 +291,7 @@ void PmIpkg::remove()
291 291
292 out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); 292 out(tr("Removing")+"\n"+tr("please wait")+"\n\n");
293 293
294 QStringList *fileList; 294 QStringList *fileList = new QStringList;
295 for (uint i=0; i < to_remove.count(); i++) 295 for (uint i=0; i < to_remove.count(); i++)
296 { 296 {
297 if ( to_remove.at(i)->link() ) fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); 297 if ( to_remove.at(i)->link() ) fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() );
@@ -414,7 +414,7 @@ void PmIpkg::installFile(const QString &fileName, const QString &dest)
414 to_install.clear(); 414 to_install.clear();
415 to_remove.clear(); 415 to_remove.clear();
416 pvDebug( 2,"PmIpkg::installFile "+ fileName); 416 pvDebug( 2,"PmIpkg::installFile "+ fileName);
417 Package *p = new Package(fileName,settings); 417 OipkgPackage *p = new OipkgPackage(fileName,settings);
418 if ( dest!="") p->setDest( dest ); 418 if ( dest!="") p->setDest( dest );
419 to_install.append( p ); 419 to_install.append( p );
420 commit(); 420 commit();
@@ -427,7 +427,7 @@ void PmIpkg::removeFile(const QString &fileName, const QString &dest)
427 to_install.clear(); 427 to_install.clear();
428 to_remove.clear(); 428 to_remove.clear();
429 pvDebug( 2,"PmIpkg::removeFile "+ fileName); 429 pvDebug( 2,"PmIpkg::removeFile "+ fileName);
430 Package *p = new Package(fileName,settings); 430 OipkgPackage *p = new OipkgPackage(fileName,settings);
431 if ( dest!="") p->setDest( dest ); 431 if ( dest!="") p->setDest( dest );
432 to_remove.append( p ); 432 to_remove.append( p );
433 commit(); 433 commit();
diff --git a/noncore/unsupported/oipkg/pmipkg.h b/noncore/unsupported/oipkg/pmipkg.h
index 2f4d6ae..cb0759a 100644
--- a/noncore/unsupported/oipkg/pmipkg.h
+++ b/noncore/unsupported/oipkg/pmipkg.h
@@ -23,7 +23,7 @@
23#define createLink 0 23#define createLink 0
24#define removeLink 1 24#define removeLink 1
25 25
26class Package; 26class OipkgPackage;
27class PmIpkg : public QObject 27class PmIpkg : public QObject
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
@@ -53,9 +53,9 @@ private:
53 PackageManagerSettings* settings; 53 PackageManagerSettings* settings;
54 RunWindow *runwindow; 54 RunWindow *runwindow;
55 InstallDialog *installDialog; 55 InstallDialog *installDialog;
56 QList<Package> to_remove; 56 QList<OipkgPackage> to_remove;
57 QList<Package> to_install; 57 QList<OipkgPackage> to_install;
58 void makeLinks(Package*); 58 void makeLinks(OipkgPackage*);
59 void linkPackage( QString, QString ); 59 void linkPackage( QString, QString );
60 void processLinkDir( QString , QString ); 60 void processLinkDir( QString , QString );
61 bool runIpkg(const QString& args, const QString& dest="" ); 61 bool runIpkg(const QString& args, const QString& dest="" );