summaryrefslogtreecommitdiff
path: root/noncore/unsupported
Side-by-side diff
Diffstat (limited to 'noncore/unsupported') (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
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
@@ -9,9 +9,9 @@ int debugLevel;
int main( int argc, char ** argv )
{
debugLevel = 2;
- if (argc > 0)
+ if (argc > 1)
{
debugLevel = QString ( argv[1] ).toInt();
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
@@ -48,13 +48,17 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
// settings->setIpkg( ipkg );
packageListServers.setSettings( settings );
packageListSearch.setSettings( settings );
packageListDocLnk.setSettings( settings );
+ pvDebug(9,"packageListServers.update");
packageListServers.update();
+ pvDebug(9,"packageListDocLnk.update");
packageListDocLnk.update();
+ pvDebug(9,"makeMenu");
makeMenu();
makeChannel();
//opie is hardcoded default ;)
+ pvDebug(9,"section->setCurrentItem");
for (int i=0;i<section->count();i++)
if (section->text(i)=="opie")
section->setCurrentItem(i);
sectionChanged();
@@ -66,8 +70,9 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags f = 0 ) :
SLOT(removeLinks()) );
connect( settings->createLinksButton, SIGNAL( clicked()),
SLOT(createLinks()) );
+ pvDebug(9,"displayList");
displayList();
}
void MainWindow::makeMenu()
@@ -235,16 +240,14 @@ void MainWindow::makeMenu()
}
MainWindow::~MainWindow()
{
- pvDebug(7,"MainWindow::~MainWindow ");
Config cfg( "oipkg", Config::User );
cfg.setGroup( "gui" );
cfg.writeEntry( "findBar", !findBar->isHidden() );
cfg.writeEntry( "searchBar", !searchBar->isHidden() );
cfg.writeEntry( "sectionBar", !sectionBar->isHidden() );
cfg.writeEntry( "destBar", !destBar->isHidden() );
- pvDebug(7,"MainWindow::~MainWindow ");
}
void MainWindow::runIpkg()
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
@@ -28,11 +28,13 @@ void Package::init( PackageManagerSettings *s )
_desc = "";
_name = "";
_toProcess = false;
_useFileName = false;
+ _old = false;
_status = "";
_dest = settings->getDestinationName();
_link = settings->createLinks();
+ _versions=0;
}
Package::Package( QStringList pack, PackageManagerSettings *s )
{
@@ -127,9 +129,36 @@ QString Package::installName()
}
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;
}
void Package::setDesc( QString s )
{
@@ -369,4 +398,31 @@ QDict<QString>* Package::getFields()
QString Package::status()
{
return _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
@@ -22,11 +22,12 @@ class Package //: public QObject
void setValue( QString, QString );
void copyValues( Package* );
- QString name() ;
- QString installName() ;
+ QString name();
+ QString installName();
bool installed();
+ bool otherInstalled();
void setDesc( QString );
QString shortDesc();
QString desc();
@@ -45,21 +46,29 @@ class Package //: public QObject
void setDest( QString d );
void setOn();
bool link();
void setLink(bool);
+ bool isOld();
+ bool hasVersions();
void parseIpkgFile( QString );
void instalFromFile(bool iff=true);
void setName(QString);
QDict<QString>* getFields();
QString status();
+
+ QDict<Package>* getOtherVersions();
+ void setOtherVersions(QDict<Package>*);
+
public slots:
void toggleProcess();
private:
PackageManagerSettings *settings;
QString _displayName;
QString _name;
QString _fileName;
+ bool _old;
+ bool _hasVersions;
bool _toProcess;
bool _link;
QString _status;
QString _size;
@@ -69,8 +78,9 @@ private:
QString _desc;
QString _version;
QString _dest;
QDict<QString> _values;
+ QDict<Package> *_versions;
bool _useFileName;
void parsePackage( QStringList );
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
@@ -6,12 +6,15 @@
#include <qtextstream.h>
#include "debug.h"
+static QDict<Package> *packageListAll;
+
PackageList::PackageList()
: packageIter( packageList )
{
empty=true;
+ if (!packageListAll) packageListAll = new QDict<Package>();
sections << "All";
subSections.insert("All", new QStringList() );
QStringList *ss = subSections["All"];
*ss << "All";
@@ -33,23 +36,35 @@ PackageList::~PackageList()
/** Inserts a package into the list */
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()) )
{
p->copyValues( pack );
delete pack;
pack = p;
} 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 );
origPackageList.insert( pack->name(), pack );
}
}else{
+ packageListAll->insert( pack->name(), pack );
packageList.insert( pack->name(), pack );
origPackageList.insert( pack->name(), pack );
};
empty=false;
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
@@ -27,8 +27,10 @@ public:
Package* getByName( QString );
void clear();
void allPackages();
+ QDict<Package> *versions;
+
public slots:
void setSection(QString);
void setSubSection(QString);
// virtual void update();
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
@@ -5,11 +5,15 @@
#include "debug.h"
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;
PackageListItem::PackageListItem(QListView* lv, Package *pi, PackageManagerSettings *s)
: QCheckListItem(lv,pi->name(),CheckBox)
{
@@ -45,9 +49,13 @@ void PackageListItem::init( Package *pi, PackageManagerSettings *s)
if (!pm_uninstalled)
{
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"));
pm_uninstall = new QPixmap(Resource::loadPixmap("oipkg/uninstall"));
}
}
@@ -92,14 +100,27 @@ void PackageListItem::paintFocus( QPainter *p, const QColorGroup & cg,
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 )
return *pm_install;
else
return *pm_uninstall;
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
@@ -38,14 +38,15 @@ PmIpkg::~PmIpkg()
}
//#define PROC
#define SYSTEM
+#define QT_QPROCESS_DEBUG
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
#ifdef SYSTEM
QString cmd = "/usr/bin/ipkg ";
#endif
@@ -71,9 +72,9 @@ int PmIpkg::runIpkg(const QString& args, const QString& dest )
cmd += args;
int r = 0;
#ifdef PROC
QString o = "start";
- Process *ipkg = new Process( cmd );
+ Process *ipkg = new Process(QStringList() << "ipkg" << cmd );
out( "running:<br>\n"+ipkg->arguments().join(" ")+"<br>\n" );
QString description;
r = ipkg->exec("",o);
out( o );
@@ -296,9 +297,9 @@ void PmIpkg::install()
for (uint i=0; i < to_install.count(); i++)
{
if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() ) == 0 )
{
- runwindow->progress->setProgress( to_install.at(i)->size().toInt() );
+ runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress());
linkOpp = createLink;
if ( to_install.at(i)->link() )
{
out( "<br>creating links<br>" );