summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/devices.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/ppp/devices.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/devices.cpp25
1 files changed, 15 insertions, 10 deletions
diff --git a/noncore/settings/networksettings/ppp/devices.cpp b/noncore/settings/networksettings/ppp/devices.cpp
index e94904b..9da090d 100644
--- a/noncore/settings/networksettings/ppp/devices.cpp
+++ b/noncore/settings/networksettings/ppp/devices.cpp
@@ -3,67 +3,73 @@
3 * 3 *
4 * $Id$ 4 * $Id$
5 * 5 *
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"
28#include "devices.h"
29#include "authwidget.h"
30#include "pppdata.h"
31#include "edit.h"
32#include "general.h"
33
34/* OPIE */
35#include <qpe/qpeapplication.h>
36
37/* QT */
27#include <qdir.h> 38#include <qdir.h>
28#include <stdlib.h>
29#include <qlayout.h> 39#include <qlayout.h>
30#include <qtabwidget.h> 40#include <qtabwidget.h>
31#include <qtabdialog.h> 41#include <qtabdialog.h>
32#include <qwhatsthis.h> 42#include <qwhatsthis.h>
33#include <qmessagebox.h> 43#include <qmessagebox.h>
34
35#include <qapplication.h> 44#include <qapplication.h>
36#include <qbuttongroup.h> 45#include <qbuttongroup.h>
37#include <qmessagebox.h> 46#include <qmessagebox.h>
38#include <qvgroupbox.h> 47#include <qvgroupbox.h>
39 48
40#include "interfaceppp.h" 49/* STD */
41#include "devices.h" 50#include <stdlib.h>
42#include "authwidget.h" 51
43#include "pppdata.h"
44#include "edit.h"
45#include "general.h"
46 52
47void parseargs(char* buf, char** args); 53void parseargs(char* buf, char** args);
48 54
49DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *name, WFlags f ) 55DevicesWidget::DevicesWidget( InterfacePPP* ip, QWidget *parent, const char *name, WFlags f )
50 : ChooserWidget(ip->data(), parent, name, f) 56 : ChooserWidget(ip->data(), parent, name, f)
51{ 57{
52 _ifaceppp = ip; 58 _ifaceppp = ip;
53 QWhatsThis::add(edit_b, tr("Allows you to modify the selected device")); 59 QWhatsThis::add(edit_b, tr("Allows you to modify the selected device"));
54 QWhatsThis::add(new_b, tr("Create a new device") ); 60 QWhatsThis::add(new_b, tr("Create a new device") );
55 61
56 QWhatsThis::add(copy_b, 62 QWhatsThis::add(copy_b,
57 tr("Makes a copy of the selected device. All\n" 63 tr("Makes a copy of the selected device. All\n"
58 "settings of the selected device are copied\n" 64 "settings of the selected device are copied\n"
59 "to a new device, that you can modify to fit your\n" 65 "to a new device, that you can modify to fit your\n"
60 "needs")); 66 "needs"));
61 QWhatsThis::add(delete_b, 67 QWhatsThis::add(delete_b,
62 tr("<p>Deletes the selected device\n\n" 68 tr("<p>Deletes the selected device\n\n"
63 "<font color=\"red\"><b>Use with care!</b></font>")); 69 "<font color=\"red\"><b>Use with care!</b></font>"));
64 70
65 copy_b->setEnabled( false ); //FIXME 71 copy_b->setEnabled( false ); //FIXME
66// delete_b->setEnabled( false ); //FIXME 72// delete_b->setEnabled( false ); //FIXME
67 73
68 QStringList tmp = _pppdata->getDevicesNamesList(); 74 QStringList tmp = _pppdata->getDevicesNamesList();
69 qDebug("DevicesWidget::DevicesWidget got devices %s",tmp.join("--").latin1()); 75 qDebug("DevicesWidget::DevicesWidget got devices %s",tmp.join("--").latin1());
@@ -170,43 +176,42 @@ int DevicesWidget::doTab(){
170 QTabWidget *tabWindow = new QTabWidget( dlg, "tabWindow" ); 176 QTabWidget *tabWindow = new QTabWidget( dlg, "tabWindow" );
171 layout->addWidget( tabWindow ); 177 layout->addWidget( tabWindow );
172 178
173 bool isnew; 179 bool isnew;
174 180
175 if(_pppdata->devname().isEmpty()) { 181 if(_pppdata->devname().isEmpty()) {
176 dlg->setCaption(tr("New Device")); 182 dlg->setCaption(tr("New Device"));
177 isnew = true; 183 isnew = true;
178 } else { 184 } else {
179 QString tit = tr("Edit Device: "); 185 QString tit = tr("Edit Device: ");
180 tit += _pppdata->devname(); 186 tit += _pppdata->devname();
181 dlg->setCaption(tit); 187 dlg->setCaption(tit);
182 isnew = false; 188 isnew = false;
183 } 189 }
184 190
185 modem1 = new ModemWidget( _pppdata, tabWindow, "modem1" ); 191 modem1 = new ModemWidget( _pppdata, tabWindow, "modem1" );
186 tabWindow->addTab( modem1, tr("&Device") ); 192 tabWindow->addTab( modem1, tr("&Device") );
187 modem2 = new ModemWidget2( _pppdata, _ifaceppp, tabWindow, "modem2" ); 193 modem2 = new ModemWidget2( _pppdata, _ifaceppp, tabWindow, "modem2" );
188 tabWindow->addTab( modem2, tr("&Modem") ); 194 tabWindow->addTab( modem2, tr("&Modem") );
189 195
190 int result = 0; 196 int result = 0;
191 bool ok = false; 197 bool ok = false;
192 198
193 while (!ok){ 199 while (!ok){
194 dlg->showMaximized(); 200 result = QPEApplication::execDialog( dlg );
195 result = dlg->exec();
196 ok = true; 201 ok = true;
197 202
198 if(result == QDialog::Accepted) { 203 if(result == QDialog::Accepted) {
199 if (!modem1->save()){ 204 if (!modem1->save()){
200 QMessageBox::critical(this, "error", tr( "You must enter a unique device name")); 205 QMessageBox::critical(this, "error", tr( "You must enter a unique device name"));
201 ok = false; 206 ok = false;
202 }else{ 207 }else{
203 modem2->save(); 208 modem2->save();
204 } 209 }
205 } 210 }
206 } 211 }
207 212
208 delete dlg; 213 delete dlg;
209 214
210 return result; 215 return result;
211} 216}
212 217