summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/networksettings2/systemfile.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/systemfile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/networksettings2/systemfile.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.cpp b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
index b3fc1a5..2b40834 100644
--- a/noncore/settings/networksettings2/networksettings2/systemfile.cpp
+++ b/noncore/settings/networksettings2/networksettings2/systemfile.cpp
@@ -11,7 +11,9 @@
11#define TEMPLATEDIR "networktemplates/" 11#define TEMPLATEDIR "networktemplates/"
12QString TemplDir; 12QString TemplDir;
13 13
14SystemFile::SystemFile( const QString & N, const QString & P ){ 14SystemFile::SystemFile( const QString & N,
15 const QString & P,
16 bool KDI ){
15 Name = N; 17 Name = N;
16 Path = P; 18 Path = P;
17 F = 0; 19 F = 0;
@@ -57,6 +59,8 @@ SystemFile::SystemFile( const QString & N, const QString & P ){
57 FI.setFile( S ); 59 FI.setFile( S );
58 hasPostDeviceSection = ( FI.exists() && FI.isReadable() ); 60 hasPostDeviceSection = ( FI.exists() && FI.isReadable() );
59 } 61 }
62
63 KnowsDeviceInstances = KDI;
60} 64}
61 65
62SystemFile::~SystemFile( void ) { 66SystemFile::~SystemFile( void ) {
@@ -96,29 +100,29 @@ bool SystemFile::preSection( void ) {
96 if( hasPreSection ) { 100 if( hasPreSection ) {
97 QFile Fl( TemplDir + Name + "/presection" ); 101 QFile Fl( TemplDir + Name + "/presection" );
98 if( ! Fl.open( IO_ReadOnly ) ) 102 if( ! Fl.open( IO_ReadOnly ) )
99 return 1; // error 103 return 0; // error
100 // copy file to this file 104 // copy file to this file
101 F->writeBlock( Fl.readAll() ); 105 F->writeBlock( Fl.readAll() );
102 } 106 }
103 return 0; 107 return 1;
104} 108}
105 109
106bool SystemFile::postSection( void ) { 110bool SystemFile::postSection( void ) {
107 if( hasPostSection ) { 111 if( hasPostSection ) {
108 QFile Fl( TemplDir + Name + "/postsection" ); 112 QFile Fl( TemplDir + Name + "/postsection" );
109 if( ! Fl.open( IO_ReadOnly ) ) 113 if( ! Fl.open( IO_ReadOnly ) )
110 return 1; // error 114 return 0; // error
111 // copy file to this file 115 // copy file to this file
112 F->writeBlock( Fl.readAll() ); 116 F->writeBlock( Fl.readAll() );
113 } 117 }
114 return 0; 118 return 1;
115} 119}
116 120
117bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { 121bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) {
118 if( hasPreNodeSection ) { 122 if( hasPreNodeSection ) {
119 QFile Fl( TemplDir + Name + "/prenodesection" ); 123 QFile Fl( TemplDir + Name + "/prenodesection" );
120 if( ! Fl.open( IO_ReadOnly ) ) 124 if( ! Fl.open( IO_ReadOnly ) )
121 return 1; // error 125 return 0; // error
122 QTextStream TX( &Fl ); 126 QTextStream TX( &Fl );
123 QString Out; 127 QString Out;
124 QString S = TX.readLine(); 128 QString S = TX.readLine();
@@ -129,14 +133,14 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) {
129 S = TX.readLine(); 133 S = TX.readLine();
130 } 134 }
131 } 135 }
132 return 0; 136 return 1;
133} 137}
134 138
135bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) { 139bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) {
136 if( hasPostNodeSection ) { 140 if( hasPostNodeSection ) {
137 QFile Fl( TemplDir + Name + "/postnodesection" ); 141 QFile Fl( TemplDir + Name + "/postnodesection" );
138 if( ! Fl.open( IO_ReadOnly ) ) 142 if( ! Fl.open( IO_ReadOnly ) )
139 return 1; // error 143 return 0; // error
140 QTextStream TX( &Fl ); 144 QTextStream TX( &Fl );
141 QString Out; 145 QString Out;
142 QString S = TX.readLine(); 146 QString S = TX.readLine();
@@ -147,14 +151,14 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) {
147 S = TX.readLine(); 151 S = TX.readLine();
148 } 152 }
149 } 153 }
150 return 0; 154 return 1;
151} 155}
152 156
153bool SystemFile::preDeviceSection( ANetNode * NN ) { 157bool SystemFile::preDeviceSection( ANetNode * NN ) {
154 if( hasPreDeviceSection ) { 158 if( hasPreDeviceSection ) {
155 QFile Fl( TemplDir + Name + "/predevicesection" ); 159 QFile Fl( TemplDir + Name + "/predevicesection" );
156 if( ! Fl.open( IO_ReadOnly ) ) 160 if( ! Fl.open( IO_ReadOnly ) )
157 return 1; // error 161 return 0; // error
158 QTextStream TX( &Fl ); 162 QTextStream TX( &Fl );
159 QString Out; 163 QString Out;
160 QString S = TX.readLine(); 164 QString S = TX.readLine();
@@ -164,14 +168,14 @@ bool SystemFile::preDeviceSection( ANetNode * NN ) {
164 S = TX.readLine(); 168 S = TX.readLine();
165 } 169 }
166 } 170 }
167 return 0; 171 return 1;
168} 172}
169 173
170bool SystemFile::postDeviceSection( ANetNode * NN ) { 174bool SystemFile::postDeviceSection( ANetNode * NN ) {
171 if( hasPostDeviceSection ) { 175 if( hasPostDeviceSection ) {
172 QFile Fl( TemplDir + Name + "/postdevicesection" ); 176 QFile Fl( TemplDir + Name + "/postdevicesection" );
173 if( ! Fl.open( IO_ReadOnly ) ) 177 if( ! Fl.open( IO_ReadOnly ) )
174 return 1; // error 178 return 0; // error
175 QTextStream TX( &Fl ); 179 QTextStream TX( &Fl );
176 QString Out; 180 QString Out;
177 QString S = TX.readLine(); 181 QString S = TX.readLine();
@@ -181,5 +185,5 @@ bool SystemFile::postDeviceSection( ANetNode * NN ) {
181 S = TX.readLine(); 185 S = TX.readLine();
182 } 186 }
183 } 187 }
184 return 0; 188 return 1;
185} 189}