Diffstat (limited to 'noncore/settings/aqpkg/datamgr.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/datamgr.cpp | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp index cd0c78f..67f90a3 100644 --- a/noncore/settings/aqpkg/datamgr.cpp +++ b/noncore/settings/aqpkg/datamgr.cpp | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the OPIE Project | 2 | This file is part of the OPIE Project |
3 | 3 | ||
4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> | 4 | =. Copyright (c) 2002 Andy Qua <andy.qua@blueyonder.co.uk> |
5 | .=l. Dan Williams <drw@handhelds.org> | 5 | .=l. Dan Williams <drw@handhelds.org> |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This file is free software; you can | 7 | _;:, .> :=|. This file is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
@@ -37,20 +37,23 @@ | |||
37 | #include <qfile.h> | 37 | #include <qfile.h> |
38 | #include <qtextstream.h> | 38 | #include <qtextstream.h> |
39 | 39 | ||
40 | #include "datamgr.h" | 40 | #include "datamgr.h" |
41 | #include "global.h" | 41 | #include "global.h" |
42 | 42 | ||
43 | QString LOCAL_SERVER; | ||
44 | QString LOCAL_IPKGS; | ||
45 | |||
43 | 46 | ||
44 | QString DataManager::availableCategories = ""; | 47 | QString DataManager::availableCategories = ""; |
45 | DataManager::DataManager() | 48 | DataManager::DataManager() |
46 | : QObject( 0x0, 0x0 ) | 49 | : QObject( 0x0, 0x0 ) |
47 | { | 50 | { |
48 | activeServer = ""; | 51 | activeServer = ""; |
49 | availableCategories = "#"; | 52 | availableCategories = "#"; |
50 | 53 | ||
51 | serverList.setAutoDelete( TRUE ); | 54 | serverList.setAutoDelete( TRUE ); |
52 | destList.setAutoDelete( TRUE ); | 55 | destList.setAutoDelete( TRUE ); |
53 | } | 56 | } |
54 | 57 | ||
55 | DataManager::~DataManager() | 58 | DataManager::~DataManager() |
56 | { | 59 | { |
@@ -134,13 +137,13 @@ void DataManager :: loadServers() | |||
134 | #ifdef QWS | 137 | #ifdef QWS |
135 | QString key = alias; | 138 | QString key = alias; |
136 | key += "_linkToRoot"; | 139 | key += "_linkToRoot"; |
137 | linkToRoot = cfg.readBoolEntry( key, true ); | 140 | linkToRoot = cfg.readBoolEntry( key, true ); |
138 | #endif | 141 | #endif |
139 | d->linkToRoot( linkToRoot ); | 142 | d->linkToRoot( linkToRoot ); |
140 | 143 | ||
141 | destList.append( d ); | 144 | destList.append( d ); |
142 | } | 145 | } |
143 | else if ( lineStr.startsWith( "option" ) || lineStr.startsWith( "#option" ) ) | 146 | else if ( lineStr.startsWith( "option" ) || lineStr.startsWith( "#option" ) ) |
144 | { | 147 | { |
145 | char type[20]; | 148 | char type[20]; |
146 | char val[100]; | 149 | char val[100]; |
@@ -177,45 +180,45 @@ void DataManager :: reloadServerData( ) | |||
177 | { | 180 | { |
178 | emit progressSetSteps( serverList.count() ); | 181 | emit progressSetSteps( serverList.count() ); |
179 | emit progressSetMessage( tr( "Reading configuration..." ) ); | 182 | emit progressSetMessage( tr( "Reading configuration..." ) ); |
180 | 183 | ||
181 | QString serverName; | 184 | QString serverName; |
182 | int i = 0; | 185 | int i = 0; |
183 | 186 | ||
184 | Server *server; | 187 | Server *server; |
185 | QListIterator<Server> it( serverList ); | 188 | QListIterator<Server> it( serverList ); |
186 | for ( ; it.current(); ++it ) | 189 | for ( ; it.current(); ++it ) |
187 | { | 190 | { |
188 | server = it.current(); | 191 | server = it.current(); |
189 | serverName = server->getServerName(); | 192 | serverName = server->getServerName(); |
190 | i++; | 193 | i++; |
191 | emit progressUpdate( i ); | 194 | emit progressUpdate( i ); |
192 | qApp->processEvents(); | 195 | qApp->processEvents(); |
193 | 196 | ||
194 | // Now we've read the config file in we need to read the servers | 197 | // Now we've read the config file in we need to read the servers |
195 | // The local server is a special case. This holds the contents of the | 198 | // The local server is a special case. This holds the contents of the |
196 | // status files the number of which depends on how many destinations | 199 | // status files the number of which depends on how many destinations |
197 | // we've set up | 200 | // we've set up |
198 | // The other servers files hold the contents of the server package list | 201 | // The other servers files hold the contents of the server package list |
199 | if ( serverName == LOCAL_SERVER ) | 202 | if ( serverName == LOCAL_SERVER ) |
200 | server->readStatusFile( destList ); | 203 | server->readStatusFile( destList ); |
201 | else if ( serverName == LOCAL_IPKGS ) | 204 | else if ( serverName == LOCAL_IPKGS ) |
202 | server->readLocalIpks( getServer( LOCAL_SERVER ) ); | 205 | server->readLocalIpks( getServer( LOCAL_SERVER ) ); |
203 | else | 206 | else |
204 | server->readPackageFile( getServer( LOCAL_SERVER ) ); | 207 | server->readPackageFile( getServer( LOCAL_SERVER ) ); |
205 | } | 208 | } |
206 | } | 209 | } |
207 | 210 | ||
208 | void DataManager :: writeOutIpkgConf() | 211 | void DataManager :: writeOutIpkgConf() |
209 | { | 212 | { |
210 | QFile f( IPKG_CONF ); | 213 | QFile f( IPKG_CONF ); |
211 | if ( !f.open( IO_WriteOnly ) ) | 214 | if ( !f.open( IO_WriteOnly ) ) |
212 | { | 215 | { |
213 | return; | 216 | return; |
214 | } | 217 | } |
215 | 218 | ||
216 | QTextStream t( &f ); | 219 | QTextStream t( &f ); |
217 | /* | 220 | /* |
218 | QString ipkg_conf = IPKG_CONF; | 221 | QString ipkg_conf = IPKG_CONF; |
219 | ofstream out( ipkg_conf ); | 222 | ofstream out( ipkg_conf ); |
220 | */ | 223 | */ |
221 | t << "# Written by AQPkg\n"; | 224 | t << "# Written by AQPkg\n"; |
@@ -291,13 +294,13 @@ void DataManager :: writeOutIpkgConf() | |||
291 | t << "#option proxy_password <password>\n\n"; | 294 | t << "#option proxy_password <password>\n\n"; |
292 | else | 295 | else |
293 | t << "option proxy_password " << proxyPassword << endl<< endl; | 296 | t << "option proxy_password " << proxyPassword << endl<< endl; |
294 | 297 | ||
295 | t << "# Offline mode (for use in constructing flash images offline)\n"; | 298 | t << "# Offline mode (for use in constructing flash images offline)\n"; |
296 | t << "#option offline_root target\n"; | 299 | t << "#option offline_root target\n"; |
297 | 300 | ||
298 | f.close(); | 301 | f.close(); |
299 | } | 302 | } |
300 | 303 | ||
301 | 304 | ||
302 | void DataManager :: setAvailableCategories( QString section ) | 305 | void DataManager :: setAvailableCategories( QString section ) |
303 | { | 306 | { |