summaryrefslogtreecommitdiff
path: root/noncore/unsupported/oipkg/packagelist.cpp
Unidiff
Diffstat (limited to 'noncore/unsupported/oipkg/packagelist.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/unsupported/oipkg/packagelist.cpp46
1 files changed, 32 insertions, 14 deletions
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index 944bb83..035ec81 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -70,8 +70,8 @@ void PackageList::filterPackages( QString f )
70 while ( pack ) 70 while ( pack )
71 { 71 {
72 if ( 72 if (
73 ((aktSection=="All")||(pack->getSection()==aktSection)) && 73 ((aktSection=="All")||(pack->section()==aktSection)) &&
74 ((aktSubSection=="All")||(pack->getSubSection()==aktSubSection)) && 74 ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) &&
75 pack->name().contains( f ) 75 pack->name().contains( f )
76 ) 76 )
77 { 77 {
@@ -126,11 +126,11 @@ void PackageList::setSubSection( QString ssec )
126 126
127void PackageList::updateSections( Package* pack ) 127void PackageList::updateSections( Package* pack )
128{ 128{
129 QString s = pack->getSection(); 129 QString s = pack->section();
130 if ( s.isEmpty() || s == "") return; 130 if ( s.isEmpty() || s == "") return;
131 if ( sections.contains(s) ) return; 131 if ( sections.contains(s) ) return;
132 sections += s; 132 sections += s;
133 QString ss = pack->getSubSection(); 133 QString ss = pack->subSection();
134 if ( ss.isEmpty() || ss == "" ) return; 134 if ( ss.isEmpty() || ss == "" ) return;
135 if ( !subSections[s] ) { 135 if ( !subSections[s] ) {
136 subSections.insert( s, new QStringList() ); 136 subSections.insert( s, new QStringList() );
@@ -150,10 +150,13 @@ void PackageList::updateSections( Package* pack )
150void PackageList::parseStatus() 150void PackageList::parseStatus()
151{ 151{
152 QStringList dests = settings->getDestinationUrls(); 152 QStringList dests = settings->getDestinationUrls();
153 for ( QStringList::Iterator it = dests.begin(); it != dests.end(); ++it ) 153 QStringList destnames = settings->getDestinationNames();
154 QStringList::Iterator name = destnames.begin();
155 for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir )
154 { 156 {
155 pvDebug( 2,"Status Dir: "+*it+statusDir+"/status"); 157 pvDebug( 2,"Status: "+*dir+statusDir+"/status");
156 readFileEntries( *it+statusDir+"/status" ); 158 readFileEntries( *dir+statusDir+"/status", *name );
159 ++name;
157 }; 160 };
158} 161}
159 162
@@ -163,12 +166,12 @@ void PackageList::parseList()
163 166
164 for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) 167 for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it )
165 { 168 {
166 pvDebug( 2, "List Dir: "+listsDir+"/"+*it); 169 pvDebug( 2, "List: "+listsDir+"/"+*it);
167 readFileEntries( listsDir+"/"+*it ); 170 readFileEntries( listsDir+"/"+*it, "" );
168 } 171 }
169} 172}
170 173
171void PackageList::readFileEntries( QString filename ) 174void PackageList::readFileEntries( QString filename, QString dest )
172 { 175 {
173 QStringList packEntry; 176 QStringList packEntry;
174 QFile f( filename ); 177 QFile f( filename );
@@ -182,7 +185,8 @@ void PackageList::readFileEntries( QString filename )
182 //end of package 185 //end of package
183 if ( ! packEntry.isEmpty() ) 186 if ( ! packEntry.isEmpty() )
184 { 187 {
185 Package *p = new Package( packEntry ); 188 Package *p = new Package( packEntry, settings );
189 p->setDest( dest );
186 if ( p ) 190 if ( p )
187 { 191 {
188 insertPackage( p ); 192 insertPackage( p );
@@ -199,11 +203,11 @@ void PackageList::readFileEntries( QString filename )
199 203
200void PackageList::update() 204void PackageList::update()
201{ 205{
202 pvDebug( 3, "parseStatus"); 206 pvDebug( 2, "parseStatus");
203 parseStatus(); 207 parseStatus();
204 pvDebug( 3, "parseList"); 208 pvDebug( 2, "parseList");
205 parseList(); 209 parseList();
206 pvDebug( 3, "finished parsing"); 210 pvDebug( 2, "finished parsing");
207} 211}
208 212
209void PackageList::setSettings( PackageManagerSettings *s ) 213void PackageList::setSettings( PackageManagerSettings *s )
@@ -221,3 +225,17 @@ void PackageList::clear()
221 origPackageList.clear(); 225 origPackageList.clear();
222 packageList.clear(); 226 packageList.clear();
223} 227}
228
229void PackageList::allPackages()
230{
231 packageList.clear();
232 QDictIterator<Package> filterIter( origPackageList );
233 filterIter.toFirst();
234 Package *pack= filterIter.current() ;
235 while ( pack )
236 {
237 packageList.insert( pack->name(), pack );
238 ++filterIter;
239 pack = filterIter.current();
240 }
241}