author | tille <tille> | 2002-05-01 16:14:36 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-01 16:14:36 (UTC) |
commit | da12e60078563ef6e10ddcc1edeb931f765b8b6d (patch) (unidiff) | |
tree | 0d6cfec0cf3de34568f02de41582bc84e962e12d | |
parent | da94bce203afca412336a7793ff8e58e18d59108 (diff) | |
download | opie-da12e60078563ef6e10ddcc1edeb931f765b8b6d.zip opie-da12e60078563ef6e10ddcc1edeb931f765b8b6d.tar.gz opie-da12e60078563ef6e10ddcc1edeb931f765b8b6d.tar.bz2 |
more fields in detailed view
-rw-r--r-- | noncore/unsupported/oipkg/TODO | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 5 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 1 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.cpp | 9 |
4 files changed, 14 insertions, 2 deletions
diff --git a/noncore/unsupported/oipkg/TODO b/noncore/unsupported/oipkg/TODO index fc2e8a4..9d9a650 100644 --- a/noncore/unsupported/oipkg/TODO +++ b/noncore/unsupported/oipkg/TODO | |||
@@ -1,14 +1,13 @@ | |||
1 | * Settings Class | 1 | * Settings Class |
2 | * tr() ;) | 2 | * tr() ;) |
3 | * Dialog to display ipkg output live | 3 | * Dialog to display ipkg output live |
4 | * parse "to install" and "to remove" from status | 4 | * parse "to install" and "to remove" from status |
5 | * install local file dialog | 5 | * install local file dialog |
6 | * qcop | 6 | * qcop |
7 | * error handling | 7 | * error handling |
8 | * manage links | 8 | * manage links |
9 | * dependency checking | 9 | * dependency checking |
10 | * create dest if it does not exist | 10 | * create dest if it does not exist |
11 | * allow reinstalling | 11 | * allow reinstalling |
12 | * handle different versions | ||
13 | * different types of filters and searches | 12 | * different types of filters and searches |
14 | i.e. name, desc, files etc \ No newline at end of file | 13 | i.e. name, desc, files etc \ No newline at end of file |
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp index 0787ece..f992641 100644 --- a/noncore/unsupported/oipkg/package.cpp +++ b/noncore/unsupported/oipkg/package.cpp | |||
@@ -316,48 +316,53 @@ void Package::setOn() | |||
316 | _toProcess = true; | 316 | _toProcess = true; |
317 | } | 317 | } |
318 | 318 | ||
319 | bool Package::link() | 319 | bool Package::link() |
320 | { | 320 | { |
321 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; | 321 | if ( _dest == "root" || (!installed() && !_toProcess) ) return false; |
322 | return _link; | 322 | return _link; |
323 | } | 323 | } |
324 | 324 | ||
325 | void Package::setLink(bool b) | 325 | void Package::setLink(bool b) |
326 | { | 326 | { |
327 | _link = b; | 327 | _link = b; |
328 | } | 328 | } |
329 | 329 | ||
330 | void Package::parseIpkgFile( QString file) | 330 | void Package::parseIpkgFile( QString file) |
331 | { | 331 | { |
332 | system("tar xzf "+file+" -C /tmp"); | 332 | system("tar xzf "+file+" -C /tmp"); |
333 | system("tar xzf /tmp/control.tar.gz -C /tmp"); | 333 | system("tar xzf /tmp/control.tar.gz -C /tmp"); |
334 | QFile f("/tmp/control"); | 334 | QFile f("/tmp/control"); |
335 | if ( f.open(IO_ReadOnly) ) | 335 | if ( f.open(IO_ReadOnly) ) |
336 | { | 336 | { |
337 | QTextStream t( &f ); | 337 | QTextStream t( &f ); |
338 | QStringList pack; | 338 | QStringList pack; |
339 | while ( !t.eof() ) | 339 | while ( !t.eof() ) |
340 | { | 340 | { |
341 | pack << t.readLine(); | 341 | pack << t.readLine(); |
342 | } | 342 | } |
343 | f.close(); | 343 | f.close(); |
344 | parsePackage( pack ); | 344 | parsePackage( pack ); |
345 | } | 345 | } |
346 | 346 | ||
347 | } | 347 | } |
348 | 348 | ||
349 | //QString Package::getPackageName() | 349 | //QString Package::getPackageName() |
350 | //{ | 350 | //{ |
351 | //if ( _packageName.isEmpty() ) return _name; | 351 | //if ( _packageName.isEmpty() ) return _name; |
352 | //else return _packageName; | 352 | //else return _packageName; |
353 | //} | 353 | //} |
354 | 354 | ||
355 | void Package::instalFromFile(bool iff) | 355 | void Package::instalFromFile(bool iff) |
356 | { | 356 | { |
357 | _useFileName = iff; | 357 | _useFileName = iff; |
358 | } | 358 | } |
359 | 359 | ||
360 | void Package::setName(QString n) | 360 | void Package::setName(QString n) |
361 | { | 361 | { |
362 | _displayName = n; | 362 | _displayName = n; |
363 | } | 363 | } |
364 | |||
365 | QDict<QString>* Package::getFields() | ||
366 | { | ||
367 | return &_values; | ||
368 | } | ||
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h index 2ca966d..fc725bc 100644 --- a/noncore/unsupported/oipkg/package.h +++ b/noncore/unsupported/oipkg/package.h | |||
@@ -4,74 +4,75 @@ | |||
4 | #include <qstring.h> | 4 | #include <qstring.h> |
5 | #include <qlistview.h> | 5 | #include <qlistview.h> |
6 | #include <qpainter.h> | 6 | #include <qpainter.h> |
7 | #include <qpixmap.h> | 7 | #include <qpixmap.h> |
8 | #include <qdict.h> | 8 | #include <qdict.h> |
9 | #include <qobject.h> | 9 | #include <qobject.h> |
10 | 10 | ||
11 | #include "pksettings.h" | 11 | #include "pksettings.h" |
12 | 12 | ||
13 | class Package //: public QObject | 13 | class Package //: public QObject |
14 | { | 14 | { |
15 | // Q_OBJECT | 15 | // Q_OBJECT |
16 | public: | 16 | public: |
17 | Package(PackageManagerSettings *); | 17 | Package(PackageManagerSettings *); |
18 | // ~Package(); | 18 | // ~Package(); |
19 | Package( QStringList, PackageManagerSettings * ); | 19 | Package( QStringList, PackageManagerSettings * ); |
20 | Package( QString, PackageManagerSettings * ); | 20 | Package( QString, PackageManagerSettings * ); |
21 | Package( Package* ); | 21 | Package( Package* ); |
22 | 22 | ||
23 | void setValue( QString, QString ); | 23 | void setValue( QString, QString ); |
24 | void copyValues( Package* ); | 24 | void copyValues( Package* ); |
25 | 25 | ||
26 | QString name() ; | 26 | QString name() ; |
27 | QString installName() ; | 27 | QString installName() ; |
28 | bool installed(); | 28 | bool installed(); |
29 | 29 | ||
30 | void setDesc( QString ); | 30 | void setDesc( QString ); |
31 | QString shortDesc(); | 31 | QString shortDesc(); |
32 | QString desc(); | 32 | QString desc(); |
33 | QString size(); | 33 | QString size(); |
34 | QString sizeUnits(); | 34 | QString sizeUnits(); |
35 | QString version(); | 35 | QString version(); |
36 | void setSection( QString ); | 36 | void setSection( QString ); |
37 | QString section(); | 37 | QString section(); |
38 | QString subSection(); | 38 | QString subSection(); |
39 | QString details(); | 39 | QString details(); |
40 | bool toProcess(); | 40 | bool toProcess(); |
41 | bool toInstall(); | 41 | bool toInstall(); |
42 | bool toRemove(); | 42 | bool toRemove(); |
43 | void processed(); | 43 | void processed(); |
44 | QString dest(); | 44 | QString dest(); |
45 | void setDest( QString d ); | 45 | void setDest( QString d ); |
46 | void setOn(); | 46 | void setOn(); |
47 | bool link(); | 47 | bool link(); |
48 | void setLink(bool); | 48 | void setLink(bool); |
49 | void parseIpkgFile( QString ); | 49 | void parseIpkgFile( QString ); |
50 | void instalFromFile(bool iff=true); | 50 | void instalFromFile(bool iff=true); |
51 | void setName(QString); | 51 | void setName(QString); |
52 | QDict<QString>* getFields(); | ||
52 | public slots: | 53 | public slots: |
53 | void toggleProcess(); | 54 | void toggleProcess(); |
54 | 55 | ||
55 | private: | 56 | private: |
56 | PackageManagerSettings *settings; | 57 | PackageManagerSettings *settings; |
57 | QString _displayName; | 58 | QString _displayName; |
58 | QString _name; | 59 | QString _name; |
59 | QString _fileName; | 60 | QString _fileName; |
60 | bool _toProcess; | 61 | bool _toProcess; |
61 | bool _link; | 62 | bool _link; |
62 | QString _status; | 63 | QString _status; |
63 | QString _size; | 64 | QString _size; |
64 | QString _section; | 65 | QString _section; |
65 | QString _subsection; | 66 | QString _subsection; |
66 | QString _shortDesc; | 67 | QString _shortDesc; |
67 | QString _desc; | 68 | QString _desc; |
68 | QString _version; | 69 | QString _version; |
69 | QString _dest; | 70 | QString _dest; |
70 | QDict<QString> _values; | 71 | QDict<QString> _values; |
71 | bool _useFileName; | 72 | bool _useFileName; |
72 | void parsePackage( QStringList ); | 73 | void parsePackage( QStringList ); |
73 | void init(PackageManagerSettings *); | 74 | void init(PackageManagerSettings *); |
74 | }; | 75 | }; |
75 | 76 | ||
76 | 77 | ||
77 | #endif | 78 | #endif |
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index b7af9a6..2f81714 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp | |||
@@ -1,83 +1,90 @@ | |||
1 | #include "packagelistitem.h" | 1 | #include "packagelistitem.h" |
2 | 2 | ||
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | #include <qobject.h> | 4 | #include <qobject.h> |
5 | 5 | ||
6 | #include "debug.h" | 6 | #include "debug.h" |
7 | 7 | ||
8 | static QPixmap *pm_uninstalled=0; | 8 | static QPixmap *pm_uninstalled=0; |
9 | static QPixmap *pm_installed=0; | 9 | static QPixmap *pm_installed=0; |
10 | static QPixmap *pm_uninstall=0; | 10 | static QPixmap *pm_uninstall=0; |
11 | static QPixmap *pm_install=0; | 11 | static QPixmap *pm_install=0; |
12 | 12 | ||
13 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) | 13 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) |
14 | :QCheckListItem(lv,pi->name(),CheckBox) | 14 | :QCheckListItem(lv,pi->name(),CheckBox) |
15 | { | 15 | { |
16 | init(pi,s); | 16 | init(pi,s); |
17 | } | 17 | } |
18 | 18 | ||
19 | PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) | 19 | PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) |
20 | :QCheckListItem(lvi,pi->name(),CheckBox) | 20 | :QCheckListItem(lvi,pi->name(),CheckBox) |
21 | { | 21 | { |
22 | init(pi,s); | 22 | init(pi,s); |
23 | } | 23 | } |
24 | 24 | ||
25 | void PackageListItem::init( Package *pi, PackageManagerSettings *s) | 25 | void PackageListItem::init( Package *pi, PackageManagerSettings *s) |
26 | { | 26 | { |
27 | package = pi; | 27 | package = pi; |
28 | settings = s; | 28 | settings = s; |
29 | setExpandable( true ); | 29 | setExpandable( true ); |
30 | QCheckListItem *item; | 30 | QCheckListItem *item; |
31 | nameItem = new QCheckListItem( this, "" ); | 31 | nameItem = new QCheckListItem( this, "" ); |
32 | item = new QCheckListItem( this, QObject::tr("Description: ")+pi->desc() ); | ||
33 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); | 32 | item = new QCheckListItem( this, QObject::tr("Size: ")+pi->size() ); |
34 | destItem = new QCheckListItem( this, "" ); | 33 | destItem = new QCheckListItem( this, "" ); |
35 | linkItem = new QCheckListItem( this, "" ); | 34 | linkItem = new QCheckListItem( this, "" ); |
35 | QCheckListItem *otherItem = new QCheckListItem( this, QObject::tr("other") ); | ||
36 | item = new QCheckListItem( otherItem, QObject::tr("Description: ")+pi->desc() ); | ||
37 | QDict<QString> *fields = pi->getFields(); | ||
38 | QDictIterator<QString> it( *fields ); | ||
39 | while ( it.current() ) { | ||
40 | item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) ); | ||
41 | ++it; | ||
42 | } | ||
36 | displayDetails(); | 43 | displayDetails(); |
37 | 44 | ||
38 | if (!pm_uninstalled) | 45 | if (!pm_uninstalled) |
39 | { | 46 | { |
40 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); | 47 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); |
41 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); | 48 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); |
42 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); | 49 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); |
43 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); | 50 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); |
44 | } | 51 | } |
45 | } | 52 | } |
46 | 53 | ||
47 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, | 54 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, |
48 | int column, int width, int alignment ) | 55 | int column, int width, int alignment ) |
49 | { | 56 | { |
50 | if ( !p ) | 57 | if ( !p ) |
51 | return; | 58 | return; |
52 | 59 | ||
53 | p->fillRect( 0, 0, width, height(), | 60 | p->fillRect( 0, 0, width, height(), |
54 | isSelected()? cg.highlight() : cg.base() ); | 61 | isSelected()? cg.highlight() : cg.base() ); |
55 | 62 | ||
56 | if ( column != 0 ) { | 63 | if ( column != 0 ) { |
57 | // The rest is text | 64 | // The rest is text |
58 | QListViewItem::paintCell( p, cg, column, width, alignment ); | 65 | QListViewItem::paintCell( p, cg, column, width, alignment ); |
59 | return; | 66 | return; |
60 | } | 67 | } |
61 | 68 | ||
62 | QListView *lv = listView(); | 69 | QListView *lv = listView(); |
63 | if ( !lv ) | 70 | if ( !lv ) |
64 | return; | 71 | return; |
65 | int marg = lv->itemMargin(); | 72 | int marg = lv->itemMargin(); |
66 | int r = marg; | 73 | int r = marg; |
67 | 74 | ||
68 | QPixmap pm = statePixmap(); | 75 | QPixmap pm = statePixmap(); |
69 | p->drawPixmap(marg,(height()-pm.height())/2,pm); | 76 | p->drawPixmap(marg,(height()-pm.height())/2,pm); |
70 | r += pm.width()+1; | 77 | r += pm.width()+1; |
71 | 78 | ||
72 | p->translate( r, 0 ); | 79 | p->translate( r, 0 ); |
73 | QListViewItem::paintCell( p, cg, column, width - r, alignment ); | 80 | QListViewItem::paintCell( p, cg, column, width - r, alignment ); |
74 | } | 81 | } |
75 | 82 | ||
76 | 83 | ||
77 | void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, | 84 | void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, |
78 | const QRect & r ) | 85 | const QRect & r ) |
79 | { | 86 | { |
80 | // Skip QCheckListItem | 87 | // Skip QCheckListItem |
81 | // (makes you wonder what we're getting from QCheckListItem) | 88 | // (makes you wonder what we're getting from QCheckListItem) |
82 | QListViewItem::paintFocus(p,cg,r); | 89 | QListViewItem::paintFocus(p,cg,r); |
83 | } | 90 | } |