Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/systemfile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings2/networksettings2/systemfile.cpp | 49 |
1 files changed, 46 insertions, 3 deletions
diff --git a/noncore/settings/networksettings2/networksettings2/systemfile.cpp b/noncore/settings/networksettings2/networksettings2/systemfile.cpp index 7249976..394ff52 100644 --- a/noncore/settings/networksettings2/networksettings2/systemfile.cpp +++ b/noncore/settings/networksettings2/networksettings2/systemfile.cpp @@ -31,5 +31,7 @@ SystemFile::SystemFile( const QString & N, const QString & P ){ hasPostSection = hasPreNodeSection = - hasPostNodeSection = 0; + hasPostNodeSection = + hasPreDeviceSection = + hasPostDeviceSection = 0; return; } @@ -49,4 +51,10 @@ SystemFile::SystemFile( const QString & N, const QString & P ){ FI.setFile( S ); hasPostNodeSection = ( FI.exists() && FI.isReadable() ); + S = TemplDir + Name + "/predevicesection"; + FI.setFile( S ); + hasPreDeviceSection = ( FI.exists() && FI.isReadable() ); + S = TemplDir + Name + "/postdevicesection"; + FI.setFile( S ); + hasPostDeviceSection = ( FI.exists() && FI.isReadable() ); } } @@ -109,5 +117,5 @@ bool SystemFile::postSection( void ) { bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { if( hasPreNodeSection ) { - QFile Fl( TemplDir + Name + "/prenodesectoin" ); + QFile Fl( TemplDir + Name + "/prenodesection" ); if( ! Fl.open( IO_ReadOnly ) ) return 1; // error @@ -127,5 +135,5 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) { if( hasPostNodeSection ) { - QFile Fl( TemplDir + Name + "/postnodesectoin" ); + QFile Fl( TemplDir + Name + "/postnodesection" ); if( ! Fl.open( IO_ReadOnly ) ) return 1; // error @@ -143,2 +151,37 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) { } +bool SystemFile::preDeviceSection( ANetNodeInstance * NNI, long ) { + if( hasPreDeviceSection ) { + QFile Fl( TemplDir + Name + "/predevicesection" ); + if( ! Fl.open( IO_ReadOnly ) ) + return 1; // error + QTextStream TX( &Fl ); + QString Out; + QString S = TX.readLine(); + while( ! TX.eof() ) { + Out = S. + arg(NNI->netNode()->nodeName()); + (*this) << Out << endl; + S = TX.readLine(); + } + } + return 0; +} + +bool SystemFile::postDeviceSection( ANetNodeInstance * NNI, long DevNr ) { + if( hasPostDeviceSection ) { + QFile Fl( TemplDir + Name + "/postdevicesection" ); + if( ! Fl.open( IO_ReadOnly ) ) + return 1; // error + QTextStream TX( &Fl ); + QString Out; + QString S = TX.readLine(); + while( ! TX.eof() ) { + Out = S. + arg(NNI->nodeName()); + (*this) << Out << endl; + S = TX.readLine(); + } + } + return 0; +} |