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
@@ -10,7 +10,7 @@ int 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);
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
@@ -49,11 +49,15 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
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);
@@ -67,6 +71,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
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
@@ -236,14 +241,12 @@ void MainWindow::makeMenu()
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
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
@@ -29,9 +29,11 @@ void Package::init( PackageManagerSettings *s )
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 )
@@ -128,7 +130,34 @@ QString Package::installName()
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 )
@@ -370,3 +399,30 @@ QString 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
@@ -23,9 +23,10 @@ class Package //: public QObject
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();
@@ -46,11 +47,17 @@ class Package //: public QObject
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
@@ -59,6 +66,8 @@ private:
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;
@@ -70,6 +79,7 @@ private:
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 *);
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
@@ -7,10 +7,13 @@
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"];
@@ -34,21 +37,33 @@ PackageList::~PackageList()
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 };
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
@@ -28,6 +28,8 @@ public:
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);
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
@@ -6,9 +6,13 @@
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)
@@ -46,7 +50,11 @@ void PackageListItem::init( Package *pi, PackageManagerSettings *s)
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 }
@@ -93,12 +101,25 @@ void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg,
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
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
@@ -39,12 +39,13 @@ PmIpkg::~PmIpkg()
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 ";
@@ -72,7 +73,7 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest )
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);
@@ -297,7 +298,7 @@ void PmIpkg::install()
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 {
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