-rw-r--r-- | noncore/unsupported/oipkg/listviewitemoipkg.cpp | 38 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/listviewitemoipkg.h | 33 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/oipkg.pro | 4 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 100 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 22 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 34 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.h | 20 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistdoclnk.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.cpp | 159 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.h | 32 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistlocal.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.cpp | 141 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistview.h | 17 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 10 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.h | 8 |
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 | |||
6 | ListViewItemOipkg::ListViewItemOipkg(QListView *parent, QString name, QCheckListItem::Type qct, Type type) | ||
7 | : QCheckListItem(parent,name,qct) | ||
8 | { | ||
9 | _type = type; | ||
10 | } | ||
11 | ListViewItemOipkg::ListViewItemOipkg(QListView *parent, QString name, Type type) | ||
12 | : QCheckListItem(parent,name,CheckBox) | ||
13 | { | ||
14 | _type = type; | ||
15 | } | ||
16 | |||
17 | ListViewItemOipkg::ListViewItemOipkg(ListViewItemOipkg *parent, QString name, Type type) | ||
18 | : QCheckListItem(parent,name,CheckBox) | ||
19 | { | ||
20 | _type = type; | ||
21 | } | ||
22 | |||
23 | ListViewItemOipkg::ListViewItemOipkg(PackageListView *parent, QString name, Type type) | ||
24 | : QCheckListItem(parent,name,Controller) | ||
25 | { | ||
26 | _type = type; | ||
27 | } | ||
28 | |||
29 | ListViewItemOipkg::ListViewItemOipkg(ListViewItemOipkg *parent, Type type, QString name) | ||
30 | : QCheckListItem(parent,name,Controller) | ||
31 | { | ||
32 | _type = type; | ||
33 | } | ||
34 | |||
35 | ListViewItemOipkg::~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 | |||
9 | class PackageListItem; | ||
10 | class PackageListView; | ||
11 | |||
12 | class ListViewItemOipkg : public QObject, public QCheckListItem | ||
13 | { | ||
14 | Q_OBJECT | ||
15 | public: | ||
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;}; | ||
26 | protected slots: | ||
27 | virtual void menuAction(int ) {}; | ||
28 | protected: | ||
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 | |||
@@ -19,4 +19,5 @@ | |||
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" |
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 | |||
@@ -9,4 +9,5 @@ HEADERS = mainwindow.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 \ |
@@ -21,4 +22,5 @@ SOURCES = main.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 \ |
@@ -33,5 +35,5 @@ LIBS += -lqpe | |||
33 | LIBS += -lopie | 35 | LIBS += -lopie |
34 | INTERFACES= runwindow.ui \ | 36 | INTERFACES= runwindow.ui \ |
35 | pksettingsbase.ui | 37 | pksettingsbase.ui |
36 | TARGET = oipkg | 38 | TARGET = oipkg |
37 | 39 | ||
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 | |||
@@ -19,5 +19,5 @@ | |||
19 | #include "debug.h" | 19 | #include "debug.h" |
20 | 20 | ||
21 | Package::Package( QObject *parent, const char *name ) | 21 | OipkgPackage::OipkgPackage( QObject *parent, const char *name ) |
22 | : QObject(parent,name) | 22 | : QObject(parent,name) |
23 | { | 23 | { |
@@ -25,16 +25,15 @@ Package::Package( QObject *parent, const char *name ) | |||
25 | } | 25 | } |
26 | 26 | ||
27 | Package::~Package() | 27 | OipkgPackage::~OipkgPackage() |
28 | { | 28 | { |
29 | } | 29 | } |
30 | 30 | ||
31 | Package::Package( PackageManagerSettings *s, QObject *parent, const char *name ) | 31 | OipkgPackage::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 | ||
38 | void Package::init( PackageManagerSettings *s ) | 37 | void OipkgPackage::init( PackageManagerSettings *s ) |
39 | { | 38 | { |
40 | settings = s; | 39 | settings = s; |
@@ -55,5 +54,5 @@ void Package::init( PackageManagerSettings *s ) | |||
55 | } | 54 | } |
56 | 55 | ||
57 | Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) | 56 | OipkgPackage::OipkgPackage( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name ) |
58 | : QObject(parent,name) | 57 | : QObject(parent,name) |
59 | { | 58 | { |
@@ -62,5 +61,5 @@ Package::Package( QStringList pack, PackageManagerSettings *s , QObject *parent, | |||
62 | } | 61 | } |
63 | 62 | ||
64 | Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) | 63 | OipkgPackage::OipkgPackage( QString n, PackageManagerSettings *s, QObject *parent, const char *name ) |
65 | : QObject(parent,name) | 64 | : QObject(parent,name) |
66 | { | 65 | { |
@@ -77,5 +76,5 @@ Package::Package( QString n, PackageManagerSettings *s, QObject *parent, const c | |||
77 | } | 76 | } |
78 | 77 | ||
79 | Package::Package( Package *pi, QObject *parent, const char *name ) | 78 | OipkgPackage::OipkgPackage( OipkgPackage *pi, QObject *parent, const char *name ) |
80 | : QObject(parent,name) | 79 | : QObject(parent,name) |
81 | { | 80 | { |
@@ -85,5 +84,5 @@ Package::Package( Package *pi, QObject *parent, const char *name ) | |||
85 | 84 | ||
86 | 85 | ||
87 | void Package::setValue( QString n, QString t ) | 86 | void OipkgPackage::setValue( QString n, QString t ) |
88 | { | 87 | { |
89 | if ( n == "Package" ) | 88 | if ( n == "Package" ) |
@@ -138,5 +137,5 @@ void Package::setValue( QString n, QString t ) | |||
138 | } | 137 | } |
139 | 138 | ||
140 | QString Package::name() | 139 | QString OipkgPackage::name() |
141 | { | 140 | { |
142 | if (_displayName.isEmpty() ) return _name; | 141 | if (_displayName.isEmpty() ) return _name; |
@@ -145,5 +144,5 @@ QString Package::name() | |||
145 | 144 | ||
146 | 145 | ||
147 | QString Package::installName() | 146 | QString OipkgPackage::installName() |
148 | { | 147 | { |
149 | if (_useFileName) return _fileName; | 148 | if (_useFileName) return _fileName; |
@@ -151,5 +150,5 @@ QString Package::installName() | |||
151 | } | 150 | } |
152 | 151 | ||
153 | QString Package::packageName() | 152 | QString OipkgPackage::packageName() |
154 | { | 153 | { |
155 | QString pn = installName(); | 154 | QString pn = installName(); |
@@ -159,5 +158,5 @@ QString Package::packageName() | |||
159 | } | 158 | } |
160 | 159 | ||
161 | bool Package::installed() | 160 | bool OipkgPackage::installed() |
162 | { | 161 | { |
163 | if (_status.contains("installed")) | 162 | if (_status.contains("installed")) |
@@ -173,5 +172,5 @@ bool Package::installed() | |||
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 | { |
@@ -185,9 +184,9 @@ bool Package::installed() | |||
185 | } | 184 | } |
186 | 185 | ||
187 | bool Package::otherInstalled() | 186 | bool 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 | { |
@@ -199,5 +198,5 @@ bool Package::otherInstalled() | |||
199 | } | 198 | } |
200 | 199 | ||
201 | void Package::setDesc( QString s ) | 200 | void OipkgPackage::setDesc( QString s ) |
202 | { | 201 | { |
203 | _desc = s; | 202 | _desc = s; |
@@ -205,15 +204,15 @@ void Package::setDesc( QString s ) | |||
205 | } | 204 | } |
206 | 205 | ||
207 | QString Package::desc() | 206 | QString OipkgPackage::desc() |
208 | { | 207 | { |
209 | return _desc; | 208 | return _desc; |
210 | } | 209 | } |
211 | 210 | ||
212 | QString Package::shortDesc() | 211 | QString OipkgPackage::shortDesc() |
213 | { | 212 | { |
214 | return _shortDesc; | 213 | return _shortDesc; |
215 | } | 214 | } |
216 | 215 | ||
217 | QString Package::size() | 216 | QString OipkgPackage::size() |
218 | { | 217 | { |
219 | return _size; | 218 | return _size; |
@@ -221,10 +220,10 @@ QString Package::size() | |||
221 | 220 | ||
222 | 221 | ||
223 | QString Package::version() | 222 | QString OipkgPackage::version() |
224 | { | 223 | { |
225 | return _version; | 224 | return _version; |
226 | } | 225 | } |
227 | 226 | ||
228 | QString Package::sizeUnits() | 227 | QString OipkgPackage::sizeUnits() |
229 | { | 228 | { |
230 | int i = _size.toInt(); | 229 | int i = _size.toInt(); |
@@ -242,10 +241,10 @@ QString Package::sizeUnits() | |||
242 | } | 241 | } |
243 | 242 | ||
244 | bool Package::toProcess() | 243 | bool OipkgPackage::toProcess() |
245 | { | 244 | { |
246 | return _toProcess; | 245 | return _toProcess; |
247 | } | 246 | } |
248 | 247 | ||
249 | bool Package::toRemove() | 248 | bool OipkgPackage::toRemove() |
250 | { | 249 | { |
251 | if ( _toProcess && installed() ) return true; | 250 | if ( _toProcess && installed() ) return true; |
@@ -253,5 +252,5 @@ bool Package::toRemove() | |||
253 | } | 252 | } |
254 | 253 | ||
255 | bool Package::toInstall() | 254 | bool OipkgPackage::toInstall() |
256 | { | 255 | { |
257 | if ( _toProcess && !installed() ) return true; | 256 | if ( _toProcess && !installed() ) return true; |
@@ -259,5 +258,5 @@ bool Package::toInstall() | |||
259 | } | 258 | } |
260 | 259 | ||
261 | void Package::toggleProcess() | 260 | void OipkgPackage::toggleProcess() |
262 | { | 261 | { |
263 | _toProcess = ! _toProcess; | 262 | _toProcess = ! _toProcess; |
@@ -265,6 +264,5 @@ void Package::toggleProcess() | |||
265 | 264 | ||
266 | 265 | ||
267 | 266 | void OipkgPackage::copyValues( OipkgPackage* pack ) | |
268 | void 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 ); |
@@ -282,10 +280,10 @@ void Package::copyValues( Package* pack ) | |||
282 | } | 280 | } |
283 | 281 | ||
284 | QString Package::section() | 282 | QString OipkgPackage::section() |
285 | { | 283 | { |
286 | return _section; | 284 | return _section; |
287 | } | 285 | } |
288 | 286 | ||
289 | void Package::setSection( QString s) | 287 | void OipkgPackage::setSection( QString s) |
290 | { | 288 | { |
291 | int i = s.find("/"); | 289 | int i = s.find("/"); |
@@ -300,10 +298,10 @@ void Package::setSection( QString s) | |||
300 | } | 298 | } |
301 | 299 | ||
302 | QString Package::subSection() | 300 | QString OipkgPackage::subSection() |
303 | { | 301 | { |
304 | return _subsection; | 302 | return _subsection; |
305 | } | 303 | } |
306 | 304 | ||
307 | void Package::parsePackage( QStringList pack ) | 305 | void OipkgPackage::parsePackage( QStringList pack ) |
308 | { | 306 | { |
309 | if ( pack.isEmpty() ) return; | 307 | if ( pack.isEmpty() ) return; |
@@ -324,5 +322,5 @@ void Package::parsePackage( QStringList pack ) | |||
324 | } | 322 | } |
325 | 323 | ||
326 | QString Package::details() | 324 | QString OipkgPackage::details() |
327 | { | 325 | { |
328 | QString status; | 326 | QString status; |
@@ -363,5 +361,5 @@ QString Package::details() | |||
363 | } | 361 | } |
364 | 362 | ||
365 | void Package::processed() | 363 | void OipkgPackage::processed() |
366 | { | 364 | { |
367 | _toProcess = false; | 365 | _toProcess = false; |
@@ -371,5 +369,5 @@ void Package::processed() | |||
371 | } | 369 | } |
372 | 370 | ||
373 | QString Package::dest() | 371 | QString OipkgPackage::dest() |
374 | { | 372 | { |
375 | if ( installed()||(!installed() && _toProcess) ) | 373 | if ( installed()||(!installed() && _toProcess) ) |
@@ -378,5 +376,5 @@ QString Package::dest() | |||
378 | } | 376 | } |
379 | 377 | ||
380 | void Package::setDest( QString d ) | 378 | void OipkgPackage::setDest( QString d ) |
381 | { | 379 | { |
382 | if ( d == "remote") _useFileName = true; | 380 | if ( d == "remote") _useFileName = true; |
@@ -384,10 +382,10 @@ void Package::setDest( QString d ) | |||
384 | } | 382 | } |
385 | 383 | ||
386 | void Package::setOn() | 384 | void OipkgPackage::setOn() |
387 | { | 385 | { |
388 | _toProcess = true; | 386 | _toProcess = true; |
389 | } | 387 | } |
390 | 388 | ||
391 | bool Package::link() | 389 | bool OipkgPackage::link() |
392 | { | 390 | { |
393 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; | 391 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; |
@@ -395,10 +393,10 @@ bool Package::link() | |||
395 | } | 393 | } |
396 | 394 | ||
397 | void Package::setLink(bool b) | 395 | void OipkgPackage::setLink(bool b) |
398 | { | 396 | { |
399 | _link = b; | 397 | _link = b; |
400 | } | 398 | } |
401 | 399 | ||
402 | void Package::parseIpkgFile( QString file) | 400 | void OipkgPackage::parseIpkgFile( QString file) |
403 | { | 401 | { |
404 | // 20020830 | 402 | // 20020830 |
@@ -426,5 +424,5 @@ void Package::parseIpkgFile( QString file) | |||
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; |
@@ -432,28 +430,28 @@ void Package::parseIpkgFile( QString file) | |||
432 | //} | 430 | //} |
433 | 431 | ||
434 | void Package::instalFromFile(bool iff) | 432 | void OipkgPackage::instalFromFile(bool iff) |
435 | { | 433 | { |
436 | _useFileName = iff; | 434 | _useFileName = iff; |
437 | } | 435 | } |
438 | 436 | ||
439 | void Package::setName(QString n) | 437 | void OipkgPackage::setName(QString n) |
440 | { | 438 | { |
441 | _displayName = n; | 439 | _displayName = n; |
442 | } | 440 | } |
443 | 441 | ||
444 | QDict<QString>* Package::getFields() | 442 | QDict<QString>* OipkgPackage::getFields() |
445 | { | 443 | { |
446 | return &_values; | 444 | return &_values; |
447 | } | 445 | } |
448 | 446 | ||
449 | QString Package::status() | 447 | QString OipkgPackage::status() |
450 | { | 448 | { |
451 | return _status; | 449 | return _status; |
452 | } | 450 | } |
453 | 451 | ||
454 | bool Package::isOld() | 452 | bool 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; |
@@ -463,5 +461,5 @@ bool Package::isOld() | |||
463 | } | 461 | } |
464 | 462 | ||
465 | bool Package::hasVersions() | 463 | bool OipkgPackage::hasVersions() |
466 | { | 464 | { |
467 | if (!_versions) return false; | 465 | if (!_versions) return false; |
@@ -469,10 +467,10 @@ bool Package::hasVersions() | |||
469 | } | 467 | } |
470 | 468 | ||
471 | QDict<Package>* Package::getOtherVersions() | 469 | QDict<OipkgPackage>* OipkgPackage::getOtherVersions() |
472 | { | 470 | { |
473 | return _versions; | 471 | return _versions; |
474 | } | 472 | } |
475 | 473 | ||
476 | void Package::setOtherVersions(QDict<Package> *v) | 474 | void OipkgPackage::setOtherVersions(QDict<OipkgPackage> *v) |
477 | { | 475 | { |
478 | _versions=v; | 476 | _versions=v; |
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 | |||
@@ -20,17 +20,17 @@ | |||
20 | #include "pksettings.h" | 20 | #include "pksettings.h" |
21 | 21 | ||
22 | class Package : public QObject | 22 | class 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(); |
@@ -67,6 +67,6 @@ class Package : public QObject | |||
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 | ||
72 | public slots: | 72 | public slots: |
@@ -91,5 +91,5 @@ private: | |||
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 ); |
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 | |||
@@ -17,5 +17,5 @@ | |||
17 | #include "debug.h" | 17 | #include "debug.h" |
18 | 18 | ||
19 | static QDict<Package> *packageListAll; | 19 | static QDict<OipkgPackage> *packageListAll; |
20 | static int packageListAllRefCount = 0; | 20 | static int packageListAllRefCount = 0; |
21 | 21 | ||
@@ -24,5 +24,5 @@ PackageList::PackageList(QObject *parent, const char *name) | |||
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"; |
@@ -47,8 +47,8 @@ PackageList::~PackageList() | |||
47 | 47 | ||
48 | /** Inserts a package into the list */ | 48 | /** Inserts a package into the list */ |
49 | void PackageList::insertPackage( Package* pack ) | 49 | void 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 | { |
@@ -61,9 +61,9 @@ void PackageList::insertPackage( Package* 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 ); |
@@ -88,7 +88,7 @@ void 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 | { |
@@ -106,10 +106,10 @@ void PackageList::filterPackages( QString f ) | |||
106 | } | 106 | } |
107 | 107 | ||
108 | Package* PackageList::find( QString n ) | 108 | OipkgPackage* PackageList::find( QString n ) |
109 | { | 109 | { |
110 | return packageList.find( n ); | 110 | return packageList.find( n ); |
111 | } | 111 | } |
112 | 112 | ||
113 | Package* PackageList::first() | 113 | OipkgPackage* PackageList::first() |
114 | { | 114 | { |
115 | packageIter.toFirst(); | 115 | packageIter.toFirst(); |
@@ -117,5 +117,5 @@ Package* PackageList::first() | |||
117 | } | 117 | } |
118 | 118 | ||
119 | Package* PackageList::next() | 119 | OipkgPackage* PackageList::next() |
120 | { | 120 | { |
121 | ++packageIter; | 121 | ++packageIter; |
@@ -148,5 +148,5 @@ void PackageList::setSubSection( QString ssec ) | |||
148 | } | 148 | } |
149 | 149 | ||
150 | void PackageList::updateSections( Package* pack ) | 150 | void PackageList::updateSections( OipkgPackage* pack ) |
151 | { | 151 | { |
152 | QString s = pack->section(); | 152 | QString s = pack->section(); |
@@ -183,5 +183,5 @@ void PackageList::readFileEntries( QString filename, QString dest ) | |||
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 | { |
@@ -198,5 +198,5 @@ void PackageList::readFileEntries( QString filename, QString dest ) | |||
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 | { |
@@ -215,5 +215,5 @@ void PackageList::setSettings( PackageManagerSettings *s ) | |||
215 | } | 215 | } |
216 | 216 | ||
217 | Package* PackageList::getByName( QString n ) | 217 | OipkgPackage* PackageList::getByName( QString n ) |
218 | { | 218 | { |
219 | return origPackageList[n]; | 219 | return origPackageList[n]; |
@@ -229,7 +229,7 @@ void 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 | { |
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 | |||
@@ -25,8 +25,8 @@ public: | |||
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(); |
@@ -34,9 +34,9 @@ public: | |||
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 | ||
42 | public slots: | 42 | public slots: |
@@ -50,7 +50,7 @@ protected: | |||
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; |
@@ -62,5 +62,5 @@ protected: | |||
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 | }; |
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 | |||
@@ -49,5 +49,5 @@ void PackageListDocLnk::update() | |||
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 | |||
@@ -12,4 +12,6 @@ | |||
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" |
@@ -24,49 +26,62 @@ static QPixmap *pm_uninstalled_old_installed_new=0; | |||
24 | static QPixmap *pm_uninstalled_installed_old=0; | 26 | static QPixmap *pm_uninstalled_installed_old=0; |
25 | 27 | ||
26 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) | 28 | PackageListItem::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 | ||
32 | PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) | 34 | PackageListItem::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 | ||
38 | void PackageListItem::init( Package *pi, PackageManagerSettings *s) | 40 | PackageListItem::PackageListItem(ListViewItemOipkg *lvi, OipkgPackage *pi, PackageManagerSettings *s) |
41 | :ListViewItemOipkg(lvi,pi->name(),ListViewItemOipkg::Package) | ||
42 | { | ||
43 | init(pi,s); | ||
44 | } | ||
45 | PackageListItem::~PackageListItem() | ||
39 | { | 46 | { |
47 | delete popupMenu; | ||
48 | delete destsMenu; | ||
49 | } | ||
50 | |||
51 | void 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 | ||
@@ -116,17 +131,17 @@ QPixmap PackageListItem::statePixmap() const | |||
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 ) |
@@ -161,14 +176,64 @@ void PackageListItem::setOn( bool b ) | |||
161 | void PackageListItem::displayDetails() | 176 | void 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 | |||
191 | QPopupMenu* 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 | |||
225 | void 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 | |||
@@ -11,25 +11,32 @@ | |||
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 | ||
23 | class PackageListItem | 24 | class QPopupMenu; |
24 | : public QCheckListItem | 25 | |
26 | class PackageListItem : public ListViewItemOipkg | ||
25 | { | 27 | { |
26 | public: | 28 | public: |
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(); }; |
@@ -38,5 +45,9 @@ public: | |||
38 | 45 | ||
39 | private: | 46 | private: |
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; |
@@ -44,5 +55,8 @@ private: | |||
44 | QCheckListItem *statusItem; | 55 | QCheckListItem *statusItem; |
45 | PackageManagerSettings *settings; | 56 | PackageManagerSettings *settings; |
46 | Package *package; | 57 | OipkgPackage *package; |
58 | protected slots: | ||
59 | // void toggleProcess(); | ||
60 | virtual void menuAction( int ); | ||
47 | }; | 61 | }; |
48 | 62 | ||
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 | |||
@@ -70,5 +70,5 @@ void PackageListLocal::update() | |||
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"); |
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 | |||
@@ -13,23 +13,22 @@ | |||
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 | ||
18 | PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettings *s) | 19 | PackageListView::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 | ||
@@ -42,20 +41,26 @@ PackageListView::PackageListView(QWidget *p, const char* n, PackageManagerSettin | |||
42 | void PackageListView::setCurrent( QListViewItem* p ) | 41 | void 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 | ||
@@ -63,84 +68,44 @@ void PackageListView::setCurrent( QListViewItem* p ) | |||
63 | void PackageListView::showPopup() | 68 | void 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 | ||
98 | void PackageListView::stopTimer( QListViewItem* ) | 77 | void PackageListView::stopTimer( QListViewItem* ) |
99 | { | 78 | { |
100 | popupTimer->stop(); | 79 | popupTimer->stop(); |
101 | } | 80 | } |
102 | 81 | ||
103 | 82 | ||
104 | void PackageListView::changePackageDest( int i ) | ||
105 | { | ||
106 | activePackage->setDest( destsMenu->text(i) ); | ||
107 | activePackage->setOn(); | ||
108 | activePackage->setLink( settings->createLinks() ); | ||
109 | activePackageListItem->displayDetails(); | ||
110 | } | ||
111 | |||
112 | void PackageListView::toggleProcess() | ||
113 | { | ||
114 | activePackage->toggleProcess() ; | ||
115 | activePackageListItem->displayDetails(); | ||
116 | } | ||
117 | |||
118 | void PackageListView::display() | 83 | void 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 | } |
@@ -148,6 +113,6 @@ void PackageListView::display() | |||
148 | void PackageListView::addList( QString n, PackageList* pl) | 113 | void 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 | |||
@@ -19,10 +19,12 @@ | |||
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 | ||
24 | class PackageListItem; | 25 | class PackageListItem; |
25 | class Package; | 26 | class OipkgPackage; |
26 | class PackageManagerSettings; | 27 | class PackageManagerSettings; |
28 | //class ListViewItemOipkg; | ||
27 | 29 | ||
28 | class PackageListView : public QListView | 30 | class PackageListView : public QListView |
@@ -36,17 +38,16 @@ public: | |||
36 | QTimer *popupTimer; | 38 | QTimer *popupTimer; |
37 | private: | 39 | private: |
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; |
45 | public slots: | 48 | public 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 | }; |
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 | |||
@@ -115,5 +115,5 @@ bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
115 | } | 115 | } |
116 | 116 | ||
117 | void PmIpkg::makeLinks(Package *pack) | 117 | void PmIpkg::makeLinks(OipkgPackage *pack) |
118 | { | 118 | { |
119 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 119 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
@@ -233,5 +233,5 @@ void PmIpkg::processLinkDir( QString file, QString dest ) | |||
233 | void PmIpkg::loadList( PackageList *pl ) | 233 | void 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) |
@@ -292,5 +292,5 @@ void PmIpkg::remove() | |||
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 | { |
@@ -415,5 +415,5 @@ void PmIpkg::installFile(const QString &fileName, const QString &dest) | |||
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 ); |
@@ -428,5 +428,5 @@ void PmIpkg::removeFile(const QString &fileName, const QString &dest) | |||
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 ); |
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 | |||
@@ -24,5 +24,5 @@ | |||
24 | #define removeLink 1 | 24 | #define removeLink 1 |
25 | 25 | ||
26 | class Package; | 26 | class OipkgPackage; |
27 | class PmIpkg : public QObject | 27 | class PmIpkg : public QObject |
28 | { | 28 | { |
@@ -54,7 +54,7 @@ private: | |||
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 ); |