summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/packagelist.cpp
Side-by-side diff
Diffstat (limited to 'noncore/unsupported/oipkg/packagelist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp87
1 files changed, 19 insertions, 68 deletions
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index 035ec81..b892b30 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -1,33 +1,19 @@
#include "packagelist.h"
#include <assert.h>
#include <qfile.h>
#include <qfileinfo.h>
#include <qtextstream.h>
-#include <qpe/config.h>
#include "debug.h"
PackageList::PackageList()
: packageIter( packageList )
{
empty=true;
- {
- Config cfg( "oipkg", Config::User );
- cfg.setGroup( "Common" );
- statusDir = cfg.readEntry( "statusDir", "" );
- listsDir = cfg.readEntry( "listsDir", "" );
- if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() )
- {
- statusDir="/usr/lib/ipkg/";
- listsDir="/usr/lib/ipkg/lists/";
- cfg.writeEntry( "statusDir", statusDir );
- cfg.writeEntry( "listsDir", listsDir );
- }
- }
sections << "All";
subSections.insert("All", new QStringList() );
QStringList *ss = subSections["All"];
*ss << "All";
aktSection = "All";
aktSubSection = "All";
@@ -142,77 +128,42 @@ void PackageList::updateSections( Package* pack )
if ( !subSections["All"] ) subSections.insert( "All", new QStringList() );
subsecs = subSections["All"];
*subsecs += ss;
}
-
-/** No descriptions */
-void PackageList::parseStatus()
-{
- QStringList dests = settings->getDestinationUrls();
- QStringList destnames = settings->getDestinationNames();
- QStringList::Iterator name = destnames.begin();
- for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir )
- {
- pvDebug( 2,"Status: "+*dir+statusDir+"/status");
- readFileEntries( *dir+statusDir+"/status", *name );
- ++name;
- };
-}
-
-void PackageList::parseList()
-{
- QStringList srvs = settings->getActiveServers();
-
- for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it )
- {
- pvDebug( 2, "List: "+listsDir+"/"+*it);
- readFileEntries( listsDir+"/"+*it, "" );
- }
-}
-
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() )
- {
- Package *p = new Package( packEntry, settings );
- p->setDest( dest );
- if ( p )
- {
- insertPackage( p );
- packEntry.clear();
- }
- }
- }else{
- packEntry << line;
- };
+ {
+ QString line = statusStream->readLine();
+ if ( line.find(QRegExp("[\n\t ]*")) || line == "" )
+ {
+ //end of package
+ if ( ! packEntry.isEmpty() )
+ {
+ Package *p = new Package( packEntry, settings );
+ p->setDest( dest );
+ if ( p )
+ {
+ insertPackage( p );
+ packEntry.clear();
+ }
+ }
+ }else{
+ packEntry << line;
+ };
}
return;
}
-
-void PackageList::update()
-{
- pvDebug( 2, "parseStatus");
- parseStatus();
- pvDebug( 2, "parseList");
- parseList();
- pvDebug( 2, "finished parsing");
-}
-
void PackageList::setSettings( PackageManagerSettings *s )
{
settings = s;
}
Package* PackageList::getByName( QString n )