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/packagelistlocal.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/packagelistlocal.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/unsupported/oipkg/packagelistlocal.cpp | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/noncore/unsupported/oipkg/packagelistlocal.cpp b/noncore/unsupported/oipkg/packagelistlocal.cpp new file mode 100644 index 0000000..6d931c8 --- a/dev/null +++ b/noncore/unsupported/oipkg/packagelistlocal.cpp | |||
@@ -0,0 +1,66 @@ | |||
1 | #include <qpe/config.h> | ||
2 | #include <qfile.h> | ||
3 | #include <qfileinfo.h> | ||
4 | #include <qtextstream.h> | ||
5 | #include <qstringlist.h> | ||
6 | #include "packagelistlocal.h" | ||
7 | |||
8 | PackageListLocal::PackageListLocal() | ||
9 | : PackageList() | ||
10 | { | ||
11 | Config cfg( "oipkg", Config::User ); | ||
12 | cfg.setGroup( "Common" ); | ||
13 | statusDir = cfg.readEntry( "statusDir", "" ); | ||
14 | listsDir = cfg.readEntry( "listsDir", "" ); | ||
15 | if ( statusDir=="" || ! QFileInfo(statusDir+"/status").isFile() ) | ||
16 | { | ||
17 | statusDir="/usr/lib/ipkg/"; | ||
18 | listsDir="/usr/lib/ipkg/lists/"; | ||
19 | cfg.writeEntry( "statusDir", statusDir ); | ||
20 | cfg.writeEntry( "listsDir", listsDir ); | ||
21 | } | ||
22 | } | ||
23 | |||
24 | PackageListLocal::PackageListLocal(PackageManagerSettings* s) | ||
25 | : PackageList(s) | ||
26 | { | ||
27 | PackageListLocal(); | ||
28 | } | ||
29 | |||
30 | PackageListLocal::~PackageListLocal() | ||
31 | { | ||
32 | } | ||
33 | |||
34 | void PackageListLocal::parseStatus() | ||
35 | { | ||
36 | QStringList dests = settings->getDestinationUrls(); | ||
37 | QStringList destnames = settings->getDestinationNames(); | ||
38 | QStringList::Iterator name = destnames.begin(); | ||
39 | for ( QStringList::Iterator dir = dests.begin(); dir != dests.end(); ++dir ) | ||
40 | { | ||
41 | pvDebug( 2,"Status: "+*dir+statusDir+"/status"); | ||
42 | readFileEntries( *dir+statusDir+"/status", *name ); | ||
43 | ++name; | ||
44 | }; | ||
45 | } | ||
46 | |||
47 | void PackageListLocal::parseList() | ||
48 | { | ||
49 | QStringList srvs = settings->getActiveServers(); | ||
50 | |||
51 | for ( QStringList::Iterator it = srvs.begin(); it != srvs.end(); ++it ) | ||
52 | { | ||
53 | pvDebug( 2, "List: "+listsDir+"/"+*it); | ||
54 | readFileEntries( listsDir+"/"+*it ); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | |||
59 | void PackageListLocal::update() | ||
60 | { | ||
61 | pvDebug( 2, "parseStatus"); | ||
62 | parseStatus(); | ||
63 | pvDebug( 2, "parseList"); | ||
64 | parseList(); | ||
65 | pvDebug( 2, "finished parsing"); | ||
66 | } | ||