author | tille <tille> | 2002-04-27 13:06:45 (UTC) |
---|---|---|
committer | tille <tille> | 2002-04-27 13:06:45 (UTC) |
commit | db90999f6298c1107888f062f2c25cb8817b528a (patch) (unidiff) | |
tree | 020ebe65beb9286f3c63e4329fc3a0f298d34460 /noncore/unsupported/oipkg/packagelist.cpp | |
parent | e2f3288d468508f2cf7c0a327044963ca4b1b54a (diff) | |
download | opie-db90999f6298c1107888f062f2c25cb8817b528a.zip opie-db90999f6298c1107888f062f2c25cb8817b528a.tar.gz opie-db90999f6298c1107888f062f2c25cb8817b528a.tar.bz2 |
added popup menu to choose inst dest (and more...)
Diffstat (limited to 'noncore/unsupported/oipkg/packagelist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 46 |
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 | |||
@@ -67,14 +67,14 @@ void PackageList::filterPackages( QString f ) | |||
67 | QDictIterator<Package> filterIter( origPackageList ); | 67 | QDictIterator<Package> filterIter( origPackageList ); |
68 | filterIter.toFirst(); | 68 | filterIter.toFirst(); |
69 | Package *pack= filterIter.current() ; | 69 | Package *pack= filterIter.current() ; |
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 | { |
78 | packageList.insert( pack->name(), pack ); | 78 | packageList.insert( pack->name(), pack ); |
79 | } | 79 | } |
80 | ++filterIter; | 80 | ++filterIter; |
@@ -123,17 +123,17 @@ void PackageList::setSubSection( QString ssec ) | |||
123 | { | 123 | { |
124 | aktSubSection = ssec; | 124 | aktSubSection = ssec; |
125 | } | 125 | } |
126 | 126 | ||
127 | void PackageList::updateSections( Package* pack ) | 127 | void 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() ); |
137 | QStringList *subsecs = subSections[s]; | 137 | QStringList *subsecs = subSections[s]; |
138 | *subsecs += "All"; | 138 | *subsecs += "All"; |
139 | } | 139 | } |
@@ -147,31 +147,34 @@ void PackageList::updateSections( Package* pack ) | |||
147 | 147 | ||
148 | 148 | ||
149 | /** No descriptions */ | 149 | /** No descriptions */ |
150 | void PackageList::parseStatus() | 150 | void 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 | ||
160 | void PackageList::parseList() | 163 | void PackageList::parseList() |
161 | { | 164 | { |
162 | QStringList srvs = settings->getActiveServers(); | 165 | QStringList srvs = settings->getActiveServers(); |
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 | ||
171 | void PackageList::readFileEntries( QString filename ) | 174 | void PackageList::readFileEntries( QString filename, QString dest ) |
172 | { | 175 | { |
173 | QStringList packEntry; | 176 | QStringList packEntry; |
174 | QFile f( filename ); | 177 | QFile f( filename ); |
175 | if ( !f.open(IO_ReadOnly) ) return; | 178 | if ( !f.open(IO_ReadOnly) ) return; |
176 | QTextStream *statusStream = new QTextStream( &f ); | 179 | QTextStream *statusStream = new QTextStream( &f ); |
177 | while ( !statusStream ->eof() ) | 180 | while ( !statusStream ->eof() ) |
@@ -179,13 +182,14 @@ void PackageList::readFileEntries( QString filename ) | |||
179 | QString line = statusStream->readLine(); | 182 | QString line = statusStream->readLine(); |
180 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) | 183 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) |
181 | { | 184 | { |
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 ); |
189 | packEntry.clear(); | 193 | packEntry.clear(); |
190 | } | 194 | } |
191 | } | 195 | } |
@@ -196,17 +200,17 @@ void PackageList::readFileEntries( QString filename ) | |||
196 | return; | 200 | return; |
197 | } | 201 | } |
198 | 202 | ||
199 | 203 | ||
200 | void PackageList::update() | 204 | void 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 | ||
209 | void PackageList::setSettings( PackageManagerSettings *s ) | 213 | void PackageList::setSettings( PackageManagerSettings *s ) |
210 | { | 214 | { |
211 | settings = s; | 215 | settings = s; |
212 | } | 216 | } |
@@ -218,6 +222,20 @@ Package* PackageList::getByName( QString n ) | |||
218 | 222 | ||
219 | void PackageList::clear() | 223 | void PackageList::clear() |
220 | { | 224 | { |
221 | origPackageList.clear(); | 225 | origPackageList.clear(); |
222 | packageList.clear(); | 226 | packageList.clear(); |
223 | } | 227 | } |
228 | |||
229 | void 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 | } | ||