summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings/ppp/pppmodule.cpp
Unidiff
Diffstat (limited to 'noncore/settings/networksettings/ppp/pppmodule.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp31
1 files changed, 17 insertions, 14 deletions
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp
index 7cbccc2..95df068 100644
--- a/noncore/settings/networksettings/ppp/pppmodule.cpp
+++ b/noncore/settings/networksettings/ppp/pppmodule.cpp
@@ -1,27 +1,28 @@
1
1#include "pppconfig.h" 2#include "pppconfig.h"
2#include "pppmodule.h" 3#include "pppmodule.h"
3#include "pppdata.h" 4#include "pppdata.h"
4#include "kpppwidget.h" 5#include "interfaceinformationppp.h"
5#include "interfaceinformationimp.h" 6#include "interfaceppp.h"
6//#include "devices.h" 7
7 8
8/** 9/**
9 * Constructor, find all of the possible interfaces 10 * Constructor, find all of the possible interfaces
10 */ 11 */
11PPPModule::PPPModule() : Module() 12PPPModule::PPPModule() : Module()
12{ 13{
13 QMap<QString,QString> ifaces = PPPData::data()->getConfiguredInterfaces(); 14 QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces();
14 QMap<QString,QString>::Iterator it; 15 QMap<QString,QString>::Iterator it;
15 Interface *iface; 16 InterfacePPP *iface;
16 qDebug("getting interfaces"); 17 qDebug("getting interfaces");
17 for( it = ifaces.begin(); it != ifaces.end(); ++it ){ 18 for( it = ifaces.begin(); it != ifaces.end(); ++it ){
18 qDebug("ifaces %s", it.key().latin1()); 19 qDebug("ifaces %s", it.key().latin1());
19 iface = new Interface( 0, it.key() ); 20 iface = new InterfacePPP( 0, it.key() );
20 iface->setHardwareName( it.data() ); 21 iface->setHardwareName( it.data() );
21 list.append( iface ); 22 list.append( (Interface*)iface );
22 } 23 }
23} 24}
24 25
25/** 26/**
26 * Delete any interfaces that we own. 27 * Delete any interfaces that we own.
27 */ 28 */
@@ -29,14 +30,13 @@ PPPModule::~PPPModule(){
29 QMap<QString,QString> ifaces; 30 QMap<QString,QString> ifaces;
30 Interface *i; 31 Interface *i;
31 for ( i=list.first(); i != 0; i=list.next() ){ 32 for ( i=list.first(); i != 0; i=list.next() ){
32 ifaces.insert( i->getInterfaceName(), i->getHardwareName() ); 33 ifaces.insert( i->getInterfaceName(), i->getHardwareName() );
33 delete i; 34 delete i;
34 } 35 }
35 PPPData::data()->setConfiguredInterfaces( ifaces ); 36 PPPData::setConfiguredInterfaces( ifaces );
36 PPPData::data()->save();
37} 37}
38 38
39/** 39/**
40 * Change the current profile 40 * Change the current profile
41 */ 41 */
42void PPPModule::setProfile(const QString &newProfile){ 42void PPPModule::setProfile(const QString &newProfile){
@@ -64,27 +64,28 @@ bool PPPModule::isOwner(Interface *i){
64/** 64/**
65 * Create, and return the WLANConfigure Module 65 * Create, and return the WLANConfigure Module
66 * @return QWidget* pointer to this modules configure. 66 * @return QWidget* pointer to this modules configure.
67 */ 67 */
68QWidget *PPPModule::configure(Interface *i){ 68QWidget *PPPModule::configure(Interface *i){
69 qDebug("return ModemWidget"); 69 qDebug("return ModemWidget");
70 PPPConfigWidget *pppconfig = new PPPConfigWidget( i, 0, "PPPConfig", 70 PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i,
71 false, 71 0, "PPPConfig", false,
72 Qt::WDestructiveClose ); 72 Qt::WDestructiveClose );
73 return pppconfig; 73 return pppconfig;
74} 74}
75 75
76/** 76/**
77 * Create, and return the Information Module 77 * Create, and return the Information Module
78 * @return QWidget* pointer to this modules info. 78 * @return QWidget* pointer to this modules info.
79 */ 79 */
80QWidget *PPPModule::information(Interface *i){ 80QWidget *PPPModule::information(Interface *i){
81 // We don't have any advanced pppd information widget yet :-D 81 // We don't have any advanced pppd information widget yet :-D
82 // TODO ^ 82 // TODO ^
83 qDebug("return PPPModule::information"); 83 qDebug("return PPPModule::information");
84 InterfaceInformationImp *information = new InterfaceInformationImp( 0, "InterfaceSetupImp", i); 84// InterfaceInformationImp *information = new InterfaceInformationImp( 0, "InterfaceSetupImp", i);
85 InterfaceInformationPPP *information = new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i );
85 return information; 86 return information;
86} 87}
87 88
88/** 89/**
89 * Get all active (up or down) interfaces 90 * Get all active (up or down) interfaces
90 * @return QList<Interface> A list of interfaces that exsist that havn't 91 * @return QList<Interface> A list of interfaces that exsist that havn't
@@ -103,18 +104,20 @@ QList<Interface> PPPModule::getInterfaces(){
103 * @return Interface* NULL if it was unable to be created. 104 * @return Interface* NULL if it was unable to be created.
104 */ 105 */
105Interface *PPPModule::addNewInterface(const QString &newInterface){ 106Interface *PPPModule::addNewInterface(const QString &newInterface){
106 107
107 qDebug("try to add iface %s",newInterface.latin1()); 108 qDebug("try to add iface %s",newInterface.latin1());
108 109
110 InterfacePPP *ifaceppp;
109 Interface *iface; 111 Interface *iface;
110 iface = new Interface(); 112 ifaceppp = new InterfacePPP();
111 PPPConfigWidget imp(iface, 0, "PPPConfigImp", true); 113 PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true);
112 imp.showMaximized(); 114 imp.showMaximized();
113 if(imp.exec() == QDialog::Accepted ){ 115 if(imp.exec() == QDialog::Accepted ){
114 iface->setModuleOwner( this ); 116 iface->setModuleOwner( this );
117 iface = ifaceppp;
115 list.append( iface ); 118 list.append( iface );
116 return iface; 119 return iface;
117 }else { 120 }else {
118 delete iface; 121 delete iface;
119 iface = NULL; 122 iface = NULL;
120 } 123 }