author | tille <tille> | 2003-05-24 16:12:02 (UTC) |
---|---|---|
committer | tille <tille> | 2003-05-24 16:12:02 (UTC) |
commit | cc1aa3e178dff65854913bd5667579fc33ce707d (patch) (unidiff) | |
tree | d37d7fd8fb3b9832c0825b015af862f2cc62f473 /noncore/settings/networksettings/ppp/pppdata.h | |
parent | 5667ded1d4583cfb79b2ddfd7aaae0e58ed6d552 (diff) | |
download | opie-cc1aa3e178dff65854913bd5667579fc33ce707d.zip opie-cc1aa3e178dff65854913bd5667579fc33ce707d.tar.gz opie-cc1aa3e178dff65854913bd5667579fc33ce707d.tar.bz2 |
saves config (still in the kppp way)
Diffstat (limited to 'noncore/settings/networksettings/ppp/pppdata.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/pppdata.h | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/noncore/settings/networksettings/ppp/pppdata.h b/noncore/settings/networksettings/ppp/pppdata.h index e286b70..57ce2fd 100644 --- a/noncore/settings/networksettings/ppp/pppdata.h +++ b/noncore/settings/networksettings/ppp/pppdata.h | |||
@@ -34,53 +34,53 @@ | |||
34 | #include <qstring.h> | 34 | #include <qstring.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <qcolor.h> | 36 | #include <qcolor.h> |
37 | 37 | ||
38 | #include "kpppconfig.h" | 38 | #include "kpppconfig.h" |
39 | 39 | ||
40 | class Config; | 40 | class Config; |
41 | 41 | ||
42 | // string lengths | 42 | // string lengths |
43 | 43 | ||
44 | #define PATH_SIZE 120 | 44 | #define PATH_SIZE 120 |
45 | #define MODEMSTR_SIZE 80 | 45 | #define MODEMSTR_SIZE 80 |
46 | #define ACCNAME_SIZE 50 | 46 | #define ACCNAME_SIZE 50 |
47 | #define PHONENUMBER_SIZE 60 | 47 | #define PHONENUMBER_SIZE 60 |
48 | #define COMMAND_SIZE 255 | 48 | #define COMMAND_SIZE 255 |
49 | #define IPADDR_SIZE 15 | 49 | #define IPADDR_SIZE 15 |
50 | #define DOMAIN_SIZE 50 | 50 | #define DOMAIN_SIZE 50 |
51 | #define TIMEOUT_SIZE 60 | 51 | #define TIMEOUT_SIZE 60 |
52 | 52 | ||
53 | // | 53 | // |
54 | // keys for config file | 54 | // keys for config file |
55 | // | 55 | // |
56 | 56 | ||
57 | // groups | 57 | // groups |
58 | #define GENERAL_GRP "General" | 58 | #define GENERAL_GRP "PPP_General" |
59 | #define MODEM_GRP "Modem" | 59 | #define MODEM_GRP "PPP_Modem" |
60 | #define ACCOUNT_GRP "Account" | 60 | #define ACCOUNT_GRP "PPP_Account" |
61 | #define GRAPH_GRP "Graph" | 61 | //#define GRAPH_GRP "Graph" |
62 | #define WINPOS_GRP "WindowPosition" | 62 | //#define WINPOS_GRP "WindowPosition" |
63 | 63 | ||
64 | // general | 64 | // general |
65 | #define DEFAULTACCOUNT_KEY "DefaultAccount" | 65 | #define DEFAULTACCOUNT_KEY "DefaultAccount" |
66 | #define PPPDVERSION_KEY "pppdVersion" | 66 | #define PPPDVERSION_KEY "pppdVersion" |
67 | #define PPPDTIMEOUT_KEY "pppdTimeout" | 67 | #define PPPDTIMEOUT_KEY "pppdTimeout" |
68 | #define SHOWCLOCK_KEY "ShowClock" | 68 | #define SHOWCLOCK_KEY "ShowClock" |
69 | #define SHOWLOGWIN_KEY "ShowLogWindow" | 69 | #define SHOWLOGWIN_KEY "ShowLogWindow" |
70 | #define AUTOREDIAL_KEY "AutomaticRedial" | 70 | #define AUTOREDIAL_KEY "AutomaticRedial" |
71 | #define DISCONNECT_KEY "DisconnectOnXServerExit" | 71 | #define DISCONNECT_KEY "DisconnectOnXServerExit" |
72 | #define QUITONDISCONNECT_KEY "QuitOnDisconnect" | 72 | #define QUITONDISCONNECT_KEY "QuitOnDisconnect" |
73 | #define NUMACCOUNTS_KEY "NumberOfAccounts" | 73 | #define NUMACCOUNTS_KEY "NumberOfAccounts" |
74 | #define ID_KEY "ID" | 74 | #define ID_KEY "ID" |
75 | 75 | ||
76 | // modem | 76 | // modem |
77 | #define MODEMDEV_KEY "Device" | 77 | #define MODEMDEV_KEY "Device" |
78 | #define LOCKFILE_KEY "UseLockFile" | 78 | #define LOCKFILE_KEY "UseLockFile" |
79 | #define FLOWCONTROL_KEY "FlowControl" | 79 | #define FLOWCONTROL_KEY "FlowControl" |
80 | #define SPEED_KEY "Speed" | 80 | #define SPEED_KEY "Speed" |
81 | #define TIMEOUT_KEY "Timeout" | 81 | #define TIMEOUT_KEY "Timeout" |
82 | #define TONEDURATION_KEY "ToneDuration" | 82 | #define TONEDURATION_KEY "ToneDuration" |
83 | #define BUSYWAIT_KEY "BusyWait" | 83 | #define BUSYWAIT_KEY "BusyWait" |
84 | #define INITSTR_KEY "InitString" | 84 | #define INITSTR_KEY "InitString" |
85 | #define INITRESP_KEY "InitResponse" | 85 | #define INITRESP_KEY "InitResponse" |
86 | #define PREINITDELAY_KEY "PreInitDelay" | 86 | #define PREINITDELAY_KEY "PreInitDelay" |
@@ -140,56 +140,57 @@ class Config; | |||
140 | #define TOTALCOSTS_KEY "TotalCosts" | 140 | #define TOTALCOSTS_KEY "TotalCosts" |
141 | #define TOTALBYTES_KEY "TotalBytes" | 141 | #define TOTALBYTES_KEY "TotalBytes" |
142 | 142 | ||
143 | // graph colors | 143 | // graph colors |
144 | #define GENABLED "Enabled" | 144 | #define GENABLED "Enabled" |
145 | #define GCOLOR_BG "Background" | 145 | #define GCOLOR_BG "Background" |
146 | #define GCOLOR_TEXT "Text" | 146 | #define GCOLOR_TEXT "Text" |
147 | #define GCOLOR_IN "InBytes" | 147 | #define GCOLOR_IN "InBytes" |
148 | #define GCOLOR_OUT "OutBytes" | 148 | #define GCOLOR_OUT "OutBytes" |
149 | 149 | ||
150 | // pppd errors | 150 | // pppd errors |
151 | #define E_IF_TIMEOUT 1 | 151 | #define E_IF_TIMEOUT 1 |
152 | #define E_PPPD_DIED 2 | 152 | #define E_PPPD_DIED 2 |
153 | 153 | ||
154 | // window position | 154 | // window position |
155 | #define WINPOS_CONWIN_X "WindowPositionConWinX" | 155 | #define WINPOS_CONWIN_X "WindowPositionConWinX" |
156 | #define WINPOS_CONWIN_Y "WindowPositionConWinY" | 156 | #define WINPOS_CONWIN_Y "WindowPositionConWinY" |
157 | #define WINPOS_STATWIN_X "WindowPositionStatWinX" | 157 | #define WINPOS_STATWIN_X "WindowPositionStatWinX" |
158 | #define WINPOS_STATWIN_Y "WindowPositionStatWinY" | 158 | #define WINPOS_STATWIN_Y "WindowPositionStatWinY" |
159 | 159 | ||
160 | class PPPData { | 160 | class PPPData { |
161 | public: | 161 | public: |
162 | PPPData(); | 162 | PPPData(); |
163 | ~PPPData() {}; | 163 | ~PPPData() {}; |
164 | static PPPData* data(); | ||
164 | 165 | ||
165 | enum { NumInitStrings = 2 }; | 166 | enum { NumInitStrings = 2 }; |
166 | 167 | ||
167 | // general functions | 168 | // general functions |
168 | bool open(); | 169 | bool open(); |
169 | void save(); | 170 | void save(); |
170 | void cancel(); | 171 | void cancel(); |
171 | int access() const; // read/write access | 172 | // int access() const; // read/write access |
172 | 173 | ||
173 | // function to read/write date to configuration file | 174 | // function to read/write date to configuration file |
174 | QString readConfig(const QString &, const QString &, const QString &); | 175 | QString readConfig(const QString &, const QString &, const QString &); |
175 | int readNumConfig(const QString &, const QString &, int); | 176 | int readNumConfig(const QString &, const QString &, int); |
176 | bool readListConfig(const QString &, const QString &, | 177 | bool readListConfig(const QString &, const QString &, |
177 | QStringList &, char sep = ','); | 178 | QStringList &, char sep = ','); |
178 | void writeConfig(const QString &, const QString &, const QString &); | 179 | void writeConfig(const QString &, const QString &, const QString &); |
179 | void writeConfig(const QString &, const QString &, int); | 180 | void writeConfig(const QString &, const QString &, int); |
180 | void writeListConfig(const QString &, const QString &, | 181 | void writeListConfig(const QString &, const QString &, |
181 | QStringList &, char sep = ','); | 182 | QStringList &, char sep = ','); |
182 | 183 | ||
183 | // return the current account group | 184 | // return the current account group |
184 | QString currentGroup() { return cgroup; } | 185 | QString currentGroup() { return cgroup; } |
185 | 186 | ||
186 | // functions to set/get general kppp info | 187 | // functions to set/get general kppp info |
187 | QString password() const; | 188 | QString password() const; |
188 | void setPassword(const QString &); | 189 | void setPassword(const QString &); |
189 | 190 | ||
190 | const QString defaultAccount(); | 191 | const QString defaultAccount(); |
191 | void setDefaultAccount(const QString &); | 192 | void setDefaultAccount(const QString &); |
192 | 193 | ||
193 | void set_xserver_exit_disconnect(bool set); | 194 | void set_xserver_exit_disconnect(bool set); |
194 | bool get_xserver_exit_disconnect(); | 195 | bool get_xserver_exit_disconnect(); |
195 | 196 | ||
@@ -405,61 +406,62 @@ public: | |||
405 | QStringList &script(); | 406 | QStringList &script(); |
406 | void setScript(QStringList &); | 407 | void setScript(QStringList &); |
407 | 408 | ||
408 | QStringList &pppdArgument(); | 409 | QStringList &pppdArgument(); |
409 | void setpppdArgumentDefaults(); | 410 | void setpppdArgumentDefaults(); |
410 | void setpppdArgument(QStringList &); | 411 | void setpppdArgument(QStringList &); |
411 | 412 | ||
412 | //functions to change/set the child pppd process info | 413 | //functions to change/set the child pppd process info |
413 | bool pppdRunning() const; | 414 | bool pppdRunning() const; |
414 | void setpppdRunning(bool set); | 415 | void setpppdRunning(bool set); |
415 | 416 | ||
416 | int pppdError() const; | 417 | int pppdError() const; |
417 | void setpppdError(int err); | 418 | void setpppdError(int err); |
418 | 419 | ||
419 | // functions to set/query the accounting info | 420 | // functions to set/query the accounting info |
420 | const QString accountingFile(); | 421 | const QString accountingFile(); |
421 | void setAccountingFile(const QString &); | 422 | void setAccountingFile(const QString &); |
422 | 423 | ||
423 | const QString totalCosts(); | 424 | const QString totalCosts(); |
424 | void setTotalCosts(const QString &); | 425 | void setTotalCosts(const QString &); |
425 | 426 | ||
426 | int totalBytes(); | 427 | int totalBytes(); |
427 | void setTotalBytes(int); | 428 | void setTotalBytes(int); |
428 | 429 | ||
429 | // graphing widget | 430 | // // graphing widget |
430 | void setGraphingOptions(bool enabled, | 431 | // void setGraphingOptions(bool enabled, |
431 | QColor bg, | 432 | // QColor bg, |
432 | QColor text, | 433 | // QColor text, |
433 | QColor in, | 434 | // QColor in, |
434 | QColor out); | 435 | // QColor out); |
435 | void graphingOptions(bool &enabled, | 436 | // void graphingOptions(bool &enabled, |
436 | QColor &bg, | 437 | // QColor &bg, |
437 | QColor &text, | 438 | // QColor &text, |
438 | QColor &in, | 439 | // QColor &in, |
439 | QColor &out); | 440 | // QColor &out); |
440 | bool graphingEnabled(); | 441 | // bool graphingEnabled(); |
441 | 442 | ||
442 | // window positions | 443 | // // window positions |
443 | void winPosConWin(int &, int &); | 444 | // void winPosConWin(int &, int &); |
444 | void setWinPosConWin(int, int); | 445 | // void setWinPosConWin(int, int); |
445 | void winPosStatWin(int &, int &); | 446 | // void winPosStatWin(int &, int &); |
446 | void setWinPosStatWin(int, int); | 447 | // void setWinPosStatWin(int, int); |
447 | 448 | ||
448 | private: | 449 | private: |
449 | QString passwd; | ||
450 | Config* config; // configuration object | ||
451 | int highcount; // index of highest account | ||
452 | int caccount; // index of the current account | ||
453 | QString cgroup; // name of current config group | ||
454 | pid_t suidprocessid; // process ID of setuid child | ||
455 | bool pppdisrunning; // pppd process | ||
456 | // daemon | ||
457 | int pppderror; // error encounterd running pppd | ||
458 | int pppdVer, pppdMod, pppdPatch; // pppd version | ||
459 | |||
460 | QStringList phonelist; | ||
461 | }; | ||
462 | 450 | ||
463 | extern PPPData gpppdata; | 451 | static PPPData *_data; |
452 | |||
453 | QString passwd; | ||
454 | static Config* config; // configuration object | ||
455 | int highcount; // index of highest account | ||
456 | int caccount; // index of the current account | ||
457 | QString cgroup; // name of current config group | ||
458 | pid_t suidprocessid; // process ID of setuid child | ||
459 | bool pppdisrunning; // pppd process | ||
460 | // daemon | ||
461 | int pppderror; // error encounterd running pppd | ||
462 | int pppdVer, pppdMod, pppdPatch; // pppd version | ||
463 | |||
464 | QStringList phonelist; | ||
465 | }; | ||
464 | 466 | ||
465 | #endif | 467 | #endif |