1 | /* -*- C++ -*- |
2 | * |
3 | * kPPP: A pppd Front End for the KDE project |
4 | * |
5 | * $Id$ |
6 | * Copyright (C) 1997 Bernd Johannes Wuebben |
7 | * wuebben@math.cornell.edu |
8 | * |
9 | * based on EzPPP: |
10 | * Copyright (C) 1997 Jay Painter |
11 | * |
12 | * |
13 | * This library is free software; you can redistribute it and/or |
14 | * modify it under the terms of the GNU Library General Public |
15 | * License as published by the Free Software Foundation; either |
16 | * version 2 of the License, or (at your option) any later version. |
17 | * |
18 | * This library is distributed in the hope that it will be useful, |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
21 | * Library General Public License for more details. |
22 | * |
23 | * You should have received a copy of the GNU Library General Public |
24 | * License along with this program; if not, write to the Free |
25 | * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
26 | */ |
27 | |
28 | |
29 | #ifndef _EDIT_H_ |
30 | #define _EDIT_H_ |
31 | |
32 | #include <qdialog.h> |
33 | #include <qpushbutton.h> |
34 | #include <q3groupbox.h> |
35 | #include <qscrollbar.h> |
36 | #include <qcombobox.h> |
37 | #include <qlineedit.h> |
38 | #include <q3listbox.h> |
39 | #include <qradiobutton.h> |
40 | #include <q3buttongroup.h> |
41 | #include <qcheckbox.h> |
42 | #include <qlabel.h> |
43 | #include <kdialog.h> |
44 | #include "scriptedit.h" |
45 | #include "kpppconfig.h" |
46 | #include "pppdargs.h" |
47 | class IPLineEdit; |
48 | |
49 | class DialWidget : public QWidget { |
50 | Q_OBJECT |
51 | public: |
52 | explicit DialWidget( QWidget *parent=0, bool isnewaccount = true); |
53 | ~DialWidget() {} |
54 | |
55 | public slots: |
56 | bool save(); |
57 | void pppdargsbutton(); |
58 | void numbersChanged(); |
59 | void cbtypeChanged(int); |
60 | void selectionChanged(int); |
61 | void addNumber(); |
62 | void delNumber(); |
63 | void upNumber(); |
64 | void downNumber(); |
65 | |
66 | private: |
67 | QLineEdit *connectname_l; |
68 | QLabel *connect_label; |
69 | QLabel *number_label; |
70 | QPushButton *pppdargs; |
71 | QComboBox *auth; |
72 | QLabel *auth_l; |
73 | QCheckBox *store_password; |
74 | |
75 | // callback support |
76 | QComboBox *cbtype; |
77 | QLabel *cbtype_l; |
78 | QLineEdit *cbphone; |
79 | QLabel *cbphone_l; |
80 | // for the phonenumber selection |
81 | QPushButton *add, *del, *up, *down; |
82 | Q3ListBox *numbers; |
83 | }; |
84 | |
85 | |
86 | ///////////////////////////////////////////////////////////////////////////// |
87 | // |
88 | // tab-window to select what to execute when |
89 | // |
90 | ///////////////////////////////////////////////////////////////////////////// |
91 | class ExecWidget : public QWidget { |
92 | Q_OBJECT |
93 | public: |
94 | explicit ExecWidget(QWidget *parent=0, bool isnewaccount=true); |
95 | |
96 | public slots: |
97 | bool save(); |
98 | |
99 | private: |
100 | QLineEdit *before_connect; |
101 | QLabel *before_connect_l; |
102 | |
103 | QLineEdit *command; |
104 | QLabel *command_label; |
105 | |
106 | QLineEdit *predisconnect; |
107 | QLabel *predisconnect_label; |
108 | |
109 | QLineEdit *discommand; |
110 | QLabel *discommand_label; |
111 | }; |
112 | |
113 | |
114 | class IPWidget : public QWidget { |
115 | Q_OBJECT |
116 | public: |
117 | explicit IPWidget( QWidget *parent=0, bool isnewaccount = true, const char *name=0 ); |
118 | ~IPWidget() {} |
119 | |
120 | public slots: |
121 | void save(); |
122 | |
123 | protected slots: |
124 | void hitIPSelect( int ); |
125 | void autoname_t(bool on); |
126 | |
127 | private: |
128 | QLabel *ipaddress_label; |
129 | QLabel *sub_label; |
130 | Q3GroupBox *box1; |
131 | Q3GroupBox *box; |
132 | |
133 | Q3ButtonGroup *rb; |
134 | QRadioButton *dynamicadd_rb; |
135 | QRadioButton *staticadd_rb; |
136 | |
137 | IPLineEdit *ipaddress_l; |
138 | IPLineEdit *subnetmask_l; |
139 | |
140 | QCheckBox *autoname; |
141 | }; |
142 | |
143 | |
144 | class DNSWidget : public QWidget { |
145 | Q_OBJECT |
146 | public: |
147 | explicit DNSWidget( QWidget *parent=0, bool isnewaccount = true ); |
148 | ~DNSWidget() {} |
149 | |
150 | public slots: |
151 | void save(); |
152 | |
153 | protected slots: |
154 | void adddns(); |
155 | void removedns(); |
156 | void DNS_Edit_Changed(const QString &); |
157 | void DNS_Entry_Selected(int); |
158 | void DNS_Mode_Selected(int); |
159 | |
160 | private: |
161 | QLabel *conf_label; |
162 | Q3ButtonGroup *bg; |
163 | QRadioButton *autodns, *mandns; |
164 | QLabel *dns_label; |
165 | QLabel *servers_label; |
166 | IPLineEdit *dnsipaddr; |
167 | QPushButton *add; |
168 | QPushButton *remove; |
169 | Q3ListBox *dnsservers; |
170 | QLineEdit *dnsdomain; |
171 | QLabel *dnsdomain_label; |
172 | QCheckBox *exdnsdisabled_toggle; |
173 | }; |
174 | |
175 | |
176 | class GatewayWidget : public QWidget { |
177 | Q_OBJECT |
178 | public: |
179 | explicit GatewayWidget( QWidget *parent=0, bool isnewaccount = true ); |
180 | ~GatewayWidget() {} |
181 | |
182 | public slots: |
183 | void save(); |
184 | |
185 | private slots: |
186 | void hitGatewaySelect( int ); |
187 | |
188 | private: |
189 | Q3GroupBox *box; |
190 | QLabel *gate_label; |
191 | Q3GroupBox *box1; |
192 | Q3ButtonGroup *rb; |
193 | QRadioButton *defaultgateway; |
194 | QRadioButton *staticgateway; |
195 | IPLineEdit *gatewayaddr; |
196 | QCheckBox *defaultroute; |
197 | }; |
198 | |
199 | |
200 | class ScriptWidget : public QWidget { |
201 | Q_OBJECT |
202 | public: |
203 | explicit ScriptWidget( QWidget *parent=0, bool isnewaccount = true, const char *name=0 ); |
204 | ~ScriptWidget() {} |
205 | |
206 | public slots: |
207 | void save(); |
208 | bool check(); |
209 | |
210 | private slots: |
211 | void addButton(); |
212 | void insertButton(); |
213 | void removeButton(); |
214 | |
215 | //signals linked to the scroll bar |
216 | void scrolling(int); |
217 | |
218 | //signals to keep the two listboxes highlighted in sync |
219 | void slhighlighted(int); |
220 | void stlhighlighted(int); |
221 | |
222 | private: |
223 | void adjustScrollBar(); |
224 | |
225 | ScriptEdit *se; |
226 | QPushButton *add; |
227 | QPushButton *remove; |
228 | QPushButton *insert; |
229 | Q3ListBox *sl, *stl; |
230 | |
231 | QScrollBar *slb; |
232 | }; |
233 | |
234 | |
235 | ///////////////////////////////////////////////////////////////////////////// |
236 | // |
237 | // Used to specify a new phone number |
238 | // |
239 | ///////////////////////////////////////////////////////////////////////////// |
240 | class PhoneNumberDialog : public KDialog { |
241 | Q_OBJECT |
242 | public: |
243 | PhoneNumberDialog(QWidget *parent = 0); |
244 | |
245 | QString phoneNumber(); |
246 | |
247 | private slots: |
248 | void textChanged(const QString &); |
249 | |
250 | private: |
251 | QLineEdit *le; |
252 | }; |
253 | |
254 | |
255 | #endif |
256 | |