summaryrefslogtreecommitdiff
path: root/noncore
authortille <tille>2002-11-24 16:28:25 (UTC)
committer tille <tille>2002-11-24 16:28:25 (UTC)
commit5b029ef4b109d50ae41a3fd8bfae0b30864745f8 (patch) (side-by-side diff)
treef5a3d81a404a57dd21c5205e70dca985bb948416 /noncore
parent9387bc3f63b1e48c559d0758c50d9af857e7feeb (diff)
downloadopie-5b029ef4b109d50ae41a3fd8bfae0b30864745f8.zip
opie-5b029ef4b109d50ae41a3fd8bfae0b30864745f8.tar.gz
opie-5b029ef4b109d50ae41a3fd8bfae0b30864745f8.tar.bz2
valgrind found bugs
thanks to simon
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/package.cpp30
-rw-r--r--noncore/unsupported/oipkg/package.h5
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp1
-rw-r--r--noncore/unsupported/oipkg/packagelistitem.cpp5
4 files changed, 27 insertions, 14 deletions
diff --git a/noncore/unsupported/oipkg/package.cpp b/noncore/unsupported/oipkg/package.cpp
index e020601..190b3fb 100644
--- a/noncore/unsupported/oipkg/package.cpp
+++ b/noncore/unsupported/oipkg/package.cpp
@@ -1,129 +1,139 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
#include "package.h"
#include <qpe/process.h>
#include <qpe/stringutil.h>
#include <qfile.h>
#include <qtextstream.h>
#include <stdlib.h>
#include <unistd.h>
#include "debug.h"
OipkgPackage::OipkgPackage( QObject *parent, const char *name )
- : QObject(parent,name)
+ : QObject(parent,name)
{
-
+ init();
}
OipkgPackage::~OipkgPackage()
{
+
}
OipkgPackage::OipkgPackage( PackageManagerSettings *s, QObject *parent, const char *name )
: QObject(parent,name)
{
- init(s);
+ settings = s;
+ init();
}
-void OipkgPackage::init( PackageManagerSettings *s )
+// void OipkgPackage::init( PackageManagerSettings *s )
+// {
+// settings = s;
+// init();
+// }
+
+void OipkgPackage::init( )
{
- settings = s;
_size = "";
_section = "";
_subsection = "";
_shortDesc = "";
_desc = "";
_name = "";
_toProcess = false;
_useFileName = false;
_old = false;
_status = "";
_dest = settings->getDestinationName();
_link = settings->createLinks();
_versions=0;
_version="";
}
OipkgPackage::OipkgPackage( QStringList pack, PackageManagerSettings *s , QObject *parent, const char *name )
: QObject(parent,name)
-{
- init(s);
+{
+ settings = s;
+ init();
parsePackage( pack );
}
OipkgPackage::OipkgPackage( QString n, PackageManagerSettings *s, QObject *parent, const char *name )
: QObject(parent,name)
-{
- init(s);
+{
+ settings = s;
+ init();
if ( !QFile::exists( n ) )
{
_name = QString( n );
}else{
pvDebug(4,"remote file: "+n);
parseIpkgFile( n );
_useFileName = true;
_fileName = QString( n );
}
}
OipkgPackage::OipkgPackage( OipkgPackage *pi, QObject *parent, const char *name )
: QObject(parent,name)
{
- init(pi->settings);
+ settings = pi->settings;
+ init();
copyValues( pi );
}
void OipkgPackage::setValue( QString n, QString t )
{
if ( n == "Package" )
{
_name = QString( t );
}else if ( n == "Installed-Size" )
{
_size = t;
// }else if ( n == "Priority")
// {
}else if ( n == "Section")
{
setSection( t );
// }else if ( n == "Maintainer")
// {
//
// }else if ( n == "Architecture")
// {
}else if ( n == "Version")
{
_version = t;
// }else if ( n == "Pre-Depends")
// {
//
// }else if ( n == "Depends")
// {
}else if ( n == "Filename")
{
_fileName = t;
// }else if ( n == "Size")
// {
//
// }else if ( n == "MD5Sum")
// {
}else if ( n == "Description")
{
setDesc( t );
}else if ( n == "Status")
{
if ( installed() ) return;
diff --git a/noncore/unsupported/oipkg/package.h b/noncore/unsupported/oipkg/package.h
index 2334c31..02d8eff 100644
--- a/noncore/unsupported/oipkg/package.h
+++ b/noncore/unsupported/oipkg/package.h
@@ -45,56 +45,57 @@ class OipkgPackage : public QObject
QString size();
QString sizeUnits();
QString version();
void setSection( QString );
QString section();
QString subSection();
QString details();
bool toProcess();
bool toInstall();
bool toRemove();
void processed();
QString dest();
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<OipkgPackage>* getOtherVersions();
void setOtherVersions(QDict<OipkgPackage>*);
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;
QString _section;
QString _subsection;
QString _shortDesc;
QString _desc;
QString _version;
QString _dest;
QDict<QString> _values;
- QDict<OipkgPackage> *_versions;
+ QDict<OipkgPackage> *_versions;
bool _useFileName;
void parsePackage( QStringList );
- void init(PackageManagerSettings *);
+ void init();
+ // void init(PackageManagerSettings*);
};
#endif
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index 5f79ec1..6f0b56f 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -161,80 +161,81 @@ void PackageList::updateSections( OipkgPackage* pack )
}
QStringList *subsecs = subSections[s];
if ( !subsecs->contains(ss) ) *subsecs += ss;
// if ( !subSections["All"] ) subSections.insert( "All", new QStringList() );
// subsecs = subSections["All"];
// *subsecs += ss;
}
void PackageList::readFileEntries( QString filename, QString dest )
{
pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest);
QStringList packEntry;
QFile f( filename );
if ( !f.open(IO_ReadOnly) ) return;
QTextStream *statusStream = new QTextStream( &f );
while ( !statusStream ->eof() )
{
QString line = statusStream->readLine();
if ( line.find(QRegExp("[\n\t ]*")) || line == "" )
{
//end of package
if ( ! packEntry.isEmpty() )
{
OipkgPackage *p = new OipkgPackage( packEntry, settings );
if ( p )
{
p->setDest( dest );
insertPackage( p );
packEntry.clear();
}
}
}else{
packEntry << line;
};
}
//there might be no nl at the end of the package file
if ( ! packEntry.isEmpty() )
{
OipkgPackage *p = new OipkgPackage( packEntry, settings );
if ( p )
{
p->setDest( dest );
insertPackage( p );
packEntry.clear();
}
}
delete statusStream;
+ f.close();
return;
}
void PackageList::setSettings( PackageManagerSettings *s )
{
settings = s;
}
OipkgPackage* PackageList::getByName( QString n )
{
return origPackageList[n];
}
void PackageList::clear()
{
origPackageList.clear();
packageList.clear();
}
void PackageList::allPackages()
{
packageList.clear();
QDictIterator<OipkgPackage> filterIter( origPackageList );
filterIter.toFirst();
OipkgPackage *pack= filterIter.current() ;
while ( pack )
{
packageList.insert( pack->name(), pack );
++filterIter;
pack = filterIter.current();
}
}
diff --git a/noncore/unsupported/oipkg/packagelistitem.cpp b/noncore/unsupported/oipkg/packagelistitem.cpp
index 51d024b..1610a37 100644
--- a/noncore/unsupported/oipkg/packagelistitem.cpp
+++ b/noncore/unsupported/oipkg/packagelistitem.cpp
@@ -1,100 +1,101 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// (c) 2002 Patrick S. Vogt <tille@handhelds.org>
#include "packagelistitem.h"
#include <qpe/resource.h>
#include <qobject.h>
#include <qpopupmenu.h>
#include <qaction.h>
#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(ListViewItemOipkg *parent, QString name, Type ittype)
: ListViewItemOipkg(parent,name,ittype)
{
}
PackageListItem::PackageListItem(QListView* lv, OipkgPackage *pi, PackageManagerSettings *s)
: ListViewItemOipkg(lv,pi->name(),ListViewItemOipkg::Package)
{
init(pi,s);
}
PackageListItem::PackageListItem(ListViewItemOipkg *lvi, OipkgPackage *pi, PackageManagerSettings *s)
: ListViewItemOipkg(lvi,pi->name(),ListViewItemOipkg::Package)
{
init(pi,s);
}
PackageListItem::~PackageListItem()
{
- delete popupMenu;
- delete destsMenu;
+ delete popupMenu;
+ delete destsMenu;
}
void PackageListItem::init( OipkgPackage *pi, PackageManagerSettings *s)
{
+ //waring pass something different than 0
popupMenu = new QPopupMenu( 0 );
destsMenu = new QPopupMenu( 0 );
package = pi;
settings = s;
setExpandable( true );
ListViewItemOipkg *item;
nameItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute,"name" );
item = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("Description: ")+pi->desc() );
item = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("Size: ")+pi->size() );
destItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "dest" );
linkItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "link" );
statusItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, "status" );
ListViewItemOipkg *otherItem = new ListViewItemOipkg( this, ListViewItemOipkg::Attribute, QObject::tr("other") );
item = new ListViewItemOipkg( otherItem, ListViewItemOipkg::Attribute, QObject::tr("Install Name: ")+pi->installName() );
QDict<QString> *fields = pi->getFields();
QDictIterator<QString> it( *fields );
while ( it.current() ) {
item = new ListViewItemOipkg( otherItem, ListViewItemOipkg::Attribute, QString(it.currentKey()+": "+*it.current()) );
++it;
}
displayDetails();
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"));
}
}
void PackageListItem::paintCell( QPainter *p, const QColorGroup & cg,
int column, int width, int alignment )
{
if ( !p )
return;
p->fillRect( 0, 0, width, height(),
isSelected()? cg.highlight() : cg.base() );
if ( column != 0 ) {
// The rest is text
QListViewItem::paintCell( p, cg, column, width, alignment );
return;