-rw-r--r-- | noncore/settings/networksettings/ppp/devices.cpp | 7 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/general.cpp | 34 | ||||
-rw-r--r-- | noncore/settings/networksettings/ppp/general.h | 17 |
3 files changed, 55 insertions, 3 deletions
diff --git a/noncore/settings/networksettings/ppp/devices.cpp b/noncore/settings/networksettings/ppp/devices.cpp index e2c67d8..c658227 100644 --- a/noncore/settings/networksettings/ppp/devices.cpp +++ b/noncore/settings/networksettings/ppp/devices.cpp | |||
@@ -6,214 +6,219 @@ | |||
6 | * Copyright (C) 1997 Bernd Johannes Wuebben | 6 | * Copyright (C) 1997 Bernd Johannes Wuebben |
7 | * wuebben@math.cornell.edu | 7 | * wuebben@math.cornell.edu |
8 | * | 8 | * |
9 | * based on EzPPP: | 9 | * based on EzPPP: |
10 | * Copyright (C) 1997 Jay Painter | 10 | * Copyright (C) 1997 Jay Painter |
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 "interfaceppp.h" | 27 | #include "interfaceppp.h" |
28 | #include "devices.h" | 28 | #include "devices.h" |
29 | #include "authwidget.h" | 29 | #include "authwidget.h" |
30 | #include "pppdata.h" | 30 | #include "pppdata.h" |
31 | #include "edit.h" | 31 | #include "edit.h" |
32 | #include "general.h" | 32 | #include "general.h" |
33 | 33 | ||
34 | /* OPIE */ | 34 | /* OPIE */ |
35 | #include <opie2/odebug.h> | 35 | #include <opie2/odebug.h> |
36 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
37 | using namespace Opie::Core; | 37 | using namespace Opie::Core; |
38 | 38 | ||
39 | /* QT */ | 39 | /* QT */ |
40 | #include <qdir.h> | 40 | #include <qdir.h> |
41 | #include <qlayout.h> | 41 | #include <qlayout.h> |
42 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
43 | #include <qtabdialog.h> | 43 | #include <qtabdialog.h> |
44 | #include <qwhatsthis.h> | 44 | #include <qwhatsthis.h> |
45 | #include <qmessagebox.h> | 45 | #include <qmessagebox.h> |
46 | #include <qapplication.h> | 46 | #include <qapplication.h> |
47 | #include <qbuttongroup.h> | 47 | #include <qbuttongroup.h> |
48 | #include <qmessagebox.h> | 48 | #include <qmessagebox.h> |
49 | #include <qvgroupbox.h> | 49 | #include <qvgroupbox.h> |
50 | 50 | ||
51 | /* STD */ | 51 | /* STD */ |
52 | #include <stdlib.h> | 52 | #include <stdlib.h> |
53 | 53 | ||
54 | 54 | ||
55 | void parseargs(char* buf, char** args); | 55 | void parseargs(char* buf, char** args); |
56 | 56 | ||
57 | DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *name, WFlags f ) | 57 | DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *name, WFlags f ) |
58 | : ChooserWidget(ip->data(), parent, name, f) | 58 | : ChooserWidget(ip->data(), parent, name, f) |
59 | { | 59 | { |
60 | _ifaceppp = ip; | 60 | _ifaceppp = ip; |
61 | QWhatsThis::add(edit_b, tr("Allows you to modify the selected device")); | 61 | QWhatsThis::add(edit_b, tr("Allows you to modify the selected device")); |
62 | QWhatsThis::add(new_b, tr("Create a new device") ); | 62 | QWhatsThis::add(new_b, tr("Create a new device") ); |
63 | 63 | ||
64 | QWhatsThis::add(copy_b, | 64 | QWhatsThis::add(copy_b, |
65 | tr("Makes a copy of the selected device. All\n" | 65 | tr("Makes a copy of the selected device. All\n" |
66 | "settings of the selected device are copied\n" | 66 | "settings of the selected device are copied\n" |
67 | "to a new device, that you can modify to fit your\n" | 67 | "to a new device, that you can modify to fit your\n" |
68 | "needs")); | 68 | "needs")); |
69 | QWhatsThis::add(delete_b, | 69 | QWhatsThis::add(delete_b, |
70 | tr("<p>Deletes the selected device\n\n" | 70 | tr("<p>Deletes the selected device\n\n" |
71 | "<font color=\"red\"><b>Use with care!</b></font>")); | 71 | "<font color=\"red\"><b>Use with care!</b></font>")); |
72 | 72 | ||
73 | copy_b->setEnabled( false ); //FIXME | 73 | copy_b->setEnabled( false ); //FIXME |
74 | // delete_b->setEnabled( false ); //FIXME | 74 | // delete_b->setEnabled( false ); //FIXME |
75 | 75 | ||
76 | QStringList tmp = _pppdata->getDevicesNamesList(); | 76 | QStringList tmp = _pppdata->getDevicesNamesList(); |
77 | odebug << "DevicesWidget::DevicesWidget got devices " << tmp.join("--").latin1() << "" << oendl; | 77 | odebug << "DevicesWidget::DevicesWidget got devices " << tmp.join("--").latin1() << "" << oendl; |
78 | listListbox->insertStringList(tmp); | 78 | listListbox->insertStringList(tmp); |
79 | 79 | ||
80 | for (uint i = 0; i < listListbox->count(); i++){ | 80 | for (uint i = 0; i < listListbox->count(); i++){ |
81 | odebug << "listListbox->text(i) " << listListbox->text(i).latin1() << " == _pppdata->devname() " << _pppdata->devname().latin1() << "" << oendl; | 81 | odebug << "listListbox->text(i) " << listListbox->text(i).latin1() << " == _pppdata->devname() " << _pppdata->devname().latin1() << "" << oendl; |
82 | if ( listListbox->text(i) == _pppdata->devname() ) | 82 | if ( listListbox->text(i) == _pppdata->devname() ) |
83 | listListbox->setCurrentItem( i ); | 83 | listListbox->setCurrentItem( i ); |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
87 | 87 | ||
88 | 88 | ||
89 | void DevicesWidget::slotListBoxSelect(int idx) { | 89 | void DevicesWidget::slotListBoxSelect(int idx) { |
90 | _pppdata->setDevice( listListbox->text(idx) ); | 90 | _pppdata->setDevice( listListbox->text(idx) ); |
91 | delete_b->setEnabled((bool)(idx != -1)); | 91 | delete_b->setEnabled((bool)(idx != -1)); |
92 | edit_b->setEnabled((bool)(idx != -1)); | 92 | edit_b->setEnabled((bool)(idx != -1)); |
93 | //FIXME copy_b->setEnabled((bool)(idx != -1)); | 93 | //FIXME copy_b->setEnabled((bool)(idx != -1)); |
94 | } | 94 | } |
95 | 95 | ||
96 | void DevicesWidget::edit() { | 96 | void DevicesWidget::edit() { |
97 | _pppdata->setDevice(listListbox->text(listListbox->currentItem())); | 97 | _pppdata->setDevice(listListbox->text(listListbox->currentItem())); |
98 | 98 | ||
99 | int result = doTab(); | 99 | int result = doTab(); |
100 | 100 | ||
101 | if(result == QDialog::Accepted) { | 101 | if(result == QDialog::Accepted) { |
102 | listListbox->changeItem(_pppdata->devname(),listListbox->currentItem()); | 102 | listListbox->changeItem(_pppdata->devname(),listListbox->currentItem()); |
103 | _pppdata->save(); | 103 | _pppdata->save(); |
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | 107 | ||
108 | void DevicesWidget::create() { | 108 | void DevicesWidget::create() { |
109 | 109 | ||
110 | // if(listListbox->count() == MAX_ACCOUNTS) { | 110 | // if(listListbox->count() == MAX_ACCOUNTS) { |
111 | // QMessageBox::information(this, "sorry", | 111 | // QMessageBox::information(this, "sorry", |
112 | // tr("Maximum number of accounts reached.")); | 112 | // tr("Maximum number of accounts reached.")); |
113 | // return; | 113 | // return; |
114 | // } | 114 | // } |
115 | 115 | ||
116 | int result; | 116 | int result; |
117 | if (_pppdata->newdevice() == -1){ | 117 | if (_pppdata->newdevice() == -1){ |
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | result = doTab(); | 120 | result = doTab(); |
121 | 121 | ||
122 | if(result == QDialog::Accepted) { | 122 | if(result == QDialog::Accepted) { |
123 | listListbox->insertItem(_pppdata->devname()); | 123 | listListbox->insertItem(_pppdata->devname()); |
124 | listListbox->setSelected(listListbox->findItem(_pppdata->devname()),true ); | 124 | listListbox->setSelected(listListbox->findItem(_pppdata->devname()),true ); |
125 | 125 | ||
126 | _pppdata->save(); | 126 | _pppdata->save(); |
127 | } else | 127 | } else |
128 | _pppdata->deleteDevice(); | 128 | _pppdata->deleteDevice(); |
129 | } | 129 | } |
130 | 130 | ||
131 | 131 | ||
132 | void DevicesWidget::copy() { | 132 | void DevicesWidget::copy() { |
133 | // if(listListbox->count() == MAX_ACCOUNTS) { | 133 | // if(listListbox->count() == MAX_ACCOUNTS) { |
134 | // QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached.")); | 134 | // QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached.")); |
135 | // return; | 135 | // return; |
136 | // } | 136 | // } |
137 | 137 | ||
138 | if(listListbox->currentItem()<0) { | 138 | if(listListbox->currentItem()<0) { |
139 | QMessageBox::information(this, "sorry", tr("No devices selected.")); | 139 | QMessageBox::information(this, "sorry", tr("No devices selected.")); |
140 | return; | 140 | return; |
141 | } | 141 | } |
142 | 142 | ||
143 | _pppdata->copydevice(listListbox->currentText()); | 143 | _pppdata->copydevice(listListbox->currentText()); |
144 | 144 | ||
145 | listListbox->insertItem(_pppdata->devname()); | 145 | listListbox->insertItem(_pppdata->devname()); |
146 | _pppdata->save(); | 146 | _pppdata->save(); |
147 | } | 147 | } |
148 | 148 | ||
149 | 149 | ||
150 | void DevicesWidget::remove() { | 150 | void DevicesWidget::remove() { |
151 | 151 | ||
152 | QString s = tr("Are you sure you want to delete\nthe device \"%1\"?") | 152 | QString s = tr("Are you sure you want to delete\nthe device \"%1\"?") |
153 | .arg(listListbox->text(listListbox->currentItem())); | 153 | .arg(listListbox->text(listListbox->currentItem())); |
154 | 154 | ||
155 | if(QMessageBox::warning(this,tr("Confirm"),s, | 155 | if(QMessageBox::warning(this,tr("Confirm"),s, |
156 | QMessageBox::Yes,QMessageBox::No | 156 | QMessageBox::Yes,QMessageBox::No |
157 | ) != QMessageBox::Yes) | 157 | ) != QMessageBox::Yes) |
158 | return; | 158 | return; |
159 | 159 | ||
160 | if(_pppdata->deleteDevice(listListbox->text(listListbox->currentItem()))) | 160 | if(_pppdata->deleteDevice(listListbox->text(listListbox->currentItem()))) |
161 | listListbox->removeItem(listListbox->currentItem()); | 161 | listListbox->removeItem(listListbox->currentItem()); |
162 | 162 | ||
163 | 163 | ||
164 | // _pppdata->save(); | 164 | // _pppdata->save(); |
165 | 165 | ||
166 | 166 | ||
167 | slotListBoxSelect(listListbox->currentItem()); | 167 | slotListBoxSelect(listListbox->currentItem()); |
168 | 168 | ||
169 | } | 169 | } |
170 | 170 | ||
171 | 171 | ||
172 | int DevicesWidget::doTab(){ | 172 | int DevicesWidget::doTab(){ |
173 | QDialog *dlg = new QDialog( 0, "newDevice", true, Qt::WStyle_ContextHelp ); | 173 | QDialog *dlg = new QDialog( 0, "newDevice", true, Qt::WStyle_ContextHelp ); |
174 | QVBoxLayout *layout = new QVBoxLayout( dlg ); | 174 | QVBoxLayout *layout = new QVBoxLayout( dlg ); |
175 | layout->setSpacing( 0 ); | 175 | layout->setSpacing( 0 ); |
176 | layout->setMargin( 1 ); | 176 | layout->setMargin( 1 ); |
177 | 177 | ||
178 | QTabWidget *tabWindow = new QTabWidget( dlg, "tabWindow" ); | 178 | QTabWidget *tabWindow = new QTabWidget( dlg, "tabWindow" ); |
179 | layout->addWidget( tabWindow ); | 179 | layout->addWidget( tabWindow ); |
180 | 180 | ||
181 | bool isnew; | 181 | bool isnew; |
182 | 182 | ||
183 | if(_pppdata->devname().isEmpty()) { | 183 | if(_pppdata->devname().isEmpty()) { |
184 | dlg->setCaption(tr("New Device")); | 184 | dlg->setCaption(tr("New Device")); |
185 | isnew = true; | 185 | isnew = true; |
186 | } else { | 186 | } else { |
187 | QString tit = tr("Edit Device: "); | 187 | QString tit = tr("Edit Device: "); |
188 | tit += _pppdata->devname(); | 188 | tit += _pppdata->devname(); |
189 | dlg->setCaption(tit); | 189 | dlg->setCaption(tit); |
190 | isnew = false; | 190 | isnew = false; |
191 | } | 191 | } |
192 | 192 | ||
193 | modem1 = new ModemWidget( _pppdata, tabWindow, "modem1" ); | 193 | modem1 = new ModemWidget( _pppdata, tabWindow, "modem1" ); |
194 | tabWindow->addTab( modem1, tr("&Device") ); | 194 | tabWindow->addTab( modem1, tr("&Device") ); |
195 | modem2 = new ModemWidget2( _pppdata, _ifaceppp, tabWindow, "modem2" ); | 195 | modem2 = new ModemWidget2( _pppdata, _ifaceppp, tabWindow, "modem2" ); |
196 | tabWindow->addTab( modem2, tr("&Modem") ); | 196 | tabWindow->addTab( modem2, tr("&Modem") ); |
197 | 197 | ||
198 | connect(modem2, SIGNAL(sig_beforeQueryModem()), | ||
199 | modem1, SLOT(slotBeforeModemQuery())); | ||
200 | connect(modem2, SIGNAL(sig_afterQueryModem()), | ||
201 | modem1, SLOT(slotAfterModemQuery())); | ||
202 | |||
198 | int result = 0; | 203 | int result = 0; |
199 | bool ok = false; | 204 | bool ok = false; |
200 | 205 | ||
201 | while (!ok){ | 206 | while (!ok){ |
202 | result = QPEApplication::execDialog( dlg ); | 207 | result = QPEApplication::execDialog( dlg ); |
203 | ok = true; | 208 | ok = true; |
204 | 209 | ||
205 | if(result == QDialog::Accepted) { | 210 | if(result == QDialog::Accepted) { |
206 | if (!modem1->save()){ | 211 | if (!modem1->save()){ |
207 | QMessageBox::critical(this, "error", tr( "You must enter a unique device name")); | 212 | QMessageBox::critical(this, tr("Error"), tr( "You must enter a unique device name")); |
208 | ok = false; | 213 | ok = false; |
209 | }else{ | 214 | }else{ |
210 | modem2->save(); | 215 | modem2->save(); |
211 | } | 216 | } |
212 | } | 217 | } |
213 | } | 218 | } |
214 | 219 | ||
215 | delete dlg; | 220 | delete dlg; |
216 | 221 | ||
217 | return result; | 222 | return result; |
218 | } | 223 | } |
219 | 224 | ||
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp index 40ba19b..5e2a04f 100644 --- a/noncore/settings/networksettings/ppp/general.cpp +++ b/noncore/settings/networksettings/ppp/general.cpp | |||
@@ -97,432 +97,462 @@ ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) | |||
97 | "emulation (most cards under Linux support this), you\n" | 97 | "emulation (most cards under Linux support this), you\n" |
98 | "should select one of the /dev/ttyIx devices."); | 98 | "should select one of the /dev/ttyIx devices."); |
99 | 99 | ||
100 | QWhatsThis::add(label1,tmp); | 100 | QWhatsThis::add(label1,tmp); |
101 | QWhatsThis::add(modemdevice,tmp); | 101 | QWhatsThis::add(modemdevice,tmp); |
102 | 102 | ||
103 | 103 | ||
104 | label1 = new QLabel(tr("&Flow control:"), this); | 104 | label1 = new QLabel(tr("&Flow control:"), this); |
105 | tl->addWidget(label1, 2, 0); | 105 | tl->addWidget(label1, 2, 0); |
106 | 106 | ||
107 | flowcontrol = new QComboBox(false, this); | 107 | flowcontrol = new QComboBox(false, this); |
108 | label1->setBuddy(flowcontrol); | 108 | label1->setBuddy(flowcontrol); |
109 | flowcontrol->insertItem(tr("Hardware [CRTSCTS]")); | 109 | flowcontrol->insertItem(tr("Hardware [CRTSCTS]")); |
110 | flowcontrol->insertItem(tr("Software [XON/XOFF]")); | 110 | flowcontrol->insertItem(tr("Software [XON/XOFF]")); |
111 | flowcontrol->insertItem(tr("None")); | 111 | flowcontrol->insertItem(tr("None")); |
112 | tl->addWidget(flowcontrol, 2, 1); | 112 | tl->addWidget(flowcontrol, 2, 1); |
113 | // connect(flowcontrol, SIGNAL(activated(int)), | 113 | // connect(flowcontrol, SIGNAL(activated(int)), |
114 | // SLOT(setflowcontrol(int))); | 114 | // SLOT(setflowcontrol(int))); |
115 | 115 | ||
116 | tmp = tr("<p>Specifies how the serial port and modem\n" | 116 | tmp = tr("<p>Specifies how the serial port and modem\n" |
117 | "communicate. You should not change this unless\n" | 117 | "communicate. You should not change this unless\n" |
118 | "you know what you are doing.\n" | 118 | "you know what you are doing.\n" |
119 | "\n" | 119 | "\n" |
120 | "<b>Default</b>: CRTSCTS"); | 120 | "<b>Default</b>: CRTSCTS"); |
121 | 121 | ||
122 | QWhatsThis::add(label1,tmp); | 122 | QWhatsThis::add(label1,tmp); |
123 | QWhatsThis::add(flowcontrol,tmp); | 123 | QWhatsThis::add(flowcontrol,tmp); |
124 | 124 | ||
125 | QLabel *labelenter = new QLabel(tr("&Line termination:"), this); | 125 | QLabel *labelenter = new QLabel(tr("&Line termination:"), this); |
126 | tl->addWidget(labelenter, 3, 0); | 126 | tl->addWidget(labelenter, 3, 0); |
127 | 127 | ||
128 | enter = new QComboBox(false, this); | 128 | enter = new QComboBox(false, this); |
129 | labelenter->setBuddy(enter); | 129 | labelenter->setBuddy(enter); |
130 | enter->insertItem("CR"); | 130 | enter->insertItem("CR"); |
131 | enter->insertItem("LF"); | 131 | enter->insertItem("LF"); |
132 | enter->insertItem("CR/LF"); | 132 | enter->insertItem("CR/LF"); |
133 | tl->addWidget(enter, 3, 1); | 133 | tl->addWidget(enter, 3, 1); |
134 | // connect(enter, SIGNAL(activated(int)), SLOT(setenter(int))); | 134 | // connect(enter, SIGNAL(activated(int)), SLOT(setenter(int))); |
135 | tmp = tr("<p>Specifies how AT commands are sent to your\n" | 135 | tmp = tr("<p>Specifies how AT commands are sent to your\n" |
136 | "modem. Most modems will work fine with the\n" | 136 | "modem. Most modems will work fine with the\n" |
137 | "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" |
138 | "to the init string, you should try different\n" | 138 | "to the init string, you should try different\n" |
139 | "settings here\n" | 139 | "settings here\n" |
140 | "\n" | 140 | "\n" |
141 | "<b>Default</b>: CR/LF"); | 141 | "<b>Default</b>: CR/LF"); |
142 | 142 | ||
143 | QWhatsThis::add(labelenter,tmp); | 143 | QWhatsThis::add(labelenter,tmp); |
144 | QWhatsThis::add(enter, tmp); | 144 | QWhatsThis::add(enter, tmp); |
145 | 145 | ||
146 | QLabel *baud_label = new QLabel(tr("Co&nnection speed:"), this); | 146 | QLabel *baud_label = new QLabel(tr("Co&nnection speed:"), this); |
147 | tl->addWidget(baud_label, 4, 0); | 147 | tl->addWidget(baud_label, 4, 0); |
148 | baud_c = new QComboBox(this); | 148 | baud_c = new QComboBox(this); |
149 | baud_label->setBuddy(baud_c); | 149 | baud_label->setBuddy(baud_c); |
150 | 150 | ||
151 | static const char *baudrates[] = | 151 | static const char *baudrates[] = |
152 | { | 152 | { |
153 | 153 | ||
154 | #ifdef B460800 | 154 | #ifdef B460800 |
155 | "460800", | 155 | "460800", |
156 | #endif | 156 | #endif |
157 | 157 | ||
158 | #ifdef B230400 | 158 | #ifdef B230400 |
159 | "230400", | 159 | "230400", |
160 | #endif | 160 | #endif |
161 | 161 | ||
162 | #ifdef B115200 | 162 | #ifdef B115200 |
163 | "115200", | 163 | "115200", |
164 | #endif | 164 | #endif |
165 | 165 | ||
166 | #ifdef B57600 | 166 | #ifdef B57600 |
167 | "57600", | 167 | "57600", |
168 | #endif | 168 | #endif |
169 | 169 | ||
170 | "38400", | 170 | "38400", |
171 | "19200", | 171 | "19200", |
172 | "9600", | 172 | "9600", |
173 | "2400", | 173 | "2400", |
174 | 0 | 174 | 0 |
175 | }; | 175 | }; |
176 | 176 | ||
177 | for(k = 0; baudrates[k]; k++) | 177 | for(k = 0; baudrates[k]; k++) |
178 | baud_c->insertItem(baudrates[k]); | 178 | baud_c->insertItem(baudrates[k]); |
179 | 179 | ||
180 | baud_c->setCurrentItem(3); | 180 | baud_c->setCurrentItem(3); |
181 | // connect(baud_c, SIGNAL(activated(int)), | 181 | // connect(baud_c, SIGNAL(activated(int)), |
182 | // this, SLOT(speed_selection(int))); | 182 | // this, SLOT(speed_selection(int))); |
183 | tl->addWidget(baud_c, 4, 1); | 183 | tl->addWidget(baud_c, 4, 1); |
184 | 184 | ||
185 | tmp = tr("Specifies the speed your modem and the serial\n" | 185 | tmp = tr("Specifies the speed your modem and the serial\n" |
186 | "port talk to each other. You should begin with\n" | 186 | "port talk to each other. You should begin with\n" |
187 | "the default of 38400 bits/sec. If everything\n" | 187 | "the default of 38400 bits/sec. If everything\n" |
188 | "works you can try to increase this value, but to\n" | 188 | "works you can try to increase this value, but to\n" |
189 | "no more than 115200 bits/sec (unless you know\n" | 189 | "no more than 115200 bits/sec (unless you know\n" |
190 | "that your serial port supports higher speeds)."); | 190 | "that your serial port supports higher speeds)."); |
191 | 191 | ||
192 | QWhatsThis::add(baud_label,tmp); | 192 | QWhatsThis::add(baud_label,tmp); |
193 | QWhatsThis::add(baud_c,tmp); | 193 | QWhatsThis::add(baud_c,tmp); |
194 | 194 | ||
195 | for(int i=0; i <= enter->count()-1; i++) | 195 | for(int i=0; i <= enter->count()-1; i++) |
196 | { | 196 | { |
197 | if(_pppdata->enter() == enter->text(i)) | 197 | if(_pppdata->enter() == enter->text(i)) |
198 | enter->setCurrentItem(i); | 198 | enter->setCurrentItem(i); |
199 | } | 199 | } |
200 | 200 | ||
201 | tl->addRowSpacing(5, 10); | 201 | tl->addRowSpacing(5, 10); |
202 | 202 | ||
203 | //Modem Lock File | 203 | //Modem Lock File |
204 | modemlockfile = new QCheckBox(tr("&Use lock file"), this); | 204 | modemlockfile = new QCheckBox(tr("&Use lock file"), this); |
205 | 205 | ||
206 | modemlockfile->setChecked(_pppdata->modemLockFile()); | 206 | modemlockfile->setChecked(_pppdata->modemLockFile()); |
207 | // connect(modemlockfile, SIGNAL(toggled(bool)), | 207 | // connect(modemlockfile, SIGNAL(toggled(bool)), |
208 | // SLOT(modemlockfilechanged(bool))); | 208 | // SLOT(modemlockfilechanged(bool))); |
209 | tl->addMultiCellWidget(modemlockfile, 6, 6, 0, 1); | 209 | tl->addMultiCellWidget(modemlockfile, 6, 6, 0, 1); |
210 | // l12->addStretch(1); | 210 | // l12->addStretch(1); |
211 | QWhatsThis::add(modemlockfile, | 211 | QWhatsThis::add(modemlockfile, |
212 | tr("<p>To prevent other programs from accessing the\n" | 212 | tr("<p>To prevent other programs from accessing the\n" |
213 | "modem while a connection is established, a\n" | 213 | "modem while a connection is established, a\n" |
214 | "file can be created to indicate that the modem\n" | 214 | "file can be created to indicate that the modem\n" |
215 | "is in use. On Linux an example file would be\n" | 215 | "is in use. On Linux an example file would be\n" |
216 | "<tt>/var/lock/LCK..ttyS1</tt>\n" | 216 | "<tt>/var/lock/LCK..ttyS1</tt>\n" |
217 | "Here you can select whether this locking will\n" | 217 | "Here you can select whether this locking will\n" |
218 | "be done.\n" | 218 | "be done.\n" |
219 | "\n" | 219 | "\n" |
220 | "<b>Default</b>: On")); | 220 | "<b>Default</b>: On")); |
221 | 221 | ||
222 | // Modem Timeout Line Edit Box | 222 | // Modem Timeout Line Edit Box |
223 | QHBoxLayout *timeoutLayout = new QHBoxLayout( this ); | 223 | QHBoxLayout *timeoutLayout = new QHBoxLayout( this ); |
224 | QLabel *timeoutlabel = new QLabel( tr("Modem timeout:") ,this, "timeout" ); | 224 | QLabel *timeoutlabel = new QLabel( tr("Modem timeout:") ,this, "timeout" ); |
225 | modemtimeout = new QSpinBox( 1, 120, 1, this, "modemTimeout" ); | 225 | modemtimeout = new QSpinBox( 1, 120, 1, this, "modemTimeout" ); |
226 | // modemtimeout = new KIntNumInput(_pppdata->modemTimeout(), this); | 226 | // modemtimeout = new KIntNumInput(_pppdata->modemTimeout(), this); |
227 | // modemtimeout->setLabel(tr("Modem &timeout:")); | 227 | // modemtimeout->setLabel(tr("Modem &timeout:")); |
228 | // modemtimeout->setRange(1, 120, 1); | 228 | // modemtimeout->setRange(1, 120, 1); |
229 | modemtimeout->setSuffix(tr(" sec")); | 229 | modemtimeout->setSuffix(tr(" sec")); |
230 | modemtimeout->setValue( _pppdata->modemTimeout() ); | 230 | modemtimeout->setValue( _pppdata->modemTimeout() ); |
231 | // connect(modemtimeout, SIGNAL(valueChanged(int)), | 231 | // connect(modemtimeout, SIGNAL(valueChanged(int)), |
232 | // SLOT(modemtimeoutchanged(int))); | 232 | // SLOT(modemtimeoutchanged(int))); |
233 | timeoutLayout->addWidget(timeoutlabel); | 233 | timeoutLayout->addWidget(timeoutlabel); |
234 | timeoutLayout->addWidget(modemtimeout); | 234 | timeoutLayout->addWidget(modemtimeout); |
235 | tl->addMultiCellLayout(timeoutLayout, 7, 7, 0, 1); | 235 | tl->addMultiCellLayout(timeoutLayout, 7, 7, 0, 1); |
236 | 236 | ||
237 | QWhatsThis::add(modemtimeout, | 237 | QWhatsThis::add(modemtimeout, |
238 | tr("This specifies how long <i>kppp</i> waits for a\n" | 238 | tr("This specifies how long <i>kppp</i> waits for a\n" |
239 | "<i>CONNECT</i> response from your modem. The\n" | 239 | "<i>CONNECT</i> response from your modem. The\n" |
240 | "recommended value is 30 seconds.")); | 240 | "recommended value is 30 seconds.")); |
241 | 241 | ||
242 | //set stuff from gpppdata | 242 | //set stuff from gpppdata |
243 | for(int i=0; i <= enter->count()-1; i++) | 243 | for(int i=0; i <= enter->count()-1; i++) |
244 | { | 244 | { |
245 | if(_pppdata->enter() == enter->text(i)) | 245 | if(_pppdata->enter() == enter->text(i)) |
246 | enter->setCurrentItem(i); | 246 | enter->setCurrentItem(i); |
247 | } | 247 | } |
248 | 248 | ||
249 | for(int i=0; i <= modemdevice->count()-1; i++) | 249 | for(int i=0; i <= modemdevice->count()-1; i++) |
250 | { | 250 | { |
251 | if(_pppdata->modemDevice() == modemdevice->text(i)) | 251 | if(_pppdata->modemDevice() == modemdevice->text(i)) |
252 | modemdevice->setCurrentItem(i); | 252 | modemdevice->setCurrentItem(i); |
253 | } | 253 | } |
254 | 254 | ||
255 | for(int i=0; i <= flowcontrol->count()-1; i++) | 255 | for(int i=0; i <= flowcontrol->count()-1; i++) |
256 | { | 256 | { |
257 | if(_pppdata->flowcontrol() == flowcontrol->text(i)) | 257 | if(_pppdata->flowcontrol() == flowcontrol->text(i)) |
258 | flowcontrol->setCurrentItem(i); | 258 | flowcontrol->setCurrentItem(i); |
259 | } | 259 | } |
260 | 260 | ||
261 | //set the modem speed | 261 | //set the modem speed |
262 | for(int i=0; i < baud_c->count(); i++) | 262 | for(int i=0; i < baud_c->count(); i++) |
263 | if(baud_c->text(i) == _pppdata->speed()) | 263 | if(baud_c->text(i) == _pppdata->speed()) |
264 | baud_c->setCurrentItem(i); | 264 | baud_c->setCurrentItem(i); |
265 | 265 | ||
266 | tl->setRowStretch(1, 1); | 266 | tl->setRowStretch(1, 1); |
267 | } | 267 | } |
268 | 268 | ||
269 | ModemWidget::~ModemWidget() | 269 | ModemWidget::~ModemWidget() |
270 | { | 270 | { |
271 | QStringList devs; | 271 | QStringList devs; |
272 | 272 | ||
273 | for (int i=0;i<modemdevice->count();i++) | 273 | for (int i=0;i<modemdevice->count();i++) |
274 | { | 274 | { |
275 | QString s = modemdevice->text(i); | 275 | QString s = modemdevice->text(i); |
276 | s.simplifyWhiteSpace(); | 276 | s.simplifyWhiteSpace(); |
277 | if (! s.isEmpty() ) devs << s; | 277 | if (! s.isEmpty() ) devs << s; |
278 | } | 278 | } |
279 | 279 | ||
280 | 280 | ||
281 | QString edited = modemdevice->currentText(); | 281 | QString edited = modemdevice->currentText(); |
282 | if ( !( edited ).isEmpty() ) | 282 | if ( !( edited ).isEmpty() ) |
283 | { | 283 | { |
284 | edited.simplifyWhiteSpace(); | 284 | edited.simplifyWhiteSpace(); |
285 | if ( devs.contains( edited ) == 0 ) | 285 | if ( devs.contains( edited ) == 0 ) |
286 | { | 286 | { |
287 | devs << edited; | 287 | devs << edited; |
288 | } | 288 | } |
289 | _pppdata->setModemDevice( edited ); | ||
290 | } | 289 | } |
291 | 290 | ||
292 | 291 | ||
293 | Config cfg("NetworkSetupPPP"); | 292 | Config cfg("NetworkSetupPPP"); |
294 | cfg.setGroup("Devices_General"); | 293 | cfg.setGroup("Devices_General"); |
295 | cfg.writeEntry("devices",devs,','); | 294 | cfg.writeEntry("devices",devs,','); |
296 | 295 | ||
297 | } | 296 | } |
298 | 297 | ||
299 | // void ModemWidget::speed_selection(int) { | 298 | // void ModemWidget::speed_selection(int) { |
300 | // _pppdata->setSpeed(baud_c->text(baud_c->currentItem())); | 299 | // _pppdata->setSpeed(baud_c->text(baud_c->currentItem())); |
301 | // } | 300 | // } |
302 | 301 | ||
303 | 302 | ||
304 | // void ModemWidget::setenter(int ) { | 303 | // void ModemWidget::setenter(int ) { |
305 | // _pppdata->setEnter(enter->text(enter->currentItem())); | 304 | // _pppdata->setEnter(enter->text(enter->currentItem())); |
306 | // } | 305 | // } |
307 | 306 | ||
308 | 307 | ||
309 | // void ModemWidget::setmodemdc(int i) { | 308 | // void ModemWidget::setmodemdc(int i) { |
310 | // _pppdata->setModemDevice(modemdevice->text(i)); | 309 | // _pppdata->setModemDevice(modemdevice->text(i)); |
311 | // } | 310 | // } |
312 | 311 | ||
313 | // void ModemWidget::setmodemdc( const QString &string ) { | 312 | // void ModemWidget::setmodemdc( const QString &string ) { |
314 | // _pppdata->setModemDevice( string ); | 313 | // _pppdata->setModemDevice( string ); |
315 | // } | 314 | // } |
316 | 315 | ||
317 | // void ModemWidget::setflowcontrol(int i) { | 316 | // void ModemWidget::setflowcontrol(int i) { |
318 | // _pppdata->setFlowcontrol(flowcontrol->text(i)); | 317 | // _pppdata->setFlowcontrol(flowcontrol->text(i)); |
319 | // } | 318 | // } |
320 | 319 | ||
321 | 320 | ||
322 | // void ModemWidget::modemlockfilechanged(bool set) { | 321 | // void ModemWidget::modemlockfilechanged(bool set) { |
323 | // _pppdata->setModemLockFile(set); | 322 | // _pppdata->setModemLockFile(set); |
324 | // } | 323 | // } |
325 | 324 | ||
326 | 325 | ||
327 | // void ModemWidget::modemtimeoutchanged(int n) { | 326 | // void ModemWidget::modemtimeoutchanged(int n) { |
328 | // _pppdata->setModemTimeout(n); | 327 | // _pppdata->setModemTimeout(n); |
329 | // } | 328 | // } |
330 | 329 | ||
331 | 330 | ||
332 | 331 | ||
333 | bool ModemWidget::save() | 332 | bool ModemWidget::save() |
334 | { | 333 | { |
335 | //first check to make sure that the device name is unique! | 334 | //first check to make sure that the device name is unique! |
336 | if(modemname->text().isEmpty() || | 335 | if(modemname->text().isEmpty() || |
337 | !_pppdata->isUniqueDevname(modemname->text())) | 336 | !_pppdata->isUniqueDevname(modemname->text())) |
338 | return false; | 337 | return false; |
339 | 338 | ||
340 | odebug << "ModemWidget::save saving modem1 data" << oendl; | ||
341 | _pppdata->setDevname( modemname->text() ); | 339 | _pppdata->setDevname( modemname->text() ); |
342 | _pppdata->setModemDevice( modemdevice->currentText() ); | 340 | _pppdata->setModemDevice( modemdevice->currentText() ); |
343 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | 341 | _pppdata->setFlowcontrol(flowcontrol->currentText()); |
344 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | 342 | _pppdata->setFlowcontrol(flowcontrol->currentText()); |
345 | _pppdata->setSpeed(baud_c->currentText()); | 343 | _pppdata->setSpeed(baud_c->currentText()); |
346 | _pppdata->setModemLockFile( modemlockfile->isChecked()); | 344 | _pppdata->setModemLockFile( modemlockfile->isChecked()); |
347 | _pppdata->setModemTimeout( modemtimeout->value() ); | 345 | _pppdata->setModemTimeout( modemtimeout->value() ); |
348 | return true; | 346 | return true; |
349 | 347 | ||
350 | } | 348 | } |
351 | 349 | ||
350 | void ModemWidget::slotBeforeModemQuery() | ||
351 | { | ||
352 | m_oldModemDev = _pppdata->modemDevice(); | ||
353 | m_oldFlowControl = _pppdata->flowcontrol(); | ||
354 | m_oldSpeed = _pppdata->speed(); | ||
355 | m_oldModemLock = _pppdata->modemLockFile(); | ||
356 | m_oldModemTimeout = _pppdata->modemTimeout(); | ||
357 | |||
358 | |||
359 | _pppdata->setModemDevice( modemdevice->currentText() ); | ||
360 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | ||
361 | _pppdata->setFlowcontrol(flowcontrol->currentText()); | ||
362 | _pppdata->setSpeed(baud_c->currentText()); | ||
363 | _pppdata->setModemLockFile( modemlockfile->isChecked()); | ||
364 | _pppdata->setModemTimeout( modemtimeout->value() ); | ||
365 | } | ||
366 | |||
367 | |||
368 | void ModemWidget::slotAfterModemQuery() | ||
369 | { | ||
370 | _pppdata->setModemDevice( m_oldModemDev ); | ||
371 | _pppdata->setFlowcontrol( m_oldFlowControl ); | ||
372 | _pppdata->setSpeed( m_oldSpeed ); | ||
373 | _pppdata->setModemLockFile( m_oldModemLock ); | ||
374 | _pppdata->setModemTimeout( m_oldModemTimeout ); | ||
375 | } | ||
376 | |||
377 | |||
352 | ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, | 378 | ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent, |
353 | const char *name) | 379 | const char *name) |
354 | : QWidget(parent, name), _pppdata(pd), _ifaceppp(ip) | 380 | : QWidget(parent, name), _pppdata(pd), _ifaceppp(ip) |
355 | { | 381 | { |
356 | QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); | 382 | QVBoxLayout *l1 = new QVBoxLayout(this, 0 );//, KDialog::spacingHint()); |
357 | 383 | ||
358 | 384 | ||
359 | waitfordt = new QCheckBox(tr("&Wait for dial tone before dialing"), this); | 385 | waitfordt = new QCheckBox(tr("&Wait for dial tone before dialing"), this); |
360 | waitfordt->setChecked(_pppdata->waitForDialTone()); | 386 | waitfordt->setChecked(_pppdata->waitForDialTone()); |
361 | // connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool))); | 387 | // connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool))); |
362 | l1->addWidget(waitfordt); | 388 | l1->addWidget(waitfordt); |
363 | QWhatsThis::add(waitfordt, | 389 | QWhatsThis::add(waitfordt, |
364 | tr("<p>Normally the modem waits for a dial tone\n" | 390 | tr("<p>Normally the modem waits for a dial tone\n" |
365 | "from your phone line, indicating that it can\n" | 391 | "from your phone line, indicating that it can\n" |
366 | "start to dial a number. If your modem does not\n" | 392 | "start to dial a number. If your modem does not\n" |
367 | "recognize this sound, or your local phone system\n" | 393 | "recognize this sound, or your local phone system\n" |
368 | "does not emit such a tone, uncheck this option\n" | 394 | "does not emit such a tone, uncheck this option\n" |
369 | "\n" | 395 | "\n" |
370 | "<b>Default:</b>: On")); | 396 | "<b>Default:</b>: On")); |
371 | 397 | ||
372 | QHBoxLayout *waitLayout = new QHBoxLayout( this ); | 398 | QHBoxLayout *waitLayout = new QHBoxLayout( this ); |
373 | QLabel *waitLabel = new QLabel( tr("Busy wait:"), this, "busyWait" ); | 399 | QLabel *waitLabel = new QLabel( tr("Busy wait:"), this, "busyWait" ); |
374 | busywait = new QSpinBox( 0, 300, 5, this, "busyWait" ); | 400 | busywait = new QSpinBox( 0, 300, 5, this, "busyWait" ); |
375 | // busywait = new KIntNumInput(_pppdata->busyWait(), this); | 401 | // busywait = new KIntNumInput(_pppdata->busyWait(), this); |
376 | // busywait->setLabel(tr("B&usy wait:")); | 402 | // busywait->setLabel(tr("B&usy wait:")); |
377 | // busywait->setRange(0, 300, 5, true); | 403 | // busywait->setRange(0, 300, 5, true); |
378 | busywait->setSuffix(tr(" sec")); | 404 | busywait->setSuffix(tr(" sec")); |
379 | // connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int))); | 405 | // connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int))); |
380 | waitLayout->addWidget(waitLabel); | 406 | waitLayout->addWidget(waitLabel); |
381 | waitLayout->addWidget(busywait); | 407 | waitLayout->addWidget(busywait); |
382 | l1->addLayout( waitLayout ); | 408 | l1->addLayout( waitLayout ); |
383 | 409 | ||
384 | QWhatsThis::add(busywait, | 410 | QWhatsThis::add(busywait, |
385 | tr("Specifies the number of seconds to wait before\n" | 411 | tr("Specifies the number of seconds to wait before\n" |
386 | "redial if all dialed numbers are busy. This is\n" | 412 | "redial if all dialed numbers are busy. This is\n" |
387 | "necessary because some modems get stuck if the\n" | 413 | "necessary because some modems get stuck if the\n" |
388 | "same number is busy too often.\n" | 414 | "same number is busy too often.\n" |
389 | "\n" | 415 | "\n" |
390 | "The default is 0 seconds, you should not change\n" | 416 | "The default is 0 seconds, you should not change\n" |
391 | "this unless you need to.")); | 417 | "this unless you need to.")); |
392 | 418 | ||
393 | l1->addSpacing(10); | 419 | l1->addSpacing(10); |
394 | 420 | ||
395 | QHBoxLayout *hbl = new QHBoxLayout; | 421 | QHBoxLayout *hbl = new QHBoxLayout; |
396 | hbl->setSpacing(2);//KDialog::spacingHint()); | 422 | hbl->setSpacing(2);//KDialog::spacingHint()); |
397 | 423 | ||
398 | QLabel *volumeLabel = new QLabel(tr("Modem &volume:"), this); | 424 | QLabel *volumeLabel = new QLabel(tr("Modem &volume:"), this); |
399 | hbl->addWidget(volumeLabel); | 425 | hbl->addWidget(volumeLabel); |
400 | volume = new QSlider(0, 2, 1, _pppdata->volume(), | 426 | volume = new QSlider(0, 2, 1, _pppdata->volume(), |
401 | QSlider::Horizontal, this); | 427 | QSlider::Horizontal, this); |
402 | volumeLabel->setBuddy(volume); | 428 | volumeLabel->setBuddy(volume); |
403 | volume->setTickmarks(QSlider::Below); | 429 | volume->setTickmarks(QSlider::Below); |
404 | hbl->addWidget(volume); | 430 | hbl->addWidget(volume); |
405 | 431 | ||
406 | l1->addLayout(hbl); | 432 | l1->addLayout(hbl); |
407 | 433 | ||
408 | // connect(volume, SIGNAL(valueChanged(int)), | 434 | // connect(volume, SIGNAL(valueChanged(int)), |
409 | // this, SLOT(volumeChanged(int))); | 435 | // this, SLOT(volumeChanged(int))); |
410 | QString tmp = tr("Most modems have a speaker which makes\n" | 436 | QString tmp = tr("Most modems have a speaker which makes\n" |
411 | "a lot of noise when dialing. Here you can\n" | 437 | "a lot of noise when dialing. Here you can\n" |
412 | "either turn this completely off or select a\n" | 438 | "either turn this completely off or select a\n" |
413 | "lower volume.\n" | 439 | "lower volume.\n" |
414 | "\n" | 440 | "\n" |
415 | "If this does not work for your modem,\n" | 441 | "If this does not work for your modem,\n" |
416 | "you must modify the modem volume command."); | 442 | "you must modify the modem volume command."); |
417 | 443 | ||
418 | QWhatsThis::add(volumeLabel,tmp); | 444 | QWhatsThis::add(volumeLabel,tmp); |
419 | QWhatsThis::add(volume, tmp); | 445 | QWhatsThis::add(volume, tmp); |
420 | 446 | ||
421 | l1->addSpacing(20); | 447 | l1->addSpacing(20); |
422 | 448 | ||
423 | #if 0 | 449 | #if 0 |
424 | chkbox1 = new QCheckBox(tr("Modem asserts CD line"), this); | 450 | chkbox1 = new QCheckBox(tr("Modem asserts CD line"), this); |
425 | chkbox1->setChecked(_pppdata->UseCDLine()); | 451 | chkbox1->setChecked(_pppdata->UseCDLine()); |
426 | connect(chkbox1,SIGNAL(toggled(bool)), | 452 | connect(chkbox1,SIGNAL(toggled(bool)), |
427 | this,SLOT(use_cdline_toggled(bool))); | 453 | this,SLOT(use_cdline_toggled(bool))); |
428 | l12->addWidget(chkbox1); | 454 | l12->addWidget(chkbox1); |
429 | l12->addStretch(1); | 455 | l12->addStretch(1); |
430 | l1->addStretch(1); | 456 | l1->addStretch(1); |
431 | QWhatsThis::add(chkbox1, | 457 | QWhatsThis::add(chkbox1, |
432 | tr("This controls how <i>kppp</i> detects that the modem\n" | 458 | tr("This controls how <i>kppp</i> detects that the modem\n" |
433 | "is not responding. Unless you are having\n" | 459 | "is not responding. Unless you are having\n" |
434 | "problems with this, do not modify this setting.\n" | 460 | "problems with this, do not modify this setting.\n" |
435 | "\n" | 461 | "\n" |
436 | "<b>Default</b>: Off")); | 462 | "<b>Default</b>: Off")); |
437 | #endif | 463 | #endif |
438 | 464 | ||
439 | modemcmds = new QPushButton(tr("Mod&em Commands..."), this); | 465 | modemcmds = new QPushButton(tr("Mod&em Commands..."), this); |
440 | QWhatsThis::add(modemcmds, | 466 | QWhatsThis::add(modemcmds, |
441 | tr("Allows you to change the AT command for\n" | 467 | tr("Allows you to change the AT command for\n" |
442 | "your modem.")); | 468 | "your modem.")); |
443 | 469 | ||
444 | modeminfo_button = new QPushButton(tr("&Query Modem..."), this); | 470 | modeminfo_button = new QPushButton(tr("&Query Modem..."), this); |
445 | QWhatsThis::add(modeminfo_button, | 471 | QWhatsThis::add(modeminfo_button, |
446 | tr("Most modems support the ATI command set to\n" | 472 | tr("Most modems support the ATI command set to\n" |
447 | "find out vendor and revision of your modem.\n" | 473 | "find out vendor and revision of your modem.\n" |
448 | "\n" | 474 | "\n" |
449 | "Press this button to query your modem for\n" | 475 | "Press this button to query your modem for\n" |
450 | "this information. It can be useful to help\n" | 476 | "this information. It can be useful to help\n" |
451 | "you setup the modem")); | 477 | "you setup the modem")); |
452 | 478 | ||
453 | // terminal_button = new QPushButton(tr("&Terminal..."), this); | 479 | // terminal_button = new QPushButton(tr("&Terminal..."), this); |
454 | // QWhatsThis::add(terminal_button, | 480 | // QWhatsThis::add(terminal_button, |
455 | // tr("Opens the built-in terminal program. You\n" | 481 | // tr("Opens the built-in terminal program. You\n" |
456 | // "can use this if you want to play around\n" | 482 | // "can use this if you want to play around\n" |
457 | // "with your modem's AT command set")); | 483 | // "with your modem's AT command set")); |
458 | 484 | ||
459 | QHBoxLayout *hbox = new QHBoxLayout(); | 485 | QHBoxLayout *hbox = new QHBoxLayout(); |
460 | l1->addLayout(hbox); | 486 | l1->addLayout(hbox); |
461 | hbox->addStretch(1); | 487 | hbox->addStretch(1); |
462 | QVBoxLayout *vbox = new QVBoxLayout(); | 488 | QVBoxLayout *vbox = new QVBoxLayout(); |
463 | hbox->addLayout(vbox); | 489 | hbox->addLayout(vbox); |
464 | 490 | ||
465 | vbox->addWidget(modemcmds); | 491 | vbox->addWidget(modemcmds); |
466 | vbox->addWidget(modeminfo_button); | 492 | vbox->addWidget(modeminfo_button); |
467 | // vbox->addWidget(terminal_button); | 493 | // vbox->addWidget(terminal_button); |
468 | 494 | ||
469 | hbox->addStretch(1); | 495 | hbox->addStretch(1); |
470 | l1->addStretch(1); | 496 | l1->addStretch(1); |
471 | 497 | ||
472 | connect(modemcmds, SIGNAL(clicked()), | 498 | connect(modemcmds, SIGNAL(clicked()), |
473 | SLOT(modemcmdsbutton())); | 499 | SLOT(modemcmdsbutton())); |
474 | connect(modeminfo_button, SIGNAL(clicked()), | 500 | connect(modeminfo_button, SIGNAL(clicked()), |
475 | SLOT(query_modem())); | 501 | SLOT(query_modem())); |
476 | // connect(terminal_button, SIGNAL(clicked()), | 502 | // connect(terminal_button, SIGNAL(clicked()), |
477 | // SLOT(terminal())); | 503 | // SLOT(terminal())); |
478 | } | 504 | } |
479 | 505 | ||
480 | 506 | ||
481 | void ModemWidget2::modemcmdsbutton() | 507 | void ModemWidget2::modemcmdsbutton() |
482 | { | 508 | { |
483 | ModemCommands mc(_ifaceppp->data(), this, "commands" , true, Qt::WStyle_ContextHelp); | 509 | ModemCommands mc(_ifaceppp->data(), this, "commands" , true, Qt::WStyle_ContextHelp); |
484 | 510 | ||
485 | QPEApplication::execDialog( &mc ); | 511 | QPEApplication::execDialog( &mc ); |
486 | } | 512 | } |
487 | 513 | ||
488 | 514 | ||
489 | void ModemWidget2::query_modem() | 515 | void ModemWidget2::query_modem() |
490 | { | 516 | { |
517 | emit sig_beforeQueryModem(); | ||
518 | |||
491 | ModemTransfer mt(_ifaceppp->modem(), this); | 519 | ModemTransfer mt(_ifaceppp->modem(), this); |
492 | mt.exec(); | 520 | mt.exec(); |
521 | |||
522 | emit sig_afterQueryModem(); | ||
493 | } | 523 | } |
494 | 524 | ||
495 | 525 | ||
496 | // void ModemWidget2::terminal() { | 526 | // void ModemWidget2::terminal() { |
497 | // MiniTerm terminal(NULL,NULL); | 527 | // MiniTerm terminal(NULL,NULL); |
498 | // terminal.exec(); | 528 | // terminal.exec(); |
499 | // } | 529 | // } |
500 | 530 | ||
501 | 531 | ||
502 | // #if 0 | 532 | // #if 0 |
503 | // void ModemWidget2::use_cdline_toggled(bool on) { | 533 | // void ModemWidget2::use_cdline_toggled(bool on) { |
504 | // _pppdata->setUseCDLine(on); | 534 | // _pppdata->setUseCDLine(on); |
505 | // } | 535 | // } |
506 | // #endif | 536 | // #endif |
507 | 537 | ||
508 | // void ModemWidget2::waitfordtchanged(bool b) { | 538 | // void ModemWidget2::waitfordtchanged(bool b) { |
509 | // _pppdata->setWaitForDialTone((int)b); | 539 | // _pppdata->setWaitForDialTone((int)b); |
510 | // } | 540 | // } |
511 | 541 | ||
512 | // void ModemWidget2::busywaitchanged(int n) { | 542 | // void ModemWidget2::busywaitchanged(int n) { |
513 | // _pppdata->setbusyWait(n); | 543 | // _pppdata->setbusyWait(n); |
514 | // } | 544 | // } |
515 | 545 | ||
516 | 546 | ||
517 | // void ModemWidget2::volumeChanged(int v) { | 547 | // void ModemWidget2::volumeChanged(int v) { |
518 | // _pppdata->setVolume(v); | 548 | // _pppdata->setVolume(v); |
519 | // } | 549 | // } |
520 | 550 | ||
521 | bool ModemWidget2::save() | 551 | bool ModemWidget2::save() |
522 | { | 552 | { |
523 | _pppdata->setWaitForDialTone(waitfordt->isChecked()); | 553 | _pppdata->setWaitForDialTone(waitfordt->isChecked()); |
524 | _pppdata->setbusyWait(busywait->value()); | 554 | _pppdata->setbusyWait(busywait->value()); |
525 | _pppdata->setVolume(volume->value()); | 555 | _pppdata->setVolume(volume->value()); |
526 | return true; | 556 | return true; |
527 | } | 557 | } |
528 | 558 | ||
diff --git a/noncore/settings/networksettings/ppp/general.h b/noncore/settings/networksettings/ppp/general.h index f43f241..a4dece4 100644 --- a/noncore/settings/networksettings/ppp/general.h +++ b/noncore/settings/networksettings/ppp/general.h | |||
@@ -1,108 +1,125 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * kPPP: A pppd front end for the KDE project | 3 | * kPPP: A pppd front end for the KDE project |
4 | * | 4 | * |
5 | * $Id$ | 5 | * $Id$ |
6 | * | 6 | * |
7 | * Copyright (C) 1997 Bernd Johannes Wuebben | 7 | * Copyright (C) 1997 Bernd Johannes Wuebben |
8 | * wuebben@math.cornell.edu | 8 | * wuebben@math.cornell.edu |
9 | * | 9 | * |
10 | * | 10 | * |
11 | * This program is free software; you can redistribute it and/or | 11 | * This program is free software; you can redistribute it and/or |
12 | * modify it under the terms of the GNU Library General Public | 12 | * modify it under the terms of the GNU Library General Public |
13 | * License as published by the Free Software Foundation; either | 13 | * License as published by the Free Software Foundation; either |
14 | * version 2 of the License, or (at your option) any later version. | 14 | * version 2 of the License, or (at your option) any later version. |
15 | * | 15 | * |
16 | * This program is distributed in the hope that it will be useful, | 16 | * This program is distributed in the hope that it will be useful, |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
19 | * Library General Public License for more details. | 19 | * Library General Public License for more details. |
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 | #ifndef _GENERAL_H_ | 26 | #ifndef _GENERAL_H_ |
27 | #define _GENERAL_H_ | 27 | #define _GENERAL_H_ |
28 | 28 | ||
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | 30 | ||
31 | class QSlider; | 31 | class QSlider; |
32 | class QSpinBox; | 32 | class QSpinBox; |
33 | class QCombobox; | 33 | class QCombobox; |
34 | class QLabel; | 34 | class QLabel; |
35 | class QCheckBox; | 35 | class QCheckBox; |
36 | class QComboBox; | 36 | class QComboBox; |
37 | class PPPData; | 37 | class PPPData; |
38 | class InterfacePPP; | 38 | class InterfacePPP; |
39 | class QLineEdit; | 39 | class QLineEdit; |
40 | 40 | ||
41 | class ModemWidget : public QWidget { | 41 | class ModemWidget : public QWidget { |
42 | Q_OBJECT | 42 | Q_OBJECT |
43 | public: | 43 | public: |
44 | ModemWidget(PPPData*, QWidget *parent=0, const char *name=0 ); | 44 | ModemWidget(PPPData*, QWidget *parent=0, const char *name=0 ); |
45 | ~ModemWidget(); | 45 | ~ModemWidget(); |
46 | 46 | ||
47 | bool save(); | 47 | bool save(); |
48 | 48 | ||
49 | private slots: | ||
50 | /* | ||
51 | * temporarily commit configuration so queryModem | ||
52 | * will use 'current' settings | ||
53 | */ | ||
54 | void slotBeforeModemQuery(); | ||
55 | void slotAfterModemQuery(); | ||
56 | |||
49 | /* private slots: */ | 57 | /* private slots: */ |
50 | /* void setmodemdc(int); */ | 58 | /* void setmodemdc(int); */ |
51 | /* void setmodemdc(const QString &); */ | 59 | /* void setmodemdc(const QString &); */ |
52 | /* void setflowcontrol(int); */ | 60 | /* void setflowcontrol(int); */ |
53 | /* void modemtimeoutchanged(int); */ | 61 | /* void modemtimeoutchanged(int); */ |
54 | /* void modemlockfilechanged(bool); */ | 62 | /* void modemlockfilechanged(bool); */ |
55 | /* void setenter(int); */ | 63 | /* void setenter(int); */ |
56 | /* void speed_selection(int); */ | 64 | /* void speed_selection(int); */ |
57 | 65 | ||
58 | private: | 66 | private: |
59 | QComboBox *enter; | 67 | QComboBox *enter; |
60 | /* QLabel *label1; */ | 68 | /* QLabel *label1; */ |
61 | /* QLabel *label2; */ | 69 | /* QLabel *label2; */ |
62 | /* QLabel *labeltmp; */ | 70 | /* QLabel *labeltmp; */ |
63 | /* QLabel *labelenter; */ | 71 | /* QLabel *labelenter; */ |
64 | QLineEdit *modemname; | 72 | QLineEdit *modemname; |
65 | QComboBox *modemdevice; | 73 | QComboBox *modemdevice; |
66 | QComboBox *flowcontrol; | 74 | QComboBox *flowcontrol; |
67 | 75 | ||
68 | QComboBox *baud_c; | 76 | QComboBox *baud_c; |
69 | QLabel *baud_label; | 77 | QLabel *baud_label; |
70 | 78 | ||
71 | QSpinBox *modemtimeout; | 79 | QSpinBox *modemtimeout; |
72 | QCheckBox *modemlockfile; | 80 | QCheckBox *modemlockfile; |
73 | PPPData *_pppdata; | 81 | PPPData *_pppdata; |
82 | |||
83 | private: | ||
84 | QString m_oldModemDev, m_oldFlowControl, m_oldSpeed; | ||
85 | bool m_oldModemLock; | ||
86 | int m_oldModemTimeout; | ||
74 | }; | 87 | }; |
75 | 88 | ||
76 | 89 | ||
77 | class ModemWidget2 : public QWidget { | 90 | class ModemWidget2 : public QWidget { |
78 | Q_OBJECT | 91 | Q_OBJECT |
79 | public: | 92 | public: |
80 | ModemWidget2( PPPData*, InterfacePPP*, QWidget *parent=0, const char *name=0 ); | 93 | ModemWidget2( PPPData*, InterfacePPP*, QWidget *parent=0, const char *name=0 ); |
81 | bool save(); | 94 | bool save(); |
82 | 95 | ||
96 | signals: | ||
97 | void sig_beforeQueryModem(); | ||
98 | void sig_afterQueryModem(); | ||
99 | |||
83 | private slots: | 100 | private slots: |
84 | /* void waitfordtchanged(bool); */ | 101 | /* void waitfordtchanged(bool); */ |
85 | /* void busywaitchanged(int); */ | 102 | /* void busywaitchanged(int); */ |
86 | // void use_cdline_toggled(bool); | 103 | // void use_cdline_toggled(bool); |
87 | void modemcmdsbutton(); | 104 | void modemcmdsbutton(); |
88 | // void terminal(); | 105 | // void terminal(); |
89 | void query_modem(); | 106 | void query_modem(); |
90 | // void volumeChanged(int); | 107 | // void volumeChanged(int); |
91 | 108 | ||
92 | private: | 109 | private: |
93 | QLabel *labeltmp; | 110 | QLabel *labeltmp; |
94 | QPushButton *modemcmds; | 111 | QPushButton *modemcmds; |
95 | QPushButton *modeminfo_button; | 112 | QPushButton *modeminfo_button; |
96 | // QPushButton *terminal_button; | 113 | // QPushButton *terminal_button; |
97 | // QFrame *fline; | 114 | // QFrame *fline; |
98 | QCheckBox *waitfordt; | 115 | QCheckBox *waitfordt; |
99 | QSpinBox *busywait; | 116 | QSpinBox *busywait; |
100 | QCheckBox *chkbox1; | 117 | QCheckBox *chkbox1; |
101 | QSlider *volume; | 118 | QSlider *volume; |
102 | PPPData *_pppdata; | 119 | PPPData *_pppdata; |
103 | InterfacePPP *_ifaceppp; | 120 | InterfacePPP *_ifaceppp; |
104 | }; | 121 | }; |
105 | 122 | ||
106 | #endif | 123 | #endif |
107 | 124 | ||
108 | 125 | ||