author | ar <ar> | 2004-02-21 18:32:37 (UTC) |
---|---|---|
committer | ar <ar> | 2004-02-21 18:32:37 (UTC) |
commit | 536f271b1e6a1d1886e96a28524a3503c4c38c4e (patch) (unidiff) | |
tree | 63b3c0ce472a89a0f9731195fececc701bf4ca67 /noncore/settings/networksettings/ppp/pppmodule.cpp | |
parent | db2afda83e495bff9fc19fa14a30072f1cd4c67a (diff) | |
download | opie-536f271b1e6a1d1886e96a28524a3503c4c38c4e.zip opie-536f271b1e6a1d1886e96a28524a3503c4c38c4e.tar.gz opie-536f271b1e6a1d1886e96a28524a3503c4c38c4e.tar.bz2 |
improve support for BigScreen
Diffstat (limited to 'noncore/settings/networksettings/ppp/pppmodule.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/settings/networksettings/ppp/pppmodule.cpp | 147 |
1 files changed, 90 insertions, 57 deletions
diff --git a/noncore/settings/networksettings/ppp/pppmodule.cpp b/noncore/settings/networksettings/ppp/pppmodule.cpp index f7dacf6..a7caffe 100644 --- a/noncore/settings/networksettings/ppp/pppmodule.cpp +++ b/noncore/settings/networksettings/ppp/pppmodule.cpp | |||
@@ -1,6 +1 @@ | |||
1 | #include <errno.h> | ||
2 | #include <signal.h> | ||
3 | |||
4 | |||
5 | #include <qpe/config.h> | ||
6 | |||
@@ -13,4 +8,15 @@ | |||
13 | 8 | ||
9 | /* OPIE */ | ||
10 | #include <qpe/config.h> | ||
11 | #include <qpe/qpeapplication.h> | ||
12 | |||
13 | /* QT */ | ||
14 | |||
15 | /* STD */ | ||
16 | #include <errno.h> | ||
17 | #include <signal.h> | ||
18 | |||
14 | // don't polute global namespace | 19 | // don't polute global namespace |
15 | namespace { | 20 | namespace |
21 | { | ||
16 | /* | 22 | /* |
@@ -20,3 +26,4 @@ namespace { | |||
20 | */ | 26 | */ |
21 | struct Connection { | 27 | struct Connection |
28 | { | ||
22 | pid_t pid; | 29 | pid_t pid; |
@@ -25,3 +32,4 @@ namespace { | |||
25 | }; | 32 | }; |
26 | class InterfaceKeeper { | 33 | class InterfaceKeeper |
34 | { | ||
27 | public: | 35 | public: |
@@ -55,3 +63,4 @@ PPPModule::PPPModule() : Module() | |||
55 | qDebug("getting interfaces"); | 63 | qDebug("getting interfaces"); |
56 | for( it = ifaces.begin(); it != ifaces.end(); ++it ){ | 64 | for( it = ifaces.begin(); it != ifaces.end(); ++it ) |
65 | { | ||
57 | qDebug("ifaces %s %s", it.key().latin1(), it.data().latin1() ); | 66 | qDebug("ifaces %s %s", it.key().latin1(), it.data().latin1() ); |
@@ -62,3 +71,4 @@ PPPModule::PPPModule() : Module() | |||
62 | // check if (*it) is one of the running ifaces | 71 | // check if (*it) is one of the running ifaces |
63 | if ( running.contains( it.data() ) ) { | 72 | if ( running.contains( it.data() ) ) |
73 | { | ||
64 | qDebug("iface is running %s", it.key().latin1() ); | 74 | qDebug("iface is running %s", it.key().latin1() ); |
@@ -78,3 +88,4 @@ PPPModule::PPPModule() : Module() | |||
78 | */ | 88 | */ |
79 | PPPModule::~PPPModule(){ | 89 | PPPModule::~PPPModule() |
90 | { | ||
80 | qDebug("PPPModule::~PPPModule() " ); | 91 | qDebug("PPPModule::~PPPModule() " ); |
@@ -83,5 +94,7 @@ PPPModule::~PPPModule(){ | |||
83 | Interface *i; | 94 | Interface *i; |
84 | for ( i=list.first(); i != 0; i=list.next() ){ | 95 | for ( i=list.first(); i != 0; i=list.next() ) |
96 | { | ||
85 | /* if online save the state */ | 97 | /* if online save the state */ |
86 | if ( i->getStatus() ) { | 98 | if ( i->getStatus() ) |
99 | { | ||
87 | qDebug("Iface %s is still up", i->getHardwareName().latin1() ); | 100 | qDebug("Iface %s is still up", i->getHardwareName().latin1() ); |
@@ -99,4 +112,5 @@ PPPModule::~PPPModule(){ | |||
99 | */ | 112 | */ |
100 | void PPPModule::setProfile(const QString &newProfile){ | 113 | void PPPModule::setProfile(const QString &newProfile) |
101 | profile = newProfile; | 114 | { |
115 | profile = newProfile; | ||
102 | } | 116 | } |
@@ -108,4 +122,5 @@ void PPPModule::setProfile(const QString &newProfile){ | |||
108 | */ | 122 | */ |
109 | QString PPPModule::getPixmapName(Interface* ){ | 123 | QString PPPModule::getPixmapName(Interface* ) |
110 | return "ppp"; | 124 | { |
125 | return "ppp"; | ||
111 | } | 126 | } |
@@ -117,3 +132,4 @@ QString PPPModule::getPixmapName(Interface* ){ | |||
117 | */ | 132 | */ |
118 | bool PPPModule::isOwner(Interface *i){ | 133 | bool PPPModule::isOwner(Interface *i) |
134 | { | ||
119 | return list.find( i ) != -1; | 135 | return list.find( i ) != -1; |
@@ -125,7 +141,8 @@ bool PPPModule::isOwner(Interface *i){ | |||
125 | */ | 141 | */ |
126 | QWidget *PPPModule::configure(Interface *i){ | 142 | QWidget *PPPModule::configure(Interface *i) |
143 | { | ||
127 | qDebug("return ModemWidget"); | 144 | qDebug("return ModemWidget"); |
128 | PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, | 145 | PPPConfigWidget *pppconfig = new PPPConfigWidget( (InterfacePPP*)i, |
129 | 0, "PPPConfig", false, | 146 | 0, "PPPConfig", false, |
130 | (Qt::WDestructiveClose | Qt::WStyle_ContextHelp)); | 147 | (Qt::WDestructiveClose | Qt::WStyle_ContextHelp)); |
131 | return pppconfig; | 148 | return pppconfig; |
@@ -137,7 +154,8 @@ QWidget *PPPModule::configure(Interface *i){ | |||
137 | */ | 154 | */ |
138 | QWidget *PPPModule::information(Interface *i){ | 155 | QWidget *PPPModule::information(Interface *i) |
139 | // We don't have any advanced pppd information widget yet :-D | 156 | { |
140 | // TODO ^ | 157 | // We don't have any advanced pppd information widget yet :-D |
158 | // TODO ^ | ||
141 | 159 | ||
142 | return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); | 160 | return new InterfaceInformationPPP( 0, "InterfaceInformationPPP", i ); |
143 | } | 161 | } |
@@ -149,6 +167,7 @@ QWidget *PPPModule::information(Interface *i){ | |||
149 | */ | 167 | */ |
150 | QList<Interface> PPPModule::getInterfaces(){ | 168 | QList<Interface> PPPModule::getInterfaces() |
151 | // List all of the files in the peer directory | 169 | { |
170 | // List all of the files in the peer directory | ||
152 | qDebug("PPPModule::getInterfaces"); | 171 | qDebug("PPPModule::getInterfaces"); |
153 | return list; | 172 | return list; |
154 | } | 173 | } |
@@ -161,19 +180,23 @@ QList<Interface> PPPModule::getInterfaces(){ | |||
161 | */ | 180 | */ |
162 | Interface *PPPModule::addNewInterface(const QString &newInterface){ | 181 | Interface *PPPModule::addNewInterface(const QString &newInterface) |
163 | 182 | { | |
164 | InterfacePPP *ifaceppp; | 183 | |
165 | Interface *iface; | 184 | InterfacePPP *ifaceppp; |
166 | ifaceppp = new InterfacePPP(); | 185 | Interface *iface; |
167 | PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true); | 186 | ifaceppp = new InterfacePPP(); |
168 | imp.showMaximized(); | 187 | PPPConfigWidget imp(ifaceppp, 0, "PPPConfigImp", true); |
169 | if(imp.exec() == QDialog::Accepted ){ | 188 | |
170 | iface = (InterfacePPP*) ifaceppp; | 189 | if( QPEApplication::execDialog( &imp ) == QDialog::Accepted ) |
171 | iface->setModuleOwner( this ); | 190 | { |
172 | list.append( iface ); | 191 | iface = (InterfacePPP*) ifaceppp; |
173 | return iface; | 192 | iface->setModuleOwner( this ); |
174 | }else { | 193 | list.append( iface ); |
175 | delete ifaceppp; | 194 | return iface; |
176 | iface = NULL; | 195 | } |
177 | } | 196 | else |
178 | return iface; | 197 | { |
198 | delete ifaceppp; | ||
199 | iface = NULL; | ||
200 | } | ||
201 | return iface; | ||
179 | } | 202 | } |
@@ -184,3 +207,4 @@ Interface *PPPModule::addNewInterface(const QString &newInterface){ | |||
184 | */ | 207 | */ |
185 | bool PPPModule::remove(Interface *i){ | 208 | bool PPPModule::remove(Interface *i) |
209 | { | ||
186 | return list.remove(i); | 210 | return list.remove(i); |
@@ -196,9 +220,12 @@ void PPPModule::possibleNewInterfaces(QMap<QString, QString> &newIfaces) | |||
196 | 220 | ||
197 | namespace { | 221 | namespace |
198 | InterfaceKeeper::InterfaceKeeper( ) { | 222 | { |
199 | } | 223 | InterfaceKeeper::InterfaceKeeper( ) |
200 | InterfaceKeeper::~InterfaceKeeper() { | 224 | {} |
225 | InterfaceKeeper::~InterfaceKeeper() | ||
226 | { | ||
201 | Config cfg("ppp_plugin_keeper"); | 227 | Config cfg("ppp_plugin_keeper"); |
202 | QStringList lst = cfg.groupList(); | 228 | QStringList lst = cfg.groupList(); |
203 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 229 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) |
230 | { | ||
204 | Connection con; | 231 | Connection con; |
@@ -208,3 +235,4 @@ namespace { | |||
208 | 235 | ||
209 | for (QMap<QString, Connection>::Iterator it = m_interfaces.begin(); it != m_interfaces.end(); ++it ) { | 236 | for (QMap<QString, Connection>::Iterator it = m_interfaces.begin(); it != m_interfaces.end(); ++it ) |
237 | { | ||
210 | Connection con = it.data(); | 238 | Connection con = it.data(); |
@@ -215,3 +243,4 @@ namespace { | |||
215 | } | 243 | } |
216 | void InterfaceKeeper::addInterface(pid_t pid, const QString& dev, const QString& name ) { | 244 | void InterfaceKeeper::addInterface(pid_t pid, const QString& dev, const QString& name ) |
245 | { | ||
217 | Connection con; | 246 | Connection con; |
@@ -222,3 +251,4 @@ namespace { | |||
222 | } | 251 | } |
223 | QMap<QString, Connection> InterfaceKeeper::interfaces()const { | 252 | QMap<QString, Connection> InterfaceKeeper::interfaces()const |
253 | { | ||
224 | Config cfg("ppp_plugin_keeper"); | 254 | Config cfg("ppp_plugin_keeper"); |
@@ -226,3 +256,4 @@ namespace { | |||
226 | QStringList lst = cfg.groupList(); | 256 | QStringList lst = cfg.groupList(); |
227 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) { | 257 | for (QStringList::Iterator it = lst.begin(); it != lst.end(); ++it ) |
258 | { | ||
228 | Connection con; | 259 | Connection con; |
@@ -239,4 +270,6 @@ namespace { | |||
239 | } | 270 | } |
240 | bool InterfaceKeeper::isAvailable( pid_t p)const { | 271 | bool InterfaceKeeper::isAvailable( pid_t p)const |
241 | if (::kill(p, 0 ) == 0 || errno != ESRCH ) { | 272 | { |
273 | if (::kill(p, 0 ) == 0 || errno != ESRCH ) | ||
274 | { | ||
242 | qDebug("isAvailable %d", p); | 275 | qDebug("isAvailable %d", p); |