Diffstat (limited to 'noncore/settings/networksettings/ppp/general.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/general.cpp | 672 |
1 files changed, 340 insertions, 332 deletions
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp index 5540946..ff1b11b 100644 --- a/noncore/settings/networksettings/ppp/general.cpp +++ b/noncore/settings/networksettings/ppp/general.cpp | |||
@@ -11,284 +11,290 @@ | |||
11 | * | 11 | * |
12 | * This program is free software; you can redistribute it and/or | 12 | * This program is free software; you can redistribute it and/or |
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 "general.h" |
28 | #include <string.h> | 28 | #include "interfaceppp.h" |
29 | #include "modeminfo.h" | ||
30 | #include "modemcmds.h" | ||
31 | #include "pppdata.h" | ||
29 | 32 | ||
33 | /* OPIE */ | ||
34 | #include <qpe/config.h> | ||
35 | #include <qpe/qpeapplication.h> | ||
36 | |||
37 | /* QT */ | ||
30 | #include <qcheckbox.h> | 38 | #include <qcheckbox.h> |
31 | #include <qcombobox.h> | 39 | #include <qcombobox.h> |
32 | #include <qlabel.h> | 40 | #include <qlabel.h> |
33 | #include <qlayout.h> | 41 | #include <qlayout.h> |
34 | #include <qpushbutton.h> | 42 | #include <qpushbutton.h> |
35 | #include <qslider.h> | 43 | #include <qslider.h> |
36 | #include <qspinbox.h> | 44 | #include <qspinbox.h> |
37 | #include <qwhatsthis.h> | 45 | #include <qwhatsthis.h> |
38 | #include <qpe/config.h> | ||
39 | // #include <qgroupbox.h> | ||
40 | 46 | ||
47 | /* STD */ | ||
48 | #include <termios.h> | ||
49 | #include <string.h> | ||
41 | 50 | ||
42 | #include "general.h" | ||
43 | #include "interfaceppp.h" | ||
44 | //#include "miniterm.h" | ||
45 | #include "modeminfo.h" | ||
46 | #include "modemcmds.h" | ||
47 | //#include "devices.h" | ||
48 | #include "pppdata.h" | ||
49 | //#include <klocale.h> | ||
50 | 51 | ||
52 | ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) | ||
53 | : QWidget(parent, name), _pppdata(pd) | ||
54 | { | ||
55 | int k; | ||
56 | |||
57 | QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint()); | ||
51 | 58 | ||
59 | QLabel *label1; | ||
52 | 60 | ||
61 | label1 = new QLabel(tr("Modem &name:"), this); | ||
62 | tl->addWidget(label1, 0, 0); | ||
53 | 63 | ||
54 | ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) | 64 | modemname = new QLineEdit(this, "modemName"); |
55 | : QWidget(parent, name), _pppdata(pd) | 65 | modemname->setText( _pppdata->devname() ); |
56 | { | 66 | label1->setBuddy(modemname); |
57 | int k; | 67 | tl->addWidget(modemname, 0, 1); |
58 | 68 | ||
59 | QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint()); | 69 | label1 = new QLabel(tr("Modem de&vice:"), this); |
60 | 70 | tl->addWidget(label1, 1, 0); | |
61 | QLabel *label1; | 71 | |
62 | 72 | modemdevice = new QComboBox(false, this); | |
63 | label1 = new QLabel(tr("Modem &name:"), this); | 73 | modemdevice->setEditable( true ); |
64 | tl->addWidget(label1, 0, 0); | 74 | modemdevice->setDuplicatesEnabled ( false ); |
65 | 75 | modemdevice->setInsertionPolicy( QComboBox::AtTop ); | |
66 | modemname = new QLineEdit(this, "modemName"); | 76 | label1->setBuddy(modemdevice); |
67 | modemname->setText( _pppdata->devname() ); | 77 | |
68 | label1->setBuddy(modemname); | 78 | Config cfg("NetworkSetupPPP"); |
69 | tl->addWidget(modemname, 0, 1); | 79 | cfg.setGroup("Devices_General"); |
70 | 80 | QStringList devs = cfg.readListEntry("devices",','); | |
71 | label1 = new QLabel(tr("Modem de&vice:"), this); | 81 | if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0"; |
72 | tl->addWidget(label1, 1, 0); | 82 | modemdevice->insertStringList( devs ); |
73 | 83 | tl->addWidget(modemdevice, 1, 1); | |
74 | modemdevice = new QComboBox(false, this); | 84 | |
75 | modemdevice->setEditable( true ); | 85 | // connect(modemdevice, SIGNAL(activated(int)), |
76 | modemdevice->setDuplicatesEnabled ( false ); | 86 | // SLOT(setmodemdc(int))); |
77 | modemdevice->setInsertionPolicy( QComboBox::AtTop ); | 87 | // connect(modemdevice, SIGNAL(textChanged( const QString & ) ), |
78 | label1->setBuddy(modemdevice); | 88 | // SLOT( setmodemdc( const QString &) ) ); |
79 | 89 | ||
80 | Config cfg("NetworkSetupPPP"); | 90 | QString tmp = tr("This specifies the serial port your modem is attached \n" |
81 | cfg.setGroup("Devices_General"); | 91 | "to. On Linux/x86, typically this is either /dev/ttyS0 \n" |
82 | QStringList devs = cfg.readListEntry("devices",','); | 92 | "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n" |
83 | if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0"; | 93 | "\n" |
84 | modemdevice->insertStringList( devs ); | 94 | "If you have an internal ISDN card with AT command\n" |
85 | tl->addWidget(modemdevice, 1, 1); | 95 | "emulation (most cards under Linux support this), you\n" |
86 | 96 | "should select one of the /dev/ttyIx devices."); | |
87 | // connect(modemdevice, SIGNAL(activated(int)), | 97 | |
88 | // SLOT(setmodemdc(int))); | 98 | QWhatsThis::add(label1,tmp); |
89 | // connect(modemdevice, SIGNAL(textChanged( const QString & ) ), | 99 | QWhatsThis::add(modemdevice,tmp); |
90 | // SLOT( setmodemdc( const QString &) ) ); | 100 | |
91 | 101 | ||
92 | QString tmp = tr("This specifies the serial port your modem is attached \n" | 102 | label1 = new QLabel(tr("&Flow control:"), this); |
93 | "to. On Linux/x86, typically this is either /dev/ttyS0 \n" | 103 | tl->addWidget(label1, 2, 0); |
94 | "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n" | 104 | |
95 | "\n" | 105 | flowcontrol = new QComboBox(false, this); |
96 | "If you have an internal ISDN card with AT command\n" | 106 | label1->setBuddy(flowcontrol); |
97 | "emulation (most cards under Linux support this), you\n" | 107 | flowcontrol->insertItem(tr("Hardware [CRTSCTS]")); |
98 | "should select one of the /dev/ttyIx devices."); | 108 | flowcontrol->insertItem(tr("Software [XON/XOFF]")); |
99 | 109 | flowcontrol->insertItem(tr("None")); | |
100 | QWhatsThis::add(label1,tmp); | 110 | tl->addWidget(flowcontrol, 2, 1); |
101 | QWhatsThis::add(modemdevice,tmp); | 111 | // connect(flowcontrol, SIGNAL(activated(int)), |
102 | 112 | // SLOT(setflowcontrol(int))); | |
103 | 113 | ||
104 | label1 = new QLabel(tr("&Flow control:"), this); | 114 | tmp = tr("<p>Specifies how the serial port and modem\n" |
105 | tl->addWidget(label1, 2, 0); | 115 | "communicate. You should not change this unless\n" |
106 | 116 | "you know what you are doing.\n" | |
107 | flowcontrol = new QComboBox(false, this); | 117 | "\n" |
108 | label1->setBuddy(flowcontrol); | 118 | "<b>Default</b>: CRTSCTS"); |
109 | flowcontrol->insertItem(tr("Hardware [CRTSCTS]")); | 119 | |
110 | flowcontrol->insertItem(tr("Software [XON/XOFF]")); | 120 | QWhatsThis::add(label1,tmp); |
111 | flowcontrol->insertItem(tr("None")); | 121 | QWhatsThis::add(flowcontrol,tmp); |
112 | tl->addWidget(flowcontrol, 2, 1); | 122 | |
113 | // connect(flowcontrol, SIGNAL(activated(int)), | 123 | QLabel *labelenter = new QLabel(tr("&Line termination:"), this); |
114 | // SLOT(setflowcontrol(int))); | 124 | tl->addWidget(labelenter, 3, 0); |
115 | 125 | ||
116 | tmp = tr("<p>Specifies how the serial port and modem\n" | 126 | enter = new QComboBox(false, this); |
117 | "communicate. You should not change this unless\n" | 127 | labelenter->setBuddy(enter); |
118 | "you know what you are doing.\n" | 128 | enter->insertItem("CR"); |
119 | "\n" | 129 | enter->insertItem("LF"); |
120 | "<b>Default</b>: CRTSCTS"); | 130 | enter->insertItem("CR/LF"); |
121 | 131 | tl->addWidget(enter, 3, 1); | |
122 | QWhatsThis::add(label1,tmp); | 132 | // connect(enter, SIGNAL(activated(int)), SLOT(setenter(int))); |
123 | QWhatsThis::add(flowcontrol,tmp); | 133 | tmp = tr("<p>Specifies how AT commands are sent to your\n" |
124 | 134 | "modem. Most modems will work fine with the\n" | |
125 | QLabel *labelenter = new QLabel(tr("&Line termination:"), this); | 135 | "default <i>CR/LF</i>. If your modem does not react\n" |
126 | tl->addWidget(labelenter, 3, 0); | 136 | "to the init string, you should try different\n" |
127 | 137 | "settings here\n" | |
128 | enter = new QComboBox(false, this); | 138 | "\n" |
129 | labelenter->setBuddy(enter); | 139 | "<b>Default</b>: CR/LF"); |
130 | enter->insertItem("CR"); | 140 | |
131 | enter->insertItem("LF"); | 141 | QWhatsThis::add(labelenter,tmp); |
132 | enter->insertItem("CR/LF"); | 142 | QWhatsThis::add(enter, tmp); |
133 | tl->addWidget(enter, 3, 1); | 143 | |
134 | // connect(enter, SIGNAL(activated(int)), SLOT(setenter(int))); | 144 | QLabel *baud_label = new QLabel(tr("Co&nnection speed:"), this); |
135 | tmp = tr("<p>Specifies how AT commands are sent to your\n" | 145 | tl->addWidget(baud_label, 4, 0); |
136 | "modem. Most modems will work fine with the\n" | 146 | baud_c = new QComboBox(this); |
137 | "default <i>CR/LF</i>. If your modem does not react\n" | 147 | baud_label->setBuddy(baud_c); |
138 | "to the init string, you should try different\n" | 148 | |
139 | "settings here\n" | 149 | static const char *baudrates[] = |
140 | "\n" | 150 | { |
141 | "<b>Default</b>: CR/LF"); | ||
142 | |||
143 | QWhatsThis::add(labelenter,tmp); | ||
144 | QWhatsThis::add(enter, tmp); | ||
145 | |||
146 | QLabel *baud_label = new QLabel(tr("Co&nnection speed:"), this); | ||
147 | tl->addWidget(baud_label, 4, 0); | ||
148 | baud_c = new QComboBox(this); | ||
149 | baud_label->setBuddy(baud_c); | ||
150 | |||
151 | static const char *baudrates[] = { | ||
152 | 151 | ||
153 | #ifdef B460800 | 152 | #ifdef B460800 |
154 | "460800", | 153 | "460800", |
155 | #endif | 154 | #endif |
156 | 155 | ||
157 | #ifdef B230400 | 156 | #ifdef B230400 |
158 | "230400", | 157 | "230400", |
159 | #endif | 158 | #endif |
160 | 159 | ||
161 | #ifdef B115200 | 160 | #ifdef B115200 |
162 | "115200", | 161 | "115200", |
163 | #endif | 162 | #endif |
164 | 163 | ||
165 | #ifdef B57600 | 164 | #ifdef B57600 |
166 | "57600", | 165 | "57600", |
167 | #endif | 166 | #endif |
168 | 167 | ||
169 | "38400", | 168 | "38400", |
170 | "19200", | 169 | "19200", |
171 | "9600", | 170 | "9600", |
172 | "2400", | 171 | "2400", |
173 | 0}; | 172 | 0 |
174 | 173 | }; | |
175 | for(k = 0; baudrates[k]; k++) | 174 | |
176 | baud_c->insertItem(baudrates[k]); | 175 | for(k = 0; baudrates[k]; k++) |
177 | 176 | baud_c->insertItem(baudrates[k]); | |
178 | baud_c->setCurrentItem(3); | 177 | |
179 | // connect(baud_c, SIGNAL(activated(int)), | 178 | baud_c->setCurrentItem(3); |
180 | // this, SLOT(speed_selection(int))); | 179 | // connect(baud_c, SIGNAL(activated(int)), |
181 | tl->addWidget(baud_c, 4, 1); | 180 | // this, SLOT(speed_selection(int))); |
182 | 181 | tl->addWidget(baud_c, 4, 1); | |
183 | tmp = tr("Specifies the speed your modem and the serial\n" | 182 | |
184 | "port talk to each other. You should begin with\n" | 183 | tmp = tr("Specifies the speed your modem and the serial\n" |
185 | "the default of 38400 bits/sec. If everything\n" | 184 | "port talk to each other. You should begin with\n" |
186 | "works you can try to increase this value, but to\n" | 185 | "the default of 38400 bits/sec. If everything\n" |
187 | "no more than 115200 bits/sec (unless you know\n" | 186 | "works you can try to increase this value, but to\n" |
188 | "that your serial port supports higher speeds)."); | 187 | "no more than 115200 bits/sec (unless you know\n" |
189 | 188 | "that your serial port supports higher speeds)."); | |
190 | QWhatsThis::add(baud_label,tmp); | 189 | |
191 | QWhatsThis::add(baud_c,tmp); | 190 | QWhatsThis::add(baud_label,tmp); |
192 | 191 | QWhatsThis::add(baud_c,tmp); | |
193 | for(int i=0; i <= enter->count()-1; i++) { | 192 | |
194 | if(_pppdata->enter() == enter->text(i)) | 193 | for(int i=0; i <= enter->count()-1; i++) |
195 | enter->setCurrentItem(i); | 194 | { |
196 | } | 195 | if(_pppdata->enter() == enter->text(i)) |
197 | 196 | enter->setCurrentItem(i); | |
198 | tl->addRowSpacing(5, 10); | 197 | } |
199 | 198 | ||
200 | //Modem Lock File | 199 | tl->addRowSpacing(5, 10); |
201 | modemlockfile = new QCheckBox(tr("&Use lock file"), this); | 200 | |
202 | 201 | //Modem Lock File | |
203 | modemlockfile->setChecked(_pppdata->modemLockFile()); | 202 | modemlockfile = new QCheckBox(tr("&Use lock file"), this); |
204 | // connect(modemlockfile, SIGNAL(toggled(bool)), | 203 | |
205 | // SLOT(modemlockfilechanged(bool))); | 204 | modemlockfile->setChecked(_pppdata->modemLockFile()); |
206 | tl->addMultiCellWidget(modemlockfile, 6, 6, 0, 1); | 205 | // connect(modemlockfile, SIGNAL(toggled(bool)), |
207 | // l12->addStretch(1); | 206 | // SLOT(modemlockfilechanged(bool))); |
208 | QWhatsThis::add(modemlockfile, | 207 | tl->addMultiCellWidget(modemlockfile, 6, 6, 0, 1); |
209 | tr("<p>To prevent other programs from accessing the\n" | 208 | // l12->addStretch(1); |
210 | "modem while a connection is established, a\n" | 209 | QWhatsThis::add(modemlockfile, |
211 | "file can be created to indicate that the modem\n" | 210 | tr("<p>To prevent other programs from accessing the\n" |
212 | "is in use. On Linux an example file would be\n" | 211 | "modem while a connection is established, a\n" |
213 | "<tt>/var/lock/LCK..ttyS1</tt>\n" | 212 | "file can be created to indicate that the modem\n" |
214 | "Here you can select whether this locking will\n" | 213 | "is in use. On Linux an example file would be\n" |
215 | "be done.\n" | 214 | "<tt>/var/lock/LCK..ttyS1</tt>\n" |
216 | "\n" | 215 | "Here you can select whether this locking will\n" |
217 | "<b>Default</b>: On")); | 216 | "be done.\n" |
218 | 217 | "\n" | |
219 | // Modem Timeout Line Edit Box | 218 | "<b>Default</b>: On")); |
220 | QHBoxLayout *timeoutLayout = new QHBoxLayout( this ); | 219 | |
221 | QLabel *timeoutlabel = new QLabel( tr("Modem timeout:") ,this, "timeout" ); | 220 | // Modem Timeout Line Edit Box |
222 | modemtimeout = new QSpinBox( 1, 120, 1, this, "modemTimeout" ); | 221 | QHBoxLayout *timeoutLayout = new QHBoxLayout( this ); |
223 | // modemtimeout = new KIntNumInput(_pppdata->modemTimeout(), this); | 222 | QLabel *timeoutlabel = new QLabel( tr("Modem timeout:") ,this, "timeout" ); |
224 | // modemtimeout->setLabel(tr("Modem &timeout:")); | 223 | modemtimeout = new QSpinBox( 1, 120, 1, this, "modemTimeout" ); |
225 | // modemtimeout->setRange(1, 120, 1); | 224 | // modemtimeout = new KIntNumInput(_pppdata->modemTimeout(), this); |
226 | modemtimeout->setSuffix(tr(" sec")); | 225 | // modemtimeout->setLabel(tr("Modem &timeout:")); |
227 | modemtimeout->setValue( _pppdata->modemTimeout() ); | 226 | // modemtimeout->setRange(1, 120, 1); |
228 | // connect(modemtimeout, SIGNAL(valueChanged(int)), | 227 | modemtimeout->setSuffix(tr(" sec")); |
229 | // SLOT(modemtimeoutchanged(int))); | 228 | modemtimeout->setValue( _pppdata->modemTimeout() ); |
230 | timeoutLayout->addWidget(timeoutlabel); | 229 | // connect(modemtimeout, SIGNAL(valueChanged(int)), |
231 | timeoutLayout->addWidget(modemtimeout); | 230 | // SLOT(modemtimeoutchanged(int))); |
232 | tl->addMultiCellLayout(timeoutLayout, 7, 7, 0, 1); | 231 | timeoutLayout->addWidget(timeoutlabel); |
233 | 232 | timeoutLayout->addWidget(modemtimeout); | |
234 | QWhatsThis::add(modemtimeout, | 233 | tl->addMultiCellLayout(timeoutLayout, 7, 7, 0, 1); |
235 | tr("This specifies how long <i>kppp</i> waits for a\n" | 234 | |
236 | "<i>CONNECT</i> response from your modem. The\n" | 235 | QWhatsThis::add(modemtimeout, |
237 | "recommended value is 30 seconds.")); | 236 | tr("This specifies how long <i>kppp</i> waits for a\n" |
238 | 237 | "<i>CONNECT</i> response from your modem. The\n" | |
239 | //set stuff from gpppdata | 238 | "recommended value is 30 seconds.")); |
240 | for(int i=0; i <= enter->count()-1; i++) { | 239 | |
241 | if(_pppdata->enter() == enter->text(i)) | 240 | //set stuff from gpppdata |
242 | enter->setCurrentItem(i); | 241 | for(int i=0; i <= enter->count()-1; i++) |
243 | } | 242 | { |
244 | 243 | if(_pppdata->enter() == enter->text(i)) | |
245 | for(int i=0; i <= modemdevice->count()-1; i++) { | 244 | enter->setCurrentItem(i); |
246 | if(_pppdata->modemDevice() == modemdevice->text(i)) | 245 | } |
247 | modemdevice->setCurrentItem(i); | 246 | |
248 | } | 247 | for(int i=0; i <= modemdevice->count()-1; i++) |
249 | 248 | { | |
250 | for(int i=0; i <= flowcontrol->count()-1; i++) { | 249 | if(_pppdata->modemDevice() == modemdevice->text(i)) |
251 | if(_pppdata->flowcontrol() == flowcontrol->text(i)) | 250 | modemdevice->setCurrentItem(i); |
252 | flowcontrol->setCurrentItem(i); | 251 | } |
253 | } | 252 | |
254 | 253 | for(int i=0; i <= flowcontrol->count()-1; i++) | |
255 | //set the modem speed | 254 | { |
256 | for(int i=0; i < baud_c->count(); i++) | 255 | if(_pppdata->flowcontrol() == flowcontrol->text(i)) |
257 | if(baud_c->text(i) == _pppdata->speed()) | 256 | flowcontrol->setCurrentItem(i); |
258 | baud_c->setCurrentItem(i); | 257 | } |
259 | 258 | ||
260 | tl->setRowStretch(1, 1); | 259 | //set the modem speed |
260 | for(int i=0; i < baud_c->count(); i++) | ||
261 | if(baud_c->text(i) == _pppdata->speed()) | ||
262 | baud_c->setCurrentItem(i); | ||
263 | |||
264 | tl->setRowStretch(1, 1); | ||
261 | } | 265 | } |
262 | 266 | ||
263 | ModemWidget::~ModemWidget() | 267 | ModemWidget::~ModemWidget() |
264 | { | 268 | { |
265 | QStringList devs; | 269 | QStringList devs; |
266 | 270 | ||
267 | for (int i=0;i<modemdevice->count();i++) | 271 | for (int i=0;i<modemdevice->count();i++) |
268 | { | 272 | { |
269 | QString s = modemdevice->text(i); | 273 | QString s = modemdevice->text(i); |
270 | s.simplifyWhiteSpace(); | 274 | s.simplifyWhiteSpace(); |
271 | if (! s.isEmpty() ) devs << s; | 275 | if (! s.isEmpty() ) devs << s; |
272 | } | 276 | } |
273 | 277 | ||
274 | 278 | ||
275 | QString edited = modemdevice->currentText(); | 279 | QString edited = modemdevice->currentText(); |
276 | if ( !( edited ).isEmpty() ) { | 280 | if ( !( edited ).isEmpty() ) |
281 | { | ||
277 | edited.simplifyWhiteSpace(); | 282 | edited.simplifyWhiteSpace(); |
278 | if ( devs.contains( edited ) == 0 ) { | 283 | if ( devs.contains( edited ) == 0 ) |
284 | { | ||
279 | devs << edited; | 285 | devs << edited; |
280 | } | 286 | } |
281 | _pppdata->setModemDevice( edited ); | 287 | _pppdata->setModemDevice( edited ); |
282 | } | 288 | } |
283 | 289 | ||
284 | 290 | ||
285 | Config cfg("NetworkSetupPPP"); | 291 | Config cfg("NetworkSetupPPP"); |
286 | cfg.setGroup("Devices_General"); | 292 | cfg.setGroup("Devices_General"); |
287 | cfg.writeEntry("devices",devs,','); | 293 | cfg.writeEntry("devices",devs,','); |
288 | 294 | ||
289 | } | 295 | } |
290 | 296 | ||
291 | // void ModemWidget::speed_selection(int) { | 297 | // void ModemWidget::speed_selection(int) { |
292 | // _pppdata->setSpeed(baud_c->text(baud_c->currentItem())); | 298 | // _pppdata->setSpeed(baud_c->text(baud_c->currentItem())); |
293 | // } | 299 | // } |
294 | 300 | ||
@@ -313,186 +319,188 @@ ModemWidget::~ModemWidget() | |||
313 | 319 | ||
314 | // void ModemWidget::modemlockfilechanged(bool set) { | 320 | // void ModemWidget::modemlockfilechanged(bool set) { |
315 | // _pppdata->setModemLockFile(set); | 321 | // _pppdata->setModemLockFile(set); |
316 | // } | 322 | // } |
317 | 323 | ||
318 | 324 | ||
319 | // void ModemWidget::modemtimeoutchanged(int n) { | 325 | // void ModemWidget::modemtimeoutchanged(int n) { |
320 | // _pppdata->setModemTimeout(n); | 326 | // _pppdata->setModemTimeout(n); |
321 | // } | 327 | // } |
322 | 328 | ||
323 | 329 | ||
324 | 330 | ||
325 | bool ModemWidget::save() | 331 | bool ModemWidget::save() |
326 | { | 332 | { |
327 | //first check to make sure that the device name is unique! | 333 | //first check to make sure that the device name is unique! |
328 | if(modemname->text().isEmpty() || | 334 | if(modemname->text().isEmpty() || |
329 | !_pppdata->isUniqueDevname(modemname->text())) | 335 | !_pppdata->isUniqueDevname(modemname->text())) |
330 | return false; | 336 | return false; |
331 | 337 | ||
332 | qDebug("ModemWidget::save saving modem1 data"); | 338 | qDebug("ModemWidget::save saving modem1 data"); |
333 | _pppdata->setDevname( modemname->text() ); | 339 | _pppdata->setDevname( modemname->text() ); |
334 | _pppdata->setModemDevice( modemdevice->currentText() ); | 340 | _pppdata->setModemDevice( modemdevice->currentText() ); |
335 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | 341 | _pppdata->setFlowcontrol(flowcontrol->currentText()); |
336 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | 342 | _pppdata->setFlowcontrol(flowcontrol->currentText()); |
337 | _pppdata->setSpeed(baud_c->currentText()); | 343 | _pppdata->setSpeed(baud_c->currentText()); |
338 | _pppdata->setModemLockFile( modemlockfile->isChecked()); | 344 | _pppdata->setModemLockFile( modemlockfile->isChecked()); |
339 | _pppdata->setModemTimeout( modemtimeout->value() ); | 345 | _pppdata->setModemTimeout( modemtimeout->value() ); |
340 | return true; | 346 | return true; |
341 | 347 | ||
342 | } | 348 | } |
343 | 349 | ||
344 | ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, | 350 | ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, |
345 | const char *name) | 351 | const char *name) |
346 | : QWidget(parent, name), _pppdata(pd), _ifaceppp(ip) | 352 | : QWidget(parent, name), _pppdata(pd), _ifaceppp(ip) |
347 | { | 353 | { |
348 | QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); | 354 | QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); |
349 | 355 | ||
350 | 356 | ||
351 | waitfordt = new QCheckBox(tr("&Wait for dial tone before dialing"), this); | 357 | waitfordt = new QCheckBox(tr("&Wait for dial tone before dialing"), this); |
352 | waitfordt->setChecked(_pppdata->waitForDialTone()); | 358 | waitfordt->setChecked(_pppdata->waitForDialTone()); |
353 | // connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool))); | 359 | // connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool))); |
354 | l1->addWidget(waitfordt); | 360 | l1->addWidget(waitfordt); |
355 | QWhatsThis::add(waitfordt, | 361 | QWhatsThis::add(waitfordt, |
356 | tr("<p>Normally the modem waits for a dial tone\n" | 362 | tr("<p>Normally the modem waits for a dial tone\n" |
357 | "from your phone line, indicating that it can\n" | 363 | "from your phone line, indicating that it can\n" |
358 | "start to dial a number. If your modem does not\n" | 364 | "start to dial a number. If your modem does not\n" |
359 | "recognize this sound, or your local phone system\n" | 365 | "recognize this sound, or your local phone system\n" |
360 | "does not emit such a tone, uncheck this option\n" | 366 | "does not emit such a tone, uncheck this option\n" |
361 | "\n" | 367 | "\n" |
362 | "<b>Default:</b>: On")); | 368 | "<b>Default:</b>: On")); |
363 | 369 | ||
364 | QHBoxLayout *waitLayout = new QHBoxLayout( this ); | 370 | QHBoxLayout *waitLayout = new QHBoxLayout( this ); |
365 | QLabel *waitLabel = new QLabel( tr("Busy wait:"), this, "busyWait" ); | 371 | QLabel *waitLabel = new QLabel( tr("Busy wait:"), this, "busyWait" ); |
366 | busywait = new QSpinBox( 0, 300, 5, this, "busyWait" ); | 372 | busywait = new QSpinBox( 0, 300, 5, this, "busyWait" ); |
367 | // busywait = new KIntNumInput(_pppdata->busyWait(), this); | 373 | // busywait = new KIntNumInput(_pppdata->busyWait(), this); |
368 | // busywait->setLabel(tr("B&usy wait:")); | 374 | // busywait->setLabel(tr("B&usy wait:")); |
369 | // busywait->setRange(0, 300, 5, true); | 375 | // busywait->setRange(0, 300, 5, true); |
370 | busywait->setSuffix(tr(" sec")); | 376 | busywait->setSuffix(tr(" sec")); |
371 | // connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int))); | 377 | // connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int))); |
372 | waitLayout->addWidget(waitLabel); | 378 | waitLayout->addWidget(waitLabel); |
373 | waitLayout->addWidget(busywait); | 379 | waitLayout->addWidget(busywait); |
374 | l1->addLayout( waitLayout ); | 380 | l1->addLayout( waitLayout ); |
375 | 381 | ||
376 | QWhatsThis::add(busywait, | 382 | QWhatsThis::add(busywait, |
377 | tr("Specifies the number of seconds to wait before\n" | 383 | tr("Specifies the number of seconds to wait before\n" |
378 | "redial if all dialed numbers are busy. This is\n" | 384 | "redial if all dialed numbers are busy. This is\n" |
379 | "necessary because some modems get stuck if the\n" | 385 | "necessary because some modems get stuck if the\n" |
380 | "same number is busy too often.\n" | 386 | "same number is busy too often.\n" |
381 | "\n" | 387 | "\n" |
382 | "The default is 0 seconds, you should not change\n" | 388 | "The default is 0 seconds, you should not change\n" |
383 | "this unless you need to.")); | 389 | "this unless you need to.")); |
384 | 390 | ||
385 | l1->addSpacing(10); | 391 | l1->addSpacing(10); |
386 | 392 | ||
387 | QHBoxLayout *hbl = new QHBoxLayout; | 393 | QHBoxLayout *hbl = new QHBoxLayout; |
388 | hbl->setSpacing(2);//KDialog::spacingHint()); | 394 | hbl->setSpacing(2);//KDialog::spacingHint()); |
389 | 395 | ||
390 | QLabel *volumeLabel = new QLabel(tr("Modem &volume:"), this); | 396 | QLabel *volumeLabel = new QLabel(tr("Modem &volume:"), this); |
391 | hbl->addWidget(volumeLabel); | 397 | hbl->addWidget(volumeLabel); |
392 | volume = new QSlider(0, 2, 1, _pppdata->volume(), | 398 | volume = new QSlider(0, 2, 1, _pppdata->volume(), |
393 | QSlider::Horizontal, this); | 399 | QSlider::Horizontal, this); |
394 | volumeLabel->setBuddy(volume); | 400 | volumeLabel->setBuddy(volume); |
395 | volume->setTickmarks(QSlider::Below); | 401 | volume->setTickmarks(QSlider::Below); |
396 | hbl->addWidget(volume); | 402 | hbl->addWidget(volume); |
397 | 403 | ||
398 | l1->addLayout(hbl); | 404 | l1->addLayout(hbl); |
399 | 405 | ||
400 | // connect(volume, SIGNAL(valueChanged(int)), | 406 | // connect(volume, SIGNAL(valueChanged(int)), |
401 | // this, SLOT(volumeChanged(int))); | 407 | // this, SLOT(volumeChanged(int))); |
402 | QString tmp = tr("Most modems have a speaker which makes\n" | 408 | QString tmp = tr("Most modems have a speaker which makes\n" |
403 | "a lot of noise when dialing. Here you can\n" | 409 | "a lot of noise when dialing. Here you can\n" |
404 | "either turn this completely off or select a\n" | 410 | "either turn this completely off or select a\n" |
405 | "lower volume.\n" | 411 | "lower volume.\n" |
406 | "\n" | 412 | "\n" |
407 | "If this does not work for your modem,\n" | 413 | "If this does not work for your modem,\n" |
408 | "you must modify the modem volume command."); | 414 | "you must modify the modem volume command."); |
409 | 415 | ||
410 | QWhatsThis::add(volumeLabel,tmp); | 416 | QWhatsThis::add(volumeLabel,tmp); |
411 | QWhatsThis::add(volume, tmp); | 417 | QWhatsThis::add(volume, tmp); |
412 | 418 | ||
413 | l1->addSpacing(20); | 419 | l1->addSpacing(20); |
414 | 420 | ||
415 | #if 0 | 421 | #if 0 |
416 | chkbox1 = new QCheckBox(tr("Modem asserts CD line"), this); | 422 | chkbox1 = new QCheckBox(tr("Modem asserts CD line"), this); |
417 | chkbox1->setChecked(_pppdata->UseCDLine()); | 423 | chkbox1->setChecked(_pppdata->UseCDLine()); |
418 | connect(chkbox1,SIGNAL(toggled(bool)), | 424 | connect(chkbox1,SIGNAL(toggled(bool)), |
419 | this,SLOT(use_cdline_toggled(bool))); | 425 | this,SLOT(use_cdline_toggled(bool))); |
420 | l12->addWidget(chkbox1); | 426 | l12->addWidget(chkbox1); |
421 | l12->addStretch(1); | 427 | l12->addStretch(1); |
422 | l1->addStretch(1); | 428 | l1->addStretch(1); |
423 | QWhatsThis::add(chkbox1, | 429 | QWhatsThis::add(chkbox1, |
424 | tr("This controls how <i>kppp</i> detects that the modem\n" | 430 | tr("This controls how <i>kppp</i> detects that the modem\n" |
425 | "is not responding. Unless you are having\n" | 431 | "is not responding. Unless you are having\n" |
426 | "problems with this, do not modify this setting.\n" | 432 | "problems with this, do not modify this setting.\n" |
427 | "\n" | 433 | "\n" |
428 | "<b>Default</b>: Off")); | 434 | "<b>Default</b>: Off")); |
429 | #endif | 435 | #endif |
430 | 436 | ||
431 | modemcmds = new QPushButton(tr("Mod&em Commands..."), this); | 437 | modemcmds = new QPushButton(tr("Mod&em Commands..."), this); |
432 | QWhatsThis::add(modemcmds, | 438 | QWhatsThis::add(modemcmds, |
433 | tr("Allows you to change the AT command for\n" | 439 | tr("Allows you to change the AT command for\n" |
434 | "your modem.")); | 440 | "your modem.")); |
435 | 441 | ||
436 | modeminfo_button = new QPushButton(tr("&Query Modem..."), this); | 442 | modeminfo_button = new QPushButton(tr("&Query Modem..."), this); |
437 | QWhatsThis::add(modeminfo_button, | 443 | QWhatsThis::add(modeminfo_button, |
438 | tr("Most modems support the ATI command set to\n" | 444 | tr("Most modems support the ATI command set to\n" |
439 | "find out vendor and revision of your modem.\n" | 445 | "find out vendor and revision of your modem.\n" |
440 | "\n" | 446 | "\n" |
441 | "Press this button to query your modem for\n" | 447 | "Press this button to query your modem for\n" |
442 | "this information. It can be useful to help\n" | 448 | "this information. It can be useful to help\n" |
443 | "you setup the modem")); | 449 | "you setup the modem")); |
444 | 450 | ||
445 | // terminal_button = new QPushButton(tr("&Terminal..."), this); | 451 | // terminal_button = new QPushButton(tr("&Terminal..."), this); |
446 | // QWhatsThis::add(terminal_button, | 452 | // QWhatsThis::add(terminal_button, |
447 | // tr("Opens the built-in terminal program. You\n" | 453 | // tr("Opens the built-in terminal program. You\n" |
448 | // "can use this if you want to play around\n" | 454 | // "can use this if you want to play around\n" |
449 | // "with your modem's AT command set")); | 455 | // "with your modem's AT command set")); |
450 | 456 | ||
451 | QHBoxLayout *hbox = new QHBoxLayout(); | 457 | QHBoxLayout *hbox = new QHBoxLayout(); |
452 | l1->addLayout(hbox); | 458 | l1->addLayout(hbox); |
453 | hbox->addStretch(1); | 459 | hbox->addStretch(1); |
454 | QVBoxLayout *vbox = new QVBoxLayout(); | 460 | QVBoxLayout *vbox = new QVBoxLayout(); |
455 | hbox->addLayout(vbox); | 461 | hbox->addLayout(vbox); |
456 | 462 | ||
457 | vbox->addWidget(modemcmds); | 463 | vbox->addWidget(modemcmds); |
458 | vbox->addWidget(modeminfo_button); | 464 | vbox->addWidget(modeminfo_button); |
459 | // vbox->addWidget(terminal_button); | 465 | // vbox->addWidget(terminal_button); |
460 | 466 | ||
461 | hbox->addStretch(1); | 467 | hbox->addStretch(1); |
462 | l1->addStretch(1); | 468 | l1->addStretch(1); |
463 | 469 | ||
464 | connect(modemcmds, SIGNAL(clicked()), | 470 | connect(modemcmds, SIGNAL(clicked()), |
465 | SLOT(modemcmdsbutton())); | 471 | SLOT(modemcmdsbutton())); |
466 | connect(modeminfo_button, SIGNAL(clicked()), | 472 | connect(modeminfo_button, SIGNAL(clicked()), |
467 | SLOT(query_modem())); | 473 | SLOT(query_modem())); |
468 | // connect(terminal_button, SIGNAL(clicked()), | 474 | // connect(terminal_button, SIGNAL(clicked()), |
469 | // SLOT(terminal())); | 475 | // SLOT(terminal())); |
470 | } | 476 | } |
471 | 477 | ||
472 | 478 | ||
473 | void ModemWidget2::modemcmdsbutton() { | 479 | void ModemWidget2::modemcmdsbutton() |
474 | ModemCommands mc(_ifaceppp->data(), this, "commands" , true, Qt::WStyle_ContextHelp); | 480 | { |
475 | mc.showMaximized(); | 481 | ModemCommands mc(_ifaceppp->data(), this, "commands" , true, Qt::WStyle_ContextHelp); |
476 | mc.exec(); | 482 | |
483 | QPEApplication::execDialog( &mc ); | ||
477 | } | 484 | } |
478 | 485 | ||
479 | 486 | ||
480 | void ModemWidget2::query_modem() { | 487 | void ModemWidget2::query_modem() |
481 | ModemTransfer mt(_ifaceppp->modem(), this); | 488 | { |
482 | mt.exec(); | 489 | ModemTransfer mt(_ifaceppp->modem(), this); |
490 | mt.exec(); | ||
483 | } | 491 | } |
484 | 492 | ||
485 | 493 | ||
486 | // void ModemWidget2::terminal() { | 494 | // void ModemWidget2::terminal() { |
487 | // MiniTerm terminal(NULL,NULL); | 495 | // MiniTerm terminal(NULL,NULL); |
488 | // terminal.exec(); | 496 | // terminal.exec(); |
489 | // } | 497 | // } |
490 | 498 | ||
491 | 499 | ||
492 | // #if 0 | 500 | // #if 0 |
493 | // void ModemWidget2::use_cdline_toggled(bool on) { | 501 | // void ModemWidget2::use_cdline_toggled(bool on) { |
494 | // _pppdata->setUseCDLine(on); | 502 | // _pppdata->setUseCDLine(on); |
495 | // } | 503 | // } |
496 | // #endif | 504 | // #endif |
497 | 505 | ||
498 | // void ModemWidget2::waitfordtchanged(bool b) { | 506 | // void ModemWidget2::waitfordtchanged(bool b) { |