Diffstat (limited to 'noncore/settings/aqpkg/server.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/server.cpp | 52 |
1 files changed, 30 insertions, 22 deletions
diff --git a/noncore/settings/aqpkg/server.cpp b/noncore/settings/aqpkg/server.cpp index e2b8096..4693db1 100644 --- a/noncore/settings/aqpkg/server.cpp +++ b/noncore/settings/aqpkg/server.cpp | |||
@@ -1,111 +1,119 @@ | |||
1 | /*************************************************************************** | 1 | /* |
2 | server.cpp - description | 2 | This file is part of the OPIE Project |
3 | ------------------- | 3 | |
4 | begin : Mon Aug 26 2002 | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | copyright : (C) 2002 by Andy Qua | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | email : andy.qua@blueyonder.co.uk | 6 | .>+-= |
7 | description : This class holds details about a server | 7 | _;:, .> :=|. This file is free software; you can |
8 | : e.g. all the packages that contained on the server | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | : the installation status | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
10 | ***************************************************************************/ | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | 11 | - . .-<_> .<> Foundation; either version 2 of the License, | |
12 | /*************************************************************************** | 12 | ._= =} : or (at your option) any later version. |
13 | * * | 13 | .%`+i> _;_. |
14 | * This program is free software; you can redistribute it and/or modify * | 14 | .i_,=:_. -<s. This file is distributed in the hope that |
15 | * it under the terms of the GNU General Public License as published by * | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | * the Free Software Foundation; either version 2 of the License, or * | 16 | : .. .:, . . . without even the implied warranty of |
17 | * (at your option) any later version. * | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | * * | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU General |
19 | ***************************************************************************/ | 19 | ..}^=.= = ; Public License for more details. |
20 | 20 | ++= -. .` .: | |
21 | : = ...= . :.=- You should have received a copy of the GNU | ||
22 | -. .:....=;==+<; General Public License along with this file; | ||
23 | -_. . . )=. = see the file COPYING. If not, write to the | ||
24 | -- :-=` Free Software Foundation, Inc., | ||
25 | 59 Temple Place - Suite 330, | ||
26 | Boston, MA 02111-1307, USA. | ||
27 | |||
28 | */ | ||
21 | 29 | ||
22 | #include "server.h" | 30 | #include "server.h" |
23 | #include "datamgr.h" | 31 | #include "datamgr.h" |
24 | 32 | ||
25 | #include <qfile.h> | 33 | #include <qfile.h> |
26 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
27 | 35 | ||
28 | #ifdef QWS | 36 | #ifdef QWS |
29 | #include <qpe/global.h> | 37 | #include <qpe/global.h> |
30 | #include <qpe/applnk.h> | 38 | #include <qpe/applnk.h> |
31 | #include <qlist.h> | 39 | #include <qlist.h> |
32 | #endif | 40 | #endif |
33 | 41 | ||
34 | #include "utils.h" | 42 | #include "utils.h" |
35 | 43 | ||
36 | #include "global.h" | 44 | #include "global.h" |
37 | 45 | ||
38 | Server :: Server( const char *name, const char *url ) | 46 | Server :: Server( const char *name, const char *url ) |
39 | { | 47 | { |
40 | serverName = name; | 48 | serverName = name; |
41 | serverUrl = url; | 49 | serverUrl = url; |
42 | packageFile = IPKG_DIR; | 50 | packageFile = IPKG_DIR; |
43 | active = true; | 51 | active = true; |
44 | packageFile += "lists/" + serverName; | 52 | packageFile.append( "lists/" ); |
53 | packageFile.append( serverName ); | ||
45 | } | 54 | } |
46 | 55 | ||
47 | Server :: ~Server() | 56 | Server :: ~Server() |
48 | { | 57 | { |
49 | cleanUp(); | 58 | cleanUp(); |
50 | } | 59 | } |
51 | 60 | ||
52 | void Server :: cleanUp() | 61 | void Server :: cleanUp() |
53 | { | 62 | { |
54 | packageList.clear(); | 63 | packageList.clear(); |
55 | } | 64 | } |
56 | 65 | ||
57 | void Server :: readStatusFile( QList<Destination> &destList ) | 66 | void Server :: readStatusFile( QList<Destination> &destList ) |
58 | { | 67 | { |
59 | cleanUp(); | 68 | cleanUp(); |
60 | 69 | ||
61 | Destination *dest; | 70 | Destination *dest; |
62 | QListIterator<Destination> dit( destList ); | 71 | QListIterator<Destination> dit( destList ); |
63 | bool rootRead = false; | 72 | bool rootRead = false; |
64 | for ( ; dit.current(); ++dit ) | 73 | for ( ; dit.current(); ++dit ) |
65 | { | 74 | { |
66 | dest = dit.current(); | 75 | dest = dit.current(); |
67 | bool installingToRoot = false; | 76 | bool installingToRoot = false; |
68 | 77 | ||
69 | QString path = dest->getDestinationPath(); | 78 | QString path = dest->getDestinationPath(); |
70 | if ( path.right( 1 ) != "/" ) | 79 | if ( path.right( 1 ) != "/" ) |
71 | path.append( "/" ); | 80 | path.append( "/" ); |
72 | 81 | ||
73 | if ( path == "/" ) | 82 | if ( path == "/" ) |
74 | { | 83 | { |
75 | rootRead = true; | 84 | rootRead = true; |
76 | installingToRoot = true; | 85 | installingToRoot = true; |
77 | } | 86 | } |
78 | 87 | ||
79 | packageFile = path; | 88 | packageFile = path; |
80 | packageFile.append( "usr/lib/ipkg/status" ); | 89 | packageFile.append( "usr/lib/ipkg/status" ); |
81 | readPackageFile( 0, false, installingToRoot, &( *dest ) ); | 90 | readPackageFile( 0, false, installingToRoot, &( *dest ) ); |
82 | } | 91 | } |
83 | 92 | ||
84 | // Ensure that the root status file is read | 93 | // Ensure that the root status file is read |
85 | if ( !rootRead ) | 94 | if ( !rootRead ) |
86 | { | 95 | { |
87 | //cout << "Reading status file " << "/usr/lib/ipkg/status" << endl; | ||
88 | packageFile = "/usr/lib/ipkg/status"; | 96 | packageFile = "/usr/lib/ipkg/status"; |
89 | readPackageFile( 0, false, true ); | 97 | readPackageFile( 0, false, true ); |
90 | } | 98 | } |
91 | } | 99 | } |
92 | 100 | ||
93 | void Server :: readLocalIpks( Server *local ) | 101 | void Server :: readLocalIpks( Server *local ) |
94 | { | 102 | { |
95 | cleanUp(); | 103 | cleanUp(); |
96 | 104 | ||
97 | #ifdef QWS | 105 | #ifdef QWS |
98 | // First, get any local IPKGs in the documents area | 106 | // First, get any local IPKGs in the documents area |
99 | // Only applicable to Qtopie/Opie | 107 | // Only applicable to Qtopie/Opie |
100 | 108 | ||
101 | DocLnkSet files; | 109 | DocLnkSet files; |
102 | Global::findDocuments( &files, "application/ipkg" ); | 110 | Global::findDocuments( &files, "application/ipkg" ); |
103 | 111 | ||
104 | // Now add the items to the list | 112 | // Now add the items to the list |
105 | QListIterator<DocLnk> it( files.children() ); | 113 | QListIterator<DocLnk> it( files.children() ); |
106 | 114 | ||
107 | for ( ; it.current() ; ++it ) | 115 | for ( ; it.current() ; ++it ) |
108 | { | 116 | { |
109 | // OK, we have a local IPK file, I think the standard naming conventions | 117 | // OK, we have a local IPK file, I think the standard naming conventions |
110 | // for these are packagename_version_arm.ipk | 118 | // for these are packagename_version_arm.ipk |
111 | QString file = (*it)->file(); | 119 | QString file = (*it)->file(); |