summaryrefslogtreecommitdiff
path: root/noncore
authorandyq <andyq>2002-10-17 22:49:03 (UTC)
committer andyq <andyq>2002-10-17 22:49:03 (UTC)
commit943c09096f11827470b9cd3e311329ac422aaf20 (patch) (unidiff)
treecec58c8ee61f85a2ebf3944594962a42489255fb /noncore
parent63a3ca758c82a397f448cce88789bf12c492b294 (diff)
downloadopie-943c09096f11827470b9cd3e311329ac422aaf20.zip
opie-943c09096f11827470b9cd3e311329ac422aaf20.tar.gz
opie-943c09096f11827470b9cd3e311329ac422aaf20.tar.bz2
Read/Write out to config file whether a destination is set to linkToRoot
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/datamgr.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/noncore/settings/aqpkg/datamgr.cpp b/noncore/settings/aqpkg/datamgr.cpp
index d929c39..089c3e3 100644
--- a/noncore/settings/aqpkg/datamgr.cpp
+++ b/noncore/settings/aqpkg/datamgr.cpp
@@ -9,24 +9,28 @@
9/*************************************************************************** 9/***************************************************************************
10 * * 10 * *
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>
19using namespace std; 19using namespace std;
20 20
21#ifdef QWS
22#include <qpe/config.h>
23#endif
24
21#include <stdio.h> 25#include <stdio.h>
22 26
23#include "datamgr.h" 27#include "datamgr.h"
24#include "global.h" 28#include "global.h"
25 29
26 30
27DataManager::DataManager() 31DataManager::DataManager()
28{ 32{
29 activeServer = ""; 33 activeServer = "";
30} 34}
31 35
32DataManager::~DataManager() 36DataManager::~DataManager()
@@ -61,24 +65,29 @@ Destination *DataManager :: getDestination( const char *name )
61 } 65 }
62 66
63 return d; 67 return d;
64} 68}
65 69
66void DataManager :: loadServers() 70void DataManager :: loadServers()
67{ 71{
68 // First add our local server - not really a server but 72 // First add our local server - not really a server but
69 // the local config (which packages are installed) 73 // the local config (which packages are installed)
70 serverList.push_back( Server( LOCAL_SERVER, "" ) ); 74 serverList.push_back( Server( LOCAL_SERVER, "" ) );
71 serverList.push_back( Server( LOCAL_IPKGS, "" ) ); 75 serverList.push_back( Server( LOCAL_IPKGS, "" ) );
72 76
77#ifdef QWS
78 Config cfg( "aqpkg" );
79 cfg.setGroup( "destinations" );
80#endif
81
73 // Read file from /etc/ipkg.conf 82 // Read file from /etc/ipkg.conf
74 QString ipkg_conf = IPKG_CONF; 83 QString ipkg_conf = IPKG_CONF;
75 FILE *fp; 84 FILE *fp;
76 fp = fopen( ipkg_conf, "r" ); 85 fp = fopen( ipkg_conf, "r" );
77 char line[130]; 86 char line[130];
78 QString lineStr; 87 QString lineStr;
79 if ( fp == NULL ) 88 if ( fp == NULL )
80 { 89 {
81 cout << "Couldn't open " << ipkg_conf << "! err = " << fp << endl; 90 cout << "Couldn't open " << ipkg_conf << "! err = " << fp << endl;
82 return; 91 return;
83 } 92 }
84 else 93 else
@@ -103,24 +112,32 @@ void DataManager :: loadServers()
103 else 112 else
104 s.setActive( false ); 113 s.setActive( false );
105 114
106 serverList.push_back( s ); 115 serverList.push_back( s );
107 116
108 } 117 }
109 else if ( lineStr.startsWith( "dest" ) ) 118 else if ( lineStr.startsWith( "dest" ) )
110 { 119 {
111 char alias[20]; 120 char alias[20];
112 char path[50]; 121 char path[50];
113 sscanf( lineStr, "%*[^ ] %s %s", alias, path ); 122 sscanf( lineStr, "%*[^ ] %s %s", alias, path );
114 Destination d( alias, path ); 123 Destination d( alias, path );
124 bool linkToRoot = true;
125#ifdef QWS
126 QString key = alias;
127 key += "_linkToRoot";
128 linkToRoot = cfg.readBoolEntry( key, true );
129#endif
130 d.linkToRoot( linkToRoot );
131
115 destList.push_back( d ); 132 destList.push_back( d );
116 } 133 }
117 } 134 }
118 } 135 }
119 fclose( fp ); 136 fclose( fp );
120 137
121 vector<Server>::iterator it; 138 vector<Server>::iterator it;
122 for ( it = serverList.begin() ; it != serverList.end() ; ++it ) 139 for ( it = serverList.begin() ; it != serverList.end() ; ++it )
123 reloadServerData( it->getServerName() ); 140 reloadServerData( it->getServerName() );
124} 141}
125 142
126void DataManager :: reloadServerData( const char *serverName ) 143void DataManager :: reloadServerData( const char *serverName )