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 ){ | |||
27 | TemplDir = "./" TEMPLATEDIR; | 27 | TemplDir = "./" TEMPLATEDIR; |
28 | FI.setFile( TemplDir ); | 28 | FI.setFile( TemplDir ); |
29 | if( ! FI.isDir() ) { | 29 | if( ! FI.isDir() ) { |
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 | } |
37 | 39 | ||
38 | // have found location | 40 | // have found location |
39 | S = TemplDir + Name + "/presection"; | 41 | S = TemplDir + Name + "/presection"; |
@@ -45,12 +47,18 @@ SystemFile::SystemFile( const QString & N, const QString & P ){ | |||
45 | S = TemplDir + Name + "/prenodesection"; | 47 | S = TemplDir + Name + "/prenodesection"; |
46 | FI.setFile( S ); | 48 | FI.setFile( S ); |
47 | hasPreNodeSection = ( FI.exists() && FI.isReadable() ); | 49 | hasPreNodeSection = ( FI.exists() && FI.isReadable() ); |
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 | ||
54 | SystemFile::~SystemFile( void ) { | 62 | SystemFile::~SystemFile( void ) { |
55 | if( F ) | 63 | if( F ) |
56 | delete F; | 64 | delete F; |
@@ -105,13 +113,13 @@ bool SystemFile::postSection( void ) { | |||
105 | } | 113 | } |
106 | return 0; | 114 | return 0; |
107 | } | 115 | } |
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 ); |
115 | QString Out; | 123 | QString Out; |
116 | QString S = TX.readLine(); | 124 | QString S = TX.readLine(); |
117 | while( ! TX.eof() ) { | 125 | while( ! TX.eof() ) { |
@@ -123,13 +131,13 @@ bool SystemFile::preNodeSection( ANetNodeInstance * NNI, long ) { | |||
123 | } | 131 | } |
124 | return 0; | 132 | return 0; |
125 | } | 133 | } |
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 ); |
133 | QString Out; | 141 | QString Out; |
134 | QString S = TX.readLine(); | 142 | QString S = TX.readLine(); |
135 | while( ! TX.eof() ) { | 143 | while( ! TX.eof() ) { |
@@ -139,6 +147,41 @@ bool SystemFile::postNodeSection( ANetNodeInstance * NNI, long DevNr ) { | |||
139 | S = TX.readLine(); | 147 | S = TX.readLine(); |
140 | } | 148 | } |
141 | } | 149 | } |
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 | } | ||