summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/pppconfig.cpp
blob: d2a149092dc60f7eb477a7419e1d0708627f242f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#include "accounts.h"
#include "devices.h"
#include "general.h"
#include "interfaceppp.h"
#include "modem.h"
#include "pppconfig.h"
#include "pppdata.h"
#include "runtests.h"

/* OPIE */
#include <opie2/odebug.h>
using namespace Opie::Core;

/* QT */
#include <qlayout.h>
#include <qmessagebox.h>
#include <qtabwidget.h>

PPPConfigWidget::PPPConfigWidget( InterfacePPP* iface, QWidget *parent,
                                  const char *name,
                                  bool modal, WFlags fl )
  : QDialog(parent, name, modal, fl)
{
    setCaption(tr("Configure Modem"));
    int result = runTests();
    if(result == TEST_CRITICAL){
        QMessageBox::critical(0, tr("Modem failure"), tr("A critical failure appeard while testing the modem") );
        return;
    }

    interface = iface;
    odebug << "PPPConfigWidget::PPPConfigWidget" << oendl; 
    odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl; 

    odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl; 


  QVBoxLayout *layout = new QVBoxLayout( this );
  layout->setSpacing( 0 );
  layout->setMargin( 1 );
  tabWindow = new QTabWidget( this, "tabWidget" );
  layout->addWidget( tabWindow );

  accounts = new AccountWidget( interface->data(), tabWindow, "accounts", Qt::WStyle_ContextHelp  );
  tabWindow->addTab( accounts, tr("&Accounts") );
  devices = new DevicesWidget( interface, tabWindow, "devices", Qt::WStyle_ContextHelp );
  tabWindow->addTab( devices, tr("&Devices") );

//OLD:
//   modem1 = new ModemWidget( interface, tabWindow, "modem1" );
//   tabWindow->addTab( modem1, tr("&Device") );
//   modem2 = new ModemWidget2( interface, tabWindow, "modem2" );
//   tabWindow->addTab( modem2, tr("&Modem") );

}


PPPConfigWidget::~PPPConfigWidget()
{

}

void PPPConfigWidget::accept()
{
    odebug << "PPPConfigWidget::accept" << oendl; 
    odebug << " _pppdata->accname >" << interface->data()->accname().latin1() << "<" << oendl; 
    odebug << " interface->getHardwareName >" << interface->getHardwareName().latin1() << "<" << oendl; 
    interface->setInterfaceName( interface->data()->devname() );
    interface->setHardwareName( interface->data()->accname() );
    interface->save();
    QDialog::accept();
}


void PPPConfigWidget::reject()
{
    interface->data()->cancel();
    QDialog::reject();
}