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.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index 5f6934d..944bb83 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -4,99 +4,100 @@
#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 );
}
}
- pvDebug( 5, "PackageList::PackageList statusDir "+statusDir);
- pvDebug( 5, "PackageList::PackageList listsDir "+listsDir);
sections << "All";
subSections.insert("All", new QStringList() );
QStringList *ss = subSections["All"];
*ss << "All";
aktSection = "All";
aktSubSection = "All";
}
PackageList::PackageList( PackageManagerSettings* s)
: packageIter( packageList )
{
settings = s;
PackageList();
}
PackageList::~PackageList()
{
}
/** Inserts a package into the list */
void PackageList::insertPackage( Package* pack )
{
Package* p = packageList.find( pack->name() );
if ( p )
{
p->copyValues( pack );
delete pack;
pack = p;
}else{
packageList.insert( pack->name(), pack );
origPackageList.insert( pack->name(), pack );
empty=false;
};
updateSections( pack );
}
-void PackageList::filterPackages()
+void PackageList::filterPackages( QString f )
{
packageList.clear();
QDictIterator<Package> filterIter( origPackageList );
filterIter.toFirst();
Package *pack= filterIter.current() ;
while ( pack )
{
- if ( ((aktSection=="All")||(pack->getSection()==aktSection)) &&
- ((aktSubSection=="All")||(pack->getSubSection()==aktSubSection)) )
- {
- packageList.insert( pack->name(), pack );
- }
+ if (
+ ((aktSection=="All")||(pack->getSection()==aktSection)) &&
+ ((aktSubSection=="All")||(pack->getSubSection()==aktSubSection)) &&
+ pack->name().contains( f )
+ )
+ {
+ packageList.insert( pack->name(), pack );
+ }
++filterIter;
pack = filterIter.current();
}
}
Package* PackageList::find( QString n )
{
return packageList.find( n );
}
Package* PackageList::first()
{
packageIter.toFirst();
return packageIter.current();
}
Package* PackageList::next()
{
++packageIter;
return packageIter.current();
}
QStringList PackageList::getSections()
{
@@ -193,24 +194,30 @@ void PackageList::readFileEntries( QString filename )
};
}
return;
}
void PackageList::update()
{
pvDebug( 3, "parseStatus");
parseStatus();
pvDebug( 3, "parseList");
parseList();
pvDebug( 3, "finished parsing");
}
void PackageList::setSettings( PackageManagerSettings *s )
{
settings = s;
}
Package* PackageList::getByName( QString n )
{
origPackageList[n];
}
+
+void PackageList::clear()
+{
+ origPackageList.clear();
+ packageList.clear();
+}