summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2004-04-27 19:16:52 (UTC)
committer mickeyl <mickeyl>2004-04-27 19:16:52 (UTC)
commit7e3f65c9733254bf9f67932cc4f3833fba9a4914 (patch) (unidiff)
treec3b609c862afbe8667f448a473a9641c8c0ab298
parentb645511e7fba8e3c27fda69b3939c0e5dbca1609 (diff)
downloadopie-7e3f65c9733254bf9f67932cc4f3833fba9a4914.zip
opie-7e3f65c9733254bf9f67932cc4f3833fba9a4914.tar.gz
opie-7e3f65c9733254bf9f67932cc4f3833fba9a4914.tar.bz2
g++ 3.4 fix in conjunction w/ the qte fix
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp
index 67f90a3..93daaba 100644
--- a/noncore/settings/aqpkg/datamgr.cpp
+++ b/noncore/settings/aqpkg/datamgr.cpp
@@ -55,211 +55,211 @@ DataManager::DataManager()
55 destList.setAutoDelete( TRUE ); 55 destList.setAutoDelete( TRUE );
56} 56}
57 57
58DataManager::~DataManager() 58DataManager::~DataManager()
59{ 59{
60} 60}
61 61
62Server *DataManager :: getServer( const char *name ) 62Server *DataManager :: getServer( const char *name )
63{ 63{
64 QListIterator<Server> it( serverList ); 64 QListIterator<Server> it( serverList );
65 while ( it.current() && it.current()->getServerName() != name ) 65 while ( it.current() && it.current()->getServerName() != name )
66 { 66 {
67 ++it; 67 ++it;
68 } 68 }
69 69
70 return it.current(); 70 return it.current();
71} 71}
72 72
73Destination *DataManager :: getDestination( const char *name ) 73Destination *DataManager :: getDestination( const char *name )
74{ 74{
75 QListIterator<Destination> it( destList ); 75 QListIterator<Destination> it( destList );
76 while ( it.current() && it.current()->getDestinationName() != name ) 76 while ( it.current() && it.current()->getDestinationName() != name )
77 { 77 {
78 ++it; 78 ++it;
79 } 79 }
80 80
81 return it.current(); 81 return it.current();
82} 82}
83 83
84void DataManager :: loadServers() 84void DataManager :: loadServers()
85{ 85{
86 // First add our local server - not really a server but 86 // First add our local server - not really a server but
87 // the local config (which packages are installed) 87 // the local config (which packages are installed)
88 serverList.append( new Server( LOCAL_SERVER, "" ) ); 88 serverList.append( new Server( LOCAL_SERVER, "" ) );
89 serverList.append( new Server( LOCAL_IPKGS, "" ) ); 89 serverList.append( new Server( LOCAL_IPKGS, "" ) );
90 90
91#ifdef QWS 91#ifdef QWS
92 Config cfg( "aqpkg" ); 92 Config cfg( "aqpkg" );
93 cfg.setGroup( "destinations" ); 93 cfg.setGroup( "destinations" );
94#endif 94#endif
95 95
96 // Read file from /etc/ipkg.conf 96 // Read file from /etc/ipkg.conf
97 QString ipkg_conf = IPKG_CONF; 97 QString ipkg_conf = IPKG_CONF;
98 FILE *fp; 98 FILE *fp;
99 fp = fopen( ipkg_conf, "r" ); 99 fp = fopen( ipkg_conf, "r" );
100 char line[130]; 100 char line[130];
101 QString lineStr; 101 QString lineStr;
102 if ( fp == NULL ) 102 if ( fp == NULL )
103 { 103 {
104 return; 104 return;
105 } 105 }
106 else 106 else
107 { 107 {
108 while ( fgets( line, sizeof line, fp) != NULL ) 108 while ( fgets( line, sizeof line, fp) != NULL )
109 { 109 {
110 lineStr = line; 110 lineStr = line;
111 if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) || lineStr.startsWith( "# src" ) ) 111 if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) || lineStr.startsWith( "# src" ) )
112 { 112 {
113 char alias[20]; 113 char alias[20];
114 char url[100]; 114 char url[100];
115 115
116 // Looks a little wierd but read up to the r of src (throwing it away), 116 // Looks a little wierd but read up to the r of src (throwing it away),
117 // then read up to the next space and throw that away, the alias 117 // then read up to the next space and throw that away, the alias
118 // is next. 118 // is next.
119 // Should Handle #src, # src, src, and combinations of 119 // Should Handle #src, # src, src, and combinations of
120 sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); 120 sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url );
121 Server *s = new Server( alias, url ); 121 Server *s = new Server( alias, url );
122 if ( lineStr.startsWith( "src" ) ) 122 if ( lineStr.startsWith( "src" ) )
123 s->setActive( true ); 123 s->setActive( true );
124 else 124 else
125 s->setActive( false ); 125 s->setActive( false );
126 126
127 serverList.append( s ); 127 serverList.append( s );
128 128
129 } 129 }
130 else if ( lineStr.startsWith( "dest" ) ) 130 else if ( lineStr.startsWith( "dest" ) )
131 { 131 {
132 char alias[20]; 132 char alias[20];
133 char path[50]; 133 char path[50];
134 sscanf( lineStr, "%*[^ ] %s %s", alias, path ); 134 sscanf( lineStr, "%*[^ ] %s %s", alias, path );
135 Destination *d = new Destination( alias, path ); 135 Destination *d = new Destination( alias, path );
136 bool linkToRoot = true; 136 bool linkToRoot = true;
137#ifdef QWS 137#ifdef QWS
138 QString key = alias; 138 QString key = alias;
139 key += "_linkToRoot"; 139 key += "_linkToRoot";
140 linkToRoot = cfg.readBoolEntry( key, true ); 140 linkToRoot = cfg.readBoolEntry( key, true );
141#endif 141#endif
142 d->linkToRoot( linkToRoot ); 142 d->linkToRoot( linkToRoot );
143 143
144 destList.append( d ); 144 destList.append( d );
145 } 145 }
146 else if ( lineStr.startsWith( "option" ) || lineStr.startsWith( "#option" ) ) 146 else if ( lineStr.startsWith( "option" ) || lineStr.startsWith( "#option" ) )
147 { 147 {
148 char type[20]; 148 char type[20];
149 char val[100]; 149 char val[100];
150 sscanf( lineStr, "%*[^ ] %s %s", type, val ); 150 sscanf( lineStr, "%*[^ ] %s %s", type, val );
151 if ( stricmp( type, "http_proxy" ) == 0 ) 151 if ( qstricmp( type, "http_proxy" ) == 0 )
152 { 152 {
153 httpProxy = val; 153 httpProxy = val;
154 if ( lineStr.startsWith( "#" ) ) 154 if ( lineStr.startsWith( "#" ) )
155 httpProxyEnabled = false; 155 httpProxyEnabled = false;
156 else 156 else
157 httpProxyEnabled = true; 157 httpProxyEnabled = true;
158 } 158 }
159 if ( stricmp( type, "ftp_proxy" ) == 0 ) 159 if ( qstricmp( type, "ftp_proxy" ) == 0 )
160 { 160 {
161 ftpProxy = val; 161 ftpProxy = val;
162 if ( lineStr.startsWith( "#" ) ) 162 if ( lineStr.startsWith( "#" ) )
163 ftpProxyEnabled = false; 163 ftpProxyEnabled = false;
164 else 164 else
165 ftpProxyEnabled = true; 165 ftpProxyEnabled = true;
166 } 166 }
167 if ( stricmp( type, "proxy_username" ) == 0 ) 167 if ( qstricmp( type, "proxy_username" ) == 0 )
168 proxyUsername = val; 168 proxyUsername = val;
169 if ( stricmp( type, "proxy_password" ) == 0 ) 169 if ( qstricmp( type, "proxy_password" ) == 0 )
170 proxyPassword = val; 170 proxyPassword = val;
171 } 171 }
172 } 172 }
173 } 173 }
174 fclose( fp ); 174 fclose( fp );
175 175
176 reloadServerData( ); 176 reloadServerData( );
177} 177}
178 178
179void DataManager :: reloadServerData( ) 179void DataManager :: reloadServerData( )
180{ 180{
181 emit progressSetSteps( serverList.count() ); 181 emit progressSetSteps( serverList.count() );
182 emit progressSetMessage( tr( "Reading configuration..." ) ); 182 emit progressSetMessage( tr( "Reading configuration..." ) );
183 183
184 QString serverName; 184 QString serverName;
185 int i = 0; 185 int i = 0;
186 186
187 Server *server; 187 Server *server;
188 QListIterator<Server> it( serverList ); 188 QListIterator<Server> it( serverList );
189 for ( ; it.current(); ++it ) 189 for ( ; it.current(); ++it )
190 { 190 {
191 server = it.current(); 191 server = it.current();
192 serverName = server->getServerName(); 192 serverName = server->getServerName();
193 i++; 193 i++;
194 emit progressUpdate( i ); 194 emit progressUpdate( i );
195 qApp->processEvents(); 195 qApp->processEvents();
196 196
197 // 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
198 // 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
199 // status files the number of which depends on how many destinations 199 // status files the number of which depends on how many destinations
200 // we've set up 200 // we've set up
201 // 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
202 if ( serverName == LOCAL_SERVER ) 202 if ( serverName == LOCAL_SERVER )
203 server->readStatusFile( destList ); 203 server->readStatusFile( destList );
204 else if ( serverName == LOCAL_IPKGS ) 204 else if ( serverName == LOCAL_IPKGS )
205 server->readLocalIpks( getServer( LOCAL_SERVER ) ); 205 server->readLocalIpks( getServer( LOCAL_SERVER ) );
206 else 206 else
207 server->readPackageFile( getServer( LOCAL_SERVER ) ); 207 server->readPackageFile( getServer( LOCAL_SERVER ) );
208 } 208 }
209} 209}
210 210
211void DataManager :: writeOutIpkgConf() 211void DataManager :: writeOutIpkgConf()
212{ 212{
213 QFile f( IPKG_CONF ); 213 QFile f( IPKG_CONF );
214 if ( !f.open( IO_WriteOnly ) ) 214 if ( !f.open( IO_WriteOnly ) )
215 { 215 {
216 return; 216 return;
217 } 217 }
218 218
219 QTextStream t( &f ); 219 QTextStream t( &f );
220/* 220/*
221 QString ipkg_conf = IPKG_CONF; 221 QString ipkg_conf = IPKG_CONF;
222 ofstream out( ipkg_conf ); 222 ofstream out( ipkg_conf );
223*/ 223*/
224 t << "# Written by AQPkg\n"; 224 t << "# Written by AQPkg\n";
225 t << "# Must have one or more source entries of the form:\n"; 225 t << "# Must have one or more source entries of the form:\n";
226 t << "#\n"; 226 t << "#\n";
227 t << "# src <src-name> <source-url>\n"; 227 t << "# src <src-name> <source-url>\n";
228 t << "#\n"; 228 t << "#\n";
229 t << "# and one or more destination entries of the form:\n"; 229 t << "# and one or more destination entries of the form:\n";
230 t << "#\n"; 230 t << "#\n";
231 t << "# dest <dest-name> <target-path>\n"; 231 t << "# dest <dest-name> <target-path>\n";
232 t << "#\n"; 232 t << "#\n";
233 t << "# where <src-name> and <dest-names> are identifiers that\n"; 233 t << "# where <src-name> and <dest-names> are identifiers that\n";
234 t << "# should match [a-zA-Z0-9._-]+, <source-url> should be a\n"; 234 t << "# should match [a-zA-Z0-9._-]+, <source-url> should be a\n";
235 t << "# URL that points to a directory containing a Familiar\n"; 235 t << "# URL that points to a directory containing a Familiar\n";
236 t << "# Packages file, and <target-path> should be a directory\n"; 236 t << "# Packages file, and <target-path> should be a directory\n";
237 t << "# that exists on the target system.\n\n"; 237 t << "# that exists on the target system.\n\n";
238 238
239 // Write out servers 239 // Write out servers
240 Server *server; 240 Server *server;
241 QListIterator<Server> it( serverList ); 241 QListIterator<Server> it( serverList );
242 while ( it.current() ) 242 while ( it.current() )
243 { 243 {
244 server = it.current(); 244 server = it.current();
245 QString alias = server->getServerName(); 245 QString alias = server->getServerName();
246 // Don't write out local as its a dummy 246 // Don't write out local as its a dummy
247 if ( alias != LOCAL_SERVER && alias != LOCAL_IPKGS ) 247 if ( alias != LOCAL_SERVER && alias != LOCAL_IPKGS )
248 { 248 {
249 QString url = server->getServerUrl();; 249 QString url = server->getServerUrl();;
250 250
251 if ( !server->isServerActive() ) 251 if ( !server->isServerActive() )
252 t << "#"; 252 t << "#";
253 t << "src " << alias << " " << url << endl; 253 t << "src " << alias << " " << url << endl;
254 } 254 }
255 255
256 ++it; 256 ++it;
257 } 257 }
258 258
259 t << endl; 259 t << endl;
260 260
261 // Write out destinations 261 // Write out destinations
262 QListIterator<Destination> it2( destList ); 262 QListIterator<Destination> it2( destList );
263 while ( it2.current() ) 263 while ( it2.current() )
264 { 264 {
265 t << "dest " << it2.current()->getDestinationName() << " " << it2.current()->getDestinationPath() << endl; 265 t << "dest " << it2.current()->getDestinationName() << " " << it2.current()->getDestinationPath() << endl;