Diffstat (limited to 'noncore/settings/networksettings/ppp/pppmodule.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/pppmodule.cpp | 31 |
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,48 +1,48 @@ | |||
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 | */ |
11 | PPPModule::PPPModule() : Module() | 12 | PPPModule::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 | */ |
28 | PPPModule::~PPPModule(){ | 29 | 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 | */ |
42 | void PPPModule::setProfile(const QString &newProfile){ | 42 | void PPPModule::setProfile(const QString &newProfile){ |
43 | profile = newProfile; | 43 | profile = newProfile; |
44 | } | 44 | } |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * get the icon name for this device. | 47 | * get the icon name for this device. |
48 | * @param Interface* can be used in determining the icon. | 48 | * @param Interface* can be used in determining the icon. |
@@ -58,69 +58,72 @@ QString PPPModule::getPixmapName(Interface* ){ | |||
58 | * @return bool true if i is owned by this module, false otherwise. | 58 | * @return bool true if i is owned by this module, false otherwise. |
59 | */ | 59 | */ |
60 | bool PPPModule::isOwner(Interface *i){ | 60 | bool PPPModule::isOwner(Interface *i){ |
61 | return list.find( i ) != -1; | 61 | return list.find( i ) != -1; |
62 | } | 62 | } |
63 | 63 | ||
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 | */ |
68 | QWidget *PPPModule::configure(Interface *i){ | 68 | QWidget *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 | */ |
80 | QWidget *PPPModule::information(Interface *i){ | 80 | QWidget *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 |
91 | * been called by isOwner() | 92 | * been called by isOwner() |
92 | */ | 93 | */ |
93 | QList<Interface> PPPModule::getInterfaces(){ | 94 | QList<Interface> PPPModule::getInterfaces(){ |
94 | // List all of the files in the peer directory | 95 | // List all of the files in the peer directory |
95 | qDebug("PPPModule::getInterfaces"); | 96 | qDebug("PPPModule::getInterfaces"); |
96 | return list; | 97 | return list; |
97 | } | 98 | } |
98 | 99 | ||
99 | /** | 100 | /** |
100 | * Attempt to add a new interface as defined by name | 101 | * Attempt to add a new interface as defined by name |
101 | * @param name the name of the type of interface that should be created given | 102 | * @param name the name of the type of interface that should be created given |
102 | * by possibleNewInterfaces(); | 103 | * by possibleNewInterfaces(); |
103 | * @return Interface* NULL if it was unable to be created. | 104 | * @return Interface* NULL if it was unable to be created. |
104 | */ | 105 | */ |
105 | Interface *PPPModule::addNewInterface(const QString &newInterface){ | 106 | Interface *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 | } |
121 | return iface; | 124 | return iface; |
122 | } | 125 | } |
123 | 126 | ||
124 | /** | 127 | /** |
125 | * Attempts to remove the interface, doesn't delete i | 128 | * Attempts to remove the interface, doesn't delete i |
126 | * @return bool true if successfull, false otherwise. | 129 | * @return bool true if successfull, false otherwise. |