Diffstat (limited to 'noncore/unsupported/oipkg/packagelistitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp index 45aaf1d..c743a49 100644 --- a/noncore/unsupported/oipkg/packagelistitem.cpp +++ b/noncore/unsupported/oipkg/packagelistitem.cpp | |||
@@ -1,23 +1,27 @@ | |||
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_uninstalled_old=0; | ||
9 | static QPixmap *pm_installed=0; | 10 | static QPixmap *pm_installed=0; |
11 | static QPixmap *pm_installed_old=0; | ||
10 | static QPixmap *pm_uninstall=0; | 12 | static QPixmap *pm_uninstall=0; |
11 | static QPixmap *pm_install=0; | 13 | static QPixmap *pm_install=0; |
14 | static QPixmap *pm_uninstalled_old_installed_new=0; | ||
15 | static QPixmap *pm_uninstalled_installed_old=0; | ||
12 | 16 | ||
13 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) | 17 | PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) |
14 | :QCheckListItem(lv,pi->name(),CheckBox) | 18 | :QCheckListItem(lv,pi->name(),CheckBox) |
15 | { | 19 | { |
16 | init(pi,s); | 20 | init(pi,s); |
17 | } | 21 | } |
18 | 22 | ||
19 | PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) | 23 | PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) |
20 | :QCheckListItem(lvi,pi->name(),CheckBox) | 24 | :QCheckListItem(lvi,pi->name(),CheckBox) |
21 | { | 25 | { |
22 | init(pi,s); | 26 | init(pi,s); |
23 | } | 27 | } |
@@ -37,25 +41,29 @@ void PackageListItem::init( Package *pi, PackageManagerSettings *s) | |||
37 | item = new QCheckListItem( otherItem, QObject::tr("Description: ")+pi->desc() ); | 41 | item = new QCheckListItem( otherItem, QObject::tr("Description: ")+pi->desc() ); |
38 | QDict<QString> *fields = pi->getFields(); | 42 | QDict<QString> *fields = pi->getFields(); |
39 | QDictIterator<QString> it( *fields ); | 43 | QDictIterator<QString> it( *fields ); |
40 | while ( it.current() ) { | 44 | while ( it.current() ) { |
41 | item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) ); | 45 | item = new QCheckListItem( otherItem, QString(it.currentKey()+": "+*it.current()) ); |
42 | ++it; | 46 | ++it; |
43 | } | 47 | } |
44 | displayDetails(); | 48 | displayDetails(); |
45 | 49 | ||
46 | if (!pm_uninstalled) | 50 | if (!pm_uninstalled) |
47 | { | 51 | { |
48 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); | 52 | pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); |
53 | pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld")); | ||
54 | pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew")); | ||
55 | pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld")); | ||
49 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); | 56 | pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); |
57 | pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld")); | ||
50 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); | 58 | pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); |
51 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); | 59 | pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall")); |
52 | } | 60 | } |
53 | } | 61 | } |
54 | 62 | ||
55 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, | 63 | void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, |
56 | int column, int width, int alignment ) | 64 | int column, int width, int alignment ) |
57 | { | 65 | { |
58 | if ( !p ) | 66 | if ( !p ) |
59 | return; | 67 | return; |
60 | 68 | ||
61 | p->fillRect( 0, 0, width, height(), | 69 | p->fillRect( 0, 0, width, height(), |
@@ -84,30 +92,43 @@ void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, | |||
84 | 92 | ||
85 | void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, | 93 | void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, |
86 | const QRect & r ) | 94 | const QRect & r ) |
87 | { | 95 | { |
88 | // Skip QCheckListItem | 96 | // Skip QCheckListItem |
89 | // (makes you wonder what we're getting from QCheckListItem) | 97 | // (makes you wonder what we're getting from QCheckListItem) |
90 | QListViewItem::paintFocus(p,cg,r); | 98 | QListViewItem::paintFocus(p,cg,r); |
91 | } | 99 | } |
92 | 100 | ||
93 | QPixmap PackageListItem::statePixmap() const | 101 | QPixmap PackageListItem::statePixmap() const |
94 | { | 102 | { |
95 | bool installed = package->installed(); | 103 | bool installed = package->installed(); |
104 | bool old = package->isOld(); | ||
105 | bool versions = package->hasVersions(); | ||
106 | bool verinstalled = package->otherInstalled(); | ||
96 | if ( !package->toProcess() ) { | 107 | if ( !package->toProcess() ) { |
97 | if ( !installed ) | 108 | if ( !installed ) |
98 | return *pm_uninstalled; | 109 | if (old) |
110 | { | ||
111 | if (verinstalled) return *pm_uninstalled_old_installed_new; | ||
112 | else return *pm_uninstalled_old; | ||
113 | } | ||
114 | else | ||
115 | { | ||
116 | if (verinstalled) return *pm_uninstalled_installed_old; | ||
117 | else return *pm_uninstalled; | ||
118 | } | ||
99 | else | 119 | else |
100 | return *pm_installed; | 120 | if (old) return *pm_installed_old; |
101 | } else { | 121 | else return *pm_installed; |
122 | } else { //toProcess() == true | ||
102 | if ( !installed ) | 123 | if ( !installed ) |
103 | return *pm_install; | 124 | return *pm_install; |
104 | else | 125 | else |
105 | return *pm_uninstall; | 126 | return *pm_uninstall; |
106 | } | 127 | } |
107 | } | 128 | } |
108 | 129 | ||
109 | QString PackageListItem::key( int column, bool ascending ) const | 130 | QString PackageListItem::key( int column, bool ascending ) const |
110 | { | 131 | { |
111 | if ( column == 2 ) { | 132 | if ( column == 2 ) { |
112 | QString t = text(2); | 133 | QString t = text(2); |
113 | double bytes=t.toDouble(); | 134 | double bytes=t.toDouble(); |