author | andyq <andyq> | 2002-10-16 21:24:23 (UTC) |
---|---|---|
committer | andyq <andyq> | 2002-10-16 21:24:23 (UTC) |
commit | 6c5cf5e778ce7cce306b5e02c1ce66a536d3a11c (patch) (side-by-side diff) | |
tree | 472f959c5e6bdda1468a405af93e6794f4eb6332 /noncore/settings | |
parent | b44c3eeb732a115e7c49e6ca9880e674f28da43e (diff) | |
download | opie-6c5cf5e778ce7cce306b5e02c1ce66a536d3a11c.zip opie-6c5cf5e778ce7cce306b5e02c1ce66a536d3a11c.tar.gz opie-6c5cf5e778ce7cce306b5e02c1ce66a536d3a11c.tar.bz2 |
Changed active server - found out you can have many (ipkg is so clever)
Now active is set in server class.
Also, currently ignores commented out servers in ipkg.conf
-rw-r--r-- | noncore/settings/aqpkg/datamgr.cpp | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp index bb86766..7c49621 100644 --- a/noncore/settings/aqpkg/datamgr.cpp +++ b/noncore/settings/aqpkg/datamgr.cpp @@ -83,28 +83,31 @@ void DataManager :: loadServers() } else { while ( fgets( line, sizeof line, fp) != NULL ) { lineStr = line; - if ( lineStr.startsWith( "src" ) || lineStr.startsWith( "#src" ) || lineStr.startsWith( "# src" ) ) + if ( lineStr.startsWith( "src" ) ) //|| lineStr.startsWith( "#src" ) || lineStr.startsWith( "# src" ) ) { char alias[20]; char url[100]; // Looks a little wierd but read up to the r of src (throwing it away), // then read up to the next space and throw that away, the alias // is next. // Should Handle #src, # src, src, and combinations of sscanf( lineStr, "%*[^r]%*[^ ] %s %s", alias, url ); Server s( alias, url ); + if ( lineStr.startsWith( "src" ) ) + s.setActive( true ); + else + s.setActive( false ); + serverList.push_back( s ); - if ( lineStr.startsWith( "src" ) ) - setActiveServer( alias ); } else if ( lineStr.startsWith( "dest" ) ) { char alias[20]; char path[50]; sscanf( lineStr, "%*[^ ] %s %s", alias, path ); @@ -112,46 +115,12 @@ void DataManager :: loadServers() destList.push_back( d ); } } } fclose( fp ); - // Go through the server destination list and add root, cf and card if they - // don't already exist -/* AQ - commented out as if you don't have a CF or SD card in then - * this causes IPKG to try to create directories on non existant devices - * (which of course fails), gives a nasty error message and can cause ipkg - * to seg fault. - * - vector<Destination>::iterator dit; - bool foundRoot = false; - bool foundCF = false; - bool foundCard = false; - for ( dit = destList.begin() ; dit != destList.end() ; ++dit ) - { - if ( dit->getDestinationPath() == "/" ) - foundRoot = true; - if ( dit->getDestinationPath() == "/mnt/cf" ) - foundCF = true; - if ( dit->getDestinationPath() == "/mnt/card" ) - foundCard = true; - } - - // If running on a Zaurus (arm) then if we didn't find root, CF or card - // destinations, add them as default -#ifdef QWS -#ifndef X86 - if ( !foundRoot ) - destList.push_back( Destination( "root", "/" ) ); - if ( !foundCF ) - destList.push_back( Destination( "cf", "/mnt/cf" ) ); - if ( !foundCF ) - destList.push_back( Destination( "card", "/mnt/card" ) ); -#endif -#endif -*/ vector<Server>::iterator it; for ( it = serverList.begin() ; it != serverList.end() ; ++it ) reloadServerData( it->getServerName() ); } void DataManager :: reloadServerData( const char *serverName ) @@ -198,13 +167,13 @@ void DataManager :: writeOutIpkgConf() QString alias = it->getServerName(); // Don't write out local as its a dummy if ( alias != LOCAL_SERVER && alias != LOCAL_IPKGS ) { QString url = it->getServerUrl();; - if ( !activeServer || alias != activeServer ) + if ( !it->isServerActive() ) out << "#"; out << "src " << alias << " " << url << endl; } it++; } |