Diffstat (limited to 'noncore/settings/aqpkg/datamgr.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/settings/aqpkg/datamgr.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp index 0159a79..2c83e28 100644 --- a/noncore/settings/aqpkg/datamgr.cpp +++ b/noncore/settings/aqpkg/datamgr.cpp | |||
@@ -11,34 +11,38 @@ | |||
11 | * This program is free software; you can redistribute it and/or modify * | 11 | * This program is free software; you can redistribute it and/or modify * |
12 | * it under the terms of the GNU General Public License as published by * | 12 | * it under the terms of the GNU General Public License as published by * |
13 | * the Free Software Foundation; either version 2 of the License, or * | 13 | * the Free Software Foundation; either version 2 of the License, or * |
14 | * (at your option) any later version. * | 14 | * (at your option) any later version. * |
15 | * * | 15 | * * |
16 | ***************************************************************************/ | 16 | ***************************************************************************/ |
17 | #include <fstream> | 17 | #include <fstream> |
18 | #include <iostream> | 18 | #include <iostream> |
19 | using namespace std; | 19 | using namespace std; |
20 | 20 | ||
21 | #ifdef QWS | 21 | #ifdef QWS |
22 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
23 | #include <qpe/qpeapplication.h> | ||
24 | #else | ||
25 | #include <qapplication.h> | ||
23 | #endif | 26 | #endif |
24 | 27 | ||
25 | #include <stdio.h> | 28 | #include <stdio.h> |
26 | 29 | ||
27 | #include "datamgr.h" | 30 | #include "datamgr.h" |
28 | #include "global.h" | 31 | #include "global.h" |
29 | 32 | ||
30 | 33 | ||
31 | QString DataManager::availableCategories = ""; | 34 | QString DataManager::availableCategories = ""; |
32 | DataManager::DataManager() | 35 | DataManager::DataManager() |
36 | : QObject( 0x0, 0x0 ) | ||
33 | { | 37 | { |
34 | activeServer = ""; | 38 | activeServer = ""; |
35 | availableCategories = "#"; | 39 | availableCategories = "#"; |
36 | } | 40 | } |
37 | 41 | ||
38 | DataManager::~DataManager() | 42 | DataManager::~DataManager() |
39 | { | 43 | { |
40 | } | 44 | } |
41 | 45 | ||
42 | vector<Server>::iterator DataManager :: getServer( const char *name ) | 46 | vector<Server>::iterator DataManager :: getServer( const char *name ) |
43 | { | 47 | { |
44 | vector<Server>::iterator it = serverList.begin(); | 48 | vector<Server>::iterator it = serverList.begin(); |
@@ -156,35 +160,45 @@ void DataManager :: loadServers() | |||
156 | if ( stricmp( type, "proxy_password" ) == 0 ) | 160 | if ( stricmp( type, "proxy_password" ) == 0 ) |
157 | proxyPassword = val; | 161 | proxyPassword = val; |
158 | } | 162 | } |
159 | } | 163 | } |
160 | } | 164 | } |
161 | fclose( fp ); | 165 | fclose( fp ); |
162 | 166 | ||
163 | reloadServerData( ); | 167 | reloadServerData( ); |
164 | } | 168 | } |
165 | 169 | ||
166 | void DataManager :: reloadServerData( ) | 170 | void DataManager :: reloadServerData( ) |
167 | { | 171 | { |
172 | emit progressSetSteps( serverList.size() ); | ||
173 | emit progressSetMessage( tr( "Reading configuration..." ) ); | ||
174 | |||
168 | vector<Server>::iterator it = serverList.begin(); | 175 | vector<Server>::iterator it = serverList.begin(); |
176 | QString serverName; | ||
177 | int i = 0; | ||
169 | for ( it = serverList.begin() ; it != serverList.end() ; ++it ) | 178 | for ( it = serverList.begin() ; it != serverList.end() ; ++it ) |
170 | { | 179 | { |
180 | serverName = it->getServerName(); | ||
181 | i++; | ||
182 | emit progressUpdate( i ); | ||
183 | qApp->processEvents(); | ||
184 | |||
171 | // Now we've read the config file in we need to read the servers | 185 | // Now we've read the config file in we need to read the servers |
172 | // The local server is a special case. This holds the contents of the | 186 | // The local server is a special case. This holds the contents of the |
173 | // status files the number of which depends on how many destinations | 187 | // status files the number of which depends on how many destinations |
174 | // we've set up | 188 | // we've set up |
175 | // The other servers files hold the contents of the server package list | 189 | // The other servers files hold the contents of the server package list |
176 | if ( it->getServerName() == LOCAL_SERVER ) | 190 | if ( serverName == LOCAL_SERVER ) |
177 | it->readStatusFile( destList ); | 191 | it->readStatusFile( destList ); |
178 | else if ( it->getServerName() == LOCAL_IPKGS ) | 192 | else if ( serverName == LOCAL_IPKGS ) |
179 | it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) ); | 193 | it->readLocalIpks( &( *getServer( LOCAL_SERVER ) ) ); |
180 | else | 194 | else |
181 | it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) ); | 195 | it->readPackageFile( &( *getServer( LOCAL_SERVER ) ) ); |
182 | } | 196 | } |
183 | } | 197 | } |
184 | 198 | ||
185 | void DataManager :: writeOutIpkgConf() | 199 | void DataManager :: writeOutIpkgConf() |
186 | { | 200 | { |
187 | QString ipkg_conf = IPKG_CONF; | 201 | QString ipkg_conf = IPKG_CONF; |
188 | ofstream out( ipkg_conf ); | 202 | ofstream out( ipkg_conf ); |
189 | 203 | ||
190 | out << "# Written by AQPkg" << endl; | 204 | out << "# Written by AQPkg" << endl; |