summaryrefslogtreecommitdiff
authortille <tille>2002-05-04 14:09:41 (UTC)
committer tille <tille>2002-05-04 14:09:41 (UTC)
commit27f8629d4e6e16e9a33410ffe650f4a6d0bb17be (patch) (unidiff)
tree924a9449cff5d062d421f580644ea98ab8f42429
parent4eddfebd1b4f70bbfe9106a16e9a3eeb6601f653 (diff)
downloadopie-27f8629d4e6e16e9a33410ffe650f4a6d0bb17be.zip
opie-27f8629d4e6e16e9a33410ffe650f4a6d0bb17be.tar.gz
opie-27f8629d4e6e16e9a33410ffe650f4a6d0bb17be.tar.bz2
version handling
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/main.cpp2
-rw-r--r--noncore/unsupported/oipkg/mainwindow.cpp7
-rw-r--r--noncore/unsupported/oipkg/package.cpp58
-rw-r--r--noncore/unsupported/oipkg/package.h14
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp21
-rw-r--r--noncore/unsupported/oipkg/packagelist.h2
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp27
-rw-r--r--noncore/unsupported/oipkg/pmipkg.cpp9
-rw-r--r--pics/oipkg/installedOld.pngbin0 -> 197 bytes
-rw-r--r--pics/oipkg/uninstalledInstalledOld.pngbin0 -> 257 bytes
-rw-r--r--pics/oipkg/uninstalledOld.pngbin0 -> 225 bytes
-rw-r--r--pics/oipkg/uninstalledOldinstalledNew.pngbin0 -> 261 bytes
12 files changed, 124 insertions, 16 deletions
diff --git a/noncore/unsupported/oipkg/main.cpp b/noncore/unsupported/oipkg/main.cpp
index 4af11df..d98bcaa 100644
--- a/noncore/unsupported/oipkg/main.cpp
+++ b/noncore/unsupported/oipkg/main.cpp
@@ -1,24 +1,24 @@
1 1
2#include "mainwindow.h" 2#include "mainwindow.h"
3 3
4#include <qpe/qpeapplication.h> 4#include <qpe/qpeapplication.h>
5#include <qstring.h> 5#include <qstring.h>
6#include <qmessagebox.h> 6#include <qmessagebox.h>
7int debugLevel; 7int debugLevel;
8 8
9int main( int argc, char ** argv ) 9int main( int argc, char ** argv )
10{ 10{
11 11
12 debugLevel = 2; 12 debugLevel = 2;
13 if (argc > 0) 13 if (argc > 1)
14 { 14 {
15 debugLevel = QString ( argv[1] ).toInt(); 15 debugLevel = QString ( argv[1] ).toInt();
16 qDebug("setting debug level to %i",debugLevel); 16 qDebug("setting debug level to %i",debugLevel);
17 } 17 }
18 QPEApplication a( argc, argv ); 18 QPEApplication a( argc, argv );
19 MainWindow mw; 19 MainWindow mw;
20 if (argc > 2) 20 if (argc > 2)
21 QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!"); 21 QMessageBox::information( &mw, "oipkg","While ipkg is working\noipkg is hanging.\nPlease be patient!");
22 a.showMainDocumentWidget( &mw ); 22 a.showMainDocumentWidget( &mw );
23 return a.exec(); 23 return a.exec();
24} 24}
diff --git a/noncore/unsupported/oipkg/mainwindow.cpp b/noncore/unsupported/oipkg/mainwindow.cpp
index 4f6e4cc..55f915d 100644
--- a/noncore/unsupported/oipkg/mainwindow.cpp
+++ b/noncore/unsupported/oipkg/mainwindow.cpp
@@ -40,42 +40,47 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
40 setCentralWidget( listViewPackages ); 40 setCentralWidget( listViewPackages );
41 listViewPackages->addList( tr("feeds"), &packageListServers ); 41 listViewPackages->addList( tr("feeds"), &packageListServers );
42 listViewPackages->addList( tr("ipkgfind"), &packageListSearch ); 42 listViewPackages->addList( tr("ipkgfind"), &packageListSearch );
43 listViewPackages->addList( tr("documents"), &packageListDocLnk ); 43 listViewPackages->addList( tr("documents"), &packageListDocLnk );
44 //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton); 44 //wait = new QMessageBox(tr("oipkg"),tr("Please wait")//,QMessageBox::Information,QMessageBox::NoButton,QMessageBox::NoButton,QMessageBox::NoButton);
45 //wait = new QMessageBox(this); 45 //wait = new QMessageBox(this);
46 // wait->setText(tr("Please wait")); 46 // wait->setText(tr("Please wait"));
47 ipkg = new PmIpkg( settings, this ); 47 ipkg = new PmIpkg( settings, this );
48// settings->setIpkg( ipkg ); 48// settings->setIpkg( ipkg );
49 packageListServers.setSettings( settings ); 49 packageListServers.setSettings( settings );
50 packageListSearch.setSettings( settings ); 50 packageListSearch.setSettings( settings );
51 packageListDocLnk.setSettings( settings ); 51 packageListDocLnk.setSettings( settings );
52 pvDebug(9,"packageListServers.update");
52 packageListServers.update(); 53 packageListServers.update();
54 pvDebug(9,"packageListDocLnk.update");
53 packageListDocLnk.update(); 55 packageListDocLnk.update();
56 pvDebug(9,"makeMenu");
54 makeMenu(); 57 makeMenu();
55 makeChannel(); 58 makeChannel();
56 //opie is hardcoded default ;) 59 //opie is hardcoded default ;)
60 pvDebug(9,"section->setCurrentItem");
57 for (int i=0;i<section->count();i++) 61 for (int i=0;i<section->count();i++)
58 if (section->text(i)=="opie") 62 if (section->text(i)=="opie")
59 section->setCurrentItem(i); 63 section->setCurrentItem(i);
60 sectionChanged(); 64 sectionChanged();
61 65
62 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) ); 66 connect( section, SIGNAL(activated(int)), SLOT(sectionChanged()) );
63 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) ); 67 connect( subsection, SIGNAL(activated(int)), SLOT(subSectionChanged()) );
64 68
65 connect( settings->removeLinksButton, SIGNAL( clicked()), 69 connect( settings->removeLinksButton, SIGNAL( clicked()),
66 SLOT(removeLinks()) ); 70 SLOT(removeLinks()) );
67 connect( settings->createLinksButton, SIGNAL( clicked()), 71 connect( settings->createLinksButton, SIGNAL( clicked()),
68 SLOT(createLinks()) ); 72 SLOT(createLinks()) );
69 73
74 pvDebug(9,"displayList");
70 displayList(); 75 displayList();
71} 76}
72 77
73void MainWindow::makeMenu() 78void MainWindow::makeMenu()
74{ 79{
75 80
76 QPEToolBar *toolBar = new QPEToolBar( this ); 81 QPEToolBar *toolBar = new QPEToolBar( this );
77 QPEMenuBar *menuBar = new QPEMenuBar( toolBar ); 82 QPEMenuBar *menuBar = new QPEMenuBar( toolBar );
78 QPopupMenu *srvMenu = new QPopupMenu( menuBar ); 83 QPopupMenu *srvMenu = new QPopupMenu( menuBar );
79 QPopupMenu *viewMenu = new QPopupMenu( menuBar ); 84 QPopupMenu *viewMenu = new QPopupMenu( menuBar );
80 QPopupMenu *cfgMenu = new QPopupMenu( menuBar ); 85 QPopupMenu *cfgMenu = new QPopupMenu( menuBar );
81 // QPopupMenu *sectMenu = new QPopupMenu( menuBar ); 86 // QPopupMenu *sectMenu = new QPopupMenu( menuBar );
@@ -227,32 +232,30 @@ void MainWindow::makeMenu()
227 // configure the menus 232 // configure the menus
228 Config cfg( "oipkg", Config::User ); 233 Config cfg( "oipkg", Config::User );
229 cfg.setGroup( "gui" ); 234 cfg.setGroup( "gui" );
230 235
231 findShow( cfg.readBoolEntry( "findBar", true ) ); 236 findShow( cfg.readBoolEntry( "findBar", true ) );
232 searchShow( cfg.readBoolEntry( "searchBar", true ) ); 237 searchShow( cfg.readBoolEntry( "searchBar", true ) );
233 sectionShow( cfg.readBoolEntry( "sectionBar", true ) ); 238 sectionShow( cfg.readBoolEntry( "sectionBar", true ) );
234 destShow( cfg.readBoolEntry( "destBar", false ) ); 239 destShow( cfg.readBoolEntry( "destBar", false ) );
235} 240}
236 241
237MainWindow::~MainWindow() 242MainWindow::~MainWindow()
238{ 243{
239 pvDebug(7,"MainWindow::~MainWindow ");
240 Config cfg( "oipkg", Config::User ); 244 Config cfg( "oipkg", Config::User );
241 cfg.setGroup( "gui" ); 245 cfg.setGroup( "gui" );
242 cfg.writeEntry( "findBar", !findBar->isHidden() ); 246 cfg.writeEntry( "findBar", !findBar->isHidden() );
243 cfg.writeEntry( "searchBar", !searchBar->isHidden() ); 247 cfg.writeEntry( "searchBar", !searchBar->isHidden() );
244 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() ); 248 cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
245 cfg.writeEntry( "destBar", !destBar->isHidden() ); 249 cfg.writeEntry( "destBar", !destBar->isHidden() );
246 pvDebug(7,"MainWindow::~MainWindow ");
247 250
248} 251}
249 252
250void MainWindow::runIpkg() 253void MainWindow::runIpkg()
251{ 254{
252 packageListServers.allPackages(); 255 packageListServers.allPackages();
253 ipkg->loadList( &packageListSearch ); 256 ipkg->loadList( &packageListSearch );
254 ipkg->loadList( &packageListDocLnk ); 257 ipkg->loadList( &packageListDocLnk );
255 ipkg->loadList( &packageListServers ); 258 ipkg->loadList( &packageListServers );
256 ipkg->commit(); 259 ipkg->commit();
257 // ##### If we looked in the list of files, we could send out accurate 260 // ##### If we looked in the list of files, we could send out accurate
258 // ##### messages. But we don't bother yet, and just do an "all". 261 // ##### messages. But we don't bother yet, and just do an "all".
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index 9280d89..c947c64 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -20,27 +20,29 @@ Package::Package( PackageManagerSettings *s )
20 20
21void Package::init( PackageManagerSettings *s ) 21void Package::init( PackageManagerSettings *s )
22{ 22{
23 settings = s; 23 settings = s;
24 _size = ""; 24 _size = "";
25 _section = ""; 25 _section = "";
26 _subsection = ""; 26 _subsection = "";
27 _shortDesc = ""; 27 _shortDesc = "";
28 _desc = ""; 28 _desc = "";
29 _name = ""; 29 _name = "";
30 _toProcess = false; 30 _toProcess = false;
31 _useFileName = false; 31 _useFileName = false;
32 _old = false;
32 _status = ""; 33 _status = "";
33 _dest = settings->getDestinationName(); 34 _dest = settings->getDestinationName();
34 _link = settings->createLinks(); 35 _link = settings->createLinks();
36 _versions=0;
35} 37}
36 38
37Package::Package( QStringList pack, PackageManagerSettings *s ) 39Package::Package( QStringList pack, PackageManagerSettings *s )
38 { 40 {
39 init(s); 41 init(s);
40 parsePackage( pack ); 42 parsePackage( pack );
41} 43}
42 44
43Package::Package( QString n, PackageManagerSettings *s ) 45Package::Package( QString n, PackageManagerSettings *s )
44 { 46 {
45 init(s); 47 init(s);
46 if ( !QFile::exists( n ) ) 48 if ( !QFile::exists( n ) )
@@ -119,25 +121,52 @@ QString Package::name()
119 else return _displayName; 121 else return _displayName;
120} 122}
121 123
122 124
123QString Package::installName() 125QString Package::installName()
124{ 126{
125 if (_useFileName) return _fileName; 127 if (_useFileName) return _fileName;
126 else return _name; 128 else return _name;
127} 129}
128 130
129bool Package::installed() 131bool Package::installed()
130{ 132{
131 return _status.contains("installed"); 133 if (_status.contains("installed")) return true;
134 else
135 if (_versions)
136 {
137 QDictIterator<Package> other( *_versions );
138 while ( other.current() )
139 {
140 if (other.current()->status().contains("installed")
141 && other.current()->version() == version())
142 return true;
143 ++other;
144 }
145 }
146 return false;
147}
148
149bool Package::otherInstalled()
150{
151 if (_versions)
152 {
153 QDictIterator<Package> other( *_versions );
154 while ( other.current() )
155 {
156 if (other.current()->installed()) return true;
157 ++other;
158 }
159 }
160 return false;
132} 161}
133 162
134void Package::setDesc( QString s ) 163void Package::setDesc( QString s )
135{ 164{
136 _desc = s; 165 _desc = s;
137 _shortDesc = s.left( s.find("\n") ); 166 _shortDesc = s.left( s.find("\n") );
138} 167}
139 168
140QString Package::desc() 169QString Package::desc()
141{ 170{
142 return _desc; 171 return _desc;
143} 172}
@@ -361,12 +390,39 @@ void Package::setName(QString n)
361 _displayName = n; 390 _displayName = n;
362} 391}
363 392
364QDict<QString>* Package::getFields() 393QDict<QString>* Package::getFields()
365{ 394{
366 return &_values; 395 return &_values;
367} 396}
368 397
369QString Package::status() 398QString Package::status()
370{ 399{
371 return _status; 400 return _status;
372} 401}
402
403bool Package::isOld()
404{
405 if (!_versions) return false;
406 QDictIterator<Package> other( *_versions );
407 while ( other.current() ) {
408 if (other.current()->version() > version() ) return true;
409 ++other;
410 }
411 return false;
412}
413
414bool Package::hasVersions()
415{
416 if (!_versions) return false;
417 else return true;
418}
419
420QDict<Package>* Package::getOtherVersions()
421{
422 return _versions;
423}
424
425void Package::setOtherVersions(QDict<Package> *v)
426{
427 _versions=v;
428}
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h
index 257d9c7..68090dc 100644
--- a/noncore/unsupported/oipkg/package.h
+++ b/noncore/unsupported/oipkg/package.h
@@ -14,66 +14,76 @@ 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 bool otherInstalled();
29 30
30 void setDesc( QString ); 31 void setDesc( QString );
31 QString shortDesc(); 32 QString shortDesc();
32 QString desc(); 33 QString desc();
33 QString size(); 34 QString size();
34 QString sizeUnits(); 35 QString sizeUnits();
35 QString version(); 36 QString version();
36 void setSection( QString ); 37 void setSection( QString );
37 QString section(); 38 QString section();
38 QString subSection(); 39 QString subSection();
39 QString details(); 40 QString details();
40 bool toProcess(); 41 bool toProcess();
41 bool toInstall(); 42 bool toInstall();
42 bool toRemove(); 43 bool toRemove();
43 void processed(); 44 void processed();
44 QString dest(); 45 QString dest();
45 void setDest( QString d ); 46 void setDest( QString d );
46 void setOn(); 47 void setOn();
47 bool link(); 48 bool link();
48 void setLink(bool); 49 void setLink(bool);
50 bool isOld();
51 bool hasVersions();
49 void parseIpkgFile( QString ); 52 void parseIpkgFile( QString );
50 void instalFromFile(bool iff=true); 53 void instalFromFile(bool iff=true);
51 void setName(QString); 54 void setName(QString);
52 QDict<QString>* getFields(); 55 QDict<QString>* getFields();
53 QString status(); 56 QString status();
57
58 QDict<Package>* getOtherVersions();
59 void setOtherVersions(QDict<Package>*);
60
54public slots: 61public slots:
55 void toggleProcess(); 62 void toggleProcess();
56 63
57private: 64private:
58 PackageManagerSettings *settings; 65 PackageManagerSettings *settings;
59 QString _displayName; 66 QString _displayName;
60 QString _name; 67 QString _name;
61 QString _fileName; 68 QString _fileName;
69 bool _old;
70 bool _hasVersions;
62 bool _toProcess; 71 bool _toProcess;
63 bool _link; 72 bool _link;
64 QString _status; 73 QString _status;
65 QString _size; 74 QString _size;
66 QString _section; 75 QString _section;
67 QString _subsection; 76 QString _subsection;
68 QString _shortDesc; 77 QString _shortDesc;
69 QString _desc; 78 QString _desc;
70 QString _version; 79 QString _version;
71 QString _dest; 80 QString _dest;
72 QDict<QString> _values; 81 QDict<QString> _values;
82 QDict<Package> *_versions;
73 bool _useFileName; 83 bool _useFileName;
74 void parsePackage( QStringList ); 84 void parsePackage( QStringList );
75 void init(PackageManagerSettings *); 85 void init(PackageManagerSettings *);
76}; 86};
77 87
78 88
79#endif 89#endif
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index be20c71..2fc4c41 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -1,63 +1,78 @@
1#include "packagelist.h" 1#include "packagelist.h"
2 2
3#include <assert.h> 3#include <assert.h>
4#include <qfile.h> 4#include <qfile.h>
5#include <qfileinfo.h> 5#include <qfileinfo.h>
6#include <qtextstream.h> 6#include <qtextstream.h>
7 7
8#include "debug.h" 8#include "debug.h"
9 9
10static QDict<Package> *packageListAll;
11
10PackageList::PackageList() 12PackageList::PackageList()
11 : packageIter( packageList ) 13 : packageIter( packageList )
12{ 14{
13 empty=true; 15 empty=true;
16 if (!packageListAll) packageListAll = new QDict<Package>();
14 sections << "All"; 17 sections << "All";
15 subSections.insert("All", new QStringList() ); 18 subSections.insert("All", new QStringList() );
16 QStringList *ss = subSections["All"]; 19 QStringList *ss = subSections["All"];
17 *ss << "All"; 20 *ss << "All";
18 aktSection = "All"; 21 aktSection = "All";
19 aktSubSection = "All"; 22 aktSubSection = "All";
20} 23}
21 24
22PackageList::PackageList( PackageManagerSettings* s) 25PackageList::PackageList( PackageManagerSettings* s)
23 : packageIter( packageList ) 26 : packageIter( packageList )
24{ 27{
25 settings = s; 28 settings = s;
26 PackageList(); 29 PackageList();
27} 30}
28 31
29PackageList::~PackageList() 32PackageList::~PackageList()
30{ 33{
31} 34}
32 35
33/** Inserts a package into the list */ 36/** Inserts a package into the list */
34void PackageList::insertPackage( Package* pack ) 37void PackageList::insertPackage( Package* pack )
35{ 38{
36 if (!pack) return; 39 if (!pack) return;
37 Package* p = packageList.find( pack->name() ); 40 Package* p = packageListAll->find( pack->name() );
38 if ( p ) 41 if ( p )
39 { 42 {
40 if ( p->version() == pack->version() ) 43 if ( (p->version() == pack->version())
44 && (p->dest() == pack->dest()) )
41 { 45 {
42 p->copyValues( pack ); 46 p->copyValues( pack );
43 delete pack; 47 delete pack;
44 pack = p; 48 pack = p;
45 } else { 49 } else {
46 p->setName( pack->name()+"["+p->version()+"]" ); 50 QDict<Package> *packver = p->getOtherVersions();
51 // p->setName( pack->name()+"["+p->version()+"]" );
52 if (!packver)
53 {
54 packver = new QDict<Package>;
55 packver->insert( pack->name(), p );
56 p->setOtherVersions( packver );
57 }
47 pack->setName( pack->name()+"["+pack->version()+"]" ); 58 pack->setName( pack->name()+"["+pack->version()+"]" );
59 pack->setOtherVersions( packver );
60 packver->insert( pack->name(), pack );
61 packageListAll->insert( pack->name(), pack );
48 packageList.insert( pack->name(), pack ); 62 packageList.insert( pack->name(), pack );
49 origPackageList.insert( pack->name(), pack ); 63 origPackageList.insert( pack->name(), pack );
50 } 64 }
51 }else{ 65 }else{
66 packageListAll->insert( pack->name(), pack );
52 packageList.insert( pack->name(), pack ); 67 packageList.insert( pack->name(), pack );
53 origPackageList.insert( pack->name(), pack ); 68 origPackageList.insert( pack->name(), pack );
54 }; 69 };
55 empty=false; 70 empty=false;
56 updateSections( pack ); 71 updateSections( pack );
57} 72}
58 73
59void PackageList::filterPackages( QString f ) 74void PackageList::filterPackages( QString f )
60 { 75 {
61 packageList.clear(); 76 packageList.clear();
62 QDictIterator<Package> filterIter( origPackageList ); 77 QDictIterator<Package> filterIter( origPackageList );
63 filterIter.toFirst(); 78 filterIter.toFirst();
diff --git a/noncore/unsupported/oipkg/packagelist.h b/noncore/unsupported/oipkg/packagelist.h
index acea3b9..d0f8897 100644
--- a/noncore/unsupported/oipkg/packagelist.h
+++ b/noncore/unsupported/oipkg/packagelist.h
@@ -19,24 +19,26 @@ public:
19 Package* find( QString ); 19 Package* find( QString );
20 Package* next(); 20 Package* next();
21 Package* first(); 21 Package* first();
22 22
23 QStringList getSections(); 23 QStringList getSections();
24 QStringList getSubSections(); 24 QStringList getSubSections();
25 void setSettings( PackageManagerSettings* ); 25 void setSettings( PackageManagerSettings* );
26 void filterPackages( QString ); 26 void filterPackages( QString );
27 Package* getByName( QString ); 27 Package* getByName( QString );
28 void clear(); 28 void clear();
29 void allPackages(); 29 void allPackages();
30 30
31 QDict<Package> *versions;
32
31public slots: 33public slots:
32 void setSection(QString); 34 void setSection(QString);
33 void setSubSection(QString); 35 void setSubSection(QString);
34 // virtual void update(); 36 // virtual void update();
35 37
36protected: 38protected:
37 int currentPackage; 39 int currentPackage;
38 int packageCount; 40 int packageCount;
39 41
40 PackageManagerSettings *settings; 42 PackageManagerSettings *settings;
41 QDict<Package> packageList; 43 QDict<Package> packageList;
42 QDict<Package> origPackageList; 44 QDict<Package> origPackageList;
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
8static QPixmap *pm_uninstalled=0; 8static QPixmap *pm_uninstalled=0;
9static QPixmap *pm_uninstalled_old=0;
9static QPixmap *pm_installed=0; 10static QPixmap *pm_installed=0;
11static QPixmap *pm_installed_old=0;
10static QPixmap *pm_uninstall=0; 12static QPixmap *pm_uninstall=0;
11static QPixmap *pm_install=0; 13static QPixmap *pm_install=0;
14static QPixmap *pm_uninstalled_old_installed_new=0;
15static QPixmap *pm_uninstalled_installed_old=0;
12 16
13PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s) 17PackageListItem::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
19PackageListItem::PackageListItem(QListViewItem *lvi, Package *pi, PackageManagerSettings *s) 23PackageListItem::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
55void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg, 63void 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
85void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg, 93void 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
93QPixmap PackageListItem::statePixmap() const 101QPixmap 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
109QString PackageListItem::key( int column, bool ascending ) const 130QString 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();
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp
index 0ae74da..5996e63 100644
--- a/noncore/unsupported/oipkg/pmipkg.cpp
+++ b/noncore/unsupported/oipkg/pmipkg.cpp
@@ -30,30 +30,31 @@ PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlag
30 : QObject ( p ) 30 : QObject ( p )
31{ 31{
32 settings = s; 32 settings = s;
33 runwindow = new RunWindow( p, name, true, f ); 33 runwindow = new RunWindow( p, name, true, f );
34} 34}
35 35
36PmIpkg::~PmIpkg() 36PmIpkg::~PmIpkg()
37{ 37{
38} 38}
39 39
40//#define PROC 40//#define PROC
41#define SYSTEM 41#define SYSTEM
42#define QT_QPROCESS_DEBUG
42int PmIpkg::runIpkg(const QString& args, const QString& dest ) 43int PmIpkg::runIpkg(const QString& args, const QString& dest )
43{ 44{
44 pvDebug(2,"PmIpkg::runIpkg "+args); 45 pvDebug(2,"PmIpkg::runIpkg "+args);
45 46 QDir::setCurrent("/tmp");
46#ifdef PROC 47#ifdef PROC
47 QStringList cmd = "ipkg "; 48 QString cmd;
48#endif 49#endif
49#ifdef SYSTEM 50#ifdef SYSTEM
50 QString cmd = "/usr/bin/ipkg "; 51 QString cmd = "/usr/bin/ipkg ";
51#endif 52#endif
52 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); 53 pvDebug( 3,"PmIpkg::runIpkg got dest="+dest);
53 if ( dest == "" ) 54 if ( dest == "" )
54 cmd += " -dest "+settings->getDestinationName(); 55 cmd += " -dest "+settings->getDestinationName();
55 else 56 else
56 cmd += " -dest "+ dest; 57 cmd += " -dest "+ dest;
57 58
58 cmd += " -force-defaults "; 59 cmd += " -force-defaults ";
59 60
@@ -63,25 +64,25 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest )
63 cmd += " -force-depends "; 64 cmd += " -force-depends ";
64 if (installDialog->_force_reinstall->isChecked()) 65 if (installDialog->_force_reinstall->isChecked())
65 cmd += " -force-reinstall "; 66 cmd += " -force-reinstall ";
66 if (installDialog->_force_remove->isChecked()) 67 if (installDialog->_force_remove->isChecked())
67 cmd += " -force-removal-of-essential-packages "; 68 cmd += " -force-removal-of-essential-packages ";
68 } 69 }
69 70
70 out( "<hr><br>Starting to "+ args+"<br>\n"); 71 out( "<hr><br>Starting to "+ args+"<br>\n");
71 cmd += args; 72 cmd += args;
72 int r = 0; 73 int r = 0;
73#ifdef PROC 74#ifdef PROC
74 QString o = "start"; 75 QString o = "start";
75 Process *ipkg = new Process( cmd ); 76 Process *ipkg = new Process(QStringList() << "ipkg" << cmd );
76 out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); 77 out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" );
77 QString description; 78 QString description;
78 r = ipkg->exec("",o); 79 r = ipkg->exec("",o);
79 out( o ); 80 out( o );
80#endif 81#endif
81#ifdef SYSTEM 82#ifdef SYSTEM
82 out( "running:<br>\n"+cmd+"<br>\n" ); 83 out( "running:<br>\n"+cmd+"<br>\n" );
83 QString redirect = "/tmp/oipkg.pipe"; 84 QString redirect = "/tmp/oipkg.pipe";
84 cmd += " 2>&1 | tee "+redirect+" 2>&1"; 85 cmd += " 2>&1 | tee "+redirect+" 2>&1";
85 pvDebug(2, "running >"+cmd+"<"); 86 pvDebug(2, "running >"+cmd+"<");
86 r = system(cmd.latin1()); 87 r = system(cmd.latin1());
87 QFile f( redirect ); 88 QFile f( redirect );
@@ -288,25 +289,25 @@ void PmIpkg::remove()
288 out("<br>"); 289 out("<br>");
289} 290}
290 291
291 292
292void PmIpkg::install() 293void PmIpkg::install()
293{ 294{
294 if ( to_install.count() == 0 ) return; 295 if ( to_install.count() == 0 ) return;
295 out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>"); 296 out("<b>"+tr("Installing")+"<br>"+tr("please wait")+"</b><br>");
296 for (uint i=0; i < to_install.count(); i++) 297 for (uint i=0; i < to_install.count(); i++)
297 { 298 {
298 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ) == 0 ) 299 if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ) == 0 )
299 { 300 {
300 runwindow->progress->setProgress( to_install.at(i)->size().toInt() ); 301 runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress());
301 linkOpp = createLink; 302 linkOpp = createLink;
302 if ( to_install.at(i)->link() ) 303 if ( to_install.at(i)->link() )
303 { 304 {
304 out( "<br>creating links<br>" ); 305 out( "<br>creating links<br>" );
305 out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"<br>" ); 306 out( "for package "+to_install.at(i)->name()+" in "+to_install.at(i)->dest()+"<br>" );
306 makeLinks( to_install.at(i) ); 307 makeLinks( to_install.at(i) );
307 } 308 }
308 to_install.at(i)->processed(); 309 to_install.at(i)->processed();
309 to_install.take( i ); 310 to_install.take( i );
310 out("<br><hr>"); 311 out("<br><hr>");
311 }else{ 312 }else{
312 out("<b>"+tr("Error while installing")+"</b><hr>"+to_install.at(i)->name()); 313 out("<b>"+tr("Error while installing")+"</b><hr>"+to_install.at(i)->name());
diff --git a/pics/oipkg/installedOld.png b/pics/oipkg/installedOld.png
new file mode 100644
index 0000000..8a042fc
--- a/dev/null
+++ b/pics/oipkg/installedOld.png
Binary files differ
diff --git a/pics/oipkg/uninstalledInstalledOld.png b/pics/oipkg/uninstalledInstalledOld.png
new file mode 100644
index 0000000..f369c63
--- a/dev/null
+++ b/pics/oipkg/uninstalledInstalledOld.png
Binary files differ
diff --git a/pics/oipkg/uninstalledOld.png b/pics/oipkg/uninstalledOld.png
new file mode 100644
index 0000000..5dce3ea
--- a/dev/null
+++ b/pics/oipkg/uninstalledOld.png
Binary files differ
diff --git a/pics/oipkg/uninstalledOldinstalledNew.png b/pics/oipkg/uninstalledOldinstalledNew.png
new file mode 100644
index 0000000..3bfe126
--- a/dev/null
+++ b/pics/oipkg/uninstalledOldinstalledNew.png
Binary files differ