author | tille <tille> | 2002-05-01 14:00:09 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-01 14:00:09 (UTC) |
commit | e729a9bdd9f37f4bd610d10122f002a0540c93ed (patch) (unidiff) | |
tree | a23696d8742a36b57256281dc7e2f7848407be61 /noncore/unsupported/oipkg/packagelist.cpp | |
parent | 7e5615473c1d103db66f42ae60bf9ed57d52566c (diff) | |
download | opie-e729a9bdd9f37f4bd610d10122f002a0540c93ed.zip opie-e729a9bdd9f37f4bd610d10122f002a0540c93ed.tar.gz opie-e729a9bdd9f37f4bd610d10122f002a0540c93ed.tar.bz2 |
added ipkgfind remote query
Diffstat (limited to 'noncore/unsupported/oipkg/packagelist.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 87 |
1 files changed, 19 insertions, 68 deletions
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index 035ec81..b892b30 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -4,7 +4,6 @@ | |||
4 | #include <qfile.h> | 4 | #include <qfile.h> |
5 | #include <qfileinfo.h> | 5 | #include <qfileinfo.h> |
6 | #include <qtextstream.h> | 6 | #include <qtextstream.h> |
7 | #include <qpe/config.h> | ||
8 | 7 | ||
9 | #include "debug.h" | 8 | #include "debug.h" |
10 | 9 | ||
@@ -12,19 +11,6 @@ PackageList::PackageList() | |||
12 | : packageIter( packageList ) | 11 | : packageIter( packageList ) |
13 | { | 12 | { |
14 | empty=true; | 13 | empty=true; |
15 | { | ||
16 | Config cfg( "oipkg", Config::User ); | ||
17 | cfg.setGroup( "Common" ); | ||
18 | statusDir = cfg.readEntry( "statusDir", "" ); | ||
19 | listsDir = cfg.readEntry( "listsDir", "" ); | ||
20 | if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() ) | ||
21 | { | ||
22 | statusDir="/usr/lib/ipkg/"; | ||
23 | listsDir="/usr/lib/ipkg/lists/"; | ||
24 | cfg.writeEntry( "statusDir", statusDir ); | ||
25 | cfg.writeEntry( "listsDir", listsDir ); | ||
26 | } | ||
27 | } | ||
28 | sections << "All"; | 14 | sections << "All"; |
29 | subSections.insert("All", new QStringList() ); | 15 | subSections.insert("All", new QStringList() ); |
30 | QStringList *ss = subSections["All"]; | 16 | QStringList *ss = subSections["All"]; |
@@ -145,71 +131,36 @@ void PackageList::updateSections( Package* pack ) | |||
145 | } | 131 | } |
146 | 132 | ||
147 | 133 | ||
148 | |||
149 | /** No descriptions */ | ||
150 | void PackageList::parseStatus() | ||
151 | { | ||
152 | QStringList dests = settings->getDestinationUrls(); | ||
153 | QStringList destnames = settings->getDestinationNames(); | ||
154 | QStringList::Iterator name = destnames.begin(); | ||
155 | for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir ) | ||
156 | { | ||
157 | pvDebug( 2,"Status: "+*dir+statusDir+"/status"); | ||
158 | readFileEntries( *dir+statusDir+"/status", *name ); | ||
159 | ++name; | ||
160 | }; | ||
161 | } | ||
162 | |||
163 | void PackageList::parseList() | ||
164 | { | ||
165 | QStringList srvs = settings->getActiveServers(); | ||
166 | |||
167 | for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) | ||
168 | { | ||
169 | pvDebug( 2, "List: "+listsDir+"/"+*it); | ||
170 | readFileEntries( listsDir+"/"+*it, "" ); | ||
171 | } | ||
172 | } | ||
173 | |||
174 | void PackageList::readFileEntries( QString filename, QString dest ) | 134 | void PackageList::readFileEntries( QString filename, QString dest ) |
175 | { | 135 | { |
136 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); | ||
176 | QStringList packEntry; | 137 | QStringList packEntry; |
177 | QFile f( filename ); | 138 | QFile f( filename ); |
178 | if ( !f.open(IO_ReadOnly) ) return; | 139 | if ( !f.open(IO_ReadOnly) ) return; |
179 | QTextStream *statusStream = new QTextStream( &f ); | 140 | QTextStream *statusStream = new QTextStream( &f ); |
180 | while ( !statusStream ->eof() ) | 141 | while ( !statusStream ->eof() ) |
181 | { | 142 | { |
182 | QString line = statusStream->readLine(); | 143 | QString line = statusStream->readLine(); |
183 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) | 144 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) |
184 | { | 145 | { |
185 | //end of package | 146 | //end of package |
186 | if ( ! packEntry.isEmpty() ) | 147 | if ( ! packEntry.isEmpty() ) |
187 | { | 148 | { |
188 | Package *p = new Package( packEntry, settings ); | 149 | Package *p = new Package( packEntry, settings ); |
189 | p->setDest( dest ); | 150 | p->setDest( dest ); |
190 | if ( p ) | 151 | if ( p ) |
191 | { | 152 | { |
192 | insertPackage( p ); | 153 | insertPackage( p ); |
193 | packEntry.clear(); | 154 | packEntry.clear(); |
194 | } | 155 | } |
195 | } | 156 | } |
196 | }else{ | 157 | }else{ |
197 | packEntry << line; | 158 | packEntry << line; |
198 | }; | 159 | }; |
199 | } | 160 | } |
200 | return; | 161 | return; |
201 | } | 162 | } |
202 | 163 | ||
203 | |||
204 | void PackageList::update() | ||
205 | { | ||
206 | pvDebug( 2, "parseStatus"); | ||
207 | parseStatus(); | ||
208 | pvDebug( 2, "parseList"); | ||
209 | parseList(); | ||
210 | pvDebug( 2, "finished parsing"); | ||
211 | } | ||
212 | |||
213 | void PackageList::setSettings( PackageManagerSettings *s ) | 164 | void PackageList::setSettings( PackageManagerSettings *s ) |
214 | { | 165 | { |
215 | settings = s; | 166 | settings = s; |