Diffstat (limited to 'noncore/unsupported/oipkg/packagelist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 23 |
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 @@ -16,26 +16,24 @@ PackageList::PackageList() 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; @@ -54,37 +52,40 @@ void PackageList::insertPackage( Package* pack ) { 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() { @@ -205,12 +206,18 @@ void PackageList::update() 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(); +} |