summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/networksettings2/systemfile.cpp
Side-by-side diff
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
@@ -10,9 +10,11 @@
#define TEMPLATEDIR "networktemplates/"
QString TemplDir;
-SystemFile::SystemFile( const QString & N, const QString & P ){
+SystemFile::SystemFile( const QString & N,
+ const QString & P,
+ bool KDI ){
Name = N;
Path = P;
F = 0;
// get template info
@@ -56,8 +58,10 @@ SystemFile::SystemFile( const QString & N, const QString & P ){
S = TemplDir + Name + "/postdevicesection";
FI.setFile( S );
hasPostDeviceSection = ( FI.exists() && FI.isReadable() );
}
+
+ KnowsDeviceInstances = KDI;
}
SystemFile::~SystemFile( void ) {
if( F )
@@ -95,31 +99,31 @@ bool SystemFile::close( void ) {
bool SystemFile::preSection( void ) {
if( hasPreSection ) {
QFile Fl( TemplDir + Name + "/presection" );
if( ! Fl.open( IO_ReadOnly ) )
- return 1; // error
+ return 0; // error
// copy file to this file
F->writeBlock( Fl.readAll() );
}
- return 0;
+ return 1;
}
bool SystemFile::postSection( void ) {
if( hasPostSection ) {
QFile Fl( TemplDir + Name + "/postsection" );
if( ! Fl.open( IO_ReadOnly ) )
- return 1; // error
+ return 0; // error
// copy file to this file
F->writeBlock( Fl.readAll() );
}
- return 0;
+ return 1;
}
bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) {
if( hasPreNodeSection ) {
QFile Fl( TemplDir + Name + "/prenodesection" );
if( ! Fl.open( IO_ReadOnly ) )
- return 1; // error
+ return 0; // error
QTextStream TX( &Fl );
QString Out;
QString S = TX.readLine();
while( ! TX.eof() ) {
@@ -128,16 +132,16 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) {
(*this) << Out << endl;
S = TX.readLine();
}
}
- return 0;
+ return 1;
}
bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) {
if( hasPostNodeSection ) {
QFile Fl( TemplDir + Name + "/postnodesection" );
if( ! Fl.open( IO_ReadOnly ) )
- return 1; // error
+ return 0; // error
QTextStream TX( &Fl );
QString Out;
QString S = TX.readLine();
while( ! TX.eof() ) {
@@ -146,16 +150,16 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long ) {
(*this) << Out << endl;
S = TX.readLine();
}
}
- return 0;
+ return 1;
}
bool SystemFile::preDeviceSection( ANetNode * NN ) {
if( hasPreDeviceSection ) {
QFile Fl( TemplDir + Name + "/predevicesection" );
if( ! Fl.open( IO_ReadOnly ) )
- return 1; // error
+ return 0; // error
QTextStream TX( &Fl );
QString Out;
QString S = TX.readLine();
while( ! TX.eof() ) {
@@ -163,16 +167,16 @@ bool SystemFile::preDeviceSection( ANetNode * NN ) {
(*this) << Out << endl;
S = TX.readLine();
}
}
- return 0;
+ return 1;
}
bool SystemFile::postDeviceSection( ANetNode * NN ) {
if( hasPostDeviceSection ) {
QFile Fl( TemplDir + Name + "/postdevicesection" );
if( ! Fl.open( IO_ReadOnly ) )
- return 1; // error
+ return 0; // error
QTextStream TX( &Fl );
QString Out;
QString S = TX.readLine();
while( ! TX.eof() ) {
@@ -180,6 +184,6 @@ bool SystemFile::postDeviceSection( ANetNode * NN ) {
(*this) << Out << endl;
S = TX.readLine();
}
}
- return 0;
+ return 1;
}