author | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
commit | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (unidiff) | |
tree | 0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/settings/networksettings/ppp/pppmodule.cpp | |
parent | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff) | |
download | opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2 |
convert to Opie Debugging Framework
Diffstat (limited to 'noncore/settings/networksettings/ppp/pppmodule.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/pppmodule.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp index a7caffe..2291e8a 100644 --- a/noncore/settings/networksettings/ppp/pppmodule.cpp +++ b/noncore/settings/networksettings/ppp/pppmodule.cpp | |||
@@ -51,62 +51,62 @@ namespace | |||
51 | * an interface was up while closing the application | 51 | * an interface was up while closing the application |
52 | * we need to be able to shut it down... | 52 | * we need to be able to shut it down... |
53 | */ | 53 | */ |
54 | PPPModule::PPPModule() : Module() | 54 | PPPModule::PPPModule() : Module() |
55 | { | 55 | { |
56 | InterfaceKeeper inFace; | 56 | InterfaceKeeper inFace; |
57 | QMap<QString,Connection> running = inFace.interfaces(); | 57 | QMap<QString,Connection> running = inFace.interfaces(); |
58 | QStringList handledInterfaceNames; | 58 | QStringList handledInterfaceNames; |
59 | 59 | ||
60 | QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces(); | 60 | QMap<QString,QString> ifaces = PPPData::getConfiguredInterfaces(); |
61 | QMap<QString,QString>::Iterator it; | 61 | QMap<QString,QString>::Iterator it; |
62 | InterfacePPP *iface; | 62 | InterfacePPP *iface; |
63 | qDebug("getting interfaces"); | 63 | odebug << "getting interfaces" << oendl; |
64 | for( it = ifaces.begin(); it != ifaces.end(); ++it ) | 64 | for( it = ifaces.begin(); it != ifaces.end(); ++it ) |
65 | { | 65 | { |
66 | qDebug("ifaces %s %s", it.key().latin1(), it.data().latin1() ); | 66 | odebug << "ifaces " << it.key().latin1() << " " << it.data().latin1() << "" << oendl; |
67 | iface = new InterfacePPP( 0, it.key() ); | 67 | iface = new InterfacePPP( 0, it.key() ); |
68 | iface->setHardwareName( it.data() ); | 68 | iface->setHardwareName( it.data() ); |
69 | list.append( (Interface*)iface ); | 69 | list.append( (Interface*)iface ); |
70 | 70 | ||
71 | // check if (*it) is one of the running ifaces | 71 | // check if (*it) is one of the running ifaces |
72 | if ( running.contains( it.data() ) ) | 72 | if ( running.contains( it.data() ) ) |
73 | { | 73 | { |
74 | qDebug("iface is running %s", it.key().latin1() ); | 74 | odebug << "iface is running " << it.key().latin1() << "" << oendl; |
75 | handledInterfaceNames << running[it.data()].device; | 75 | handledInterfaceNames << running[it.data()].device; |
76 | iface->setStatus( true ); | 76 | iface->setStatus( true ); |
77 | iface->setPPPDpid( running[it.data()].pid ); | 77 | iface->setPPPDpid( running[it.data()].pid ); |
78 | iface->modem()->setPPPDevice( running[it.data()].device ); | 78 | iface->modem()->setPPPDevice( running[it.data()].device ); |
79 | iface->refresh(); | 79 | iface->refresh(); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | setHandledInterfaceNames( handledInterfaceNames ); | 83 | setHandledInterfaceNames( handledInterfaceNames ); |
84 | } | 84 | } |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Delete any interfaces that we own. | 87 | * Delete any interfaces that we own. |
88 | */ | 88 | */ |
89 | PPPModule::~PPPModule() | 89 | PPPModule::~PPPModule() |
90 | { | 90 | { |
91 | qDebug("PPPModule::~PPPModule() " ); | 91 | odebug << "PPPModule::~PPPModule() " << oendl; |
92 | QMap<QString,QString> ifaces; | 92 | QMap<QString,QString> ifaces; |
93 | InterfaceKeeper keeper; | 93 | InterfaceKeeper keeper; |
94 | Interface *i; | 94 | Interface *i; |
95 | for ( i=list.first(); i != 0; i=list.next() ) | 95 | for ( i=list.first(); i != 0; i=list.next() ) |
96 | { | 96 | { |
97 | /* if online save the state */ | 97 | /* if online save the state */ |
98 | if ( i->getStatus() ) | 98 | if ( i->getStatus() ) |
99 | { | 99 | { |
100 | qDebug("Iface %s is still up", i->getHardwareName().latin1() ); | 100 | odebug << "Iface " << i->getHardwareName().latin1() << " is still up" << oendl; |
101 | InterfacePPP* ppp = static_cast<InterfacePPP*>(i); | 101 | InterfacePPP* ppp = static_cast<InterfacePPP*>(i); |
102 | keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() ); | 102 | keeper.addInterface( ppp->pppPID(), ppp->pppDev(), ppp->getHardwareName() ); |
103 | } | 103 | } |
104 | ifaces.insert( i->getInterfaceName(), i->getHardwareName() ); | 104 | ifaces.insert( i->getInterfaceName(), i->getHardwareName() ); |
105 | delete i; | 105 | delete i; |
106 | } | 106 | } |
107 | PPPData::setConfiguredInterfaces( ifaces ); | 107 | PPPData::setConfiguredInterfaces( ifaces ); |
108 | } | 108 | } |
109 | 109 | ||
110 | /** | 110 | /** |
111 | * Change the current profile | 111 | * Change the current profile |
112 | */ | 112 | */ |
@@ -132,25 +132,25 @@ QString PPPModule::getPixmapName(Interface* ) | |||
132 | */ | 132 | */ |
133 | bool PPPModule::isOwner(Interface *i) | 133 | bool PPPModule::isOwner(Interface *i) |
134 | { | 134 | { |
135 | return list.find( i ) != -1; | 135 | return list.find( i ) != -1; |
136 | } | 136 | } |
137 | 137 | ||
138 | /** | 138 | /** |
139 | * Create, and return the WLANConfigure Module | 139 | * Create, and return the WLANConfigure Module |
140 | * @return QWidget* pointer to this modules configure. | 140 | * @return QWidget* pointer to this modules configure. |
141 | */ | 141 | */ |
142 | QWidget *PPPModule::configure(Interface *i) | 142 | QWidget *PPPModule::configure(Interface *i) |
143 | { | 143 | { |
144 | qDebug("return ModemWidget"); | 144 | odebug << "return ModemWidget" << oendl; |
145 | PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, | 145 | PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, |
146 | 0, "PPPConfig", false, | 146 | 0, "PPPConfig", false, |
147 | (Qt::WDestructiveClose | Qt::WStyle_ContextHelp)); | 147 | (Qt::WDestructiveClose | Qt::WStyle_ContextHelp)); |
148 | return pppconfig; | 148 | return pppconfig; |
149 | } | 149 | } |
150 | 150 | ||
151 | /** | 151 | /** |
152 | * Create, and return the Information Module | 152 | * Create, and return the Information Module |
153 | * @return QWidget* pointer to this modules info. | 153 | * @return QWidget* pointer to this modules info. |
154 | */ | 154 | */ |
155 | QWidget *PPPModule::information(Interface *i) | 155 | QWidget *PPPModule::information(Interface *i) |
156 | { | 156 | { |
@@ -159,25 +159,25 @@ QWidget *PPPModule::information(Interface *i) | |||
159 | 159 | ||
160 | return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); | 160 | return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); |
161 | } | 161 | } |
162 | 162 | ||
163 | /** | 163 | /** |
164 | * Get all active (up or down) interfaces | 164 | * Get all active (up or down) interfaces |
165 | * @return QList<Interface> A list of interfaces that exsist that havn't | 165 | * @return QList<Interface> A list of interfaces that exsist that havn't |
166 | * been called by isOwner() | 166 | * been called by isOwner() |
167 | */ | 167 | */ |
168 | QList<Interface> PPPModule::getInterfaces() | 168 | QList<Interface> PPPModule::getInterfaces() |
169 | { | 169 | { |
170 | // List all of the files in the peer directory | 170 | // List all of the files in the peer directory |
171 | qDebug("PPPModule::getInterfaces"); | 171 | odebug << "PPPModule::getInterfaces" << oendl; |
172 | return list; | 172 | return list; |
173 | } | 173 | } |
174 | 174 | ||
175 | /** | 175 | /** |
176 | * Attempt to add a new interface as defined by name | 176 | * Attempt to add a new interface as defined by name |
177 | * @param name the name of the type of interface that should be created given | 177 | * @param name the name of the type of interface that should be created given |
178 | * by possibleNewInterfaces(); | 178 | * by possibleNewInterfaces(); |
179 | * @return Interface* NULL if it was unable to be created. | 179 | * @return Interface* NULL if it was unable to be created. |
180 | */ | 180 | */ |
181 | Interface *PPPModule::addNewInterface(const QString &newInterface) | 181 | Interface *PPPModule::addNewInterface(const QString &newInterface) |
182 | { | 182 | { |
183 | 183 | ||
@@ -252,32 +252,32 @@ namespace | |||
252 | QMap<QString, Connection> InterfaceKeeper::interfaces()const | 252 | QMap<QString, Connection> InterfaceKeeper::interfaces()const |
253 | { | 253 | { |
254 | Config cfg("ppp_plugin_keeper"); | 254 | Config cfg("ppp_plugin_keeper"); |
255 | QMap<QString, Connection> ifaces; | 255 | QMap<QString, Connection> ifaces; |
256 | QStringList lst = cfg.groupList(); | 256 | QStringList lst = cfg.groupList(); |
257 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) | 257 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) |
258 | { | 258 | { |
259 | Connection con; | 259 | Connection con; |
260 | cfg.setGroup( (*it) ); | 260 | cfg.setGroup( (*it) ); |
261 | con.name = (*it); | 261 | con.name = (*it); |
262 | con.pid = cfg.readNumEntry("pid"); | 262 | con.pid = cfg.readNumEntry("pid"); |
263 | con.device = cfg.readEntry("device"); | 263 | con.device = cfg.readEntry("device"); |
264 | qDebug(" %s %s %d", con.name.latin1(), con.device.latin1(), con.pid ); | 264 | odebug << " " << con.name.latin1() << " " << con.device.latin1() << " " << con.pid << "" << oendl; |
265 | 265 | ||
266 | if ( con.pid != -1 && isAvailable( con.pid ) ) | 266 | if ( con.pid != -1 && isAvailable( con.pid ) ) |
267 | ifaces.insert( con.name, con ); | 267 | ifaces.insert( con.name, con ); |
268 | } | 268 | } |
269 | return ifaces; | 269 | return ifaces; |
270 | } | 270 | } |
271 | bool InterfaceKeeper::isAvailable( pid_t p)const | 271 | bool InterfaceKeeper::isAvailable( pid_t p)const |
272 | { | 272 | { |
273 | if (::kill(p, 0 ) == 0 || errno != ESRCH ) | 273 | if (::kill(p, 0 ) == 0 || errno != ESRCH ) |
274 | { | 274 | { |
275 | qDebug("isAvailable %d", p); | 275 | odebug << "isAvailable " << p << "" << oendl; |
276 | return true; | 276 | return true; |
277 | } | 277 | } |
278 | 278 | ||
279 | qDebug("notAvailable %d", p); | 279 | odebug << "notAvailable " << p << "" << oendl; |
280 | return false; | 280 | return false; |
281 | } | 281 | } |
282 | 282 | ||
283 | } | 283 | } |