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.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp
index edb9cc5..5f79ec1 100644
--- a/noncore/unsupported/oipkg/packagelist.cpp
+++ b/noncore/unsupported/oipkg/packagelist.cpp
@@ -13,20 +13,20 @@
13#include <qfile.h> 13#include <qfile.h>
14#include <qfileinfo.h> 14#include <qfileinfo.h>
15#include <qtextstream.h> 15#include <qtextstream.h>
16 16
17#include "debug.h" 17#include "debug.h"
18 18
19static QDict<Package> *packageListAll; 19static QDict<OipkgPackage> *packageListAll;
20static int packageListAllRefCount = 0; 20static int packageListAllRefCount = 0;
21 21
22PackageList::PackageList(QObject *parent, const char *name) 22PackageList::PackageList(QObject *parent, const char *name)
23 : QObject(parent,name), packageIter( packageList ) 23 : QObject(parent,name), packageIter( packageList )
24{ 24{
25 empty=true; 25 empty=true;
26 if (!packageListAll) packageListAll = new QDict<Package>(); 26 if (!packageListAll) packageListAll = new QDict<OipkgPackage>();
27 packageListAllRefCount++; 27 packageListAllRefCount++;
28 sections << "All"; 28 sections << "All";
29 subSections.insert("All", new QStringList() ); 29 subSections.insert("All", new QStringList() );
30 QStringList *ss = subSections["All"]; 30 QStringList *ss = subSections["All"];
31 *ss << "All"; 31 *ss << "All";
32 aktSection = "All"; 32 aktSection = "All";
@@ -43,31 +43,31 @@ PackageList::PackageList( PackageManagerSettings* s, QObject *parent, const char
43PackageList::~PackageList() 43PackageList::~PackageList()
44{ 44{
45 if (--packageListAllRefCount < 1 ) delete packageListAll; 45 if (--packageListAllRefCount < 1 ) delete packageListAll;
46} 46}
47 47
48/** Inserts a package into the list */ 48/** Inserts a package into the list */
49void PackageList::insertPackage( Package* pack ) 49void PackageList::insertPackage( OipkgPackage* pack )
50{ 50{
51 if (!pack) return; 51 if (!pack) return;
52 Package* p = packageListAll->find( pack->name() ); 52 OipkgPackage* p = packageListAll->find( pack->name() );
53 if ( p ) 53 if ( p )
54 { 54 {
55 if ( (p->version() == pack->version()) 55 if ( (p->version() == pack->version())
56 // && (p->dest() == pack->dest()) 56 // && (p->dest() == pack->dest())
57 ) 57 )
58 { 58 {
59 p->copyValues( pack ); 59 p->copyValues( pack );
60 delete pack; 60 delete pack;
61 pack = p; 61 pack = p;
62 } else { 62 } else {
63 QDict<Package> *packver = p->getOtherVersions(); 63 QDict<OipkgPackage> *packver = p->getOtherVersions();
64 // p->setName( pack->name()+"["+p->version()+"]" ); 64 // p->setName( pack->name()+"["+p->version()+"]" );
65 if (!packver) 65 if (!packver)
66 { 66 {
67 packver = new QDict<Package>(); 67 packver = new QDict<OipkgPackage>();
68 packver->insert( pack->name(), p ); 68 packver->insert( pack->name(), p );
69 p->setOtherVersions( packver ); 69 p->setOtherVersions( packver );
70 } 70 }
71 pack->setName( pack->name() );//+"["+pack->version()+"]" ); 71 pack->setName( pack->name() );//+"["+pack->version()+"]" );
72 pack->setOtherVersions( packver ); 72 pack->setOtherVersions( packver );
73 packver->insert( pack->name(), pack ); 73 packver->insert( pack->name(), pack );
@@ -84,15 +84,15 @@ void PackageList::insertPackage( Package* pack )
84 updateSections( pack ); 84 updateSections( pack );
85} 85}
86 86
87void PackageList::filterPackages( QString f ) 87void PackageList::filterPackages( QString f )
88 { 88 {
89 packageList.clear(); 89 packageList.clear();
90 QDictIterator<Package> filterIter( origPackageList ); 90 QDictIterator<OipkgPackage> filterIter( origPackageList );
91 filterIter.toFirst(); 91 filterIter.toFirst();
92 Package *pack= filterIter.current() ; 92 OipkgPackage *pack= filterIter.current() ;
93 while ( pack ) 93 while ( pack )
94 { 94 {
95 if ( 95 if (
96 ((aktSection=="All")||(pack->section()==aktSection)) && 96 ((aktSection=="All")||(pack->section()==aktSection)) &&
97 ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) && 97 ((aktSubSection=="All")||(pack->subSection()==aktSubSection)) &&
98 pack->name().contains( f ) 98 pack->name().contains( f )
@@ -102,24 +102,24 @@ void PackageList::filterPackages( QString f )
102 } 102 }
103 ++filterIter; 103 ++filterIter;
104 pack = filterIter.current(); 104 pack = filterIter.current();
105 } 105 }
106} 106}
107 107
108Package* PackageList::find( QString n ) 108OipkgPackage* PackageList::find( QString n )
109{ 109{
110 return packageList.find( n ); 110 return packageList.find( n );
111} 111}
112 112
113Package* PackageList::first() 113OipkgPackage* PackageList::first()
114 { 114 {
115 packageIter.toFirst(); 115 packageIter.toFirst();
116 return packageIter.current(); 116 return packageIter.current();
117} 117}
118 118
119Package* PackageList::next() 119OipkgPackage* PackageList::next()
120{ 120{
121 ++packageIter; 121 ++packageIter;
122 return packageIter.current(); 122 return packageIter.current();
123} 123}
124 124
125QStringList PackageList::getSections() 125QStringList PackageList::getSections()
@@ -144,13 +144,13 @@ void PackageList::setSection( QString sec )
144 144
145void PackageList::setSubSection( QString ssec ) 145void PackageList::setSubSection( QString ssec )
146{ 146{
147 aktSubSection = ssec; 147 aktSubSection = ssec;
148} 148}
149 149
150void PackageList::updateSections( Package* pack ) 150void PackageList::updateSections( OipkgPackage* pack )
151{ 151{
152 QString s = pack->section(); 152 QString s = pack->section();
153 if ( s.isEmpty() || s == "") return; 153 if ( s.isEmpty() || s == "") return;
154 if ( !sections.contains(s) ) sections += s; 154 if ( !sections.contains(s) ) sections += s;
155 QString ss = pack->subSection(); 155 QString ss = pack->subSection();
156 if ( ss.isEmpty() || ss == "" ) return; 156 if ( ss.isEmpty() || ss == "" ) return;
@@ -179,13 +179,13 @@ void PackageList::readFileEntries( QString filename, QString dest )
179 QString line = statusStream->readLine(); 179 QString line = statusStream->readLine();
180 if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) 180 if ( line.find(QRegExp("[\n\t ]*")) || line == "" )
181 { 181 {
182 //end of package 182 //end of package
183 if ( ! packEntry.isEmpty() ) 183 if ( ! packEntry.isEmpty() )
184 { 184 {
185 Package *p = new Package( packEntry, settings ); 185 OipkgPackage *p = new OipkgPackage( packEntry, settings );
186 if ( p ) 186 if ( p )
187 { 187 {
188 p->setDest( dest ); 188 p->setDest( dest );
189 insertPackage( p ); 189 insertPackage( p );
190 packEntry.clear(); 190 packEntry.clear();
191 } 191 }
@@ -194,13 +194,13 @@ void PackageList::readFileEntries( QString filename, QString dest )
194 packEntry << line; 194 packEntry << line;
195 }; 195 };
196 } 196 }
197 //there might be no nl at the end of the package file 197 //there might be no nl at the end of the package file
198 if ( ! packEntry.isEmpty() ) 198 if ( ! packEntry.isEmpty() )
199 { 199 {
200 Package *p = new Package( packEntry, settings ); 200 OipkgPackage *p = new OipkgPackage( packEntry, settings );
201 if ( p ) 201 if ( p )
202 { 202 {
203 p->setDest( dest ); 203 p->setDest( dest );
204 insertPackage( p ); 204 insertPackage( p );
205 packEntry.clear(); 205 packEntry.clear();
206 } 206 }
@@ -211,13 +211,13 @@ void PackageList::readFileEntries( QString filename, QString dest )
211 211
212void PackageList::setSettings( PackageManagerSettings *s ) 212void PackageList::setSettings( PackageManagerSettings *s )
213{ 213{
214 settings = s; 214 settings = s;
215} 215}
216 216
217Package* PackageList::getByName( QString n ) 217OipkgPackage* PackageList::getByName( QString n )
218{ 218{
219 return origPackageList[n]; 219 return origPackageList[n];
220} 220}
221 221
222void PackageList::clear() 222void PackageList::clear()
223{ 223{
@@ -225,15 +225,15 @@ void PackageList::clear()
225 packageList.clear(); 225 packageList.clear();
226} 226}
227 227
228void PackageList::allPackages() 228void PackageList::allPackages()
229{ 229{
230 packageList.clear(); 230 packageList.clear();
231 QDictIterator<Package> filterIter( origPackageList ); 231 QDictIterator<OipkgPackage> filterIter( origPackageList );
232 filterIter.toFirst(); 232 filterIter.toFirst();
233 Package *pack= filterIter.current() ; 233 OipkgPackage *pack= filterIter.current() ;
234 while ( pack ) 234 while ( pack )
235 { 235 {
236 packageList.insert( pack->name(), pack ); 236 packageList.insert( pack->name(), pack );
237 ++filterIter; 237 ++filterIter;
238 pack = filterIter.current(); 238 pack = filterIter.current();
239 } 239 }