00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <qpe/config.h>
00011 #include <qfile.h>
00012 #include <qfileinfo.h>
00013 #include <qtextstream.h>
00014 #include <qstringlist.h>
00015 #include "packagelistlocal.h"
00016
00017 PackageListLocal::PackageListLocal()
00018 : PackageList()
00019 {
00020 Config cfg( "oipkg", Config::User );
00021 cfg.setGroup( "Common" );
00022 statusDir = cfg.readEntry( "statusDir", "" );
00023 listsDir = cfg.readEntry( "listsDir", "" );
00024 if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() )
00025 {
00026 statusDir="/usr/lib/ipkg/";
00027 listsDir="/usr/lib/ipkg/lists/";
00028 cfg.writeEntry( "statusDir", statusDir );
00029 cfg.writeEntry( "listsDir", listsDir );
00030 }
00031 }
00032
00033 PackageListLocal::PackageListLocal(PackageManagerSettings* s)
00034 : PackageList(s)
00035 {
00036 PackageListLocal();
00037 }
00038
00039 PackageListLocal::~PackageListLocal()
00040 {
00041 }
00042
00043 void PackageListLocal::parseStatus()
00044 {
00045 QStringList dests = settings->getDestinationUrls();
00046 QStringList destnames = settings->getDestinationNames();
00047 QStringList::Iterator name = destnames.begin();
00048 for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir )
00049 {
00050 pvDebug( 2,"Status: "+*dir+statusDir+"/status");
00051 readFileEntries( *dir+statusDir+"/status", *name );
00052 ++name;
00053 };
00054 }
00055
00056 void PackageListLocal::parseList()
00057 {
00058 QStringList srvs = settings->getActiveServers();
00059
00060 for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it )
00061 {
00062 pvDebug( 2, "List: "+listsDir+"/"+*it);
00063 readFileEntries( listsDir+"/"+*it );
00064 }
00065 }
00066
00067
00068 void PackageListLocal::update()
00069 {
00070 pvDebug( 2, "parseStatus");
00071 parseStatus();
00072 pvDebug( 2, "parseList "+listsDir);
00073 parseList();
00074 pvDebug( 2, "finished parsing");
00075 }