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