Diffstat (limited to 'noncore/settings/networksettings2/networksettings2/systemfile.cpp') (more/less context) (show 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 @@ -27,13 +27,15 @@ SystemFile::SystemFile( const QString & N, const QString & P ){ TemplDir = "./" TEMPLATEDIR; FI.setFile( TemplDir ); if( ! FI.isDir() ) { hasPreSection = hasPostSection = hasPreNodeSection = - hasPostNodeSection = 0; + hasPostNodeSection = + hasPreDeviceSection = + hasPostDeviceSection = 0; return; } } // have found location S = TemplDir + Name + "/presection"; @@ -45,12 +47,18 @@ SystemFile::SystemFile( const QString & N, const QString & P ){ S = TemplDir + Name + "/prenodesection"; FI.setFile( S ); hasPreNodeSection = ( FI.exists() && FI.isReadable() ); S = TemplDir + Name + "/postnodesection"; 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() ); } } SystemFile::~SystemFile( void ) { if( F ) delete F; @@ -105,13 +113,13 @@ bool SystemFile::postSection( void ) { } return 0; } 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 QTextStream TX( &Fl ); QString Out; QString S = TX.readLine(); while( ! TX.eof() ) { @@ -123,13 +131,13 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { } return 0; } 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 QTextStream TX( &Fl ); QString Out; QString S = TX.readLine(); while( ! TX.eof() ) { @@ -139,6 +147,41 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) { S = TX.readLine(); } } return 0; } +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; +} |