author | tille <tille> | 2002-05-04 14:09:41 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-04 14:09:41 (UTC) |
commit | 27f8629d4e6e16e9a33410ffe650f4a6d0bb17be (patch) (side-by-side diff) | |
tree | 924a9449cff5d062d421f580644ea98ab8f42429 | |
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 | ||||
-rw-r--r-- | pics/oipkg/installedOld.png | bin | 0 -> 197 bytes | |||
-rw-r--r-- | pics/oipkg/uninstalledInstalledOld.png | bin | 0 -> 257 bytes | |||
-rw-r--r-- | pics/oipkg/uninstalledOld.png | bin | 0 -> 225 bytes | |||
-rw-r--r-- | pics/oipkg/uninstalledOldinstalledNew.png | bin | 0 -> 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 @@ -12,3 +12,3 @@ int main( int argc, char ** argv ) debugLevel = 2; - if (argc > 0) + if (argc > 1) { 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 ) : packageListDocLnk.setSettings( settings ); + pvDebug(9,"packageListServers.update"); packageListServers.update(); + pvDebug(9,"packageListDocLnk.update"); packageListDocLnk.update(); + pvDebug(9,"makeMenu"); makeMenu(); @@ -56,2 +59,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : //opie is hardcoded default ;) + pvDebug(9,"section->setCurrentItem"); for (int i=0;i<section->count();i++) @@ -69,2 +73,3 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) : + pvDebug(9,"displayList"); displayList(); @@ -238,3 +243,2 @@ MainWindow::~MainWindow() { - pvDebug(7,"MainWindow::~MainWindow "); Config cfg( "oipkg", Config::User ); @@ -245,3 +249,2 @@ MainWindow::~MainWindow() cfg.writeEntry( "destBar", !destBar->isHidden() ); - pvDebug(7,"MainWindow::~MainWindow "); 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 ) _useFileName = false; + _old = false; _status = ""; @@ -34,2 +35,3 @@ void Package::init( PackageManagerSettings *s ) _link = settings->createLinks(); + _versions=0; } @@ -130,3 +132,30 @@ bool Package::installed() { - return _status.contains("installed"); + if (_status.contains("installed")) return true; + else + if (_versions) + { + QDictIterator<Package> other( *_versions ); + while ( other.current() ) + { + if (other.current()->status().contains("installed") + && other.current()->version() == version()) + return true; + ++other; + } + } + return false; +} + +bool Package::otherInstalled() +{ + if (_versions) + { + QDictIterator<Package> other( *_versions ); + while ( other.current() ) + { + if (other.current()->installed()) return true; + ++other; + } + } + return false; } @@ -372 +401,28 @@ QString Package::status() } + +bool Package::isOld() +{ + if (!_versions) return false; + QDictIterator<Package> other( *_versions ); + while ( other.current() ) { + if (other.current()->version() > version() ) return true; + ++other; + } + return false; +} + +bool Package::hasVersions() +{ + if (!_versions) return false; + else return true; +} + +QDict<Package>* Package::getOtherVersions() +{ + return _versions; +} + +void Package::setOtherVersions(QDict<Package> *v) +{ + _versions=v; +} 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 - QString name() ; - QString installName() ; + QString name(); + QString installName(); bool installed(); + bool otherInstalled(); @@ -48,2 +49,4 @@ class Package //: public QObject void setLink(bool); + bool isOld(); + bool hasVersions(); void parseIpkgFile( QString ); @@ -53,2 +56,6 @@ class Package //: public QObject QString status(); + + QDict<Package>* getOtherVersions(); + void setOtherVersions(QDict<Package>*); + public slots: @@ -61,2 +68,4 @@ private: QString _fileName; + bool _old; + bool _hasVersions; bool _toProcess; @@ -72,2 +81,3 @@ private: QDict<QString> _values; + QDict<Package> *_versions; 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 @@ +static QDict<Package> *packageListAll; + PackageList::PackageList() @@ -13,2 +15,3 @@ PackageList::PackageList() empty=true; + if (!packageListAll) packageListAll = new QDict<Package>(); sections << "All"; @@ -36,6 +39,7 @@ void PackageList::insertPackage( Package* pack ) if (!pack) return; - Package* p = packageList.find( pack->name() ); + Package* p = packageListAll->find( pack->name() ); if ( p ) { - if ( p->version() == pack->version() ) + if ( (p->version() == pack->version()) + && (p->dest() == pack->dest()) ) { @@ -45,4 +49,14 @@ void PackageList::insertPackage( Package* pack ) } else { - p->setName( pack->name()+"["+p->version()+"]" ); + QDict<Package> *packver = p->getOtherVersions(); +// p->setName( pack->name()+"["+p->version()+"]" ); + if (!packver) + { + packver = new QDict<Package>; + packver->insert( pack->name(), p ); + p->setOtherVersions( packver ); + } pack->setName( pack->name()+"["+pack->version()+"]" ); + pack->setOtherVersions( packver ); + packver->insert( pack->name(), pack ); + packageListAll->insert( pack->name(), pack ); packageList.insert( pack->name(), pack ); @@ -51,2 +65,3 @@ void PackageList::insertPackage( Package* pack ) }else{ + packageListAll->insert( pack->name(), pack ); 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: + QDict<Package> *versions; + 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 @@ static QPixmap *pm_uninstalled=0; +static QPixmap *pm_uninstalled_old=0; static QPixmap *pm_installed=0; +static QPixmap *pm_installed_old=0; static QPixmap *pm_uninstall=0; static QPixmap *pm_install=0; +static QPixmap *pm_uninstalled_old_installed_new=0; +static QPixmap *pm_uninstalled_installed_old=0; @@ -48,3 +52,7 @@ void PackageListItem::init( Package *pi, PackageManagerSettings *s) pm_uninstalled = new QPixmap(Resource::loadPixmap("oipkg/uninstalled")); + pm_uninstalled_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOld")); + pm_uninstalled_old_installed_new = new QPixmap(Resource::loadPixmap("oipkg/uninstalledOldinstalledNew")); + pm_uninstalled_installed_old = new QPixmap(Resource::loadPixmap("oipkg/uninstalledInstalledOld")); pm_installed = new QPixmap(Resource::loadPixmap("oipkg/installed")); + pm_installed_old = new QPixmap(Resource::loadPixmap("oipkg/installedOld")); pm_install = new QPixmap(Resource::loadPixmap("oipkg/install")); @@ -95,8 +103,21 @@ QPixmap PackageListItem::statePixmap() const bool installed = package->installed(); + bool old = package->isOld(); + bool versions = package->hasVersions(); + bool verinstalled = package->otherInstalled(); if ( !package->toProcess() ) { if ( !installed ) - return *pm_uninstalled; + if (old) + { + if (verinstalled) return *pm_uninstalled_old_installed_new; + else return *pm_uninstalled_old; + } + else + { + if (verinstalled) return *pm_uninstalled_installed_old; + else return *pm_uninstalled; + } else - return *pm_installed; - } else { + if (old) return *pm_installed_old; + else return *pm_installed; + } else { //toProcess() == true 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() #define SYSTEM +#define QT_QPROCESS_DEBUG int PmIpkg::runIpkg(const QString& args, const QString& dest ) @@ -44,5 +45,5 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) pvDebug(2,"PmIpkg::runIpkg "+args); - + QDir::setCurrent("/tmp"); #ifdef PROC - QStringList cmd = "ipkg "; + QString cmd; #endif @@ -74,3 +75,3 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest ) QString o = "start"; - Process *ipkg = new Process( cmd ); + Process *ipkg = new Process(QStringList() << "ipkg" << cmd ); out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" ); @@ -299,3 +300,3 @@ void PmIpkg::install() { - runwindow->progress->setProgress( to_install.at(i)->size().toInt() ); + runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); linkOpp = createLink; diff --git a/pics/oipkg/installedOld.png b/pics/oipkg/installedOld.png Binary files differnew file mode 100644 index 0000000..8a042fc --- a/dev/null +++ b/pics/oipkg/installedOld.png diff --git a/pics/oipkg/uninstalledInstalledOld.png b/pics/oipkg/uninstalledInstalledOld.png Binary files differnew file mode 100644 index 0000000..f369c63 --- a/dev/null +++ b/pics/oipkg/uninstalledInstalledOld.png diff --git a/pics/oipkg/uninstalledOld.png b/pics/oipkg/uninstalledOld.png Binary files differnew file mode 100644 index 0000000..5dce3ea --- a/dev/null +++ b/pics/oipkg/uninstalledOld.png diff --git a/pics/oipkg/uninstalledOldinstalledNew.png b/pics/oipkg/uninstalledOldinstalledNew.png Binary files differnew file mode 100644 index 0000000..3bfe126 --- a/dev/null +++ b/pics/oipkg/uninstalledOldinstalledNew.png |