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 | |||
@@ -30,7 +30,9 @@ SystemFile::SystemFile( const QString & N, const QString & P ){ | |||
30 | hasPreSection = | 30 | hasPreSection = |
31 | hasPostSection = | 31 | hasPostSection = |
32 | hasPreNodeSection = | 32 | hasPreNodeSection = |
33 | hasPostNodeSection = 0; | 33 | hasPostNodeSection = |
34 | hasPreDeviceSection = | ||
35 | hasPostDeviceSection = 0; | ||
34 | return; | 36 | return; |
35 | } | 37 | } |
36 | } | 38 | } |
@@ -48,6 +50,12 @@ SystemFile::SystemFile( const QString & N, const QString & P ){ | |||
48 | S = TemplDir + Name + "/postnodesection"; | 50 | S = TemplDir + Name + "/postnodesection"; |
49 | FI.setFile( S ); | 51 | FI.setFile( S ); |
50 | hasPostNodeSection = ( FI.exists() && FI.isReadable() ); | 52 | hasPostNodeSection = ( FI.exists() && FI.isReadable() ); |
53 | S = TemplDir + Name + "/predevicesection"; | ||
54 | FI.setFile( S ); | ||
55 | hasPreDeviceSection = ( FI.exists() && FI.isReadable() ); | ||
56 | S = TemplDir + Name + "/postdevicesection"; | ||
57 | FI.setFile( S ); | ||
58 | hasPostDeviceSection = ( FI.exists() && FI.isReadable() ); | ||
51 | } | 59 | } |
52 | } | 60 | } |
53 | 61 | ||
@@ -108,7 +116,7 @@ bool SystemFile::postSection( void ) { | |||
108 | 116 | ||
109 | bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { | 117 | bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { |
110 | if( hasPreNodeSection ) { | 118 | if( hasPreNodeSection ) { |
111 | QFile Fl( TemplDir + Name + "/prenodesectoin" ); | 119 | QFile Fl( TemplDir + Name + "/prenodesection" ); |
112 | if( ! Fl.open( IO_ReadOnly ) ) | 120 | if( ! Fl.open( IO_ReadOnly ) ) |
113 | return 1; // error | 121 | return 1; // error |
114 | QTextStream TX( &Fl ); | 122 | QTextStream TX( &Fl ); |
@@ -126,7 +134,7 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { | |||
126 | 134 | ||
127 | bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) { | 135 | bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) { |
128 | if( hasPostNodeSection ) { | 136 | if( hasPostNodeSection ) { |
129 | QFile Fl( TemplDir + Name + "/postnodesectoin" ); | 137 | QFile Fl( TemplDir + Name + "/postnodesection" ); |
130 | if( ! Fl.open( IO_ReadOnly ) ) | 138 | if( ! Fl.open( IO_ReadOnly ) ) |
131 | return 1; // error | 139 | return 1; // error |
132 | QTextStream TX( &Fl ); | 140 | QTextStream TX( &Fl ); |
@@ -142,3 +150,38 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) { | |||
142 | return 0; | 150 | return 0; |
143 | } | 151 | } |
144 | 152 | ||
153 | bool SystemFile::preDeviceSection( ANetNodeInstance * NNI, long ) { | ||
154 | if( hasPreDeviceSection ) { | ||
155 | QFile Fl( TemplDir + Name + "/predevicesection" ); | ||
156 | if( ! Fl.open( IO_ReadOnly ) ) | ||
157 | return 1; // error | ||
158 | QTextStream TX( &Fl ); | ||
159 | QString Out; | ||
160 | QString S = TX.readLine(); | ||
161 | while( ! TX.eof() ) { | ||
162 | Out = S. | ||
163 | arg(NNI->netNode()->nodeName()); | ||
164 | (*this) << Out << endl; | ||
165 | S = TX.readLine(); | ||
166 | } | ||
167 | } | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | bool SystemFile::postDeviceSection( ANetNodeInstance * NNI, long DevNr ) { | ||
172 | if( hasPostDeviceSection ) { | ||
173 | QFile Fl( TemplDir + Name + "/postdevicesection" ); | ||
174 | if( ! Fl.open( IO_ReadOnly ) ) | ||
175 | return 1; // error | ||
176 | QTextStream TX( &Fl ); | ||
177 | QString Out; | ||
178 | QString S = TX.readLine(); | ||
179 | while( ! TX.eof() ) { | ||
180 | Out = S. | ||
181 | arg(NNI->nodeName()); | ||
182 | (*this) << Out << endl; | ||
183 | S = TX.readLine(); | ||
184 | } | ||
185 | } | ||
186 | return 0; | ||
187 | } | ||