Diffstat (limited to 'noncore/settings/networksettings/ppp/edit.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/edit.cpp | 242 |
1 files changed, 121 insertions, 121 deletions
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp index 961047b..6132b80 100644 --- a/noncore/settings/networksettings/ppp/edit.cpp +++ b/noncore/settings/networksettings/ppp/edit.cpp | |||
@@ -20,400 +20,400 @@ | |||
20 | * | 20 | * |
21 | * You should have received a copy of the GNU Library General Public | 21 | * You should have received a copy of the GNU Library General Public |
22 | * License along with this program; if not, write to the Free | 22 | * License along with this program; if not, write to the Free |
23 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 23 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include <string.h> | 26 | #include <string.h> |
27 | #include <termios.h> | 27 | #include <termios.h> |
28 | #include <qlayout.h> | 28 | #include <qlayout.h> |
29 | #include <qmessagebox.h> | 29 | #include <qmessagebox.h> |
30 | #include <qwhatsthis.h> | 30 | #include <qwhatsthis.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qapplication.h> | 32 | #include <qapplication.h> |
33 | //#include <kiconloader.h> | 33 | //#include <kiconloader.h> |
34 | #include <qbuttongroup.h> | 34 | #include <qbuttongroup.h> |
35 | //#include <klocale.h> | 35 | //#include <klocale.h> |
36 | #define i18n QObject::tr | 36 | #define i18n QObject::tr |
37 | #include <qvgroupbox.h> | 37 | #include <qvgroupbox.h> |
38 | #include <qhbox.h> | 38 | #include <qhbox.h> |
39 | #include <qdialog.h> | 39 | #include <qdialog.h> |
40 | //#include <kwin.h> | 40 | //#include <kwin.h> |
41 | 41 | ||
42 | #include "edit.h" | 42 | #include "edit.h" |
43 | #include "pppdata.h" | 43 | #include "pppdata.h" |
44 | #include "newwidget.h" | 44 | //#include "newwidget.h" |
45 | #include "iplined.h" | 45 | #include "iplined.h" |
46 | #include "auth.h" | 46 | #include "auth.h" |
47 | 47 | ||
48 | DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) | 48 | DialWidget::DialWidget( QWidget *parent, bool isnewaccount, const char *name ) |
49 | : QWidget(parent, name) | 49 | : QWidget(parent, name) |
50 | { | 50 | { |
51 | const int GRIDROWS = 6; | 51 | const int GRIDROWS = 6; |
52 | 52 | ||
53 | QGridLayout *tl = new QGridLayout(parent, GRIDROWS, 2, 0 );//, KDialog::spacingHint()); | 53 | QGridLayout *tl = new QGridLayout(this, GRIDROWS, 2, 0 );//, KDialog::spacingHint()); |
54 | 54 | ||
55 | connect_label = new QLabel(i18n("Connection name:"), parent); | 55 | connect_label = new QLabel(i18n("Connection name:"), this); |
56 | tl->addWidget(connect_label, 0, 0); | 56 | tl->addWidget(connect_label, 0, 0); |
57 | 57 | ||
58 | connectname_l = new QLineEdit(parent); | 58 | connectname_l = new QLineEdit(this); |
59 | connectname_l->setMaxLength(ACCNAME_SIZE); | 59 | // connectname_l->setMaxLength(ACCNAME_SIZE); |
60 | tl->addWidget(connectname_l, 0, 1); | 60 | tl->addWidget(connectname_l, 0, 1); |
61 | QString tmp = i18n("Type in a unique name for this connection"); | 61 | QString tmp = i18n("Type in a unique name for this connection"); |
62 | 62 | ||
63 | QWhatsThis::add(connect_label,tmp); | 63 | QWhatsThis::add(connect_label,tmp); |
64 | QWhatsThis::add(connectname_l,tmp); | 64 | QWhatsThis::add(connectname_l,tmp); |
65 | 65 | ||
66 | 66 | ||
67 | number_label = new QLabel(i18n("Phone number:"), parent); | 67 | number_label = new QLabel(i18n("Phone number:"), this); |
68 | number_label->setAlignment(AlignTop|AlignLeft); | 68 | number_label->setAlignment(AlignTop|AlignLeft); |
69 | tl->addWidget(number_label, 1, 0); | 69 | tl->addWidget(number_label, 1, 0); |
70 | 70 | ||
71 | QHBoxLayout *lpn = new QHBoxLayout(5); | 71 | QHBoxLayout *lpn = new QHBoxLayout(5); |
72 | tl->addLayout(lpn, 1, 1); | 72 | tl->addLayout(lpn, 1, 1); |
73 | numbers = new QListBox(parent); | 73 | numbers = new QListBox(this); |
74 | numbers->setMinimumSize(120, 70); | 74 | numbers->setMinimumSize(120, 70); |
75 | lpn->addWidget(numbers); | 75 | lpn->addWidget(numbers); |
76 | QVBoxLayout *lpn1 = new QVBoxLayout; | 76 | QVBoxLayout *lpn1 = new QVBoxLayout; |
77 | lpn->addLayout(lpn1); | 77 | lpn->addLayout(lpn1); |
78 | add = new QPushButton(i18n("&Add..."), parent); | 78 | add = new QPushButton(i18n("&Add..."), this); |
79 | del = new QPushButton(i18n("&Remove"), parent); | 79 | del = new QPushButton(i18n("&Remove"), this); |
80 | 80 | ||
81 | up = new QPushButton(parent); | 81 | up = new QPushButton(this); |
82 | //FIXME: QPixmap pm = BarIcon("up"); | 82 | //FIXME: QPixmap pm = BarIcon("up"); |
83 | // up->setPixmap(pm); | 83 | // up->setPixmap(pm); |
84 | down = new QPushButton(parent); | 84 | down = new QPushButton(this); |
85 | //FIXME: pm = BarIcon("down"); | 85 | //FIXME: pm = BarIcon("down"); |
86 | // down->setPixmap(pm); | 86 | // down->setPixmap(pm); |
87 | lpn1->addWidget(add); | 87 | lpn1->addWidget(add); |
88 | lpn1->addWidget(del); | 88 | lpn1->addWidget(del); |
89 | lpn1->addStretch(1); | 89 | lpn1->addStretch(1); |
90 | lpn1->addWidget(up); | 90 | lpn1->addWidget(up); |
91 | lpn1->addWidget(down); | 91 | lpn1->addWidget(down); |
92 | connect(add, SIGNAL(clicked()), | 92 | connect(add, SIGNAL(clicked()), |
93 | this, SLOT(addNumber())); | 93 | this, SLOT(addNumber())); |
94 | connect(del, SIGNAL(clicked()), | 94 | connect(del, SIGNAL(clicked()), |
95 | this, SLOT(delNumber())); | 95 | this, SLOT(delNumber())); |
96 | connect(up, SIGNAL(clicked()), | 96 | connect(up, SIGNAL(clicked()), |
97 | this, SLOT(upNumber())); | 97 | this, SLOT(upNumber())); |
98 | connect(down, SIGNAL(clicked()), | 98 | connect(down, SIGNAL(clicked()), |
99 | this, SLOT(downNumber())); | 99 | this, SLOT(downNumber())); |
100 | connect(numbers, SIGNAL(highlighted(int)), | 100 | connect(numbers, SIGNAL(highlighted(int)), |
101 | this, SLOT(selectionChanged(int))); | 101 | this, SLOT(selectionChanged(int))); |
102 | numbersChanged(); | 102 | numbersChanged(); |
103 | 103 | ||
104 | tmp = i18n("<p>Specifies the phone numbers to dial. You\n" | 104 | tmp = i18n("<p>Specifies the phone numbers to dial. You\n" |
105 | "can supply multiple numbers here, simply\n" | 105 | "can supply multiple numbers here, simply\n" |
106 | "click on \"Add\". You can arrange the\n" | 106 | "click on \"Add\". You can arrange the\n" |
107 | "order the numbers are tried by using the\n" | 107 | "order the numbers are tried by using the\n" |
108 | "arrow buttons.\n\n" | 108 | "arrow buttons.\n\n" |
109 | "When a number is busy or fails, <i>kppp</i> will \n" | 109 | "When a number is busy or fails, <i>kppp</i> will \n" |
110 | "try the next number and so on"); | 110 | "try the next number and so on"); |
111 | 111 | ||
112 | QWhatsThis::add(number_label,tmp); | 112 | QWhatsThis::add(number_label,tmp); |
113 | QWhatsThis::add(numbers,tmp); | 113 | QWhatsThis::add(numbers,tmp); |
114 | 114 | ||
115 | auth_l = new QLabel(i18n("Authentication:"), parent); | 115 | auth_l = new QLabel(i18n("Authentication:"), this); |
116 | tl->addWidget(auth_l, 3, 0); | 116 | tl->addWidget(auth_l, 3, 0); |
117 | 117 | ||
118 | auth = new QComboBox(parent); | 118 | auth = new QComboBox(this); |
119 | auth->insertItem(i18n("Script-based")); | 119 | auth->insertItem(i18n("Script-based")); |
120 | auth->insertItem(i18n("PAP")); | 120 | auth->insertItem(i18n("PAP")); |
121 | auth->insertItem(i18n("Terminal-based")); | 121 | auth->insertItem(i18n("Terminal-based")); |
122 | auth->insertItem(i18n("CHAP")); | 122 | auth->insertItem(i18n("CHAP")); |
123 | auth->insertItem(i18n("PAP/CHAP")); | 123 | auth->insertItem(i18n("PAP/CHAP")); |
124 | tl->addWidget(auth, 3, 1); | 124 | tl->addWidget(auth, 3, 1); |
125 | tmp = i18n("<p>Specifies the method used to identify yourself to\n" | 125 | tmp = i18n("<p>Specifies the method used to identify yourself to\n" |
126 | "the PPP server. Most universities still use\n" | 126 | "the PPP server. Most universities still use\n" |
127 | "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" | 127 | "<b>Terminal</b>- or <b>Script</b>-based authentication,\n" |
128 | "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" | 128 | "while most ISP use <b>PAP</b> and/or <b>CHAP</b>. If\n" |
129 | "unsure, contact your ISP.\n" | 129 | "unsure, contact your ISP.\n" |
130 | "\n" | 130 | "\n" |
131 | "If you can choose between PAP and CHAP,\n" | 131 | "If you can choose between PAP and CHAP,\n" |
132 | "choose CHAP, because it's much safer. If you don't know\n" | 132 | "choose CHAP, because it's much safer. If you don't know\n" |
133 | "whether PAP or CHAP is right, choose PAP/CHAP."); | 133 | "whether PAP or CHAP is right, choose PAP/CHAP."); |
134 | 134 | ||
135 | QWhatsThis::add(auth_l,tmp); | 135 | QWhatsThis::add(auth_l,tmp); |
136 | QWhatsThis::add(auth,tmp); | 136 | QWhatsThis::add(auth,tmp); |
137 | 137 | ||
138 | store_password = new QCheckBox(i18n("Store password"), parent); | 138 | store_password = new QCheckBox(i18n("Store password"), this); |
139 | store_password->setChecked(true); | 139 | store_password->setChecked(true); |
140 | tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight); | 140 | tl->addMultiCellWidget(store_password, 4, 4, 0, 1, AlignRight); |
141 | QWhatsThis::add(store_password, | 141 | QWhatsThis::add(store_password, |
142 | i18n("<p>When this is turned on, your ISP password\n" | 142 | i18n("<p>When this is turned on, your ISP password\n" |
143 | "will be saved in <i>kppp</i>'s config file, so\n" | 143 | "will be saved in <i>kppp</i>'s config file, so\n" |
144 | "you do not need to type it in every time.\n" | 144 | "you do not need to type it in every time.\n" |
145 | "\n" | 145 | "\n" |
146 | "<b><font color=\"red\">Warning:</font> your password will be stored as\n" | 146 | "<b><font color=\"red\">Warning:</font> your password will be stored as\n" |
147 | "plain text in the config file, which is\n" | 147 | "plain text in the config file, which is\n" |
148 | "readable only to you. Make sure nobody\n" | 148 | "readable only to you. Make sure nobody\n" |
149 | "gains access to this file!")); | 149 | "gains access to this file!")); |
150 | 150 | ||
151 | pppdargs = new QPushButton(i18n("Customize pppd Arguments..."), parent); | 151 | pppdargs = new QPushButton(i18n("Customize pppd Arguments..."), this); |
152 | connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); | 152 | connect(pppdargs, SIGNAL(clicked()), SLOT(pppdargsbutton())); |
153 | tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); | 153 | tl->addMultiCellWidget(pppdargs, 5, 5, 0, 1, AlignCenter); |
154 | 154 | ||
155 | // Set defaults if editing an existing connection | 155 | // Set defaults if editing an existing connection |
156 | if(!isnewaccount) { | 156 | if(!isnewaccount) { |
157 | connectname_l->setText(gpppdata.accname()); | 157 | connectname_l->setText(PPPData::data()->accname()); |
158 | 158 | ||
159 | // insert the phone numbers into the listbox | 159 | // insert the phone numbers into the listbox |
160 | QString n = gpppdata.phonenumber(); | 160 | QString n = PPPData::data()->phonenumber(); |
161 | QString tmp = ""; | 161 | QString tmp = ""; |
162 | uint idx = 0; | 162 | uint idx = 0; |
163 | while(idx != n.length()) { | 163 | while(idx != n.length()) { |
164 | if(n[idx] == ':') { | 164 | if(n[idx] == ':') { |
165 | if(tmp.length() > 0) | 165 | if(tmp.length() > 0) |
166 | numbers->insertItem(tmp); | 166 | numbers->insertItem(tmp); |
167 | tmp = ""; | 167 | tmp = ""; |
168 | } else | 168 | } else |
169 | tmp += n[idx]; | 169 | tmp += n[idx]; |
170 | idx++; | 170 | idx++; |
171 | } | 171 | } |
172 | if(tmp.length() > 0) | 172 | if(tmp.length() > 0) |
173 | numbers->insertItem(tmp); | 173 | numbers->insertItem(tmp); |
174 | 174 | ||
175 | auth->setCurrentItem(gpppdata.authMethod()); | 175 | auth->setCurrentItem(PPPData::data()->authMethod()); |
176 | store_password->setChecked(gpppdata.storePassword()); | 176 | store_password->setChecked(PPPData::data()->storePassword()); |
177 | } else { | 177 | } else { |
178 | // select PAP/CHAP as default | 178 | // select PAP/CHAP as default |
179 | auth->setCurrentItem(AUTH_PAPCHAP); | 179 | auth->setCurrentItem(AUTH_PAPCHAP); |
180 | } | 180 | } |
181 | 181 | ||
182 | numbersChanged(); | 182 | numbersChanged(); |
183 | tl->activate(); | 183 | tl->activate(); |
184 | } | 184 | } |
185 | 185 | ||
186 | 186 | ||
187 | bool DialWidget::save() { | 187 | bool DialWidget::save() { |
188 | //first check to make sure that the account name is unique! | 188 | //first check to make sure that the account name is unique! |
189 | if(connectname_l->text().isEmpty() || | 189 | if(connectname_l->text().isEmpty() || |
190 | !gpppdata.isUniqueAccname(connectname_l->text())) { | 190 | !PPPData::data()->isUniqueAccname(connectname_l->text())) { |
191 | return false; | 191 | return false; |
192 | } else { | 192 | } else { |
193 | gpppdata.setAccname(connectname_l->text()); | 193 | PPPData::data()->setAccname(connectname_l->text()); |
194 | 194 | ||
195 | QString number = ""; | 195 | QString number = ""; |
196 | for(uint i = 0; i < numbers->count(); i++) { | 196 | for(uint i = 0; i < numbers->count(); i++) { |
197 | if(i != 0) | 197 | if(i != 0) |
198 | number += ":"; | 198 | number += ":"; |
199 | number += numbers->text(i); | 199 | number += numbers->text(i); |
200 | } | 200 | } |
201 | 201 | ||
202 | gpppdata.setPhonenumber(number); | 202 | PPPData::data()->setPhonenumber(number); |
203 | gpppdata.setAuthMethod(auth->currentItem()); | 203 | PPPData::data()->setAuthMethod(auth->currentItem()); |
204 | gpppdata.setStorePassword(store_password->isChecked()); | 204 | PPPData::data()->setStorePassword(store_password->isChecked()); |
205 | return true; | 205 | return true; |
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | 209 | ||
210 | void DialWidget::numbersChanged() { | 210 | void DialWidget::numbersChanged() { |
211 | int sel = numbers->currentItem(); | 211 | int sel = numbers->currentItem(); |
212 | 212 | ||
213 | del->setEnabled(sel != -1); | 213 | del->setEnabled(sel != -1); |
214 | up->setEnabled(sel != -1 && sel != 0); | 214 | up->setEnabled(sel != -1 && sel != 0); |
215 | down->setEnabled(sel != -1 && sel != (int)numbers->count()-1); | 215 | down->setEnabled(sel != -1 && sel != (int)numbers->count()-1); |
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | void DialWidget::selectionChanged(int) { | 219 | void DialWidget::selectionChanged(int) { |
220 | numbersChanged(); | 220 | numbersChanged(); |
221 | } | 221 | } |
222 | 222 | ||
223 | 223 | ||
224 | void DialWidget::addNumber() { | 224 | void DialWidget::addNumber() { |
225 | PhoneNumberDialog dlg(this); | 225 | PhoneNumberDialog dlg(this); |
226 | if(dlg.exec()) { | 226 | if(dlg.exec()) { |
227 | numbers->insertItem(dlg.phoneNumber()); | 227 | numbers->insertItem(dlg.phoneNumber()); |
228 | numbersChanged(); | 228 | numbersChanged(); |
229 | } | 229 | } |
230 | } | 230 | } |
231 | 231 | ||
232 | 232 | ||
233 | void DialWidget::delNumber() { | 233 | void DialWidget::delNumber() { |
234 | if(numbers->currentItem() != -1) { | 234 | if(numbers->currentItem() != -1) { |
235 | numbers->removeItem(numbers->currentItem()); | 235 | numbers->removeItem(numbers->currentItem()); |
236 | numbersChanged(); | 236 | numbersChanged(); |
237 | } | 237 | } |
238 | } | 238 | } |
239 | 239 | ||
240 | 240 | ||
241 | void DialWidget::upNumber() { | 241 | void DialWidget::upNumber() { |
242 | int idx = numbers->currentItem(); | 242 | int idx = numbers->currentItem(); |
243 | if(idx != -1) { | 243 | if(idx != -1) { |
244 | QString item = numbers->text(idx); | 244 | QString item = numbers->text(idx); |
245 | numbers->removeItem(idx); | 245 | numbers->removeItem(idx); |
246 | numbers->insertItem(item, idx-1); | 246 | numbers->insertItem(item, idx-1); |
247 | numbers->setCurrentItem(idx-1); | 247 | numbers->setCurrentItem(idx-1); |
248 | numbersChanged(); | 248 | numbersChanged(); |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | 252 | ||
253 | void DialWidget::downNumber() { | 253 | void DialWidget::downNumber() { |
254 | int idx = numbers->currentItem(); | 254 | int idx = numbers->currentItem(); |
255 | if(idx != -1) { | 255 | if(idx != -1) { |
256 | QString item = numbers->text(idx); | 256 | QString item = numbers->text(idx); |
257 | numbers->removeItem(idx); | 257 | numbers->removeItem(idx); |
258 | numbers->insertItem(item, idx+1); | 258 | numbers->insertItem(item, idx+1); |
259 | numbers->setCurrentItem(idx+1); | 259 | numbers->setCurrentItem(idx+1); |
260 | numbersChanged(); | 260 | numbersChanged(); |
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | 264 | ||
265 | void DialWidget::pppdargsbutton() { | 265 | void DialWidget::pppdargsbutton() { |
266 | PPPdArguments pa(this); | 266 | PPPdArguments pa(this); |
267 | pa.exec(); | 267 | pa.exec(); |
268 | } | 268 | } |
269 | 269 | ||
270 | 270 | ||
271 | 271 | ||
272 | ///////////////////////////////////////////////////////////////////////////// | 272 | ///////////////////////////////////////////////////////////////////////////// |
273 | // ExecWidget | 273 | // ExecWidget |
274 | ///////////////////////////////////////////////////////////////////////////// | 274 | ///////////////////////////////////////////////////////////////////////////// |
275 | ExecWidget::ExecWidget(QWidget *parent, bool isnewaccount, const char *name) : | 275 | ExecWidget::ExecWidget(QWidget *parent, bool isnewaccount, const char *name) : |
276 | QWidget(parent, name) | 276 | QWidget(parent, name) |
277 | { | 277 | { |
278 | QVBoxLayout *tl = new QVBoxLayout(parent, 0 );//, KDialog::spacingHint()); | 278 | QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); |
279 | 279 | ||
280 | QLabel *l = new QLabel(\ | 280 | QLabel *l = new QLabel(\ |
281 | i18n("Here you can select commands to run at certain stages of the\n" | 281 | i18n("Here you can select commands to run at certain stages of the\n" |
282 | "connection. The commands are run with your real user id, so\n" | 282 | "connection. The commands are run with your real user id, so\n" |
283 | "you cannot run any commands here requiring root permissions\n" | 283 | "you cannot run any commands here requiring root permissions\n" |
284 | "(unless, of course, you are root).\n\n" | 284 | "(unless, of course, you are root).\n\n" |
285 | "Be sure to supply the whole path to the program otherwise\n" | 285 | "Be sure to supply the whole path to the program otherwise\n" |
286 | "kppp might be unable to find it."), parent); | 286 | "kppp might be unable to find it."), this); |
287 | l->setMinimumHeight(l->sizeHint().height()); | 287 | // l->setMinimumHeight(l->sizeHint().height()); |
288 | tl->addWidget(l); | 288 | tl->addWidget(l); |
289 | tl->addStretch(1); | 289 | tl->addStretch(1); |
290 | 290 | ||
291 | QGridLayout *l1 = new QGridLayout(4, 2, 10); | 291 | QGridLayout *l1 = new QGridLayout(4, 2, 10); |
292 | tl->addLayout(l1); | 292 | tl->addLayout(l1); |
293 | l1->setColStretch(0, 0); | 293 | l1->setColStretch(0, 0); |
294 | l1->setColStretch(1, 1); | 294 | l1->setColStretch(1, 1); |
295 | 295 | ||
296 | before_connect_l = new QLabel(i18n("Before connect:"), parent); | 296 | before_connect_l = new QLabel(i18n("Before connect:"), this); |
297 | before_connect_l->setAlignment(AlignVCenter); | 297 | before_connect_l->setAlignment(AlignVCenter); |
298 | l1->addWidget(before_connect_l, 0, 0); | 298 | l1->addWidget(before_connect_l, 0, 0); |
299 | before_connect = new QLineEdit(parent); | 299 | before_connect = new QLineEdit(this); |
300 | before_connect->setMaxLength(COMMAND_SIZE); | 300 | // before_connect->setMaxLength(COMMAND_SIZE); |
301 | l1->addWidget(before_connect, 0, 1); | 301 | l1->addWidget(before_connect, 0, 1); |
302 | QString tmp = i18n("Allows you to run a program <b>before</b> a connection\n" | 302 | QString tmp = i18n("Allows you to run a program <b>before</b> a connection\n" |
303 | "is established. It is called immediately before\n" | 303 | "is established. It is called immediately before\n" |
304 | "dialing has begun.\n\n" | 304 | "dialing has begun.\n\n" |
305 | "This might be useful, e.g. to stop HylaFAX blocking the\n" | 305 | "This might be useful, e.g. to stop HylaFAX blocking the\n" |
306 | "modem."); | 306 | "modem."); |
307 | 307 | ||
308 | QWhatsThis::add(before_connect_l,tmp); | 308 | QWhatsThis::add(before_connect_l,tmp); |
309 | QWhatsThis::add(before_connect,tmp); | 309 | QWhatsThis::add(before_connect,tmp); |
310 | 310 | ||
311 | command_label = new QLabel(i18n("Upon connect:"), parent); | 311 | command_label = new QLabel(i18n("Upon connect:"), this); |
312 | command_label->setAlignment(AlignVCenter); | 312 | command_label->setAlignment(AlignVCenter); |
313 | l1->addWidget(command_label, 1, 0); | 313 | l1->addWidget(command_label, 1, 0); |
314 | command = new QLineEdit(parent); | 314 | command = new QLineEdit(this); |
315 | command->setMaxLength(COMMAND_SIZE); | 315 | // command->setMaxLength(COMMAND_SIZE); |
316 | l1->addWidget(command, 1, 1); | 316 | l1->addWidget(command, 1, 1); |
317 | tmp = i18n("Allows you to run a program <b>after</b> a connection\n" | 317 | tmp = i18n("Allows you to run a program <b>after</b> a connection\n" |
318 | "is established. When your program is called, all\n" | 318 | "is established. When your program is called, all\n" |
319 | "preparations for an Internet connection are finished.\n" | 319 | "preparations for an Internet connection are finished.\n" |
320 | "\n" | 320 | "\n" |
321 | "Very useful for fetching mail and news"); | 321 | "Very useful for fetching mail and news"); |
322 | 322 | ||
323 | QWhatsThis::add(command_label,tmp); | 323 | QWhatsThis::add(command_label,tmp); |
324 | QWhatsThis::add(command,tmp); | 324 | QWhatsThis::add(command,tmp); |
325 | 325 | ||
326 | predisconnect_label = new QLabel(i18n("Before disconnect:"), | 326 | predisconnect_label = new QLabel(i18n("Before disconnect:"), |
327 | parent); | 327 | this); |
328 | predisconnect_label->setAlignment(AlignVCenter); | 328 | predisconnect_label->setAlignment(AlignVCenter); |
329 | l1->addWidget(predisconnect_label, 2, 0); | 329 | l1->addWidget(predisconnect_label, 2, 0); |
330 | predisconnect = new QLineEdit(parent); | 330 | predisconnect = new QLineEdit(this); |
331 | predisconnect->setMaxLength(COMMAND_SIZE); | 331 | // predisconnect->setMaxLength(COMMAND_SIZE); |
332 | l1->addWidget(predisconnect, 2, 1); | 332 | l1->addWidget(predisconnect, 2, 1); |
333 | tmp = i18n("Allows you to run a program <b>before</b> a connection\n" | 333 | tmp = i18n("Allows you to run a program <b>before</b> a connection\n" |
334 | "is closed. The connection will stay open until\n" | 334 | "is closed. The connection will stay open until\n" |
335 | "the program exits."); | 335 | "the program exits."); |
336 | 336 | ||
337 | QWhatsThis::add(predisconnect_label,tmp); | 337 | QWhatsThis::add(predisconnect_label,tmp); |
338 | QWhatsThis::add(predisconnect,tmp); | 338 | QWhatsThis::add(predisconnect,tmp); |
339 | 339 | ||
340 | discommand_label = new QLabel(i18n("Upon disconnect:"), | 340 | discommand_label = new QLabel(i18n("Upon disconnect:"), |
341 | parent); | 341 | this); |
342 | discommand_label->setAlignment(AlignVCenter); | 342 | discommand_label->setAlignment(AlignVCenter); |
343 | l1->addWidget(discommand_label, 3, 0); | 343 | l1->addWidget(discommand_label, 3, 0); |
344 | 344 | ||
345 | discommand = new QLineEdit(parent); | 345 | discommand = new QLineEdit(this); |
346 | discommand->setMaxLength(COMMAND_SIZE); | 346 | // discommand->setMaxLength(COMMAND_SIZE); |
347 | l1->addWidget(discommand, 3, 1); | 347 | l1->addWidget(discommand, 3, 1); |
348 | tmp = i18n("Allows you to run a program <b>after</b> a connection\n" | 348 | tmp = i18n("Allows you to run a program <b>after</b> a connection\n" |
349 | "has been closed."); | 349 | "has been closed."); |
350 | 350 | ||
351 | QWhatsThis::add(discommand_label,tmp); | 351 | QWhatsThis::add(discommand_label,tmp); |
352 | QWhatsThis::add(discommand,tmp); | 352 | QWhatsThis::add(discommand,tmp); |
353 | 353 | ||
354 | // extra space between entries | 354 | // extra space between entries |
355 | l1->addRowSpacing(1, 5); | 355 | l1->addRowSpacing(1, 5); |
356 | l1->addRowSpacing(3, 5); | 356 | l1->addRowSpacing(3, 5); |
357 | 357 | ||
358 | tl->addStretch(1); | 358 | tl->addStretch(1); |
359 | tl->activate(); | 359 | tl->activate(); |
360 | 360 | ||
361 | // Set defaults if editing an existing connection | 361 | // Set defaults if editing an existing connection |
362 | if(!isnewaccount) { | 362 | if(!isnewaccount) { |
363 | before_connect->setText(gpppdata.command_before_connect()); | 363 | before_connect->setText(PPPData::data()->command_before_connect()); |
364 | command->setText(gpppdata.command_on_connect()); | 364 | command->setText(PPPData::data()->command_on_connect()); |
365 | discommand->setText(gpppdata.command_on_disconnect()); | 365 | discommand->setText(PPPData::data()->command_on_disconnect()); |
366 | predisconnect->setText(gpppdata.command_before_disconnect()); | 366 | predisconnect->setText(PPPData::data()->command_before_disconnect()); |
367 | } | 367 | } |
368 | } | 368 | } |
369 | 369 | ||
370 | 370 | ||
371 | bool ExecWidget::save() { | 371 | bool ExecWidget::save() { |
372 | gpppdata.setCommand_before_connect(before_connect->text()); | 372 | PPPData::data()->setCommand_before_connect(before_connect->text()); |
373 | gpppdata.setCommand_on_connect(command->text()); | 373 | PPPData::data()->setCommand_on_connect(command->text()); |
374 | gpppdata.setCommand_before_disconnect(predisconnect->text()); | 374 | PPPData::data()->setCommand_before_disconnect(predisconnect->text()); |
375 | gpppdata.setCommand_on_disconnect(discommand->text()); | 375 | PPPData::data()->setCommand_on_disconnect(discommand->text()); |
376 | return true; | 376 | return true; |
377 | } | 377 | } |
378 | 378 | ||
379 | 379 | ||
380 | 380 | ||
381 | ///////////////////////////////////////////////////////////////////////////// | 381 | ///////////////////////////////////////////////////////////////////////////// |
382 | // | 382 | // |
383 | // IPWidget | 383 | // IPWidget |
384 | // | 384 | // |
385 | ///////////////////////////////////////////////////////////////////////////// | 385 | ///////////////////////////////////////////////////////////////////////////// |
386 | IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name ) | 386 | IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name ) |
387 | : QWidget(parent, name) | 387 | : QWidget(parent, name) |
388 | { | 388 | { |
389 | QVBoxLayout *topLayout = new QVBoxLayout(parent); | 389 | QVBoxLayout *topLayout = new QVBoxLayout(this); |
390 | topLayout->setSpacing( 3 );//KDialog::spacingHint()); | 390 | topLayout->setSpacing( 3 );//KDialog::spacingHint()); |
391 | 391 | ||
392 | box = new QVGroupBox(i18n("Configuration"), parent); | 392 | box = new QVGroupBox(i18n("Configuration"), this); |
393 | // box->setInsideSpacing( 1 );//KDialog::spacingHint()); | 393 | // box->setInsideSpacing( 1 );//KDialog::spacingHint()); |
394 | 394 | ||
395 | rb = new QButtonGroup(parent); | 395 | rb = new QButtonGroup(this); |
396 | rb->hide(); | 396 | rb->hide(); |
397 | connect(rb, SIGNAL(clicked(int)), | 397 | connect(rb, SIGNAL(clicked(int)), |
398 | SLOT(hitIPSelect(int))); | 398 | SLOT(hitIPSelect(int))); |
399 | 399 | ||
400 | dynamicadd_rb = new QRadioButton(box); | 400 | dynamicadd_rb = new QRadioButton(box); |
401 | dynamicadd_rb->setText(i18n("Dynamic IP address")); | 401 | dynamicadd_rb->setText(i18n("Dynamic IP address")); |
402 | QWhatsThis::add(dynamicadd_rb, | 402 | QWhatsThis::add(dynamicadd_rb, |
403 | i18n("Select this option when your computer gets an\n" | 403 | i18n("Select this option when your computer gets an\n" |
404 | "internet address (IP) every time a\n" | 404 | "internet address (IP) every time a\n" |
405 | "connection is made.\n" | 405 | "connection is made.\n" |
406 | "\n" | 406 | "\n" |
407 | "Almost every Internet Service Provider uses\n" | 407 | "Almost every Internet Service Provider uses\n" |
408 | "this method, so this should be turned on.")); | 408 | "this method, so this should be turned on.")); |
409 | 409 | ||
410 | staticadd_rb = new QRadioButton(box); | 410 | staticadd_rb = new QRadioButton(box); |
411 | staticadd_rb->setText(i18n("Static IP address")); | 411 | staticadd_rb->setText(i18n("Static IP address")); |
412 | rb->insert(dynamicadd_rb, 0); | 412 | rb->insert(dynamicadd_rb, 0); |
413 | rb->insert(staticadd_rb, 1); | 413 | rb->insert(staticadd_rb, 1); |
414 | QWhatsThis::add(staticadd_rb, | 414 | QWhatsThis::add(staticadd_rb, |
415 | i18n("Select this option when your computer has a\n" | 415 | i18n("Select this option when your computer has a\n" |
416 | "fixed internet address (IP). Most computers\n" | 416 | "fixed internet address (IP). Most computers\n" |
417 | "don't have this, so you should probably select\n" | 417 | "don't have this, so you should probably select\n" |
418 | "dynamic IP addressing unless you know what you\n" | 418 | "dynamic IP addressing unless you know what you\n" |
419 | "are doing.")); | 419 | "are doing.")); |
@@ -427,518 +427,518 @@ IPWidget::IPWidget( QWidget *parent, bool isnewaccount, const char *name ) | |||
427 | "address, you must supply your IP address here."); | 427 | "address, you must supply your IP address here."); |
428 | ipLayout->addWidget(ipaddress_label, 0, 0); | 428 | ipLayout->addWidget(ipaddress_label, 0, 0); |
429 | 429 | ||
430 | ipaddress_l = new IPLineEdit(ipWidget); | 430 | ipaddress_l = new IPLineEdit(ipWidget); |
431 | ipLayout->addWidget(ipaddress_l, 0, 1); | 431 | ipLayout->addWidget(ipaddress_l, 0, 1); |
432 | 432 | ||
433 | QWhatsThis::add(ipaddress_label,tmp); | 433 | QWhatsThis::add(ipaddress_label,tmp); |
434 | QWhatsThis::add(ipaddress_l,tmp); | 434 | QWhatsThis::add(ipaddress_l,tmp); |
435 | 435 | ||
436 | sub_label = new QLabel(i18n("Subnet mask:"), ipWidget); | 436 | sub_label = new QLabel(i18n("Subnet mask:"), ipWidget); |
437 | tmp = i18n("<p>If your computer has a static Internet address,\n" | 437 | tmp = i18n("<p>If your computer has a static Internet address,\n" |
438 | "you must supply a network mask here. In almost\n" | 438 | "you must supply a network mask here. In almost\n" |
439 | "all cases this netmask will be <b>255.255.255.0</b>,\n" | 439 | "all cases this netmask will be <b>255.255.255.0</b>,\n" |
440 | "but your mileage may vary.\n" | 440 | "but your mileage may vary.\n" |
441 | "\n" | 441 | "\n" |
442 | "If unsure, contact your Internet Service Provider"); | 442 | "If unsure, contact your Internet Service Provider"); |
443 | ipLayout->addWidget(sub_label, 1, 0); | 443 | ipLayout->addWidget(sub_label, 1, 0); |
444 | 444 | ||
445 | subnetmask_l = new IPLineEdit(ipWidget); | 445 | subnetmask_l = new IPLineEdit(ipWidget); |
446 | ipLayout->addWidget(subnetmask_l, 1, 1); | 446 | ipLayout->addWidget(subnetmask_l, 1, 1); |
447 | 447 | ||
448 | QWhatsThis::add(sub_label,tmp); | 448 | QWhatsThis::add(sub_label,tmp); |
449 | QWhatsThis::add(subnetmask_l,tmp); | 449 | QWhatsThis::add(subnetmask_l,tmp); |
450 | 450 | ||
451 | autoname = new QCheckBox(i18n("Auto-configure hostname from this IP"), parent); | 451 | autoname = new QCheckBox(i18n("Auto-configure hostname from this IP"), this); |
452 | autoname->setChecked(gpppdata.autoname()); | 452 | autoname->setChecked(PPPData::data()->autoname()); |
453 | connect(autoname,SIGNAL(toggled(bool)), | 453 | connect(autoname,SIGNAL(toggled(bool)), |
454 | this,SLOT(autoname_t(bool))); | 454 | this,SLOT(autoname_t(bool))); |
455 | 455 | ||
456 | QWhatsThis::add(autoname, | 456 | QWhatsThis::add(autoname, |
457 | i18n("<p>Whenever you connect, this reconfigures\n" | 457 | i18n("<p>Whenever you connect, this reconfigures\n" |
458 | "your hostname to match the IP address you\n" | 458 | "your hostname to match the IP address you\n" |
459 | "got from the PPP server. This may be useful\n" | 459 | "got from the PPP server. This may be useful\n" |
460 | "if you need to use a protocol which depends\n" | 460 | "if you need to use a protocol which depends\n" |
461 | "on this information, but it can also cause several\n" | 461 | "on this information, but it can also cause several\n" |
462 | "<a href=\"kppp-7.html#autohostname\">problems</a>.\n" | 462 | "<a href=\"kppp-7.html#autohostname\">problems</a>.\n" |
463 | "\n" | 463 | "\n" |
464 | "Don't enable this unless you really need it.")); | 464 | "Don't enable this unless you really need it.")); |
465 | 465 | ||
466 | topLayout->addWidget(box); | 466 | topLayout->addWidget(box); |
467 | topLayout->addWidget(autoname); | 467 | topLayout->addWidget(autoname); |
468 | topLayout->addStretch(); | 468 | topLayout->addStretch(); |
469 | 469 | ||
470 | //load info from gpppdata | 470 | //load info from gpppdata |
471 | if(!isnewaccount) { | 471 | if(!isnewaccount) { |
472 | if(gpppdata.ipaddr() == "0.0.0.0" && | 472 | if(PPPData::data()->ipaddr() == "0.0.0.0" && |
473 | gpppdata.subnetmask() == "0.0.0.0") { | 473 | PPPData::data()->subnetmask() == "0.0.0.0") { |
474 | dynamicadd_rb->setChecked(true); | 474 | dynamicadd_rb->setChecked(true); |
475 | hitIPSelect(0); | 475 | hitIPSelect(0); |
476 | autoname->setChecked(gpppdata.autoname()); | 476 | autoname->setChecked(PPPData::data()->autoname()); |
477 | } | 477 | } |
478 | else { | 478 | else { |
479 | ipaddress_l->setText(gpppdata.ipaddr()); | 479 | ipaddress_l->setText(PPPData::data()->ipaddr()); |
480 | subnetmask_l->setText(gpppdata.subnetmask()); | 480 | subnetmask_l->setText(PPPData::data()->subnetmask()); |
481 | staticadd_rb->setChecked(true); | 481 | staticadd_rb->setChecked(true); |
482 | autoname->setChecked(false); | 482 | autoname->setChecked(false); |
483 | } | 483 | } |
484 | } | 484 | } |
485 | else { | 485 | else { |
486 | dynamicadd_rb->setChecked(true); | 486 | dynamicadd_rb->setChecked(true); |
487 | hitIPSelect(0); | 487 | hitIPSelect(0); |
488 | } | 488 | } |
489 | 489 | ||
490 | } | 490 | } |
491 | 491 | ||
492 | void IPWidget::autoname_t(bool on) { | 492 | void IPWidget::autoname_t(bool on) { |
493 | static bool was_warned = false; | 493 | static bool was_warned = false; |
494 | 494 | ||
495 | // big-fat warning when selecting the auto configure hostname option | 495 | // big-fat warning when selecting the auto configure hostname option |
496 | if(on && !was_warned) { | 496 | if(on && !was_warned) { |
497 | QMessageBox::information(this, | 497 | QMessageBox::information(this, |
498 | i18n("Selecting this option might cause some weird " | 498 | i18n("Selecting this option might cause some weird " |
499 | "problems with the X-server and applications " | 499 | "problems with the X-server and applications " |
500 | "while kppp is connected. Don't use it until " | 500 | "while kppp is connected. Don't use it until " |
501 | "you know what you are doing!\n" | 501 | "you know what you are doing!\n" |
502 | "For more information take a look at the " | 502 | "For more information take a look at the " |
503 | "handbook (or help) in the section \"Frequently " | 503 | "handbook (or help) in the section \"Frequently " |
504 | "asked questions\"."), | 504 | "asked questions\"."), |
505 | i18n("Warning")); | 505 | i18n("Warning")); |
506 | was_warned = true; | 506 | was_warned = true; |
507 | } | 507 | } |
508 | } | 508 | } |
509 | 509 | ||
510 | 510 | ||
511 | void IPWidget::save() { | 511 | void IPWidget::save() { |
512 | if(dynamicadd_rb->isChecked()) { | 512 | if(dynamicadd_rb->isChecked()) { |
513 | gpppdata.setIpaddr("0.0.0.0"); | 513 | PPPData::data()->setIpaddr("0.0.0.0"); |
514 | gpppdata.setSubnetmask("0.0.0.0"); | 514 | PPPData::data()->setSubnetmask("0.0.0.0"); |
515 | } else { | 515 | } else { |
516 | gpppdata.setIpaddr(ipaddress_l->text()); | 516 | PPPData::data()->setIpaddr(ipaddress_l->text()); |
517 | gpppdata.setSubnetmask(subnetmask_l->text()); | 517 | PPPData::data()->setSubnetmask(subnetmask_l->text()); |
518 | } | 518 | } |
519 | gpppdata.setAutoname(autoname->isChecked()); | 519 | PPPData::data()->setAutoname(autoname->isChecked()); |
520 | } | 520 | } |
521 | 521 | ||
522 | 522 | ||
523 | void IPWidget::hitIPSelect( int i ) { | 523 | void IPWidget::hitIPSelect( int i ) { |
524 | if(i == 0) { | 524 | if(i == 0) { |
525 | ipaddress_label->setEnabled(false); | 525 | ipaddress_label->setEnabled(false); |
526 | sub_label->setEnabled(false); | 526 | sub_label->setEnabled(false); |
527 | ipaddress_l->setEnabled(false); | 527 | ipaddress_l->setEnabled(false); |
528 | subnetmask_l->setEnabled(false); | 528 | subnetmask_l->setEnabled(false); |
529 | } | 529 | } |
530 | else { | 530 | else { |
531 | ipaddress_label->setEnabled(true); | 531 | ipaddress_label->setEnabled(true); |
532 | sub_label->setEnabled(true); | 532 | sub_label->setEnabled(true); |
533 | ipaddress_l->setEnabled(true); | 533 | ipaddress_l->setEnabled(true); |
534 | subnetmask_l->setEnabled(true); | 534 | subnetmask_l->setEnabled(true); |
535 | } | 535 | } |
536 | } | 536 | } |
537 | 537 | ||
538 | 538 | ||
539 | 539 | ||
540 | DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) | 540 | DNSWidget::DNSWidget( QWidget *parent, bool isnewaccount, const char *name ) |
541 | : QWidget(parent, name) | 541 | : QWidget(parent, name) |
542 | { | 542 | { |
543 | // box = new QGroupBox(parent); | 543 | // box = new QGroupBox(this); |
544 | QGridLayout *tl = new QGridLayout(parent, 7, 2, 0 );//, KDialog::spacingHint()); | 544 | QGridLayout *tl = new QGridLayout(this, 7, 2, 0 );//, KDialog::spacingHint()); |
545 | 545 | ||
546 | dnsdomain_label = new QLabel(i18n("Domain name:"), parent); | 546 | dnsdomain_label = new QLabel(i18n("Domain name:"), this); |
547 | tl->addWidget(dnsdomain_label, 0, 0); | 547 | tl->addWidget(dnsdomain_label, 0, 0); |
548 | 548 | ||
549 | dnsdomain = new QLineEdit(parent); | 549 | dnsdomain = new QLineEdit(this); |
550 | dnsdomain->setMaxLength(DOMAIN_SIZE); | 550 | // dnsdomain->setMaxLength(DOMAIN_SIZE); |
551 | tl->addWidget(dnsdomain, 0, 1); | 551 | tl->addWidget(dnsdomain, 0, 1); |
552 | QString tmp = i18n("If you enter a domain name here, this domain\n" | 552 | QString tmp = i18n("If you enter a domain name here, this domain\n" |
553 | "name is used for your computer while you are\n" | 553 | "name is used for your computer while you are\n" |
554 | "connected. When the connection is closed, the\n" | 554 | "connected. When the connection is closed, the\n" |
555 | "original domain name of your computer is\n" | 555 | "original domain name of your computer is\n" |
556 | "restored.\n" | 556 | "restored.\n" |
557 | "\n" | 557 | "\n" |
558 | "If you leave this field blank, no changes are\n" | 558 | "If you leave this field blank, no changes are\n" |
559 | "made to the domain name."); | 559 | "made to the domain name."); |
560 | 560 | ||
561 | QWhatsThis::add(dnsdomain_label,tmp); | 561 | QWhatsThis::add(dnsdomain_label,tmp); |
562 | QWhatsThis::add(dnsdomain,tmp); | 562 | QWhatsThis::add(dnsdomain,tmp); |
563 | 563 | ||
564 | conf_label = new QLabel(i18n("Configuration:"), parent); | 564 | conf_label = new QLabel(i18n("Configuration:"), this); |
565 | tl->addWidget(conf_label, 1, 0); | 565 | tl->addWidget(conf_label, 1, 0); |
566 | 566 | ||
567 | bg = new QButtonGroup("Group", this); | 567 | bg = new QButtonGroup("Group", this); |
568 | connect(bg, SIGNAL(clicked(int)), SLOT(DNS_Mode_Selected(int))); | 568 | connect(bg, SIGNAL(clicked(int)), SLOT(DNS_Mode_Selected(int))); |
569 | bg->hide(); | 569 | bg->hide(); |
570 | 570 | ||
571 | autodns = new QRadioButton(i18n("Automatic"), parent); | 571 | autodns = new QRadioButton(i18n("Automatic"), this); |
572 | bg->insert(autodns, 0); | 572 | bg->insert(autodns, 0); |
573 | tl->addWidget(autodns, 1, 1); | 573 | tl->addWidget(autodns, 1, 1); |
574 | // no automatic DNS detection for pppd < 2.3.7 | 574 | // no automatic DNS detection for pppd < 2.3.7 |
575 | if(!gpppdata.pppdVersionMin(2, 3, 7)) | 575 | if(!PPPData::data()->pppdVersionMin(2, 3, 7)) |
576 | autodns->setEnabled(false); | 576 | autodns->setEnabled(false); |
577 | 577 | ||
578 | mandns = new QRadioButton(i18n("Manual"), parent); | 578 | mandns = new QRadioButton(i18n("Manual"), this); |
579 | bg->insert(mandns, 1); | 579 | bg->insert(mandns, 1); |
580 | tl->addWidget(mandns, 2, 1); | 580 | tl->addWidget(mandns, 2, 1); |
581 | 581 | ||
582 | dns_label = new QLabel(i18n("DNS IP address:"), parent); | 582 | dns_label = new QLabel(i18n("DNS IP address:"), this); |
583 | tl->addWidget(dns_label, 3, 0); | 583 | tl->addWidget(dns_label, 3, 0); |
584 | 584 | ||
585 | QHBoxLayout *l2 = new QHBoxLayout; | 585 | QHBoxLayout *l2 = new QHBoxLayout; |
586 | tl->addLayout(l2, 3, 1); | 586 | tl->addLayout(l2, 3, 1); |
587 | dnsipaddr = new IPLineEdit(parent); | 587 | dnsipaddr = new IPLineEdit(this); |
588 | connect(dnsipaddr, SIGNAL(returnPressed()), | 588 | connect(dnsipaddr, SIGNAL(returnPressed()), |
589 | SLOT(adddns())); | 589 | SLOT(adddns())); |
590 | connect(dnsipaddr, SIGNAL(textChanged(const QString &)), | 590 | connect(dnsipaddr, SIGNAL(textChanged(const QString &)), |
591 | SLOT(DNS_Edit_Changed(const QString &))); | 591 | SLOT(DNS_Edit_Changed(const QString &))); |
592 | l2->addWidget(dnsipaddr, 1); | 592 | l2->addWidget(dnsipaddr, 1); |
593 | l2->addStretch(1); | 593 | l2->addStretch(1); |
594 | tmp = i18n("<p>Allows you to specify a new DNS server to be\n" | 594 | tmp = i18n("<p>Allows you to specify a new DNS server to be\n" |
595 | "used while you are connected. When the\n" | 595 | "used while you are connected. When the\n" |
596 | "connection is closed, this DNS entry will be\n" | 596 | "connection is closed, this DNS entry will be\n" |
597 | "removed again.\n" | 597 | "removed again.\n" |
598 | "\n" | 598 | "\n" |
599 | "To add a DNS server, type in the IP address of\n" | 599 | "To add a DNS server, type in the IP address of\n" |
600 | "the DNS server here and click on <b>Add</b>"); | 600 | "the DNS server here and click on <b>Add</b>"); |
601 | 601 | ||
602 | QWhatsThis::add(dns_label, tmp); | 602 | QWhatsThis::add(dns_label, tmp); |
603 | QWhatsThis::add(dnsipaddr, tmp); | 603 | QWhatsThis::add(dnsipaddr, tmp); |
604 | 604 | ||
605 | QHBoxLayout *l1 = new QHBoxLayout; | 605 | QHBoxLayout *l1 = new QHBoxLayout; |
606 | tl->addLayout(l1, 4, 1); | 606 | tl->addLayout(l1, 4, 1); |
607 | add = new QPushButton(i18n("Add"), parent); | 607 | add = new QPushButton(i18n("Add"), this); |
608 | connect(add, SIGNAL(clicked()), SLOT(adddns())); | 608 | connect(add, SIGNAL(clicked()), SLOT(adddns())); |
609 | int width = add->sizeHint().width(); | 609 | // int width = add->sizeHint().width(); |
610 | width = QMAX(width,60); | 610 | // width = QMAX(width,60); |
611 | add->setMinimumWidth(width); | 611 | // add->setMinimumWidth(width); |
612 | l1->addWidget(add); | 612 | l1->addWidget(add); |
613 | l1->addStretch(1); | 613 | l1->addStretch(1); |
614 | QWhatsThis::add(add, | 614 | QWhatsThis::add(add, |
615 | i18n("Click this button to add the DNS server\n" | 615 | i18n("Click this button to add the DNS server\n" |
616 | "specified in the field above. The entry\n" | 616 | "specified in the field above. The entry\n" |
617 | "will then be added to the list below")); | 617 | "will then be added to the list below")); |
618 | 618 | ||
619 | remove = new QPushButton(i18n("Remove"), parent); | 619 | remove = new QPushButton(i18n("Remove"), this); |
620 | connect(remove, SIGNAL(clicked()), SLOT(removedns())); | 620 | connect(remove, SIGNAL(clicked()), SLOT(removedns())); |
621 | width = remove->sizeHint().width(); | 621 | // width = remove->sizeHint().width(); |
622 | width = QMAX(width,60); | 622 | // width = QMAX(width,60); |
623 | remove->setMinimumWidth(width); | 623 | // remove->setMinimumWidth(width); |
624 | l1->addWidget(remove); | 624 | l1->addWidget(remove); |
625 | QWhatsThis::add(remove, | 625 | QWhatsThis::add(remove, |
626 | i18n("Click this button to remove the selected DNS\n" | 626 | i18n("Click this button to remove the selected DNS\n" |
627 | "server entry from the list below")); | 627 | "server entry from the list below")); |
628 | 628 | ||
629 | servers_label = new QLabel(i18n("DNS address list:"), parent); | 629 | servers_label = new QLabel(i18n("DNS address list:"), this); |
630 | servers_label->setAlignment(AlignTop|AlignLeft); | 630 | servers_label->setAlignment(AlignTop|AlignLeft); |
631 | tl->addWidget(servers_label, 5, 0); | 631 | tl->addWidget(servers_label, 5, 0); |
632 | 632 | ||
633 | dnsservers = new QListBox(parent); | 633 | dnsservers = new QListBox(this); |
634 | dnsservers->setMinimumSize(150, 80); | 634 | dnsservers->setMinimumSize(150, 80); |
635 | connect(dnsservers, SIGNAL(highlighted(int)), | 635 | connect(dnsservers, SIGNAL(highlighted(int)), |
636 | SLOT(DNS_Entry_Selected(int))); | 636 | SLOT(DNS_Entry_Selected(int))); |
637 | tl->addWidget(dnsservers, 5, 1); | 637 | tl->addWidget(dnsservers, 5, 1); |
638 | tmp = i18n("<p>This shows all defined DNS servers to use\n" | 638 | tmp = i18n("<p>This shows all defined DNS servers to use\n" |
639 | "while you are connected. Use the <b>Add</b> and\n" | 639 | "while you are connected. Use the <b>Add</b> and\n" |
640 | "<b>Remove</b> buttons to modify the list"); | 640 | "<b>Remove</b> buttons to modify the list"); |
641 | 641 | ||
642 | QWhatsThis::add(servers_label,tmp); | 642 | QWhatsThis::add(servers_label,tmp); |
643 | QWhatsThis::add(dnsservers,tmp); | 643 | QWhatsThis::add(dnsservers,tmp); |
644 | 644 | ||
645 | exdnsdisabled_toggle = new QCheckBox(i18n( \ | 645 | exdnsdisabled_toggle = new QCheckBox(i18n( \ |
646 | "Disable existing DNS servers during connection"), | 646 | "Disable existing DNS servers during connection"), |
647 | parent); | 647 | this); |
648 | exdnsdisabled_toggle->setChecked(gpppdata.exDNSDisabled()); | 648 | exdnsdisabled_toggle->setChecked(PPPData::data()->exDNSDisabled()); |
649 | tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter); | 649 | tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter); |
650 | QWhatsThis::add(exdnsdisabled_toggle, | 650 | QWhatsThis::add(exdnsdisabled_toggle, |
651 | i18n("<p>When this option is selected, all DNS\n" | 651 | i18n("<p>When this option is selected, all DNS\n" |
652 | "servers specified in <tt>/etc/resolv.conf</tt> are\n" | 652 | "servers specified in <tt>/etc/resolv.conf</tt> are\n" |
653 | "temporary disabled while the dialup connection\n" | 653 | "temporary disabled while the dialup connection\n" |
654 | "is established. After the connection is\n" | 654 | "is established. After the connection is\n" |
655 | "closed, the servers will be re-enabled\n" | 655 | "closed, the servers will be re-enabled\n" |
656 | "\n" | 656 | "\n" |
657 | "Typically, there is no reason to use this\n" | 657 | "Typically, there is no reason to use this\n" |
658 | "option, but it may become useful under \n" | 658 | "option, but it may become useful under \n" |
659 | "some circumstances.")); | 659 | "some circumstances.")); |
660 | 660 | ||
661 | 661 | ||
662 | // restore data if editing | 662 | // restore data if editing |
663 | if(!isnewaccount) { | 663 | if(!isnewaccount) { |
664 | dnsservers->insertStringList(gpppdata.dns()); | 664 | dnsservers->insertStringList(PPPData::data()->dns()); |
665 | dnsdomain->setText(gpppdata.domain()); | 665 | dnsdomain->setText(PPPData::data()->domain()); |
666 | } | 666 | } |
667 | 667 | ||
668 | int mode = gpppdata.autoDNS() ? 0 : 1; | 668 | int mode = PPPData::data()->autoDNS() ? 0 : 1; |
669 | bg->setButton(mode); | 669 | bg->setButton(mode); |
670 | DNS_Mode_Selected(mode); | 670 | DNS_Mode_Selected(mode); |
671 | 671 | ||
672 | tl->activate(); | 672 | tl->activate(); |
673 | } | 673 | } |
674 | 674 | ||
675 | void DNSWidget::DNS_Edit_Changed(const QString &text) { | 675 | void DNSWidget::DNS_Edit_Changed(const QString &text) { |
676 | QRegExp r("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); | 676 | QRegExp r("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); |
677 | add->setEnabled(text.find(r) != -1); | 677 | add->setEnabled(text.find(r) != -1); |
678 | } | 678 | } |
679 | 679 | ||
680 | void DNSWidget::DNS_Entry_Selected(int) { | 680 | void DNSWidget::DNS_Entry_Selected(int) { |
681 | remove->setEnabled(true); | 681 | remove->setEnabled(true); |
682 | } | 682 | } |
683 | 683 | ||
684 | void DNSWidget::DNS_Mode_Selected(int mode) { | 684 | void DNSWidget::DNS_Mode_Selected(int mode) { |
685 | bool on = (mode == 1); | 685 | bool on = (mode == 1); |
686 | dns_label->setEnabled(on); | 686 | dns_label->setEnabled(on); |
687 | servers_label->setEnabled(on); | 687 | servers_label->setEnabled(on); |
688 | dnsipaddr->setText(""); | 688 | dnsipaddr->setText(""); |
689 | dnsipaddr->setEnabled(on); | 689 | dnsipaddr->setEnabled(on); |
690 | add->setEnabled(false); | 690 | add->setEnabled(false); |
691 | remove->setEnabled(dnsservers->count()>0 && on); | 691 | remove->setEnabled(dnsservers->count()>0 && on); |
692 | dnsservers->clearSelection(); | 692 | dnsservers->clearSelection(); |
693 | dnsservers->setEnabled(on); | 693 | dnsservers->setEnabled(on); |
694 | dnsservers->triggerUpdate(false); | 694 | dnsservers->triggerUpdate(false); |
695 | } | 695 | } |
696 | 696 | ||
697 | void DNSWidget::save() { | 697 | void DNSWidget::save() { |
698 | gpppdata.setAutoDNS(bg->id(bg->selected()) == 0); | 698 | PPPData::data()->setAutoDNS(bg->id(bg->selected()) == 0); |
699 | QStringList serverlist; | 699 | QStringList serverlist; |
700 | for(uint i=0; i < dnsservers->count(); i++) | 700 | for(uint i=0; i < dnsservers->count(); i++) |
701 | serverlist.append(dnsservers->text(i)); | 701 | serverlist.append(dnsservers->text(i)); |
702 | gpppdata.setDns(serverlist); | 702 | PPPData::data()->setDns(serverlist); |
703 | 703 | ||
704 | // strip leading dot | 704 | // strip leading dot |
705 | QString s(dnsdomain->text()); | 705 | QString s(dnsdomain->text()); |
706 | if(s.left(1) == ".") | 706 | if(s.left(1) == ".") |
707 | gpppdata.setDomain(s.mid(1)); | 707 | PPPData::data()->setDomain(s.mid(1)); |
708 | else | 708 | else |
709 | gpppdata.setDomain(dnsdomain->text()); | 709 | PPPData::data()->setDomain(dnsdomain->text()); |
710 | 710 | ||
711 | gpppdata.setExDNSDisabled(exdnsdisabled_toggle->isChecked()); | 711 | PPPData::data()->setExDNSDisabled(exdnsdisabled_toggle->isChecked()); |
712 | } | 712 | } |
713 | 713 | ||
714 | 714 | ||
715 | void DNSWidget::adddns() { | 715 | void DNSWidget::adddns() { |
716 | if(dnsservers->count() < MAX_DNS_ENTRIES) { | 716 | if(dnsservers->count() < MAX_DNS_ENTRIES) { |
717 | dnsservers->insertItem(dnsipaddr->text()); | 717 | dnsservers->insertItem(dnsipaddr->text()); |
718 | dnsipaddr->setText(""); | 718 | dnsipaddr->setText(""); |
719 | } | 719 | } |
720 | } | 720 | } |
721 | 721 | ||
722 | 722 | ||
723 | void DNSWidget::removedns() { | 723 | void DNSWidget::removedns() { |
724 | int i; | 724 | int i; |
725 | i = dnsservers->currentItem(); | 725 | i = dnsservers->currentItem(); |
726 | if(i != -1) | 726 | if(i != -1) |
727 | dnsservers->removeItem(i); | 727 | dnsservers->removeItem(i); |
728 | remove->setEnabled(dnsservers->count()>0); | 728 | remove->setEnabled(dnsservers->count()>0); |
729 | } | 729 | } |
730 | 730 | ||
731 | 731 | ||
732 | // | 732 | // |
733 | // GatewayWidget | 733 | // GatewayWidget |
734 | // | 734 | // |
735 | GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *name ) | 735 | GatewayWidget::GatewayWidget( QWidget *parent, bool isnewaccount, const char *name ) |
736 | : QWidget(parent, name) | 736 | : QWidget(parent, name) |
737 | { | 737 | { |
738 | QVBoxLayout *topLayout = new QVBoxLayout(parent); | 738 | QVBoxLayout *topLayout = new QVBoxLayout(this); |
739 | topLayout->setSpacing( 2 );//KDialog::spacingHint()); | 739 | topLayout->setSpacing( 2 );//KDialog::spacingHint()); |
740 | 740 | ||
741 | box = new QVGroupBox(i18n("Configuration"), parent); | 741 | box = new QVGroupBox(i18n("Configuration"), this); |
742 | // box->setInsideSpacing( 2 );//KDialog::spacingHint()); | 742 | // box->setInsideSpacing( 2 );//KDialog::spacingHint()); |
743 | 743 | ||
744 | rb = new QButtonGroup(parent); | 744 | rb = new QButtonGroup(this); |
745 | rb->hide(); | 745 | rb->hide(); |
746 | connect(rb, SIGNAL(clicked(int)), SLOT(hitGatewaySelect(int))); | 746 | connect(rb, SIGNAL(clicked(int)), SLOT(hitGatewaySelect(int))); |
747 | 747 | ||
748 | defaultgateway = new QRadioButton(box); | 748 | defaultgateway = new QRadioButton(box); |
749 | defaultgateway->setText(i18n("Default gateway")); | 749 | defaultgateway->setText(i18n("Default gateway")); |
750 | rb->insert(defaultgateway, 0); | 750 | rb->insert(defaultgateway, 0); |
751 | QWhatsThis::add(defaultgateway, | 751 | QWhatsThis::add(defaultgateway, |
752 | i18n("This makes the PPP peer computer (the computer\n" | 752 | i18n("This makes the PPP peer computer (the computer\n" |
753 | "you are connected to with your modem) to act as\n" | 753 | "you are connected to with your modem) to act as\n" |
754 | "a gateway. Your computer will send all packets not\n" | 754 | "a gateway. Your computer will send all packets not\n" |
755 | "going to a computer inside your local net to this\n" | 755 | "going to a computer inside your local net to this\n" |
756 | "computer, which will route these packets.\n" | 756 | "computer, which will route these packets.\n" |
757 | "\n" | 757 | "\n" |
758 | "This is the default for most ISPs, so you should\n" | 758 | "This is the default for most ISPs, so you should\n" |
759 | "probably leave this option on.")); | 759 | "probably leave this option on.")); |
760 | 760 | ||
761 | 761 | ||
762 | staticgateway = new QRadioButton(box); | 762 | staticgateway = new QRadioButton(box); |
763 | staticgateway->setText(i18n("Static gateway")); | 763 | staticgateway->setText(i18n("Static gateway")); |
764 | rb->insert(staticgateway, 1); | 764 | rb->insert(staticgateway, 1); |
765 | QWhatsThis::add(staticgateway, | 765 | QWhatsThis::add(staticgateway, |
766 | i18n("<p>Allows you to specify which computer you want\n" | 766 | i18n("<p>Allows you to specify which computer you want\n" |
767 | "to use as gateway (see <i>Default Gateway</i> above)")); | 767 | "to use as gateway (see <i>Default Gateway</i> above)")); |
768 | 768 | ||
769 | QHBox *gateBox = new QHBox(box); | 769 | QHBox *gateBox = new QHBox(box); |
770 | gate_label = new QLabel(i18n("Gateway IP address:"), gateBox); | 770 | gate_label = new QLabel(i18n("Gateway IP address:"), gateBox); |
771 | gatewayaddr = new IPLineEdit(gateBox); | 771 | gatewayaddr = new IPLineEdit(gateBox); |
772 | 772 | ||
773 | defaultroute = new QCheckBox(i18n("Assign the default route to this gateway"), | 773 | defaultroute = new QCheckBox(i18n("Assign the default route to this gateway"), |
774 | parent); | 774 | this); |
775 | QWhatsThis::add(defaultroute, | 775 | QWhatsThis::add(defaultroute, |
776 | i18n("If this option is enabled, all packets not\n" | 776 | i18n("If this option is enabled, all packets not\n" |
777 | "going to the local net are routed through\n" | 777 | "going to the local net are routed through\n" |
778 | "the PPP connection.\n" | 778 | "the PPP connection.\n" |
779 | "\n" | 779 | "\n" |
780 | "Normally, you should turn this on")); | 780 | "Normally, you should turn this on")); |
781 | 781 | ||
782 | topLayout->addWidget(box); | 782 | topLayout->addWidget(box); |
783 | topLayout->addWidget(defaultroute); | 783 | topLayout->addWidget(defaultroute); |
784 | topLayout->addStretch(); | 784 | topLayout->addStretch(); |
785 | 785 | ||
786 | //load info from gpppdata | 786 | //load info from gpppdata |
787 | if(!isnewaccount) { | 787 | if(!isnewaccount) { |
788 | if(gpppdata.gateway() == "0.0.0.0") { | 788 | if(PPPData::data()->gateway() == "0.0.0.0") { |
789 | defaultgateway->setChecked(true); | 789 | defaultgateway->setChecked(true); |
790 | hitGatewaySelect(0); | 790 | hitGatewaySelect(0); |
791 | } | 791 | } |
792 | else { | 792 | else { |
793 | gatewayaddr->setText(gpppdata.gateway()); | 793 | gatewayaddr->setText(PPPData::data()->gateway()); |
794 | staticgateway->setChecked(true); | 794 | staticgateway->setChecked(true); |
795 | } | 795 | } |
796 | defaultroute->setChecked(gpppdata.defaultroute()); | 796 | defaultroute->setChecked(PPPData::data()->defaultroute()); |
797 | } | 797 | } |
798 | else { | 798 | else { |
799 | defaultgateway->setChecked(true); | 799 | defaultgateway->setChecked(true); |
800 | hitGatewaySelect(0); | 800 | hitGatewaySelect(0); |
801 | defaultroute->setChecked(true); | 801 | defaultroute->setChecked(true); |
802 | } | 802 | } |
803 | } | 803 | } |
804 | 804 | ||
805 | void GatewayWidget::save() { | 805 | void GatewayWidget::save() { |
806 | gpppdata.setGateway(gatewayaddr->text()); | 806 | PPPData::data()->setGateway(gatewayaddr->text()); |
807 | gpppdata.setDefaultroute(defaultroute->isChecked()); | 807 | PPPData::data()->setDefaultroute(defaultroute->isChecked()); |
808 | } | 808 | } |
809 | 809 | ||
810 | 810 | ||
811 | void GatewayWidget::hitGatewaySelect( int i ) { | 811 | void GatewayWidget::hitGatewaySelect( int i ) { |
812 | if(i == 0) { | 812 | if(i == 0) { |
813 | gatewayaddr->setText("0.0.0.0"); | 813 | gatewayaddr->setText("0.0.0.0"); |
814 | gatewayaddr->setEnabled(false); | 814 | gatewayaddr->setEnabled(false); |
815 | gate_label->setEnabled(false); | 815 | gate_label->setEnabled(false); |
816 | } | 816 | } |
817 | else { | 817 | else { |
818 | gatewayaddr->setEnabled(true); | 818 | gatewayaddr->setEnabled(true); |
819 | gatewayaddr->setText(""); | 819 | gatewayaddr->setText(""); |
820 | gate_label->setEnabled(true); | 820 | gate_label->setEnabled(true); |
821 | } | 821 | } |
822 | } | 822 | } |
823 | 823 | ||
824 | 824 | ||
825 | 825 | ||
826 | ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name ) | 826 | ScriptWidget::ScriptWidget( QWidget *parent, bool isnewaccount, const char *name ) |
827 | : QWidget(parent, name) | 827 | : QWidget(parent, name) |
828 | { | 828 | { |
829 | QVBoxLayout *tl = new QVBoxLayout(parent, 0 );//, KDialog::spacingHint()); | 829 | QVBoxLayout *tl = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); |
830 | se = new ScriptEdit(parent); | 830 | se = new ScriptEdit(this); |
831 | connect(se, SIGNAL(returnPressed()), SLOT(addButton())); | 831 | connect(se, SIGNAL(returnPressed()), SLOT(addButton())); |
832 | tl->addWidget(se); | 832 | tl->addWidget(se); |
833 | 833 | ||
834 | // insert equal-sized buttons | 834 | // insert equal-sized buttons |
835 | QButtonGroup *bbox = new QButtonGroup(parent); | 835 | QButtonGroup *bbox = new QButtonGroup(this); |
836 | add = new QPushButton( bbox, i18n("Add") ); | 836 | add = new QPushButton( bbox, i18n("Add") ); |
837 | bbox->insert(add); | 837 | bbox->insert(add); |
838 | connect(add, SIGNAL(clicked()), SLOT(addButton())); | 838 | connect(add, SIGNAL(clicked()), SLOT(addButton())); |
839 | // bbox->addStretch(1); | 839 | // bbox->addStretch(1); |
840 | insert = new QPushButton( bbox, i18n("Insert") ); | 840 | insert = new QPushButton( bbox, i18n("Insert") ); |
841 | bbox->insert(insert); | 841 | bbox->insert(insert); |
842 | connect(insert, SIGNAL(clicked()), SLOT(insertButton())); | 842 | connect(insert, SIGNAL(clicked()), SLOT(insertButton())); |
843 | // bbox->addStretch(1); | 843 | // bbox->addStretch(1); |
844 | remove = new QPushButton( bbox, i18n("Remove") ); | 844 | remove = new QPushButton( bbox, i18n("Remove") ); |
845 | bbox->insert(remove); | 845 | bbox->insert(remove); |
846 | connect(remove, SIGNAL(clicked()), SLOT(removeButton())); | 846 | connect(remove, SIGNAL(clicked()), SLOT(removeButton())); |
847 | bbox->layout(); | 847 | bbox->layout(); |
848 | tl->addWidget(bbox); | 848 | tl->addWidget(bbox); |
849 | 849 | ||
850 | QHBoxLayout *l12 = new QHBoxLayout(0); | 850 | QHBoxLayout *l12 = new QHBoxLayout(0); |
851 | tl->addLayout(l12); | 851 | tl->addLayout(l12); |
852 | stl = new QListBox(parent); | 852 | stl = new QListBox(this); |
853 | stl->setVScrollBarMode( QScrollView::AlwaysOff ); | 853 | stl->setVScrollBarMode( QScrollView::AlwaysOff ); |
854 | connect(stl, SIGNAL(highlighted(int)), SLOT(stlhighlighted(int))); | 854 | connect(stl, SIGNAL(highlighted(int)), SLOT(stlhighlighted(int))); |
855 | stl->setMinimumSize(QSize(70, 140)); | 855 | stl->setMinimumSize(QSize(70, 140)); |
856 | 856 | ||
857 | sl = new QListBox(parent); | 857 | sl = new QListBox(this); |
858 | sl->setVScrollBarMode( QScrollView::AlwaysOff ); | 858 | sl->setVScrollBarMode( QScrollView::AlwaysOff ); |
859 | connect(sl, SIGNAL(highlighted(int)), SLOT(slhighlighted(int))); | 859 | connect(sl, SIGNAL(highlighted(int)), SLOT(slhighlighted(int))); |
860 | sl->setMinimumSize(QSize(150, 140)); | 860 | sl->setMinimumSize(QSize(150, 140)); |
861 | 861 | ||
862 | slb = new QScrollBar(parent); | 862 | slb = new QScrollBar(this); |
863 | slb->setFixedWidth(slb->sizeHint().width()); | 863 | // slb->setFixedWidth(slb->sizeHint().width()); |
864 | connect(slb, SIGNAL(valueChanged(int)), SLOT(scrolling(int))); | 864 | connect(slb, SIGNAL(valueChanged(int)), SLOT(scrolling(int))); |
865 | 865 | ||
866 | l12->addWidget(stl, 1); | 866 | l12->addWidget(stl, 1); |
867 | l12->addWidget(sl, 3); | 867 | l12->addWidget(sl, 3); |
868 | l12->addWidget(slb, 0); | 868 | l12->addWidget(slb, 0); |
869 | 869 | ||
870 | //load data from gpppdata | 870 | //load data from gpppdata |
871 | if(!isnewaccount) { | 871 | if(!isnewaccount) { |
872 | QStringList &comlist = gpppdata.scriptType(); | 872 | QStringList &comlist = PPPData::data()->scriptType(); |
873 | QStringList &arglist = gpppdata.script(); | 873 | QStringList &arglist = PPPData::data()->script(); |
874 | QStringList::Iterator itcom = comlist.begin(); | 874 | QStringList::Iterator itcom = comlist.begin(); |
875 | QStringList::Iterator itarg = arglist.begin(); | 875 | QStringList::Iterator itarg = arglist.begin(); |
876 | 876 | ||
877 | for ( ; | 877 | for ( ; |
878 | itcom != comlist.end() && itarg != arglist.end(); | 878 | itcom != comlist.end() && itarg != arglist.end(); |
879 | ++itcom, ++itarg ) | 879 | ++itcom, ++itarg ) |
880 | { | 880 | { |
881 | stl->insertItem(*itcom); | 881 | stl->insertItem(*itcom); |
882 | sl->insertItem(*itarg); | 882 | sl->insertItem(*itarg); |
883 | } | 883 | } |
884 | } | 884 | } |
885 | 885 | ||
886 | insert->setEnabled(false); | 886 | insert->setEnabled(false); |
887 | remove->setEnabled(false); | 887 | remove->setEnabled(false); |
888 | adjustScrollBar(); | 888 | adjustScrollBar(); |
889 | tl->activate(); | 889 | tl->activate(); |
890 | } | 890 | } |
891 | 891 | ||
892 | bool ScriptWidget::check() { | 892 | bool ScriptWidget::check() { |
893 | uint lstart = 0; | 893 | uint lstart = 0; |
894 | uint lend = 0; | 894 | uint lend = 0; |
895 | uint errcnt = 0; | 895 | uint errcnt = 0; |
896 | 896 | ||
897 | if(sl->count() > 0) { | 897 | if(sl->count() > 0) { |
898 | for( uint i=0; i <= sl->count()-1; i++) { | 898 | for( uint i=0; i <= sl->count()-1; i++) { |
899 | if(stl->text(i) == "LoopStart") { | 899 | if(stl->text(i) == "LoopStart") { |
900 | lstart++; | 900 | lstart++; |
901 | } | 901 | } |
902 | if (stl->text(i) == "LoopEnd") { | 902 | if (stl->text(i) == "LoopEnd") { |
903 | lend++; | 903 | lend++; |
904 | } | 904 | } |
905 | if ( lend > lstart ) errcnt++; | 905 | if ( lend > lstart ) errcnt++; |
906 | } | 906 | } |
907 | return ( (errcnt == 0 ) && (lstart == lend) ); | 907 | return ( (errcnt == 0 ) && (lstart == lend) ); |
908 | } | 908 | } |
909 | return true; | 909 | return true; |
910 | } | 910 | } |
911 | 911 | ||
912 | 912 | ||
913 | void ScriptWidget::save() { | 913 | void ScriptWidget::save() { |
914 | QStringList typelist, arglist; | 914 | QStringList typelist, arglist; |
915 | for(uint i=0; i < sl->count(); i++) { | 915 | for(uint i=0; i < sl->count(); i++) { |
916 | typelist.append(stl->text(i)); | 916 | typelist.append(stl->text(i)); |
917 | arglist.append(sl->text(i)); | 917 | arglist.append(sl->text(i)); |
918 | } | 918 | } |
919 | gpppdata.setScriptType(typelist); | 919 | PPPData::data()->setScriptType(typelist); |
920 | gpppdata.setScript(arglist); | 920 | PPPData::data()->setScript(arglist); |
921 | } | 921 | } |
922 | 922 | ||
923 | 923 | ||
924 | 924 | ||
925 | void ScriptWidget::adjustScrollBar() { | 925 | void ScriptWidget::adjustScrollBar() { |
926 | if((int)sl->count() <= sl->numItemsVisible()) | 926 | if((int)sl->count() <= sl->numItemsVisible()) |
927 | slb->setRange(0, 0); | 927 | slb->setRange(0, 0); |
928 | else | 928 | else |
929 | slb->setRange(0, (sl->count() - sl->numItemsVisible())+1); | 929 | slb->setRange(0, (sl->count() - sl->numItemsVisible())+1); |
930 | } | 930 | } |
931 | 931 | ||
932 | 932 | ||
933 | void ScriptWidget::scrolling(int i) { | 933 | void ScriptWidget::scrolling(int i) { |
934 | sl->setTopItem(i); | 934 | sl->setTopItem(i); |
935 | stl->setTopItem(i); | 935 | stl->setTopItem(i); |
936 | } | 936 | } |
937 | 937 | ||
938 | 938 | ||
939 | void ScriptWidget::slhighlighted(int i) { | 939 | void ScriptWidget::slhighlighted(int i) { |
940 | insert->setEnabled(true); | 940 | insert->setEnabled(true); |
941 | remove->setEnabled(true); | 941 | remove->setEnabled(true); |
942 | stl->setCurrentItem(i); | 942 | stl->setCurrentItem(i); |
943 | } | 943 | } |
944 | 944 | ||
@@ -1133,61 +1133,61 @@ void ScriptWidget::insertButton() { | |||
1133 | adjustScrollBar(); | 1133 | adjustScrollBar(); |
1134 | se->setText(""); | 1134 | se->setText(""); |
1135 | } | 1135 | } |
1136 | 1136 | ||
1137 | 1137 | ||
1138 | void ScriptWidget::removeButton() { | 1138 | void ScriptWidget::removeButton() { |
1139 | if(sl->currentItem() >= 0) { | 1139 | if(sl->currentItem() >= 0) { |
1140 | int stlc = stl->currentItem(); | 1140 | int stlc = stl->currentItem(); |
1141 | sl->removeItem(sl->currentItem()); | 1141 | sl->removeItem(sl->currentItem()); |
1142 | stl->removeItem(stlc); | 1142 | stl->removeItem(stlc); |
1143 | adjustScrollBar(); | 1143 | adjustScrollBar(); |
1144 | insert->setEnabled(sl->currentItem() != -1); | 1144 | insert->setEnabled(sl->currentItem() != -1); |
1145 | remove->setEnabled(sl->currentItem() != -1); | 1145 | remove->setEnabled(sl->currentItem() != -1); |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | 1148 | ||
1149 | 1149 | ||
1150 | 1150 | ||
1151 | ///////////////////////////////////////////////////////////////////////////// | 1151 | ///////////////////////////////////////////////////////////////////////////// |
1152 | // | 1152 | // |
1153 | // Used to specify a new phone number | 1153 | // Used to specify a new phone number |
1154 | // | 1154 | // |
1155 | ///////////////////////////////////////////////////////////////////////////// | 1155 | ///////////////////////////////////////////////////////////////////////////// |
1156 | PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) | 1156 | PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) |
1157 | : QDialog(parent, 0, true ) { | 1157 | : QDialog(parent,"PhoneNumberDialog",true) { |
1158 | setCaption( i18n("Add Phone Number") ); | 1158 | setCaption( i18n("Add Phone Number") ); |
1159 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); | 1159 | // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); |
1160 | 1160 | ||
1161 | QHBox *hbox = new QHBox(this); | 1161 | QHBox *hbox = new QHBox(this); |
1162 | // setMainWidget(hbox); | 1162 | // setMainWidget(hbox); |
1163 | 1163 | ||
1164 | hbox->setSpacing( 2 );//KDialog::spacingHint()); | 1164 | hbox->setSpacing( 2 );//KDialog::spacingHint()); |
1165 | 1165 | ||
1166 | new QLabel(i18n("Enter a phone number:"), hbox); | 1166 | new QLabel(i18n("Enter a phone number:"), hbox); |
1167 | 1167 | ||
1168 | le = newLineEdit(14, hbox); | 1168 | le = new QLineEdit(hbox); |
1169 | le->setMinimumWidth(125); | 1169 | // le->setMinimumWidth(125); |
1170 | 1170 | ||
1171 | connect(le, SIGNAL(textChanged(const QString &)), | 1171 | connect(le, SIGNAL(textChanged(const QString &)), |
1172 | this, SLOT(textChanged(const QString &))); | 1172 | this, SLOT(textChanged(const QString &))); |
1173 | 1173 | ||
1174 | le->setFocus(); | 1174 | le->setFocus(); |
1175 | textChanged(""); | 1175 | textChanged(""); |
1176 | 1176 | ||
1177 | // enableButtonSeparator(true); | 1177 | // enableButtonSeparator(true); |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | 1180 | ||
1181 | QString PhoneNumberDialog::phoneNumber() { | 1181 | QString PhoneNumberDialog::phoneNumber() { |
1182 | QString s = le->text(); | 1182 | QString s = le->text(); |
1183 | 1183 | ||
1184 | return s; | 1184 | return s; |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | 1187 | ||
1188 | void PhoneNumberDialog::textChanged(const QString &s) { | 1188 | void PhoneNumberDialog::textChanged(const QString &s) { |
1189 | // enableButtonOK(s.length() > 0); | 1189 | // enableButtonOK(s.length() > 0); |
1190 | } | 1190 | } |
1191 | 1191 | ||
1192 | 1192 | ||
1193 | //#include "edit.moc" | 1193 | //#include "edit.moc" |