author | tille <tille> | 2002-05-04 14:09:41 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-04 14:09:41 (UTC) |
commit | 27f8629d4e6e16e9a33410ffe650f4a6d0bb17be (patch) (unidiff) | |
tree | 924a9449cff5d062d421f580644ea98ab8f42429 /noncore/unsupported | |
parent | 4eddfebd1b4f70bbfe9106a16e9a3eeb6601f653 (diff) | |
download | opie-27f8629d4e6e16e9a33410ffe650f4a6d0bb17be.zip opie-27f8629d4e6e16e9a33410ffe650f4a6d0bb17be.tar.gz opie-27f8629d4e6e16e9a33410ffe650f4a6d0bb17be.tar.bz2 |
version handling
-rw-r--r-- | noncore/unsupported/oipkg/main.cpp | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/mainwindow.cpp | 7 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.cpp | 58 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/package.h | 14 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 21 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.h | 2 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/packagelistitem.cpp | 27 | ||||
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 9 |
8 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 | |||
@@ -12,3 +12,3 @@ int main( int argc, char ** argv ) | |||
12 | debugLevel = 2; | 12 | debugLevel = 2; |
13 | if (argc > 0) | 13 | if (argc > 1) |
14 | { | 14 | { |
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 | |||
@@ -51,4 +51,7 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
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(); |
@@ -56,2 +59,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
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++) |
@@ -69,2 +73,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : | |||
69 | 73 | ||
74 | pvDebug(9,"displayList"); | ||
70 | displayList(); | 75 | displayList(); |
@@ -238,3 +243,2 @@ MainWindow::~MainWindow() | |||
238 | { | 243 | { |
239 | pvDebug(7,"MainWindow::~MainWindow "); | ||
240 | Config cfg( "oipkg", Config::User ); | 244 | Config cfg( "oipkg", Config::User ); |
@@ -245,3 +249,2 @@ MainWindow::~MainWindow() | |||
245 | cfg.writeEntry( "destBar", !destBar->isHidden() ); | 249 | cfg.writeEntry( "destBar", !destBar->isHidden() ); |
246 | pvDebug(7,"MainWindow::~MainWindow "); | ||
247 | 250 | ||
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 | |||
@@ -31,2 +31,3 @@ void Package::init( PackageManagerSettings *s ) | |||
31 | _useFileName = false; | 31 | _useFileName = false; |
32 | _old = false; | ||
32 | _status = ""; | 33 | _status = ""; |
@@ -34,2 +35,3 @@ void Package::init( PackageManagerSettings *s ) | |||
34 | _link = settings->createLinks(); | 35 | _link = settings->createLinks(); |
36 | _versions=0; | ||
35 | } | 37 | } |
@@ -130,3 +132,30 @@ bool 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 | |||
149 | bool 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 | } |
@@ -372 +401,28 @@ QString Package::status() | |||
372 | } | 401 | } |
402 | |||
403 | bool 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 | |||
414 | bool Package::hasVersions() | ||
415 | { | ||
416 | if (!_versions) return false; | ||
417 | else return true; | ||
418 | } | ||
419 | |||
420 | QDict<Package>* Package::getOtherVersions() | ||
421 | { | ||
422 | return _versions; | ||
423 | } | ||
424 | |||
425 | void 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 | |||
@@ -25,5 +25,6 @@ class Package //: public QObject | |||
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 | ||
@@ -48,2 +49,4 @@ class Package //: public QObject | |||
48 | void setLink(bool); | 49 | void setLink(bool); |
50 | bool isOld(); | ||
51 | bool hasVersions(); | ||
49 | void parseIpkgFile( QString ); | 52 | void parseIpkgFile( QString ); |
@@ -53,2 +56,6 @@ class Package //: public QObject | |||
53 | QString status(); | 56 | QString status(); |
57 | |||
58 | QDict<Package>* getOtherVersions(); | ||
59 | void setOtherVersions(QDict<Package>*); | ||
60 | |||
54 | public slots: | 61 | public slots: |
@@ -61,2 +68,4 @@ private: | |||
61 | QString _fileName; | 68 | QString _fileName; |
69 | bool _old; | ||
70 | bool _hasVersions; | ||
62 | bool _toProcess; | 71 | bool _toProcess; |
@@ -72,2 +81,3 @@ private: | |||
72 | QDict<QString> _values; | 81 | QDict<QString> _values; |
82 | QDict<Package> *_versions; | ||
73 | bool _useFileName; | 83 | bool _useFileName; |
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 | |||
@@ -9,2 +9,4 @@ | |||
9 | 9 | ||
10 | static QDict<Package> *packageListAll; | ||
11 | |||
10 | PackageList::PackageList() | 12 | PackageList::PackageList() |
@@ -13,2 +15,3 @@ PackageList::PackageList() | |||
13 | empty=true; | 15 | empty=true; |
16 | if (!packageListAll) packageListAll = new QDict<Package>(); | ||
14 | sections << "All"; | 17 | sections << "All"; |
@@ -36,6 +39,7 @@ void PackageList::insertPackage( Package* pack ) | |||
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 | { |
@@ -45,4 +49,14 @@ void PackageList::insertPackage( Package* pack ) | |||
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 ); |
@@ -51,2 +65,3 @@ void PackageList::insertPackage( Package* pack ) | |||
51 | }else{ | 65 | }else{ |
66 | packageListAll->insert( pack->name(), pack ); | ||
52 | packageList.insert( pack->name(), pack ); | 67 | packageList.insert( pack->name(), pack ); |
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 | |||
@@ -30,2 +30,4 @@ public: | |||
30 | 30 | ||
31 | QDict<Package> *versions; | ||
32 | |||
31 | public slots: | 33 | public slots: |
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 | |||
@@ -8,5 +8,9 @@ | |||
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 | ||
@@ -48,3 +52,7 @@ void PackageListItem::init( Package *pi, PackageManagerSettings *s) | |||
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")); |
@@ -95,8 +103,21 @@ QPixmap PackageListItem::statePixmap() const | |||
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 ) |
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 | |||
@@ -41,2 +41,3 @@ PmIpkg::~PmIpkg() | |||
41 | #define SYSTEM | 41 | #define SYSTEM |
42 | #define QT_QPROCESS_DEBUG | ||
42 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) | 43 | int PmIpkg::runIpkg(const QString& args, const QString& dest ) |
@@ -44,5 +45,5 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
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 |
@@ -74,3 +75,3 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) | |||
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" ); |
@@ -299,3 +300,3 @@ void PmIpkg::install() | |||
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; |