summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/general.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/ppp/general.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/general.cpp55
1 files changed, 36 insertions, 19 deletions
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp
index a02ee35..98e035b 100644
--- a/noncore/settings/networksettings/ppp/general.cpp
+++ b/noncore/settings/networksettings/ppp/general.cpp
@@ -13,123 +13,131 @@
13 * modify it under the terms of the GNU Library General Public 13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either 14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version. 15 * version 2 of the License, or (at your option) any later version.
16 * 16 *
17 * This program is distributed in the hope that it will be useful, 17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details. 20 * Library General Public License for more details.
21 * 21 *
22 * You should have received a copy of the GNU Library General Public 22 * You should have received a copy of the GNU Library General Public
23 * License along with this program; if not, write to the Free 23 * License along with this program; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */ 25 */
26 26
27#include <termios.h> 27#include <termios.h>
28#include <string.h> 28#include <string.h>
29#include <qwhatsthis.h>
30 29
31#include "knuminput.h" 30#include <qcheckbox.h>
32#include <qslider.h> 31#include <qcombobox.h>
32#include <qlabel.h>
33#include <qlayout.h> 33#include <qlayout.h>
34#include <qpushbutton.h>
35#include <qslider.h>
36#include <qspinbox.h>
37#include <qwhatsthis.h>
38
39// #include <qgroupbox.h>
40
34#include "general.h" 41#include "general.h"
35//#include "version.h" 42//#include "version.h"
36//#include "miniterm.h" 43//#include "miniterm.h"
37#include "modeminfo.h" 44#include "modeminfo.h"
38#include "modemcmds.h" 45#include "modemcmds.h"
39#include "devices.h" 46#include "devices.h"
40#include "pppdata.h" 47#include "pppdata.h"
41//#include <klocale.h> 48//#include <klocale.h>
42#define i18n QObject::tr 49#define i18n QObject::tr
43 50
44 51
45 52
46ModemWidget::ModemWidget( QWidget *parent, const char *name) 53ModemWidget::ModemWidget( QWidget *parent, const char *name)
47 : QWidget(parent, name) 54 : QWidget(parent, name)
48{ 55{
49 int k; 56 int k;
50 57
51 QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint()); 58 QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint());
52 59
60 QLabel *label1;
53 label1 = new QLabel(i18n("Modem de&vice:"), this); 61 label1 = new QLabel(i18n("Modem de&vice:"), this);
54 tl->addWidget(label1, 0, 0); 62 tl->addWidget(label1, 0, 0);
55 63
56 modemdevice = new QComboBox(false, this); 64 modemdevice = new QComboBox(false, this);
57 label1->setBuddy(modemdevice); 65 label1->setBuddy(modemdevice);
58 66
59 for(k = 0; devices[k]; k++) 67 for(k = 0; devices[k]; k++)
60 modemdevice->insertItem(devices[k]); 68 modemdevice->insertItem(devices[k]);
61 69
62 tl->addWidget(modemdevice, 0, 1); 70 tl->addWidget(modemdevice, 0, 1);
63 connect(modemdevice, SIGNAL(activated(int)), 71 connect(modemdevice, SIGNAL(activated(int)),
64 SLOT(setmodemdc(int))); 72 SLOT(setmodemdc(int)));
65 QString tmp = i18n("This specifies the serial port your modem is attached \n" 73 QString tmp = i18n("This specifies the serial port your modem is attached \n"
66 "to. On Linux/x86, typically this is either /dev/ttyS0 \n" 74 "to. On Linux/x86, typically this is either /dev/ttyS0 \n"
67 "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n" 75 "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n"
68 "\n" 76 "\n"
69 "If you have an internal ISDN card with AT command\n" 77 "If you have an internal ISDN card with AT command\n"
70 "emulation (most cards under Linux support this), you\n" 78 "emulation (most cards under Linux support this), you\n"
71 "should select one of the /dev/ttyIx devices."); 79 "should select one of the /dev/ttyIx devices.");
72 80
73 QWhatsThis::add(label1,tmp); 81 QWhatsThis::add(label1,tmp);
74 QWhatsThis::add(modemdevice,tmp); 82 QWhatsThis::add(modemdevice,tmp);
75 83
76 84
77 label2 = new QLabel(i18n("&Flow control:"), this); 85 label1 = new QLabel(i18n("&Flow control:"), this);
78 tl->addWidget(label2, 1, 0); 86 tl->addWidget(label1, 1, 0);
79 87
80 flowcontrol = new QComboBox(false, this); 88 flowcontrol = new QComboBox(false, this);
81 label2->setBuddy(flowcontrol); 89 label1->setBuddy(flowcontrol);
82 flowcontrol->insertItem(i18n("Hardware [CRTSCTS]")); 90 flowcontrol->insertItem(i18n("Hardware [CRTSCTS]"));
83 flowcontrol->insertItem(i18n("Software [XON/XOFF]")); 91 flowcontrol->insertItem(i18n("Software [XON/XOFF]"));
84 flowcontrol->insertItem(i18n("None")); 92 flowcontrol->insertItem(i18n("None"));
85 tl->addWidget(flowcontrol, 1, 1); 93 tl->addWidget(flowcontrol, 1, 1);
86 connect(flowcontrol, SIGNAL(activated(int)), 94 connect(flowcontrol, SIGNAL(activated(int)),
87 SLOT(setflowcontrol(int))); 95 SLOT(setflowcontrol(int)));
88 96
89 tmp = i18n("<p>Specifies how the serial port and modem\n" 97 tmp = i18n("<p>Specifies how the serial port and modem\n"
90 "communicate. You should not change this unless\n" 98 "communicate. You should not change this unless\n"
91 "you know what you are doing.\n" 99 "you know what you are doing.\n"
92 "\n" 100 "\n"
93 "<b>Default</b>: CRTSCTS"); 101 "<b>Default</b>: CRTSCTS");
94 102
95 QWhatsThis::add(label2,tmp); 103 QWhatsThis::add(label1,tmp);
96 QWhatsThis::add(flowcontrol,tmp); 104 QWhatsThis::add(flowcontrol,tmp);
97 105
98 labelenter = new QLabel(i18n("&Line termination:"), this); 106 QLabel *labelenter = new QLabel(i18n("&Line termination:"), this);
99 tl->addWidget(labelenter, 2, 0); 107 tl->addWidget(labelenter, 2, 0);
100 108
101 enter = new QComboBox(false, this); 109 enter = new QComboBox(false, this);
102 labelenter->setBuddy(enter); 110 labelenter->setBuddy(enter);
103 enter->insertItem("CR"); 111 enter->insertItem("CR");
104 enter->insertItem("LF"); 112 enter->insertItem("LF");
105 enter->insertItem("CR/LF"); 113 enter->insertItem("CR/LF");
106 tl->addWidget(enter, 2, 1); 114 tl->addWidget(enter, 2, 1);
107 connect(enter, SIGNAL(activated(int)), SLOT(setenter(int))); 115 connect(enter, SIGNAL(activated(int)), SLOT(setenter(int)));
108 tmp = i18n("<p>Specifies how AT commands are sent to your\n" 116 tmp = i18n("<p>Specifies how AT commands are sent to your\n"
109 "modem. Most modems will work fine with the\n" 117 "modem. Most modems will work fine with the\n"
110 "default <i>CR/LF</i>. If your modem does not react\n" 118 "default <i>CR/LF</i>. If your modem does not react\n"
111 "to the init string, you should try different\n" 119 "to the init string, you should try different\n"
112 "settings here\n" 120 "settings here\n"
113 "\n" 121 "\n"
114 "<b>Default</b>: CR/LF"); 122 "<b>Default</b>: CR/LF");
115 123
116 QWhatsThis::add(labelenter,tmp); 124 QWhatsThis::add(labelenter,tmp);
117 QWhatsThis::add(enter, tmp); 125 QWhatsThis::add(enter, tmp);
118 126
119 baud_label = new QLabel(i18n("Co&nnection speed:"), this); 127 QLabel *baud_label = new QLabel(i18n("Co&nnection speed:"), this);
120 tl->addWidget(baud_label, 3, 0); 128 tl->addWidget(baud_label, 3, 0);
121 baud_c = new QComboBox(this); 129 baud_c = new QComboBox(this);
122 baud_label->setBuddy(baud_c); 130 baud_label->setBuddy(baud_c);
123 131
124 static const char *baudrates[] = { 132 static const char *baudrates[] = {
125 133
126#ifdef B460800 134#ifdef B460800
127 "460800", 135 "460800",
128#endif 136#endif
129 137
130#ifdef B230400 138#ifdef B230400
131 "230400", 139 "230400",
132#endif 140#endif
133 141
134#ifdef B115200 142#ifdef B115200
135 "115200", 143 "115200",
@@ -177,40 +185,44 @@ ModemWidget::ModemWidget( QWidget *parent, const char *name)
177 connect(modemlockfile, SIGNAL(toggled(bool)), 185 connect(modemlockfile, SIGNAL(toggled(bool)),
178 SLOT(modemlockfilechanged(bool))); 186 SLOT(modemlockfilechanged(bool)));
179 tl->addMultiCellWidget(modemlockfile, 5, 5, 0, 1); 187 tl->addMultiCellWidget(modemlockfile, 5, 5, 0, 1);
180 // l12->addStretch(1); 188 // l12->addStretch(1);
181 QWhatsThis::add(modemlockfile, 189 QWhatsThis::add(modemlockfile,
182 i18n("<p>To prevent other programs from accessing the\n" 190 i18n("<p>To prevent other programs from accessing the\n"
183 "modem while a connection is established, a\n" 191 "modem while a connection is established, a\n"
184 "file can be created to indicate that the modem\n" 192 "file can be created to indicate that the modem\n"
185 "is in use. On Linux an example file would be\n" 193 "is in use. On Linux an example file would be\n"
186 "<tt>/var/lock/LCK..ttyS1</tt>\n" 194 "<tt>/var/lock/LCK..ttyS1</tt>\n"
187 "Here you can select whether this locking will\n" 195 "Here you can select whether this locking will\n"
188 "be done.\n" 196 "be done.\n"
189 "\n" 197 "\n"
190 "<b>Default</b>: On")); 198 "<b>Default</b>: On"));
191 199
192 // Modem Timeout Line Edit Box 200 // Modem Timeout Line Edit Box
193 201 QHBoxLayout *timeoutLayout = new QHBoxLayout( this );
194 modemtimeout = new KIntNumInput(PPPData::data()->modemTimeout(), this); 202 QLabel *timeoutlabel = new QLabel( tr("Modem timeout:") ,this, "timeout" );
195 modemtimeout->setLabel(i18n("Modem &timeout:")); 203 modemtimeout = new QSpinBox( 1, 120, 1, this, "modemTimeout" );
196 modemtimeout->setRange(1, 120, 1); 204// modemtimeout = new KIntNumInput(PPPData::data()->modemTimeout(), this);
205// modemtimeout->setLabel(i18n("Modem &timeout:"));
206// modemtimeout->setRange(1, 120, 1);
197 modemtimeout->setSuffix(i18n(" sec")); 207 modemtimeout->setSuffix(i18n(" sec"));
198 connect(modemtimeout, SIGNAL(valueChanged(int)), 208 connect(modemtimeout, SIGNAL(valueChanged(int)),
199 SLOT(modemtimeoutchanged(int))); 209 SLOT(modemtimeoutchanged(int)));
200 tl->addMultiCellWidget(modemtimeout, 6, 6, 0, 1); 210 timeoutLayout->addWidget(timeoutlabel);
211 timeoutLayout->addWidget(modemtimeout);
212 tl->addMultiCellLayout(timeoutLayout, 6, 6, 0, 1);
201 213
202 QWhatsThis::add(modemtimeout, 214 QWhatsThis::add(modemtimeout,
203 i18n("This specifies how long <i>kppp</i> waits for a\n" 215 i18n("This specifies how long <i>kppp</i> waits for a\n"
204 "<i>CONNECT</i> response from your modem. The\n" 216 "<i>CONNECT</i> response from your modem. The\n"
205 "recommended value is 30 seconds.")); 217 "recommended value is 30 seconds."));
206 218
207 //set stuff from gpppdata 219 //set stuff from gpppdata
208 for(int i=0; i <= enter->count()-1; i++) { 220 for(int i=0; i <= enter->count()-1; i++) {
209 if(PPPData::data()->enter() == enter->text(i)) 221 if(PPPData::data()->enter() == enter->text(i))
210 enter->setCurrentItem(i); 222 enter->setCurrentItem(i);
211 } 223 }
212 224
213 for(int i=0; i <= modemdevice->count()-1; i++) { 225 for(int i=0; i <= modemdevice->count()-1; i++) {
214 if(PPPData::data()->modemDevice() == modemdevice->text(i)) 226 if(PPPData::data()->modemDevice() == modemdevice->text(i))
215 modemdevice->setCurrentItem(i); 227 modemdevice->setCurrentItem(i);
216 } 228 }
@@ -265,38 +277,43 @@ ModemWidget2::ModemWidget2( QWidget *parent, const char *name)
265 QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); 277 QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint());
266 278
267 279
268 waitfordt = new QCheckBox(i18n("&Wait for dial tone before dialing"), this); 280 waitfordt = new QCheckBox(i18n("&Wait for dial tone before dialing"), this);
269 waitfordt->setChecked(PPPData::data()->waitForDialTone()); 281 waitfordt->setChecked(PPPData::data()->waitForDialTone());
270 connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool))); 282 connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool)));
271 l1->addWidget(waitfordt); 283 l1->addWidget(waitfordt);
272 QWhatsThis::add(waitfordt, 284 QWhatsThis::add(waitfordt,
273 i18n("<p>Normally the modem waits for a dial tone\n" 285 i18n("<p>Normally the modem waits for a dial tone\n"
274 "from your phone line, indicating that it can\n" 286 "from your phone line, indicating that it can\n"
275 "start to dial a number. If your modem does not\n" 287 "start to dial a number. If your modem does not\n"
276 "recognize this sound, or your local phone system\n" 288 "recognize this sound, or your local phone system\n"
277 "does not emit such a tone, uncheck this option\n" 289 "does not emit such a tone, uncheck this option\n"
278 "\n" 290 "\n"
279 "<b>Default:</b>: On")); 291 "<b>Default:</b>: On"));
280 292
281 busywait = new KIntNumInput(PPPData::data()->busyWait(), this); 293 QHBoxLayout *waitLayout = new QHBoxLayout( this );
282 busywait->setLabel(i18n("B&usy wait:")); 294 QLabel *waitLabel = new QLabel( tr("Busy wait:"), this, "busyWait" );
283 busywait->setRange(0, 300, 5, true); 295 busywait = new QSpinBox( 0, 300, 5, this, "busyWait" );
284 busywait->setSuffix(i18n(" sec")); 296// busywait = new KIntNumInput(PPPData::data()->busyWait(), this);
297// busywait->setLabel(i18n("B&usy wait:"));
298// busywait->setRange(0, 300, 5, true);
299 busywait->setSuffix(i18n(" sec"));
285 connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int))); 300 connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int)));
286 l1->addWidget(busywait); 301 waitLayout->addWidget(waitLabel);
302 waitLayout->addWidget(busywait);
303 l1->addLayout( waitLayout );
287 304
288 QWhatsThis::add(busywait, 305 QWhatsThis::add(busywait,
289 i18n("Specifies the number of seconds to wait before\n" 306 i18n("Specifies the number of seconds to wait before\n"
290 "redial if all dialed numbers are busy. This is\n" 307 "redial if all dialed numbers are busy. This is\n"
291 "necessary because some modems get stuck if the\n" 308 "necessary because some modems get stuck if the\n"
292 "same number is busy too often.\n" 309 "same number is busy too often.\n"
293 "\n" 310 "\n"
294 "The default is 0 seconds, you should not change\n" 311 "The default is 0 seconds, you should not change\n"
295 "this unless you need to.")); 312 "this unless you need to."));
296 313
297 l1->addSpacing(10); 314 l1->addSpacing(10);
298 315
299 QHBoxLayout *hbl = new QHBoxLayout; 316 QHBoxLayout *hbl = new QHBoxLayout;
300 hbl->setSpacing(2);//KDialog::spacingHint()); 317 hbl->setSpacing(2);//KDialog::spacingHint());
301 318
302 QLabel *volumeLabel = new QLabel(i18n("Modem &volume:"), this); 319 QLabel *volumeLabel = new QLabel(i18n("Modem &volume:"), this);