summaryrefslogtreecommitdiff
path: root/noncore
authorar <ar>2004-02-21 18:32:37 (UTC)
committer ar <ar>2004-02-21 18:32:37 (UTC)
commit536f271b1e6a1d1886e96a28524a3503c4c38c4e (patch) (unidiff)
tree63b3c0ce472a89a0f9731195fececc701bf4ca67 /noncore
parentdb2afda83e495bff9fc19fa14a30072f1cd4c67a (diff)
downloadopie-536f271b1e6a1d1886e96a28524a3503c4c38c4e.zip
opie-536f271b1e6a1d1886e96a28524a3503c4c38c4e.tar.gz
opie-536f271b1e6a1d1886e96a28524a3503c4c38c4e.tar.bz2
improve support for BigScreen
Diffstat (limited to 'noncore') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp97
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp1040
-rw-r--r--noncore/settings/networksettings/ppp/accounts.cpp206
-rw-r--r--noncore/settings/networksettings/ppp/general.cpp672
-rw-r--r--noncore/settings/networksettings/ppp/modeminfo.cpp383
-rw-r--r--noncore/settings/networksettings/ppp/pppmodule.cpp147
-rw-r--r--noncore/settings/networksettings/wlan/wlanmodule.cpp11
7 files changed, 1363 insertions, 1193 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
index 37c3a91..698dfd3 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
@@ -1 +1,2 @@
1
1#include "interfaceinformationimp.h" 2#include "interfaceinformationimp.h"
@@ -3,2 +4,7 @@
3 4
5/* OPIE */
6#include <qpe/config.h>
7#include <qpe/qpeapplication.h>
8
9/* QT */
4#include <qcheckbox.h> 10#include <qcheckbox.h>
@@ -9,3 +15,2 @@
9 15
10#include <qpe/config.h>
11 16
@@ -20,14 +25,15 @@
20 */ 25 */
21InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i){ 26InterfaceInformationImp::InterfaceInformationImp(QWidget *parent, const char *name, Interface *i, WFlags f):InterfaceInformation(parent, name, f), interface(i)
22 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 27{
23 connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); 28 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
24 updateInterface(interface); 29 connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &)));
25 connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); 30 updateInterface(interface);
26 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); 31 connect(startButton, SIGNAL(clicked()), interface, SLOT(start()));
27 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); 32 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop()));
28 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); 33 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart()));
29 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); 34 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh()));
30 Config cfg("networksettings", Config::User); 35 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced()));
31 cfg.setGroup("interface"); 36 Config cfg("networksettings", Config::User);
32 CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) ); 37 cfg.setGroup("interface");
38 CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) );
33} 39}
@@ -46,17 +52,20 @@ InterfaceInformationImp::~InterfaceInformationImp()
46 */ 52 */
47void InterfaceInformationImp::updateInterface(Interface *){ 53void InterfaceInformationImp::updateInterface(Interface *)
48 if(interface->getStatus()){ 54{
49 startButton->setEnabled(false); 55 if(interface->getStatus())
50 stopButton->setEnabled(true); 56 {
51 restartButton->setEnabled(true); 57 startButton->setEnabled(false);
52 } 58 stopButton->setEnabled(true);
53 else{ 59 restartButton->setEnabled(true);
54 startButton->setEnabled(true); 60 }
55 stopButton->setEnabled(false); 61 else
56 restartButton->setEnabled(false); 62 {
57 } 63 startButton->setEnabled(true);
58 macAddressLabel->setText(interface->getMacAddress()); 64 stopButton->setEnabled(false);
59 ipAddressLabel->setText(interface->getIp()); 65 restartButton->setEnabled(false);
60 subnetMaskLabel->setText(interface->getSubnetMask()); 66 }
61 broadcastLabel->setText(interface->getBroadcast()); 67 macAddressLabel->setText(interface->getMacAddress());
68 ipAddressLabel->setText(interface->getIp());
69 subnetMaskLabel->setText(interface->getSubnetMask());
70 broadcastLabel->setText(interface->getBroadcast());
62} 71}
@@ -67,14 +76,15 @@ void InterfaceInformationImp::updateInterface(Interface *){
67 */ 76 */
68void InterfaceInformationImp::advanced(){ 77void InterfaceInformationImp::advanced()
69 InterfaceAdvanced *a = new InterfaceAdvanced(this, "InterfaceAdvanced", Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog); 78{
70 a->interfaceName->setText(interface->getInterfaceName()); 79 InterfaceAdvanced *a = new InterfaceAdvanced(this, "InterfaceAdvanced", Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog);
71 a->macAddressLabel->setText(interface->getMacAddress()); 80 a->interfaceName->setText(interface->getInterfaceName());
72 a->ipAddressLabel->setText(interface->getIp()); 81 a->macAddressLabel->setText(interface->getMacAddress());
73 a->subnetMaskLabel->setText(interface->getSubnetMask()); 82 a->ipAddressLabel->setText(interface->getIp());
74 a->broadcastLabel->setText(interface->getBroadcast()); 83 a->subnetMaskLabel->setText(interface->getSubnetMask());
75 a->dhcpServerLabel->setText(interface->getDhcpServerIp()); 84 a->broadcastLabel->setText(interface->getBroadcast());
76 a->leaseObtainedLabel->setText(interface->getLeaseObtained()); 85 a->dhcpServerLabel->setText(interface->getDhcpServerIp());
77 a->leaseExpiresLabel->setText(interface->getLeaseExpires()); 86 a->leaseObtainedLabel->setText(interface->getLeaseObtained());
78 a->dhcpInformation->setEnabled(interface->isDhcp()); 87 a->leaseExpiresLabel->setText(interface->getLeaseExpires());
79 a->showMaximized(); 88 a->dhcpInformation->setEnabled(interface->isDhcp());
89 QPEApplication::showWidget( a );
80} 90}
@@ -86,5 +96,6 @@ void InterfaceInformationImp::advanced(){
86 */ 96 */
87void InterfaceInformationImp::showMessage(const QString &message){ 97void InterfaceInformationImp::showMessage(const QString &message)
88 if (CheckBoxSilent->isChecked()) return; 98{
89 QMessageBox::information(this, "Message", message, QMessageBox::Ok); 99 if (CheckBoxSilent->isChecked()) return;
100 QMessageBox::information(this, "Message", message, QMessageBox::Ok);
90} 101}
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index d9752ce..b0a1dd9 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -1 +1,2 @@
1
1#include "mainwindowimp.h" 2#include "mainwindowimp.h"
@@ -7,2 +8,10 @@
7 8
9/* OPIE */
10#include <qpe/qcopenvelope_qws.h>
11#include <qpe/qpeapplication.h>
12#include <qpe/config.h>
13#include <qpe/qlibrary.h>
14#include <qpe/resource.h>
15
16/* QT */
8#include <qpushbutton.h> 17#include <qpushbutton.h>
@@ -13,23 +22,5 @@
13#include <qlabel.h> 22#include <qlabel.h>
14#include <qpe/qcopenvelope_qws.h>
15#include <qtabwidget.h> // in order to disable the profiles tab 23#include <qtabwidget.h> // in order to disable the profiles tab
16#include <qpe/qpeapplication.h>
17
18#include <qmessagebox.h> 24#include <qmessagebox.h>
19 25
20#ifdef QWS
21 #include <qpe/config.h>
22 #include <qpe/qlibrary.h>
23 #include <qpe/resource.h>
24 #include <qpe/qpeapplication.h>
25#else
26 #include <klibloader.h>
27 #define QLibrary KLibrary
28 #include <kconfig.h>
29 #define Config KConfig
30 #include <kapplication.h>
31 #include <kstandarddirs.h>
32 #include <kiconloader.h>
33 #define showMaximized show
34#endif
35 26
@@ -45,2 +36,3 @@
45 36
37/* STD */
46#include <net/if.h> 38#include <net/if.h>
@@ -52,82 +44,91 @@
52 44
53MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME){ 45MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWindow(parent, name, Qt::WStyle_ContextHelp), advancedUserMode(true), scheme(DEFAULT_SCHEME)
54 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); 46{
55 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 47 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
56 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 48 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
57 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 49 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
50 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
58 51
59 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); 52 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
60 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); 53 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
61 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); 54 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
62 55
63 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); 56 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
64 57
65 //FIXME: disable profiles for the moment: 58 //FIXME: disable profiles for the moment:
66 tabWidget->setTabEnabled( tab, false ); 59 tabWidget->setTabEnabled( tab, false );
67 60
68 // Load connections. 61 // Load connections.
69 // /usr/local/kde/lib/libinterfaces.la 62 // /usr/local/kde/lib/libinterfaces.la
70#ifdef QWS 63#ifdef QWS
71 loadModules(QPEApplication::qpeDir() + "plugins/networksettings"); 64 loadModules(QPEApplication::qpeDir() + "plugins/networksettings");
72#else 65#else
73 loader = KLibLoader::self(); 66 loader = KLibLoader::self();
74 loadModules(QString("/usr/")+KStandardDirs::kde_default("lib")); 67 loadModules(QString("/usr/")+KStandardDirs::kde_default("lib"));
75#endif 68#endif
76 getAllInterfaces(); 69 getAllInterfaces();
77 70
78 Interfaces i; 71 Interfaces i;
79 QStringList list = i.getInterfaceList(); 72 QStringList list = i.getInterfaceList();
80 QMap<QString, Interface*>::Iterator it; 73 QMap<QString, Interface*>::Iterator it;
81 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) { 74 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni )
82 /* 75 {
83 * we skipped it in getAllInterfaces now 76 /*
84 * we need to ignore it as well 77 * we skipped it in getAllInterfaces now
85 */ 78 * we need to ignore it as well
86 if (m_handledIfaces.contains( *ni) ) { 79 */
87 qDebug("Not up iface handled by module"); 80 if (m_handledIfaces.contains( *ni) )
88 continue; 81 {
89 } 82 qDebug("Not up iface handled by module");
90 bool found = false; 83 continue;
91 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ){ 84 }
92 if(it.key() == (*ni)) 85 bool found = false;
93 found = true; 86 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it )
94 } 87 {
95 if(!found){ 88 if(it.key() == (*ni))
96 if(!(*ni).contains("_")){ 89 found = true;
97 Interface *i = new Interface(this, *ni, false); 90 }
98 i->setAttached(false); 91 if(!found)
99 i->setHardwareName(tr("Disconnected")); 92 {
100 interfaceNames.insert(i->getInterfaceName(), i); 93 if(!(*ni).contains("_"))
101 updateInterface(i); 94 {
102 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 95 Interface *i = new Interface(this, *ni, false);
103 } 96 i->setAttached(false);
104 } 97 i->setHardwareName(tr("Disconnected"));
105 } 98 interfaceNames.insert(i->getInterfaceName(), i);
106 99 updateInterface(i);
107 //getInterfaceList(); 100 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *)));
108 connectionList->header()->hide(); 101 }
109 102 }
110 Config cfg("NetworkSetup"); 103 }
111 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); 104
112 for ( QStringList::Iterator it = profiles.begin(); 105 //getInterfaceList();
113 it != profiles.end(); ++it) 106 connectionList->header()->hide();
114 profilesList->insertItem((*it)); 107
115 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); 108 Config cfg("NetworkSetup");
116 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); 109 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
117 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); 110 for ( QStringList::Iterator it = profiles.begin();
118 111 it != profiles.end(); ++it)
119 QFile file(scheme); 112 profilesList->insertItem((*it));
120 if ( file.open(IO_ReadOnly) ) { // file opened successfully 113 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
121 QTextStream stream( &file ); // use a text stream 114 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
122 while ( !stream.eof() ) { // until end of file... 115 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
123 QString line = stream.readLine(); // line of text excluding '\n' 116
124 if(line.contains("SCHEME")){ 117 QFile file(scheme);
125 line = line.mid(7, line.length()); 118 if ( file.open(IO_ReadOnly) )
126 currentProfileLabel->setText(line); 119 { // file opened successfully
127 break; 120 QTextStream stream( &file ); // use a text stream
128 } 121 while ( !stream.eof() )
129 } 122 { // until end of file...
130 file.close(); 123 QString line = stream.readLine(); // line of text excluding '\n'
131 } 124 if(line.contains("SCHEME"))
132 makeChannel(); 125 {
126 line = line.mid(7, line.length());
127 currentProfileLabel->setText(line);
128 break;
129 }
130 }
131 file.close();
132 }
133 makeChannel();
133} 134}
@@ -137,26 +138,29 @@ MainWindowImp::MainWindowImp(QWidget *parent, const char *name, WFlags) : MainWi
137 */ 138 */
138MainWindowImp::~MainWindowImp(){ 139MainWindowImp::~MainWindowImp()
139 // Save profiles. 140{
140 Config cfg("NetworkSetup"); 141 // Save profiles.
141 cfg.setGroup("General"); 142 Config cfg("NetworkSetup");
142 cfg.writeEntry("Profiles", profiles.join(" ")); 143 cfg.setGroup("General");
143 144 cfg.writeEntry("Profiles", profiles.join(" "));
144 // Delete all interfaces that don't have owners. 145
145 QMap<Interface*, QListViewItem*>::Iterator iIt; 146 // Delete all interfaces that don't have owners.
146 for( iIt = items.begin(); iIt != items.end(); ++iIt ){ 147 QMap<Interface*, QListViewItem*>::Iterator iIt;
147 if(iIt.key()->getModuleOwner() == NULL) 148 for( iIt = items.begin(); iIt != items.end(); ++iIt )
148 delete iIt.key(); 149 {
149 } 150 if(iIt.key()->getModuleOwner() == NULL)
151 delete iIt.key();
152 }
150 153
151#ifdef QWS 154#ifdef QWS
152 // Delete Modules and Libraries 155 // Delete Modules and Libraries
153 QMap<Module*, QLibrary*>::Iterator it; 156 QMap<Module*, QLibrary*>::Iterator it;
154 for( it = libraries.begin(); it != libraries.end(); ++it ){ 157 for( it = libraries.begin(); it != libraries.end(); ++it )
155 delete it.key(); 158 {
156 // I wonder why I can't delete the libraries 159 delete it.key();
157 // What fucking shit this is. 160 // I wonder why I can't delete the libraries
158 //delete it.data(); 161 // What fucking shit this is.
159 } 162 //delete it.data();
163 }
160#else 164#else
161 // klibloader automaticly deletes the libraries for us... 165 // klibloader automaticly deletes the libraries for us...
162#endif 166#endif
@@ -167,94 +171,106 @@ MainWindowImp::~MainWindowImp(){
167 */ 171 */
168void MainWindowImp::getAllInterfaces(){ 172void MainWindowImp::getAllInterfaces()
169 int sockfd = socket(PF_INET, SOCK_DGRAM, 0); 173{
170 if(sockfd == -1) 174 int sockfd = socket(PF_INET, SOCK_DGRAM, 0);
171 return; 175 if(sockfd == -1)
172 176 return;
173 struct ifreq ifr; 177
174 QStringList ifaces; 178 struct ifreq ifr;
175 QFile procFile(QString(_PROCNETDEV)); 179 QStringList ifaces;
176 int result; 180 QFile procFile(QString(_PROCNETDEV));
177 Interface *i; 181 int result;
178 182 Interface *i;
179 if (! procFile.exists()) { 183
180 struct ifreq ifrs[100]; 184 if (! procFile.exists())
181 struct ifconf ifc; 185 {
182 ifc.ifc_len = sizeof(ifrs); 186 struct ifreq ifrs[100];
183 ifc.ifc_req = ifrs; 187 struct ifconf ifc;
184 result = ioctl(sockfd, SIOCGIFCONF, &ifc); 188 ifc.ifc_len = sizeof(ifrs);
185 189 ifc.ifc_req = ifrs;
186 for (unsigned int i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++) { 190 result = ioctl(sockfd, SIOCGIFCONF, &ifc);
187 struct ifreq *pifr = &ifrs[i]; 191
188 192 for (unsigned int i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++)
189 ifaces += pifr->ifr_name; 193 {
190 } 194 struct ifreq *pifr = &ifrs[i];
191 } else { 195
192 procFile.open(IO_ReadOnly); 196 ifaces += pifr->ifr_name;
193 QString line; 197 }
194 QTextStream procTs(&procFile); 198 }
195 int loc = -1;
196
197 procTs.readLine(); // eat a line
198 procTs.readLine(); // eat a line
199 while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) {
200 if((loc = line.find(":")) != -1) {
201 ifaces += line.left(loc);
202 }
203 }
204 }
205
206 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) {
207 int flags = 0;
208 if ( m_handledIfaces.contains( (*it) ) ) {
209 qDebug(" %s is handled by a module", (*it).latin1() );
210 continue;
211 }
212// int family;
213 i = NULL;
214
215 strcpy(ifr.ifr_name, (*it).latin1());
216
217 struct ifreq ifcopy;
218 ifcopy = ifr;
219 result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy);
220 flags = ifcopy.ifr_flags;
221 i = new Interface(this, ifr.ifr_name, false);
222 i->setAttached(true);
223 if ((flags & IFF_UP) == IFF_UP)
224 i->setStatus(true);
225 else
226 i->setStatus(false);
227
228 if ((flags & IFF_BROADCAST) == IFF_BROADCAST)
229 i->setHardwareName("Ethernet");
230 else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT)
231 i->setHardwareName("Point to Point");
232 else if ((flags & IFF_MULTICAST) == IFF_MULTICAST)
233 i->setHardwareName("Multicast");
234 else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK)
235 i->setHardwareName("Loopback");
236 else 199 else
237 i->setHardwareName("Unknown"); 200 {
238 201 procFile.open(IO_ReadOnly);
239 qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name); 202 QString line;
240 interfaceNames.insert(i->getInterfaceName(), i); 203 QTextStream procTs(&procFile);
241 updateInterface(i); 204 int loc = -1;
242 connect(i, SIGNAL(updateInterface(Interface *)), 205
243 this, SLOT(updateInterface(Interface *))); 206 procTs.readLine(); // eat a line
244 } 207 procTs.readLine(); // eat a line
245 // now lets ask the plugins too ;) 208 while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null)
246 QMap<Module*, QLibrary*>::Iterator it; 209 {
247 QList<Interface> ilist; 210 if((loc = line.find(":")) != -1)
248 for( it = libraries.begin(); it != libraries.end(); ++it ){ 211 {
249 if(it.key()){ 212 ifaces += line.left(loc);
250 ilist = it.key()->getInterfaces(); 213 }
251 for( i = ilist.first(); i != 0; i = ilist.next() ){ 214 }
252 qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() ); 215 }
253 interfaceNames.insert(i->getInterfaceName(), i); 216
254 updateInterface(i); 217 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it)
255 connect(i, SIGNAL(updateInterface(Interface *)), 218 {
256 this, SLOT(updateInterface(Interface *))); 219 int flags = 0;
220 if ( m_handledIfaces.contains( (*it) ) )
221 {
222 qDebug(" %s is handled by a module", (*it).latin1() );
223 continue;
224 }
225 // int family;
226 i = NULL;
227
228 strcpy(ifr.ifr_name, (*it).latin1());
229
230 struct ifreq ifcopy;
231 ifcopy = ifr;
232 result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy);
233 flags = ifcopy.ifr_flags;
234 i = new Interface(this, ifr.ifr_name, false);
235 i->setAttached(true);
236 if ((flags & IFF_UP) == IFF_UP)
237 i->setStatus(true);
238 else
239 i->setStatus(false);
240
241 if ((flags & IFF_BROADCAST) == IFF_BROADCAST)
242 i->setHardwareName("Ethernet");
243 else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT)
244 i->setHardwareName("Point to Point");
245 else if ((flags & IFF_MULTICAST) == IFF_MULTICAST)
246 i->setHardwareName("Multicast");
247 else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK)
248 i->setHardwareName("Loopback");
249 else
250 i->setHardwareName("Unknown");
251
252 qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name);
253 interfaceNames.insert(i->getInterfaceName(), i);
254 updateInterface(i);
255 connect(i, SIGNAL(updateInterface(Interface *)),
256 this, SLOT(updateInterface(Interface *)));
257 }
258 // now lets ask the plugins too ;)
259 QMap<Module*, QLibrary*>::Iterator it;
260 QList<Interface> ilist;
261 for( it = libraries.begin(); it != libraries.end(); ++it )
262 {
263 if(it.key())
264 {
265 ilist = it.key()->getInterfaces();
266 for( i = ilist.first(); i != 0; i = ilist.next() )
267 {
268 qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() );
269 interfaceNames.insert(i->getInterfaceName(), i);
270 updateInterface(i);
271 connect(i, SIGNAL(updateInterface(Interface *)),
272 this, SLOT(updateInterface(Interface *)));
273 }
257 } 274 }
258 } 275 }
259 }
260} 276}
@@ -266,26 +282,30 @@ void MainWindowImp::getAllInterfaces(){
266 */ 282 */
267void MainWindowImp::loadModules(const QString &path){ 283void MainWindowImp::loadModules(const QString &path)
284{
268#ifdef DEBUG 285#ifdef DEBUG
269 qDebug("MainWindowImp::loadModules: %s", path.latin1()); 286 qDebug("MainWindowImp::loadModules: %s", path.latin1());
270#endif 287#endif
271 QDir d(path); 288 QDir d(path);
272 if(!d.exists()) 289 if(!d.exists())
273 return; 290 return;
274 291
275 // Don't want sym links 292 // Don't want sym links
276 d.setFilter( QDir::Files | QDir::NoSymLinks ); 293 d.setFilter( QDir::Files | QDir::NoSymLinks );
277 const QFileInfoList *list = d.entryInfoList(); 294 const QFileInfoList *list = d.entryInfoList();
278 QFileInfoListIterator it( *list ); 295 QFileInfoListIterator it( *list );
279 QFileInfo *fi; 296 QFileInfo *fi;
280 while ( (fi=it.current()) ) { 297 while ( (fi=it.current()) )
298 {
281#ifdef QWS 299#ifdef QWS
282 if(fi->fileName().contains(".so")){ 300 if(fi->fileName().contains(".so"))
301 {
283#else 302#else
284 if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")){ 303 if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_"))
304 {
285#endif 305#endif
286 loadPlugin(path + "/" + fi->fileName()); 306 loadPlugin(path + "/" + fi->fileName());
287 qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1()); 307 qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1());
308 }
309 ++it;
288 } 310 }
289 ++it;
290 }
291} 311}
@@ -298,51 +318,56 @@ void MainWindowImp::loadModules(const QString &path){
298 */ 318 */
299Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString){ 319Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString)
320{
300#ifdef DEBUG 321#ifdef DEBUG
301 qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1()); 322 qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1());
302#endif 323#endif
303#ifdef QWS 324#ifdef QWS
304 QLibrary *lib = new QLibrary(pluginFileName); 325 QLibrary *lib = new QLibrary(pluginFileName);
305 void *functionPointer = lib->resolve(resolveString); 326 void *functionPointer = lib->resolve(resolveString);
306 if( !functionPointer ){ 327 if( !functionPointer )
328 {
307#ifdef DEBUG 329#ifdef DEBUG
308 qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1()); 330 qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1());
309#endif 331#endif
310 delete lib; 332 delete lib;
311 return NULL; 333 return NULL;
312 } 334 }
313 // Try to get an object. 335 // Try to get an object.
314 Module *object = ((Module* (*)()) functionPointer)(); 336 Module *object = ((Module* (*)()) functionPointer)();
315 if(object == NULL){ 337 if(object == NULL)
338 {
316#ifdef DEBUG 339#ifdef DEBUG
317 qDebug("MainWindowImp: Couldn't create object, but did load library!"); 340 qDebug("MainWindowImp: Couldn't create object, but did load library!");
318#endif 341#endif
319 delete lib; 342 delete lib;
320 return NULL; 343 return NULL;
321 } 344 }
322 345
323 m_handledIfaces += object->handledInterfaceNames(); 346 m_handledIfaces += object->handledInterfaceNames();
324 // Store for deletion later 347 // Store for deletion later
325 libraries.insert(object, lib); 348 libraries.insert(object, lib);
326 return object; 349 return object;
327 350
328#else 351#else
329 QLibrary *lib = loader->library(pluginFileName); 352 QLibrary *lib = loader->library(pluginFileName);
330 if( !lib || !lib->hasSymbol(resolveString) ){ 353 if( !lib || !lib->hasSymbol(resolveString) )
331 qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); 354 {
332 return NULL; 355 qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
333 } 356 return NULL;
334 // Try to get an object. 357 }
335 Module *object = ((Module* (*)()) lib->symbol(resolveString))(); 358 // Try to get an object.
336 if(object == NULL){ 359 Module *object = ((Module* (*)()) lib->symbol(resolveString))();
360 if(object == NULL)
361 {
337#ifdef DEBUG 362#ifdef DEBUG
338 qDebug("MainWindowImp: Couldn't create object, but did load library!"); 363 qDebug("MainWindowImp: Couldn't create object, but did load library!");
339#endif 364#endif
340 return NULL; 365 return NULL;
341 } 366 }
342#ifdef DEBUG 367#ifdef DEBUG
343 qDebug("MainWindowImp::loadPlugin:: Found object, storing."); 368 qDebug("MainWindowImp::loadPlugin:: Found object, storing.");
344#endif 369#endif
345 // Store for deletion later 370 // Store for deletion later
346 libraries.insert(object, lib); 371 libraries.insert(object, lib);
347 return object; 372 return object;
348#endif 373#endif
@@ -354,36 +379,43 @@ Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &
354 */ 379 */
355void MainWindowImp::addClicked(){ 380void MainWindowImp::addClicked()
356 QMap<Module*, QLibrary*>::Iterator it; 381{
357 QMap<QString, QString> list; 382 QMap<Module*, QLibrary*>::Iterator it;
358 QMap<QString, Module*> newInterfaceOwners; 383 QMap<QString, QString> list;
359 384 QMap<QString, Module*> newInterfaceOwners;
360 for( it = libraries.begin(); it != libraries.end(); ++it ){ 385
361 if(it.key()){ 386 for( it = libraries.begin(); it != libraries.end(); ++it )
362 (it.key())->possibleNewInterfaces(list); 387 {
363 } 388 if(it.key())
364 } 389 {
365 // See if the list has anything that we can add. 390 (it.key())->possibleNewInterfaces(list);
366 if(list.count() == 0){ 391 }
367 QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok); 392 }
368 return; 393 // See if the list has anything that we can add.
369 } 394 if(list.count() == 0)
370 AddConnectionImp addNewConnection(this, "AddConnectionImp", true); 395 {
371 addNewConnection.addConnections(list); 396 QMessageBox::information(this, "Sorry", "Nothing to add.", QMessageBox::Ok);
372 addNewConnection.showMaximized(); 397 return;
373 if(QDialog::Accepted == addNewConnection.exec()){ 398 }
374 QListViewItem *item = addNewConnection.registeredServicesList->currentItem(); 399 AddConnectionImp addNewConnection(this, "AddConnectionImp", true);
375 if(!item) 400 addNewConnection.addConnections(list);
376 return; 401 if( QDialog::Accepted == QPEApplication::execDialog( &addNewConnection ) )
377 402 {
378 for( it = libraries.begin(); it != libraries.end(); ++it ){ 403 QListViewItem *item = addNewConnection.registeredServicesList->currentItem();
379 if(it.key()){ 404 if(!item)
380 Interface *i = (it.key())->addNewInterface(item->text(0)); 405 return;
381 if(i){ 406
382 qDebug("iface name %s",i->getInterfaceName().latin1()); 407 for( it = libraries.begin(); it != libraries.end(); ++it )
383 interfaceNames.insert(i->getInterfaceName(), i); 408 {
384 updateInterface(i); 409 if(it.key())
410 {
411 Interface *i = (it.key())->addNewInterface(item->text(0));
412 if(i)
413 {
414 qDebug("iface name %s",i->getInterfaceName().latin1());
415 interfaceNames.insert(i->getInterfaceName(), i);
416 updateInterface(i);
417 }
418 }
385 } 419 }
386 }
387 } 420 }
388 }
389} 421}
@@ -394,21 +426,26 @@ void MainWindowImp::addClicked(){
394 */ 426 */
395void MainWindowImp::removeClicked(){ 427void MainWindowImp::removeClicked()
396 QListViewItem *item = connectionList->currentItem(); 428{
397 if(!item) { 429 QListViewItem *item = connectionList->currentItem();
398 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); 430 if(!item)
399 return; 431 {
400 } 432 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
401 433 return;
402 Interface *i = interfaceItems[item]; 434 }
403 if(i->getModuleOwner() == NULL){ 435
404 QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok); 436 Interface *i = interfaceItems[item];
405 } 437 if(i->getModuleOwner() == NULL)
406 else{ 438 {
407 if(!i->getModuleOwner()->remove(i)) 439 QMessageBox::information(this, "Can't remove interface.", "Interface is built in.", QMessageBox::Ok);
408 QMessageBox::information(this, tr("Error"), tr("Unable to remove."), QMessageBox::Ok); 440 }
409 else{ 441 else
410 delete item; 442 {
411// QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok); 443 if(!i->getModuleOwner()->remove(i))
412 } 444 QMessageBox::information(this, tr("Error"), tr("Unable to remove."), QMessageBox::Ok);
413 } 445 else
446 {
447 delete item;
448 // QMessageBox::information(this, "Success", "Interface was removed.", QMessageBox::Ok);
449 }
450 }
414} 451}
@@ -420,27 +457,31 @@ void MainWindowImp::removeClicked(){
420 */ 457 */
421void MainWindowImp::configureClicked(){ 458void MainWindowImp::configureClicked()
422 QListViewItem *item = connectionList->currentItem(); 459{
423 if(!item){ 460 QListViewItem *item = connectionList->currentItem();
424 QMessageBox::information(this, tr("Sorry"),tr("Please select an interface first."), QMessageBox::Ok); 461 if(!item)
425 return; 462 {
426 } 463 QMessageBox::information(this, tr("Sorry"),tr("Please select an interface first."), QMessageBox::Ok);
427 464 return;
428 QString currentProfileText = currentProfileLabel->text(); 465 }
429 if(currentProfileText.upper() == "ALL"); 466
467 QString currentProfileText = currentProfileLabel->text();
468 if(currentProfileText.upper() == "ALL");
430 currentProfileText = ""; 469 currentProfileText = "";
431 470
432 Interface *i = interfaceItems[item]; 471 Interface *i = interfaceItems[item];
433 472
434 if(i->getModuleOwner()){ 473 if(i->getModuleOwner())
435 QWidget *moduleConfigure = i->getModuleOwner()->configure(i); 474 {
436 if(moduleConfigure != NULL){ 475 QWidget *moduleConfigure = i->getModuleOwner()->configure(i);
437 i->getModuleOwner()->setProfile(currentProfileText); 476 if(moduleConfigure != NULL)
438 moduleConfigure->showMaximized(); 477 {
439 return; 478 i->getModuleOwner()->setProfile(currentProfileText);
479 QPEApplication::showWidget( moduleConfigure );
480 return;
481 }
440 } 482 }
441 }
442 483
443 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose | Qt::WStyle_ContextHelp ); 484 InterfaceSetupImpDialog *configure = new InterfaceSetupImpDialog(this, "InterfaceSetupImp", i, true, Qt::WDestructiveClose | Qt::WStyle_ContextHelp );
444 configure->setProfile(currentProfileText); 485 configure->setProfile(currentProfileText);
445 configure->showMaximized(); 486 QPEApplication::showDialog( configure );
446} 487}
@@ -452,27 +493,31 @@ void MainWindowImp::configureClicked(){
452 */ 493 */
453void MainWindowImp::informationClicked(){ 494void MainWindowImp::informationClicked()
454 QListViewItem *item = connectionList->currentItem(); 495{
455 if(!item){ 496 QListViewItem *item = connectionList->currentItem();
456 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok); 497 if(!item)
457 return; 498 {
458 } 499 QMessageBox::information(this, "Sorry","Please select an interface First.", QMessageBox::Ok);
459 500 return;
460 Interface *i = interfaceItems[item]; 501 }
461// if(!i->isAttached()){ 502
462// QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok); 503 Interface *i = interfaceItems[item];
463// return; 504 // if(!i->isAttached()){
464// } 505 // QMessageBox::information(this, "Sorry","No information about\na disconnected interface.", QMessageBox::Ok);
465 506 // return;
466 if(i->getModuleOwner()){ 507 // }
467 QWidget *moduleInformation = i->getModuleOwner()->information(i); 508
468 if(moduleInformation != NULL){ 509 if(i->getModuleOwner())
469 moduleInformation->showMaximized(); 510 {
511 QWidget *moduleInformation = i->getModuleOwner()->information(i);
512 if(moduleInformation != NULL)
513 {
514 QPEApplication::showWidget( moduleInformation );
470#ifdef DEBUG 515#ifdef DEBUG
471 qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed."); 516 qDebug("MainWindowImp::informationClicked:: Module owner has created, we showed.");
472#endif 517#endif
473 return; 518 return;
519 }
474 } 520 }
475 } 521 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp);
476 InterfaceInformationImp *information = new InterfaceInformationImp(this, "InterfaceSetupImp", i, Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog | Qt::WStyle_ContextHelp); 522 QPEApplication::showWidget( information );
477 information->showMaximized();
478} 523}
@@ -483,63 +528,68 @@ void MainWindowImp::informationClicked(){
483 */ 528 */
484void MainWindowImp::updateInterface(Interface *i){ 529void MainWindowImp::updateInterface(Interface *i)
485 if(!advancedUserMode){ 530{
486 if(i->getInterfaceName() == "lo") 531 if(!advancedUserMode)
487 return; 532 {
488 } 533 if(i->getInterfaceName() == "lo")
489 534 return;
490 QListViewItem *item = NULL; 535 }
491 536
492 // Find the interface, making it if needed. 537 QListViewItem *item = NULL;
493 if(items.find(i) == items.end()){ 538
494 item = new QListViewItem(connectionList, "", "", ""); 539 // Find the interface, making it if needed.
495 // See if you can't find a module owner for this interface 540 if(items.find(i) == items.end())
496 QMap<Module*, QLibrary*>::Iterator it; 541 {
497 for( it = libraries.begin(); it != libraries.end(); ++it ){ 542 item = new QListViewItem(connectionList, "", "", "");
498 if(it.key()->isOwner(i)) 543 // See if you can't find a module owner for this interface
499 i->setModuleOwner(it.key()); 544 QMap<Module*, QLibrary*>::Iterator it;
545 for( it = libraries.begin(); it != libraries.end(); ++it )
546 {
547 if(it.key()->isOwner(i))
548 i->setModuleOwner(it.key());
549 }
550 items.insert(i, item);
551 interfaceItems.insert(item, i);
500 } 552 }
501 items.insert(i, item); 553 else
502 interfaceItems.insert(item, i); 554 item = items[i];
503 }
504 else
505 item = items[i];
506 555
507 // Update the icons and information 556 // Update the icons and information
508#ifdef QWS 557#ifdef QWS
509 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down"))); 558 item->setPixmap(0, (Resource::loadPixmap(i->getStatus() ? "up": "down")));
510#else 559#else
511 item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down"))); 560 item->setPixmap(0, (SmallIcon(i->getStatus() ? "up": "down")));
512#endif 561#endif
513 562
514 QString typeName = "lan"; 563 QString typeName = "lan";
515 if(i->getInterfaceName() == "lo") 564 if(i->getInterfaceName() == "lo")
516 typeName = "lo"; 565 typeName = "lo";
517 if(i->getInterfaceName().contains("irda")) 566 if(i->getInterfaceName().contains("irda"))
518 typeName = "irda"; 567 typeName = "irda";
519 if(i->getInterfaceName().contains("wlan")) 568 if(i->getInterfaceName().contains("wlan"))
520 typeName = "wlan"; 569 typeName = "wlan";
521 if(i->getInterfaceName().contains("usb")) 570 if(i->getInterfaceName().contains("usb"))
522 typeName = "usb"; 571 typeName = "usb";
523 572
524 if(!i->isAttached()) 573 if(!i->isAttached())
525 typeName = "connect_no"; 574 typeName = "connect_no";
526 // Actually try to use the Module 575 // Actually try to use the Module
527 if(i->getModuleOwner() != NULL) 576 if(i->getModuleOwner() != NULL)
528 typeName = i->getModuleOwner()->getPixmapName(i); 577 typeName = i->getModuleOwner()->getPixmapName(i);
529 578
530#ifdef QWS 579#ifdef QWS
531 item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName))); 580 item->setPixmap(1, (Resource::loadPixmap(QString("networksettings/") + typeName)));
532#else 581#else
533 item->setPixmap(1, (SmallIcon(typeName))); 582 item->setPixmap(1, (SmallIcon(typeName)));
534#endif 583#endif
535 item->setText(2, i->getHardwareName()); 584 item->setText(2, i->getHardwareName());
536 item->setText(3, QString("(%1)").arg(i->getInterfaceName())); 585 item->setText(3, QString("(%1)").arg(i->getInterfaceName()));
537 item->setText(4, (i->getStatus()) ? i->getIp() : QString("")); 586 item->setText(4, (i->getStatus()) ? i->getIp() : QString(""));
538} 587}
539 588
540void MainWindowImp::newProfileChanged(const QString& newText){ 589void MainWindowImp::newProfileChanged(const QString& newText)
541 if(newText.length() > 0) 590{
542 newProfileButton->setEnabled(true); 591 if(newText.length() > 0)
543 else 592 newProfileButton->setEnabled(true);
544 newProfileButton->setEnabled(false); 593 else
594 newProfileButton->setEnabled(false);
545} 595}
@@ -551,10 +601,12 @@ void MainWindowImp::newProfileChanged(const QString& newText){
551 */ 601 */
552void MainWindowImp::addProfile(){ 602void MainWindowImp::addProfile()
553 QString newProfileName = newProfile->text(); 603{
554 if(profiles.grep(newProfileName).count() > 0){ 604 QString newProfileName = newProfile->text();
555 QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok); 605 if(profiles.grep(newProfileName).count() > 0)
556 return; 606 {
557 } 607 QMessageBox::information(this, "Can't Add","Profile already exists.", QMessageBox::Ok);
558 profiles.append(newProfileName); 608 return;
559 profilesList->insertItem(newProfileName); 609 }
610 profiles.append(newProfileName);
611 profilesList->insertItem(newProfileName);
560} 612}
@@ -565,46 +617,55 @@ void MainWindowImp::addProfile(){
565 */ 617 */
566void MainWindowImp::removeProfile(){ 618void MainWindowImp::removeProfile()
567 if(profilesList->count() <= 1){ 619{
568 QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok); 620 if(profilesList->count() <= 1)
569 return; 621 {
570 } 622 QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok);
571 QString profileToRemove = profilesList->currentText(); 623 return;
572 if(profileToRemove == "All"){ 624 }
573 QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok); 625 QString profileToRemove = profilesList->currentText();
574 return; 626 if(profileToRemove == "All")
575 } 627 {
576 // Can't remove the curent profile 628 QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok);
577 if(profileToRemove == currentProfileLabel->text()){ 629 return;
578 QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok); 630 }
579 return; 631 // Can't remove the curent profile
580 632 if(profileToRemove == currentProfileLabel->text())
581 } 633 {
582 634 QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok);
583 if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok){ 635 return;
584 profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); 636
585 profilesList->clear(); 637 }
586 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) 638
587 profilesList->insertItem((*it)); 639 if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
588 640 {
589 // Remove any interface settings and mappings. 641 profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), ""));
590 Interfaces interfaces; 642 profilesList->clear();
591 // Go through them one by one 643 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
592 QMap<Interface*, QListViewItem*>::Iterator it; 644 profilesList->insertItem((*it));
593 for( it = items.begin(); it != items.end(); ++it ){ 645
594 QString interfaceName = it.key()->getInterfaceName(); 646 // Remove any interface settings and mappings.
595 qDebug(interfaceName.latin1()); 647 Interfaces interfaces;
596 if(interfaces.setInterface(interfaceName + "_" + profileToRemove)){ 648 // Go through them one by one
597 interfaces.removeInterface(); 649 QMap<Interface*, QListViewItem*>::Iterator it;
598 if(interfaces.setMapping(interfaceName)){ 650 for( it = items.begin(); it != items.end(); ++it )
599 if(profilesList->count() == 1) 651 {
600 interfaces.removeMapping(); 652 QString interfaceName = it.key()->getInterfaceName();
601 else{ 653 qDebug(interfaceName.latin1());
602 interfaces.removeMap("map", interfaceName + "_" + profileToRemove); 654 if(interfaces.setInterface(interfaceName + "_" + profileToRemove))
603 } 655 {
656 interfaces.removeInterface();
657 if(interfaces.setMapping(interfaceName))
658 {
659 if(profilesList->count() == 1)
660 interfaces.removeMapping();
661 else
662 {
663 interfaces.removeMap("map", interfaceName + "_" + profileToRemove);
664 }
665 }
666 interfaces.write();
667 break;
668 }
604 } 669 }
605 interfaces.write();
606 break;
607 }
608 } 670 }
609 }
610} 671}
@@ -615,28 +676,34 @@ void MainWindowImp::removeProfile(){
615 */ 676 */
616void MainWindowImp::changeProfile(){ 677void MainWindowImp::changeProfile()
617 if(profilesList->currentItem() == -1){ 678{
618 QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok); 679 if(profilesList->currentItem() == -1)
619 return; 680 {
620 } 681 QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok);
621 QString newProfile = profilesList->text(profilesList->currentItem()); 682 return;
622 if(newProfile != currentProfileLabel->text()){ 683 }
623 currentProfileLabel->setText(newProfile); 684 QString newProfile = profilesList->text(profilesList->currentItem());
624 QFile::remove(scheme); 685 if(newProfile != currentProfileLabel->text())
625 QFile file(scheme); 686 {
626 if ( file.open(IO_ReadWrite) ) { 687 currentProfileLabel->setText(newProfile);
627 QTextStream stream( &file ); 688 QFile::remove(scheme);
628 stream << QString("SCHEME=%1").arg(newProfile); 689 QFile file(scheme);
629 file.close(); 690 if ( file.open(IO_ReadWrite) )
630 } 691 {
631 // restart all up devices? 692 QTextStream stream( &file );
632 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok){ 693 stream << QString("SCHEME=%1").arg(newProfile);
633 // Go through them one by one 694 file.close();
634 QMap<Interface*, QListViewItem*>::Iterator it; 695 }
635 for( it = items.begin(); it != items.end(); ++it ){ 696 // restart all up devices?
636 if(it.key()->getStatus() == true) 697 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok)
637 it.key()->restart(); 698 {
638 } 699 // Go through them one by one
639 } 700 QMap<Interface*, QListViewItem*>::Iterator it;
640 } 701 for( it = items.begin(); it != items.end(); ++it )
641 // TODO change the profile in the modules 702 {
703 if(it.key()->getStatus() == true)
704 it.key()->restart();
705 }
706 }
707 }
708 // TODO change the profile in the modules
642} 709}
@@ -646,5 +713,5 @@ void MainWindowImp::makeChannel()
646{ 713{
647 channel = new QCopChannel( "QPE/Application/networksettings", this ); 714 channel = new QCopChannel( "QPE/Application/networksettings", this );
648 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 715 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)),
649 this, SLOT(receive(const QCString&, const QByteArray&)) ); 716 this, SLOT(receive(const QCString&, const QByteArray&)) );
650} 717}
@@ -655,3 +722,4 @@ void MainWindowImp::receive(const QCString &msg, const QByteArray &arg)
655 qDebug("MainWindowImp::receive QCop msg >"+msg+"<"); 722 qDebug("MainWindowImp::receive QCop msg >"+msg+"<");
656 if (msg == "raise") { 723 if (msg == "raise")
724 {
657 raise(); 725 raise();
@@ -665,14 +733,16 @@ void MainWindowImp::receive(const QCString &msg, const QByteArray &arg)
665 733
666 QMap<Module*, QLibrary*>::Iterator it; 734 QMap<Module*, QLibrary*>::Iterator it;
667 for( it = libraries.begin(); it != libraries.end(); ++it ){ 735 for( it = libraries.begin(); it != libraries.end(); ++it )
668 qDebug("plugin >%s<", it.key()->type().latin1() ); 736 {
669 if(it.key()->type() == dest){ 737 qDebug("plugin >%s<", it.key()->type().latin1() );
670 it.key()->receive( param, arg ); 738 if(it.key()->type() == dest)
671 found = true; 739 {
672 } 740 it.key()->receive( param, arg );
673 } 741 found = true;
742 }
743 }
674 744
675 745
676 if (found) QPEApplication::setKeepRunning(); 746 if (found) QPEApplication::setKeepRunning();
677 else qDebug("Huh what do ya want"); 747 else qDebug("Huh what do ya want");
678} 748}
diff --git a/noncore/settings/networksettings/ppp/accounts.cpp b/noncore/settings/networksettings/ppp/accounts.cpp
index 28d8732..b8a1925a 100644
--- a/noncore/settings/networksettings/ppp/accounts.cpp
+++ b/noncore/settings/networksettings/ppp/accounts.cpp
@@ -26,4 +26,12 @@
26 26
27#include "accounts.h"
28#include "authwidget.h"
29#include "pppdata.h"
30#include "edit.h"
31
32/* OPIE */
33#include <qpe/qpeapplication.h>
34
35/* QT */
27#include <qdir.h> 36#include <qdir.h>
28#include <stdlib.h>
29#include <qlayout.h> 37#include <qlayout.h>
@@ -33,3 +41,2 @@
33#include <qmessagebox.h> 41#include <qmessagebox.h>
34
35#include <qapplication.h> 42#include <qapplication.h>
@@ -39,6 +46,4 @@
39 46
40#include "accounts.h" 47/* STD */
41#include "authwidget.h" 48#include <stdlib.h>
42#include "pppdata.h"
43#include "edit.h"
44 49
@@ -48,16 +53,16 @@ void parseargs(char* buf, char** args);
48AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WFlags f ) 53AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WFlags f )
49 : ChooserWidget( pd, parent, name, f ) 54 : ChooserWidget( pd, parent, name, f )
50{ 55{
51 56
52 QWhatsThis::add(edit_b, tr("Allows you to modify the selected account")); 57 QWhatsThis::add(edit_b, tr("Allows you to modify the selected account"));
53 QWhatsThis::add(new_b, tr("Create a new dialup connection\n" 58 QWhatsThis::add(new_b, tr("Create a new dialup connection\n"
54 "to the Internet")); 59 "to the Internet"));
55 QWhatsThis::add(copy_b, 60 QWhatsThis::add(copy_b,
56 tr("Makes a copy of the selected account. All\n" 61 tr("Makes a copy of the selected account. All\n"
57 "settings of the selected account are copied\n" 62 "settings of the selected account are copied\n"
58 "to a new account, that you can modify to fit your\n" 63 "to a new account, that you can modify to fit your\n"
59 "needs")); 64 "needs"));
60 QWhatsThis::add(delete_b, 65 QWhatsThis::add(delete_b,
61 tr("<p>Deletes the selected account\n\n" 66 tr("<p>Deletes the selected account\n\n"
62 "<font color=\"red\"><b>Use with care!</b></font>")); 67 "<font color=\"red\"><b>Use with care!</b></font>"));
63 68
@@ -65,11 +70,12 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WF
65 70
66 copy_b->setEnabled( false ); //FIXME 71 copy_b->setEnabled( false ); //FIXME
67 // delete_b->setEnabled( false ); //FIXME 72 // delete_b->setEnabled( false ); //FIXME
68 73
69 listListbox->insertStringList(_pppdata->getAccountList()); 74 listListbox->insertStringList(_pppdata->getAccountList());
70 75
71 for (uint i = 0; i < listListbox->count(); i++){ 76 for (uint i = 0; i < listListbox->count(); i++)
72 if ( listListbox->text(i) == _pppdata->accname() ) 77 {
73 listListbox->setCurrentItem( i ); 78 if ( listListbox->text(i) == _pppdata->accname() )
74 } 79 listListbox->setCurrentItem( i );
80 }
75} 81}
@@ -78,3 +84,4 @@ AccountWidget::AccountWidget( PPPData *pd, QWidget *parent, const char *name, WF
78 84
79void AccountWidget::slotListBoxSelect(int idx) { 85void AccountWidget::slotListBoxSelect(int idx)
86{
80 bool ok = _pppdata->setAccount( listListbox->text(idx) ); 87 bool ok = _pppdata->setAccount( listListbox->text(idx) );
@@ -83,15 +90,17 @@ void AccountWidget::slotListBoxSelect(int idx) {
83 edit_b->setEnabled(ok); 90 edit_b->setEnabled(ok);
84//FIXME copy_b->setEnabled(ok); 91 //FIXME copy_b->setEnabled(ok);
85} 92}
86 93
87void AccountWidget::edit() { 94void AccountWidget::edit()
88 _pppdata->setAccount(listListbox->text(listListbox->currentItem())); 95{
96 _pppdata->setAccount(listListbox->text(listListbox->currentItem()));
89 97
90 int result = doTab(); 98 int result = doTab();
91 99
92 if(result == QDialog::Accepted) { 100 if(result == QDialog::Accepted)
93 listListbox->changeItem(_pppdata->accname(),listListbox->currentItem()); 101 {
94// emit resetaccounts(); 102 listListbox->changeItem(_pppdata->accname(),listListbox->currentItem());
95 _pppdata->save(); 103 // emit resetaccounts();
96 } 104 _pppdata->save();
105 }
97} 106}
@@ -99,12 +108,14 @@ void AccountWidget::edit() {
99 108
100void AccountWidget::create() { 109void AccountWidget::create()
110{
101 111
102// if(listListbox->count() == MAX_ACCOUNTS) { 112 // if(listListbox->count() == MAX_ACCOUNTS) {
103// QMessageBox::information(this, "sorry", 113 // QMessageBox::information(this, "sorry",
104// tr("Maximum number of accounts reached.")); 114 // tr("Maximum number of accounts reached."));
105// return; 115 // return;
106// } 116 // }
107 117
108 int result; 118 int result;
109 if (_pppdata->newaccount() == -1){ 119 if (_pppdata->newaccount() == -1)
120 {
110 qDebug("_pppdata->newaccount() == -1"); 121 qDebug("_pppdata->newaccount() == -1");
@@ -114,3 +125,4 @@ void AccountWidget::create() {
114 125
115 if(result == QDialog::Accepted) { 126 if(result == QDialog::Accepted)
127 {
116 listListbox->insertItem(_pppdata->accname()); 128 listListbox->insertItem(_pppdata->accname());
@@ -119,3 +131,4 @@ void AccountWidget::create() {
119 _pppdata->save(); 131 _pppdata->save();
120 } else 132 }
133 else
121 _pppdata->deleteAccount(); 134 _pppdata->deleteAccount();
@@ -124,18 +137,20 @@ void AccountWidget::create() {
124 137
125void AccountWidget::copy() { 138void AccountWidget::copy()
126// if(listListbox->count() == MAX_ACCOUNTS) { 139{
127// QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached.")); 140 // if(listListbox->count() == MAX_ACCOUNTS) {
128// return; 141 // QMessageBox::information(this, "sorry", tr("Maximum number of accounts reached."));
129// } 142 // return;
130 143 // }
131 if(listListbox->currentItem()<0) { 144
132 QMessageBox::information(this, "sorry", tr("No account selected.")); 145 if(listListbox->currentItem()<0)
133 return; 146 {
134 } 147 QMessageBox::information(this, "sorry", tr("No account selected."));
148 return;
149 }
135 150
136 _pppdata->copyaccount(listListbox->currentText()); 151 _pppdata->copyaccount(listListbox->currentText());
137 152
138 listListbox->insertItem(_pppdata->accname()); 153 listListbox->insertItem(_pppdata->accname());
139// emit resetaccounts(); 154 // emit resetaccounts();
140 _pppdata->save(); 155 _pppdata->save();
141} 156}
@@ -143,21 +158,22 @@ void AccountWidget::copy() {
143 158
144void AccountWidget::remove() { 159void AccountWidget::remove()
160{
145 161
146 QString s = tr("Are you sure you want to delete\nthe account \"%1\"?") 162 QString s = tr("Are you sure you want to delete\nthe account \"%1\"?")
147 .arg(listListbox->text(listListbox->currentItem())); 163 .arg(listListbox->text(listListbox->currentItem()));
148 164
149 if(QMessageBox::warning(this,tr("Confirm"),s, 165 if(QMessageBox::warning(this,tr("Confirm"),s,
150 QMessageBox::Yes,QMessageBox::No 166 QMessageBox::Yes,QMessageBox::No
151 ) != QMessageBox::Yes) 167 ) != QMessageBox::Yes)
152 return; 168 return;
153 169
154 if(_pppdata->deleteAccount(listListbox->text(listListbox->currentItem()))) 170 if(_pppdata->deleteAccount(listListbox->text(listListbox->currentItem())))
155 listListbox->removeItem(listListbox->currentItem()); 171 listListbox->removeItem(listListbox->currentItem());
156 172
157 173
158// emit resetaccounts(); 174 // emit resetaccounts();
159// _pppdata->save(); 175 // _pppdata->save();
160 176
161 177
162 slotListBoxSelect(listListbox->currentItem()); 178 slotListBoxSelect(listListbox->currentItem());
163 179
@@ -166,3 +182,4 @@ void AccountWidget::remove() {
166 182
167int AccountWidget::doTab(){ 183int AccountWidget::doTab()
184{
168 QDialog *dlg = new QDialog( 0, "newAccount", true, Qt::WStyle_ContextHelp ); 185 QDialog *dlg = new QDialog( 0, "newAccount", true, Qt::WStyle_ContextHelp );
@@ -177,6 +194,9 @@ int AccountWidget::doTab(){
177 194
178 if(_pppdata->accname().isEmpty()) { 195 if(_pppdata->accname().isEmpty())
196 {
179 dlg->setCaption(tr("New Account")); 197 dlg->setCaption(tr("New Account"));
180 isnewaccount = true; 198 isnewaccount = true;
181 } else { 199 }
200 else
201 {
182 QString tit = tr("Edit Account: "); 202 QString tit = tr("Edit Account: ");
@@ -187,3 +207,3 @@ int AccountWidget::doTab(){
187 207
188// // DIAL WIDGET 208 // // DIAL WIDGET
189 dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup"); 209 dial_w = new DialWidget( _pppdata, tabWindow, isnewaccount, "Dial Setup");
@@ -191,7 +211,7 @@ int AccountWidget::doTab(){
191 211
192// // AUTH WIDGET 212 // // AUTH WIDGET
193 auth_w = new AuthWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script")); 213 auth_w = new AuthWidget( _pppdata, tabWindow, isnewaccount, tr("Edit Login Script"));
194 tabWindow->addTab( auth_w, tr("Authentication") ); 214 tabWindow->addTab( auth_w, tr("Authentication") );
195 215
196// // IP WIDGET 216 // // IP WIDGET
197 ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup")); 217 ip_w = new IPWidget( _pppdata, tabWindow, isnewaccount, tr("IP Setup"));
@@ -199,3 +219,3 @@ int AccountWidget::doTab(){
199 219
200// // GATEWAY WIDGET 220 // // GATEWAY WIDGET
201 gateway_w = new GatewayWidget( _pppdata, tabWindow, isnewaccount, tr("Gateway Setup")); 221 gateway_w = new GatewayWidget( _pppdata, tabWindow, isnewaccount, tr("Gateway Setup"));
@@ -203,3 +223,3 @@ int AccountWidget::doTab(){
203 223
204// // DNS WIDGET 224 // // DNS WIDGET
205 dns_w = new DNSWidget( _pppdata, tabWindow, isnewaccount, tr("DNS Servers") ); 225 dns_w = new DNSWidget( _pppdata, tabWindow, isnewaccount, tr("DNS Servers") );
@@ -207,5 +227,5 @@ int AccountWidget::doTab(){
207 227
208// // EXECUTE WIDGET 228 // // EXECUTE WIDGET
209 ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, tr("Execute Programs")); 229 ExecWidget *exec_w = new ExecWidget( _pppdata, tabWindow, isnewaccount, tr("Execute Programs"));
210 tabWindow->addTab( exec_w, tr("Execute") ); 230 tabWindow->addTab( exec_w, tr("Execute") );
211 231
@@ -214,14 +234,20 @@ int AccountWidget::doTab(){
214 234
215 while (!ok){ 235 while (!ok)
216 dlg->showMaximized(); 236 {
217 result = dlg->exec(); 237 result = QPEApplication::execDialog( dlg );
218 ok = true; 238 ok = true;
219 239
220 if(result == QDialog::Accepted) { 240 if(result == QDialog::Accepted)
221 if (!auth_w->check()){ 241 {
242 if (!auth_w->check())
243 {
222 ok = false; 244 ok = false;
223 } else if(!dial_w->save()) { 245 }
246 else if(!dial_w->save())
247 {
224 QMessageBox::critical(this, "error", tr( "You must enter a unique account name")); 248 QMessageBox::critical(this, "error", tr( "You must enter a unique account name"));
225 ok = false; 249 ok = false;
226 }else{ 250 }
251 else
252 {
227 ip_w->save(); 253 ip_w->save();
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp
index 5540946..ff1b11b 100644
--- a/noncore/settings/networksettings/ppp/general.cpp
+++ b/noncore/settings/networksettings/ppp/general.cpp
@@ -26,5 +26,13 @@
26 26
27#include <termios.h> 27#include "general.h"
28#include <string.h> 28#include "interfaceppp.h"
29#include "modeminfo.h"
30#include "modemcmds.h"
31#include "pppdata.h"
29 32
33/* OPIE */
34#include <qpe/config.h>
35#include <qpe/qpeapplication.h>
36
37/* QT */
30#include <qcheckbox.h> 38#include <qcheckbox.h>
@@ -37,119 +45,110 @@
37#include <qwhatsthis.h> 45#include <qwhatsthis.h>
38#include <qpe/config.h>
39// #include <qgroupbox.h>
40 46
47/* STD */
48#include <termios.h>
49#include <string.h>
41 50
42#include "general.h"
43#include "interfaceppp.h"
44//#include "miniterm.h"
45#include "modeminfo.h"
46#include "modemcmds.h"
47//#include "devices.h"
48#include "pppdata.h"
49//#include <klocale.h>
50 51
52ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name )
53 : QWidget(parent, name), _pppdata(pd)
54{
55 int k;
56
57 QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint());
51 58
59 QLabel *label1;
52 60
61 label1 = new QLabel(tr("Modem &name:"), this);
62 tl->addWidget(label1, 0, 0);
53 63
54ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) 64 modemname = new QLineEdit(this, "modemName");
55 : QWidget(parent, name), _pppdata(pd) 65 modemname->setText( _pppdata->devname() );
56{ 66 label1->setBuddy(modemname);
57 int k; 67 tl->addWidget(modemname, 0, 1);
58 68
59 QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint()); 69 label1 = new QLabel(tr("Modem de&vice:"), this);
60 70 tl->addWidget(label1, 1, 0);
61 QLabel *label1; 71
62 72 modemdevice = new QComboBox(false, this);
63 label1 = new QLabel(tr("Modem &name:"), this); 73 modemdevice->setEditable( true );
64 tl->addWidget(label1, 0, 0); 74 modemdevice->setDuplicatesEnabled ( false );
65 75 modemdevice->setInsertionPolicy( QComboBox::AtTop );
66 modemname = new QLineEdit(this, "modemName"); 76 label1->setBuddy(modemdevice);
67 modemname->setText( _pppdata->devname() ); 77
68 label1->setBuddy(modemname); 78 Config cfg("NetworkSetupPPP");
69 tl->addWidget(modemname, 0, 1); 79 cfg.setGroup("Devices_General");
70 80 QStringList devs = cfg.readListEntry("devices",',');
71 label1 = new QLabel(tr("Modem de&vice:"), this); 81 if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0";
72 tl->addWidget(label1, 1, 0); 82 modemdevice->insertStringList( devs );
73 83 tl->addWidget(modemdevice, 1, 1);
74 modemdevice = new QComboBox(false, this); 84
75 modemdevice->setEditable( true ); 85 // connect(modemdevice, SIGNAL(activated(int)),
76 modemdevice->setDuplicatesEnabled ( false ); 86 // SLOT(setmodemdc(int)));
77 modemdevice->setInsertionPolicy( QComboBox::AtTop ); 87 // connect(modemdevice, SIGNAL(textChanged( const QString & ) ),
78 label1->setBuddy(modemdevice); 88 // SLOT( setmodemdc( const QString &) ) );
79 89
80 Config cfg("NetworkSetupPPP"); 90 QString tmp = tr("This specifies the serial port your modem is attached \n"
81 cfg.setGroup("Devices_General"); 91 "to. On Linux/x86, typically this is either /dev/ttyS0 \n"
82 QStringList devs = cfg.readListEntry("devices",','); 92 "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n"
83 if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0"; 93 "\n"
84 modemdevice->insertStringList( devs ); 94 "If you have an internal ISDN card with AT command\n"
85 tl->addWidget(modemdevice, 1, 1); 95 "emulation (most cards under Linux support this), you\n"
86 96 "should select one of the /dev/ttyIx devices.");
87// connect(modemdevice, SIGNAL(activated(int)), 97
88 // SLOT(setmodemdc(int))); 98 QWhatsThis::add(label1,tmp);
89// connect(modemdevice, SIGNAL(textChanged( const QString & ) ), 99 QWhatsThis::add(modemdevice,tmp);
90// SLOT( setmodemdc( const QString &) ) ); 100
91 101
92 QString tmp = tr("This specifies the serial port your modem is attached \n" 102 label1 = new QLabel(tr("&Flow control:"), this);
93 "to. On Linux/x86, typically this is either /dev/ttyS0 \n" 103 tl->addWidget(label1, 2, 0);
94 "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n" 104
95 "\n" 105 flowcontrol = new QComboBox(false, this);
96 "If you have an internal ISDN card with AT command\n" 106 label1->setBuddy(flowcontrol);
97 "emulation (most cards under Linux support this), you\n" 107 flowcontrol->insertItem(tr("Hardware [CRTSCTS]"));
98 "should select one of the /dev/ttyIx devices."); 108 flowcontrol->insertItem(tr("Software [XON/XOFF]"));
99 109 flowcontrol->insertItem(tr("None"));
100 QWhatsThis::add(label1,tmp); 110 tl->addWidget(flowcontrol, 2, 1);
101 QWhatsThis::add(modemdevice,tmp); 111 // connect(flowcontrol, SIGNAL(activated(int)),
102 112 // SLOT(setflowcontrol(int)));
103 113
104 label1 = new QLabel(tr("&Flow control:"), this); 114 tmp = tr("<p>Specifies how the serial port and modem\n"
105 tl->addWidget(label1, 2, 0); 115 "communicate. You should not change this unless\n"
106 116 "you know what you are doing.\n"
107 flowcontrol = new QComboBox(false, this); 117 "\n"
108 label1->setBuddy(flowcontrol); 118 "<b>Default</b>: CRTSCTS");
109 flowcontrol->insertItem(tr("Hardware [CRTSCTS]")); 119
110 flowcontrol->insertItem(tr("Software [XON/XOFF]")); 120 QWhatsThis::add(label1,tmp);
111 flowcontrol->insertItem(tr("None")); 121 QWhatsThis::add(flowcontrol,tmp);
112 tl->addWidget(flowcontrol, 2, 1); 122
113// connect(flowcontrol, SIGNAL(activated(int)), 123 QLabel *labelenter = new QLabel(tr("&Line termination:"), this);
114 // SLOT(setflowcontrol(int))); 124 tl->addWidget(labelenter, 3, 0);
115 125
116 tmp = tr("<p>Specifies how the serial port and modem\n" 126 enter = new QComboBox(false, this);
117 "communicate. You should not change this unless\n" 127 labelenter->setBuddy(enter);
118 "you know what you are doing.\n" 128 enter->insertItem("CR");
119 "\n" 129 enter->insertItem("LF");
120 "<b>Default</b>: CRTSCTS"); 130 enter->insertItem("CR/LF");
121 131 tl->addWidget(enter, 3, 1);
122 QWhatsThis::add(label1,tmp); 132 // connect(enter, SIGNAL(activated(int)), SLOT(setenter(int)));
123 QWhatsThis::add(flowcontrol,tmp); 133 tmp = tr("<p>Specifies how AT commands are sent to your\n"
124 134 "modem. Most modems will work fine with the\n"
125 QLabel *labelenter = new QLabel(tr("&Line termination:"), this); 135 "default <i>CR/LF</i>. If your modem does not react\n"
126 tl->addWidget(labelenter, 3, 0); 136 "to the init string, you should try different\n"
127 137 "settings here\n"
128 enter = new QComboBox(false, this); 138 "\n"
129 labelenter->setBuddy(enter); 139 "<b>Default</b>: CR/LF");
130 enter->insertItem("CR"); 140
131 enter->insertItem("LF"); 141 QWhatsThis::add(labelenter,tmp);
132 enter->insertItem("CR/LF"); 142 QWhatsThis::add(enter, tmp);
133 tl->addWidget(enter, 3, 1); 143
134// connect(enter, SIGNAL(activated(int)), SLOT(setenter(int))); 144 QLabel *baud_label = new QLabel(tr("Co&nnection speed:"), this);
135 tmp = tr("<p>Specifies how AT commands are sent to your\n" 145 tl->addWidget(baud_label, 4, 0);
136 "modem. Most modems will work fine with the\n" 146 baud_c = new QComboBox(this);
137 "default <i>CR/LF</i>. If your modem does not react\n" 147 baud_label->setBuddy(baud_c);
138 "to the init string, you should try different\n" 148
139 "settings here\n" 149 static const char *baudrates[] =
140 "\n" 150 {
141 "<b>Default</b>: CR/LF");
142
143 QWhatsThis::add(labelenter,tmp);
144 QWhatsThis::add(enter, tmp);
145
146 QLabel *baud_label = new QLabel(tr("Co&nnection speed:"), this);
147 tl->addWidget(baud_label, 4, 0);
148 baud_c = new QComboBox(this);
149 baud_label->setBuddy(baud_c);
150
151 static const char *baudrates[] = {
152 151
153#ifdef B460800 152#ifdef B460800
154 "460800", 153 "460800",
155#endif 154#endif
@@ -157,3 +156,3 @@ ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name )
157#ifdef B230400 156#ifdef B230400
158 "230400", 157 "230400",
159#endif 158#endif
@@ -161,3 +160,3 @@ ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name )
161#ifdef B115200 160#ifdef B115200
162 "115200", 161 "115200",
163#endif 162#endif
@@ -165,97 +164,102 @@ ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name )
165#ifdef B57600 164#ifdef B57600
166 "57600", 165 "57600",
167#endif 166#endif
168 167
169 "38400", 168 "38400",
170 "19200", 169 "19200",
171 "9600", 170 "9600",
172 "2400", 171 "2400",
173 0}; 172 0
174 173 };
175 for(k = 0; baudrates[k]; k++) 174
176 baud_c->insertItem(baudrates[k]); 175 for(k = 0; baudrates[k]; k++)
177 176 baud_c->insertItem(baudrates[k]);
178 baud_c->setCurrentItem(3); 177
179// connect(baud_c, SIGNAL(activated(int)), 178 baud_c->setCurrentItem(3);
180 // this, SLOT(speed_selection(int))); 179 // connect(baud_c, SIGNAL(activated(int)),
181 tl->addWidget(baud_c, 4, 1); 180 // this, SLOT(speed_selection(int)));
182 181 tl->addWidget(baud_c, 4, 1);
183 tmp = tr("Specifies the speed your modem and the serial\n" 182
184 "port talk to each other. You should begin with\n" 183 tmp = tr("Specifies the speed your modem and the serial\n"
185 "the default of 38400 bits/sec. If everything\n" 184 "port talk to each other. You should begin with\n"
186 "works you can try to increase this value, but to\n" 185 "the default of 38400 bits/sec. If everything\n"
187 "no more than 115200 bits/sec (unless you know\n" 186 "works you can try to increase this value, but to\n"
188 "that your serial port supports higher speeds)."); 187 "no more than 115200 bits/sec (unless you know\n"
189 188 "that your serial port supports higher speeds).");
190 QWhatsThis::add(baud_label,tmp); 189
191 QWhatsThis::add(baud_c,tmp); 190 QWhatsThis::add(baud_label,tmp);
192 191 QWhatsThis::add(baud_c,tmp);
193 for(int i=0; i <= enter->count()-1; i++) { 192
194 if(_pppdata->enter() == enter->text(i)) 193 for(int i=0; i <= enter->count()-1; i++)
195 enter->setCurrentItem(i); 194 {
196 } 195 if(_pppdata->enter() == enter->text(i))
197 196 enter->setCurrentItem(i);
198 tl->addRowSpacing(5, 10); 197 }
199 198
200 //Modem Lock File 199 tl->addRowSpacing(5, 10);
201 modemlockfile = new QCheckBox(tr("&Use lock file"), this); 200
202 201 //Modem Lock File
203 modemlockfile->setChecked(_pppdata->modemLockFile()); 202 modemlockfile = new QCheckBox(tr("&Use lock file"), this);
204// connect(modemlockfile, SIGNAL(toggled(bool)), 203
205// SLOT(modemlockfilechanged(bool))); 204 modemlockfile->setChecked(_pppdata->modemLockFile());
206 tl->addMultiCellWidget(modemlockfile, 6, 6, 0, 1); 205 // connect(modemlockfile, SIGNAL(toggled(bool)),
207 // l12->addStretch(1); 206 // SLOT(modemlockfilechanged(bool)));
208 QWhatsThis::add(modemlockfile, 207 tl->addMultiCellWidget(modemlockfile, 6, 6, 0, 1);
209 tr("<p>To prevent other programs from accessing the\n" 208 // l12->addStretch(1);
210 "modem while a connection is established, a\n" 209 QWhatsThis::add(modemlockfile,
211 "file can be created to indicate that the modem\n" 210 tr("<p>To prevent other programs from accessing the\n"
212 "is in use. On Linux an example file would be\n" 211 "modem while a connection is established, a\n"
213 "<tt>/var/lock/LCK..ttyS1</tt>\n" 212 "file can be created to indicate that the modem\n"
214 "Here you can select whether this locking will\n" 213 "is in use. On Linux an example file would be\n"
215 "be done.\n" 214 "<tt>/var/lock/LCK..ttyS1</tt>\n"
216 "\n" 215 "Here you can select whether this locking will\n"
217 "<b>Default</b>: On")); 216 "be done.\n"
218 217 "\n"
219 // Modem Timeout Line Edit Box 218 "<b>Default</b>: On"));
220 QHBoxLayout *timeoutLayout = new QHBoxLayout( this ); 219
221 QLabel *timeoutlabel = new QLabel( tr("Modem timeout:") ,this, "timeout" ); 220 // Modem Timeout Line Edit Box
222 modemtimeout = new QSpinBox( 1, 120, 1, this, "modemTimeout" ); 221 QHBoxLayout *timeoutLayout = new QHBoxLayout( this );
223// modemtimeout = new KIntNumInput(_pppdata->modemTimeout(), this); 222 QLabel *timeoutlabel = new QLabel( tr("Modem timeout:") ,this, "timeout" );
224// modemtimeout->setLabel(tr("Modem &timeout:")); 223 modemtimeout = new QSpinBox( 1, 120, 1, this, "modemTimeout" );
225// modemtimeout->setRange(1, 120, 1); 224 // modemtimeout = new KIntNumInput(_pppdata->modemTimeout(), this);
226 modemtimeout->setSuffix(tr(" sec")); 225 // modemtimeout->setLabel(tr("Modem &timeout:"));
227 modemtimeout->setValue( _pppdata->modemTimeout() ); 226 // modemtimeout->setRange(1, 120, 1);
228// connect(modemtimeout, SIGNAL(valueChanged(int)), 227 modemtimeout->setSuffix(tr(" sec"));
229 // SLOT(modemtimeoutchanged(int))); 228 modemtimeout->setValue( _pppdata->modemTimeout() );
230 timeoutLayout->addWidget(timeoutlabel); 229 // connect(modemtimeout, SIGNAL(valueChanged(int)),
231 timeoutLayout->addWidget(modemtimeout); 230 // SLOT(modemtimeoutchanged(int)));
232 tl->addMultiCellLayout(timeoutLayout, 7, 7, 0, 1); 231 timeoutLayout->addWidget(timeoutlabel);
233 232 timeoutLayout->addWidget(modemtimeout);
234 QWhatsThis::add(modemtimeout, 233 tl->addMultiCellLayout(timeoutLayout, 7, 7, 0, 1);
235 tr("This specifies how long <i>kppp</i> waits for a\n" 234
236 "<i>CONNECT</i> response from your modem. The\n" 235 QWhatsThis::add(modemtimeout,
237 "recommended value is 30 seconds.")); 236 tr("This specifies how long <i>kppp</i> waits for a\n"
238 237 "<i>CONNECT</i> response from your modem. The\n"
239 //set stuff from gpppdata 238 "recommended value is 30 seconds."));
240 for(int i=0; i <= enter->count()-1; i++) { 239
241 if(_pppdata->enter() == enter->text(i)) 240 //set stuff from gpppdata
242 enter->setCurrentItem(i); 241 for(int i=0; i <= enter->count()-1; i++)
243 } 242 {
244 243 if(_pppdata->enter() == enter->text(i))
245 for(int i=0; i <= modemdevice->count()-1; i++) { 244 enter->setCurrentItem(i);
246 if(_pppdata->modemDevice() == modemdevice->text(i)) 245 }
247 modemdevice->setCurrentItem(i); 246
248 } 247 for(int i=0; i <= modemdevice->count()-1; i++)
249 248 {
250 for(int i=0; i <= flowcontrol->count()-1; i++) { 249 if(_pppdata->modemDevice() == modemdevice->text(i))
251 if(_pppdata->flowcontrol() == flowcontrol->text(i)) 250 modemdevice->setCurrentItem(i);
252 flowcontrol->setCurrentItem(i); 251 }
253 } 252
254 253 for(int i=0; i <= flowcontrol->count()-1; i++)
255 //set the modem speed 254 {
256 for(int i=0; i < baud_c->count(); i++) 255 if(_pppdata->flowcontrol() == flowcontrol->text(i))
257 if(baud_c->text(i) == _pppdata->speed()) 256 flowcontrol->setCurrentItem(i);
258 baud_c->setCurrentItem(i); 257 }
259 258
260 tl->setRowStretch(1, 1); 259 //set the modem speed
260 for(int i=0; i < baud_c->count(); i++)
261 if(baud_c->text(i) == _pppdata->speed())
262 baud_c->setCurrentItem(i);
263
264 tl->setRowStretch(1, 1);
261} 265}
@@ -275,5 +279,7 @@ ModemWidget::~ModemWidget()
275 QString edited = modemdevice->currentText(); 279 QString edited = modemdevice->currentText();
276 if ( !( edited ).isEmpty() ) { 280 if ( !( edited ).isEmpty() )
281 {
277 edited.simplifyWhiteSpace(); 282 edited.simplifyWhiteSpace();
278 if ( devs.contains( edited ) == 0 ) { 283 if ( devs.contains( edited ) == 0 )
284 {
279 devs << edited; 285 devs << edited;
@@ -328,3 +334,3 @@ bool ModemWidget::save()
328 if(modemname->text().isEmpty() || 334 if(modemname->text().isEmpty() ||
329 !_pppdata->isUniqueDevname(modemname->text())) 335 !_pppdata->isUniqueDevname(modemname->text()))
330 return false; 336 return false;
@@ -345,3 +351,3 @@ ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent,
345 const char *name) 351 const char *name)
346 : QWidget(parent, name), _pppdata(pd), _ifaceppp(ip) 352 : QWidget(parent, name), _pppdata(pd), _ifaceppp(ip)
347{ 353{
@@ -350,121 +356,121 @@ ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent,
350 356
351 waitfordt = new QCheckBox(tr("&Wait for dial tone before dialing"), this); 357 waitfordt = new QCheckBox(tr("&Wait for dial tone before dialing"), this);
352 waitfordt->setChecked(_pppdata->waitForDialTone()); 358 waitfordt->setChecked(_pppdata->waitForDialTone());
353// connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool))); 359 // connect(waitfordt, SIGNAL(toggled(bool)), SLOT(waitfordtchanged(bool)));
354 l1->addWidget(waitfordt); 360 l1->addWidget(waitfordt);
355 QWhatsThis::add(waitfordt, 361 QWhatsThis::add(waitfordt,
356 tr("<p>Normally the modem waits for a dial tone\n" 362 tr("<p>Normally the modem waits for a dial tone\n"
357 "from your phone line, indicating that it can\n" 363 "from your phone line, indicating that it can\n"
358 "start to dial a number. If your modem does not\n" 364 "start to dial a number. If your modem does not\n"
359 "recognize this sound, or your local phone system\n" 365 "recognize this sound, or your local phone system\n"
360 "does not emit such a tone, uncheck this option\n" 366 "does not emit such a tone, uncheck this option\n"
361 "\n" 367 "\n"
362 "<b>Default:</b>: On")); 368 "<b>Default:</b>: On"));
363 369
364 QHBoxLayout *waitLayout = new QHBoxLayout( this ); 370 QHBoxLayout *waitLayout = new QHBoxLayout( this );
365 QLabel *waitLabel = new QLabel( tr("Busy wait:"), this, "busyWait" ); 371 QLabel *waitLabel = new QLabel( tr("Busy wait:"), this, "busyWait" );
366 busywait = new QSpinBox( 0, 300, 5, this, "busyWait" ); 372 busywait = new QSpinBox( 0, 300, 5, this, "busyWait" );
367// busywait = new KIntNumInput(_pppdata->busyWait(), this); 373 // busywait = new KIntNumInput(_pppdata->busyWait(), this);
368// busywait->setLabel(tr("B&usy wait:")); 374 // busywait->setLabel(tr("B&usy wait:"));
369// busywait->setRange(0, 300, 5, true); 375 // busywait->setRange(0, 300, 5, true);
370 busywait->setSuffix(tr(" sec")); 376 busywait->setSuffix(tr(" sec"));
371// connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int))); 377 // connect(busywait, SIGNAL(valueChanged(int)), SLOT(busywaitchanged(int)));
372 waitLayout->addWidget(waitLabel); 378 waitLayout->addWidget(waitLabel);
373 waitLayout->addWidget(busywait); 379 waitLayout->addWidget(busywait);
374 l1->addLayout( waitLayout ); 380 l1->addLayout( waitLayout );
375 381
376 QWhatsThis::add(busywait, 382 QWhatsThis::add(busywait,
377 tr("Specifies the number of seconds to wait before\n" 383 tr("Specifies the number of seconds to wait before\n"
378 "redial if all dialed numbers are busy. This is\n" 384 "redial if all dialed numbers are busy. This is\n"
379 "necessary because some modems get stuck if the\n" 385 "necessary because some modems get stuck if the\n"
380 "same number is busy too often.\n" 386 "same number is busy too often.\n"
381 "\n" 387 "\n"
382 "The default is 0 seconds, you should not change\n" 388 "The default is 0 seconds, you should not change\n"
383 "this unless you need to.")); 389 "this unless you need to."));
384 390
385 l1->addSpacing(10); 391 l1->addSpacing(10);
386 392
387 QHBoxLayout *hbl = new QHBoxLayout; 393 QHBoxLayout *hbl = new QHBoxLayout;
388 hbl->setSpacing(2);//KDialog::spacingHint()); 394 hbl->setSpacing(2);//KDialog::spacingHint());
389 395
390 QLabel *volumeLabel = new QLabel(tr("Modem &volume:"), this); 396 QLabel *volumeLabel = new QLabel(tr("Modem &volume:"), this);
391 hbl->addWidget(volumeLabel); 397 hbl->addWidget(volumeLabel);
392 volume = new QSlider(0, 2, 1, _pppdata->volume(), 398 volume = new QSlider(0, 2, 1, _pppdata->volume(),
393 QSlider::Horizontal, this); 399 QSlider::Horizontal, this);
394 volumeLabel->setBuddy(volume); 400 volumeLabel->setBuddy(volume);
395 volume->setTickmarks(QSlider::Below); 401 volume->setTickmarks(QSlider::Below);
396 hbl->addWidget(volume); 402 hbl->addWidget(volume);
397 403
398 l1->addLayout(hbl); 404 l1->addLayout(hbl);
399 405
400// connect(volume, SIGNAL(valueChanged(int)), 406 // connect(volume, SIGNAL(valueChanged(int)),
401 // this, SLOT(volumeChanged(int))); 407 // this, SLOT(volumeChanged(int)));
402 QString tmp = tr("Most modems have a speaker which makes\n" 408 QString tmp = tr("Most modems have a speaker which makes\n"
403 "a lot of noise when dialing. Here you can\n" 409 "a lot of noise when dialing. Here you can\n"
404 "either turn this completely off or select a\n" 410 "either turn this completely off or select a\n"
405 "lower volume.\n" 411 "lower volume.\n"
406 "\n" 412 "\n"
407 "If this does not work for your modem,\n" 413 "If this does not work for your modem,\n"
408 "you must modify the modem volume command."); 414 "you must modify the modem volume command.");
409 415
410 QWhatsThis::add(volumeLabel,tmp); 416 QWhatsThis::add(volumeLabel,tmp);
411 QWhatsThis::add(volume, tmp); 417 QWhatsThis::add(volume, tmp);
412 418
413 l1->addSpacing(20); 419 l1->addSpacing(20);
414 420
415#if 0 421#if 0
416 chkbox1 = new QCheckBox(tr("Modem asserts CD line"), this); 422 chkbox1 = new QCheckBox(tr("Modem asserts CD line"), this);
417 chkbox1->setChecked(_pppdata->UseCDLine()); 423 chkbox1->setChecked(_pppdata->UseCDLine());
418 connect(chkbox1,SIGNAL(toggled(bool)), 424 connect(chkbox1,SIGNAL(toggled(bool)),
419 this,SLOT(use_cdline_toggled(bool))); 425 this,SLOT(use_cdline_toggled(bool)));
420 l12->addWidget(chkbox1); 426 l12->addWidget(chkbox1);
421 l12->addStretch(1); 427 l12->addStretch(1);
422 l1->addStretch(1); 428 l1->addStretch(1);
423 QWhatsThis::add(chkbox1, 429 QWhatsThis::add(chkbox1,
424 tr("This controls how <i>kppp</i> detects that the modem\n" 430 tr("This controls how <i>kppp</i> detects that the modem\n"
425 "is not responding. Unless you are having\n" 431 "is not responding. Unless you are having\n"
426 "problems with this, do not modify this setting.\n" 432 "problems with this, do not modify this setting.\n"
427 "\n" 433 "\n"
428 "<b>Default</b>: Off")); 434 "<b>Default</b>: Off"));
429#endif 435#endif
430 436
431 modemcmds = new QPushButton(tr("Mod&em Commands..."), this); 437 modemcmds = new QPushButton(tr("Mod&em Commands..."), this);
432 QWhatsThis::add(modemcmds, 438 QWhatsThis::add(modemcmds,
433 tr("Allows you to change the AT command for\n" 439 tr("Allows you to change the AT command for\n"
434 "your modem.")); 440 "your modem."));
435 441
436 modeminfo_button = new QPushButton(tr("&Query Modem..."), this); 442 modeminfo_button = new QPushButton(tr("&Query Modem..."), this);
437 QWhatsThis::add(modeminfo_button, 443 QWhatsThis::add(modeminfo_button,
438 tr("Most modems support the ATI command set to\n" 444 tr("Most modems support the ATI command set to\n"
439 "find out vendor and revision of your modem.\n" 445 "find out vendor and revision of your modem.\n"
440 "\n" 446 "\n"
441 "Press this button to query your modem for\n" 447 "Press this button to query your modem for\n"
442 "this information. It can be useful to help\n" 448 "this information. It can be useful to help\n"
443 "you setup the modem")); 449 "you setup the modem"));
444 450
445// terminal_button = new QPushButton(tr("&Terminal..."), this); 451 // terminal_button = new QPushButton(tr("&Terminal..."), this);
446// QWhatsThis::add(terminal_button, 452 // QWhatsThis::add(terminal_button,
447 // tr("Opens the built-in terminal program. You\n" 453 // tr("Opens the built-in terminal program. You\n"
448 // "can use this if you want to play around\n" 454 // "can use this if you want to play around\n"
449 // "with your modem's AT command set")); 455 // "with your modem's AT command set"));
450 456
451 QHBoxLayout *hbox = new QHBoxLayout(); 457 QHBoxLayout *hbox = new QHBoxLayout();
452 l1->addLayout(hbox); 458 l1->addLayout(hbox);
453 hbox->addStretch(1); 459 hbox->addStretch(1);
454 QVBoxLayout *vbox = new QVBoxLayout(); 460 QVBoxLayout *vbox = new QVBoxLayout();
455 hbox->addLayout(vbox); 461 hbox->addLayout(vbox);
456 462
457 vbox->addWidget(modemcmds); 463 vbox->addWidget(modemcmds);
458 vbox->addWidget(modeminfo_button); 464 vbox->addWidget(modeminfo_button);
459// vbox->addWidget(terminal_button); 465 // vbox->addWidget(terminal_button);
460 466
461 hbox->addStretch(1); 467 hbox->addStretch(1);
462 l1->addStretch(1); 468 l1->addStretch(1);
463 469
464 connect(modemcmds, SIGNAL(clicked()), 470 connect(modemcmds, SIGNAL(clicked()),
465 SLOT(modemcmdsbutton())); 471 SLOT(modemcmdsbutton()));
466 connect(modeminfo_button, SIGNAL(clicked()), 472 connect(modeminfo_button, SIGNAL(clicked()),
467 SLOT(query_modem())); 473 SLOT(query_modem()));
468// connect(terminal_button, SIGNAL(clicked()), 474 // connect(terminal_button, SIGNAL(clicked()),
469 // SLOT(terminal())); 475 // SLOT(terminal()));
470} 476}
@@ -472,6 +478,7 @@ ModemWidget2::ModemWidget2( PPPData *pd, InterfacePPP *ip, QWidget *parent,
472 478
473void ModemWidget2::modemcmdsbutton() { 479void ModemWidget2::modemcmdsbutton()
474 ModemCommands mc(_ifaceppp->data(), this, "commands" , true, Qt::WStyle_ContextHelp); 480{
475 mc.showMaximized(); 481 ModemCommands mc(_ifaceppp->data(), this, "commands" , true, Qt::WStyle_ContextHelp);
476 mc.exec(); 482
483 QPEApplication::execDialog( &mc );
477} 484}
@@ -479,5 +486,6 @@ void ModemWidget2::modemcmdsbutton() {
479 486
480void ModemWidget2::query_modem() { 487void ModemWidget2::query_modem()
481 ModemTransfer mt(_ifaceppp->modem(), this); 488{
482 mt.exec(); 489 ModemTransfer mt(_ifaceppp->modem(), this);
490 mt.exec();
483} 491}
diff --git a/noncore/settings/networksettings/ppp/modeminfo.cpp b/noncore/settings/networksettings/ppp/modeminfo.cpp
index dbb26db..df0bf9b 100644
--- a/noncore/settings/networksettings/ppp/modeminfo.cpp
+++ b/noncore/settings/networksettings/ppp/modeminfo.cpp
@@ -26,67 +26,71 @@
26 26
27#include <unistd.h> 27#include "modeminfo.h"
28#include "modem.h"
29
30/* OPIE */
31#include <qpe/qpeapplication.h>
32
33/* QT */
28#include <qregexp.h> 34#include <qregexp.h>
29#include <qlayout.h> 35#include <qlayout.h>
30// #include <kwin.h>
31// #include <kmessagebox.h>
32// #include <kapplication.h>
33#include <qmessagebox.h> 36#include <qmessagebox.h>
34#include <qapplication.h> 37#include <qapplication.h>
35#include "modeminfo.h" 38
36#include "modem.h" 39/* STD */
40#include <unistd.h>
37 41
38ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name) 42ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name)
39 : QDialog(parent, name,TRUE, WStyle_Customize|WStyle_NormalBorder), 43 : QDialog(parent, name,TRUE, WStyle_Customize|WStyle_NormalBorder),
40 _modem(mo) 44 _modem(mo)
41{ 45{
42 setCaption(QObject::tr("ATI Query")); 46 setCaption(QObject::tr("ATI Query"));
43// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); 47 // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
44 48
45 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); 49 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
46 50
47 progressBar = new QProgressBar(this, "bar"); 51 progressBar = new QProgressBar(this, "bar");
48 progressBar->setTotalSteps(8); 52 progressBar->setTotalSteps(8);
49 53
50 statusBar = new QLabel(this,"sBar"); 54 statusBar = new QLabel(this,"sBar");
51 statusBar->setFrameStyle(QFrame::Panel|QFrame::Sunken); 55 statusBar->setFrameStyle(QFrame::Panel|QFrame::Sunken);
52 statusBar->setAlignment(AlignCenter); 56 statusBar->setAlignment(AlignCenter);
53 57
54 // This is a rather complicated case. Since we do not know which 58 // This is a rather complicated case. Since we do not know which
55 // message is the widest in the national language, we'd to 59 // message is the widest in the national language, we'd to
56 // search all these messages. This is a little overkill, so I take 60 // search all these messages. This is a little overkill, so I take
57 // the longest english message, translate it and give it additional 61 // the longest english message, translate it and give it additional
58 // 20 percent space. Hope this is enough. 62 // 20 percent space. Hope this is enough.
59 statusBar->setText(QObject::tr("Unable to create modem lock file.")); 63 statusBar->setText(QObject::tr("Unable to create modem lock file."));
60 statusBar->setFixedWidth((statusBar->sizeHint().width() * 12) / 10); 64 statusBar->setFixedWidth((statusBar->sizeHint().width() * 12) / 10);
61 statusBar->setFixedHeight(statusBar->sizeHint().height() + 4); 65 statusBar->setFixedHeight(statusBar->sizeHint().height() + 4);
62 66
63 // set original text 67 // set original text
64 statusBar->setText(QObject::tr("Looking for modem...")); 68 statusBar->setText(QObject::tr("Looking for modem..."));
65 progressBar->setFixedHeight(statusBar->minimumSize().height()); 69 progressBar->setFixedHeight(statusBar->minimumSize().height());
66 tl->addWidget(progressBar); 70 tl->addWidget(progressBar);
67 tl->addWidget(statusBar); 71 tl->addWidget(statusBar);
68 72
69 cancel = new QPushButton(QObject::tr("Cancel"), this); 73 cancel = new QPushButton(QObject::tr("Cancel"), this);
70 cancel->setFocus(); 74 cancel->setFocus();
71 connect(cancel, SIGNAL(clicked()), SLOT(cancelbutton())); 75 connect(cancel, SIGNAL(clicked()), SLOT(cancelbutton()));
72 76
73 QHBoxLayout *l1 = new QHBoxLayout; 77 QHBoxLayout *l1 = new QHBoxLayout;
74 tl->addLayout(l1); 78 tl->addLayout(l1);
75 l1->addStretch(1); 79 l1->addStretch(1);
76 l1->addWidget(cancel); 80 l1->addWidget(cancel);
77 81
78 setFixedSize(sizeHint()); 82 setFixedSize(sizeHint());
79 83
80 step = 0; 84 step = 0;
81 85
82 //////////////////////////////////////////////// 86 ////////////////////////////////////////////////
83 87
84 timeout_timer = new QTimer(this); 88 timeout_timer = new QTimer(this);
85 connect(timeout_timer, SIGNAL(timeout()), SLOT(time_out_slot())); 89 connect(timeout_timer, SIGNAL(timeout()), SLOT(time_out_slot()));
86 90
87 scripttimer = new QTimer(this); 91 scripttimer = new QTimer(this);
88 connect(scripttimer, SIGNAL(timeout()), SLOT(do_script())); 92 connect(scripttimer, SIGNAL(timeout()), SLOT(do_script()));
89 93
90 timeout_timer->start(15000,TRUE); // 15 secs single shot 94 timeout_timer->start(15000,TRUE); // 15 secs single shot
91 QTimer::singleShot(500, this, SLOT(init())); 95 QTimer::singleShot(500, this, SLOT(init()));
92 96
@@ -95,18 +99,19 @@ ModemTransfer::ModemTransfer(Modem *mo, QWidget *parent, const char *name)
95 99
96void ModemTransfer::ati_done() { 100void ModemTransfer::ati_done()
97 scripttimer->stop(); 101{
98 timeout_timer->stop(); 102 scripttimer->stop();
99 _modem->closetty(); 103 timeout_timer->stop();
100 _modem->unlockdevice(); 104 _modem->closetty();
101 hide(); 105 _modem->unlockdevice();
106 hide();
107
108 // open the result window
109 ModemInfo *mi = new ModemInfo(this);
110 for(int i = 0; i < NUM_OF_ATI; i++)
111 mi->setAtiString(i, ati_query_strings[i]);
102 112
103 // open the result window 113 QPEApplication::execDialog( mi );
104 ModemInfo *mi = new ModemInfo(this); 114 delete mi;
105 for(int i = 0; i < NUM_OF_ATI; i++)
106 mi->setAtiString(i, ati_query_strings[i]);
107 mi->showMaximized();
108 mi->exec();
109 delete mi;
110 115
111 accept(); 116 accept();
112} 117}
@@ -114,8 +119,9 @@ void ModemTransfer::ati_done() {
114 119
115void ModemTransfer::time_out_slot() { 120void ModemTransfer::time_out_slot()
116 timeout_timer->stop(); 121{
117 scripttimer->stop(); 122 timeout_timer->stop();
123 scripttimer->stop();
118 124
119 QMessageBox::warning(this, tr("Error"), QObject::tr("Modem Query timed out.")); 125 QMessageBox::warning(this, tr("Error"), QObject::tr("Modem Query timed out."));
120 reject(); 126 reject();
121} 127}
@@ -123,43 +129,48 @@ void ModemTransfer::time_out_slot() {
123 129
124void ModemTransfer::init() { 130void ModemTransfer::init()
131{
125 132
126 qApp->processEvents(); 133 qApp->processEvents();
127 134
128 int lock = _modem->lockdevice(); 135 int lock = _modem->lockdevice();
129 if (lock == 1) { 136 if (lock == 1)
137 {
130 138
131 statusBar->setText(QObject::tr("Modem device is locked.")); 139 statusBar->setText(QObject::tr("Modem device is locked."));
132 return; 140 return;
133 } 141 }
134 142
135 if (lock == -1) { 143 if (lock == -1)
144 {
136 145
137 statusBar->setText(QObject::tr("Unable to create modem lock file.")); 146 statusBar->setText(QObject::tr("Unable to create modem lock file."));
138 return; 147 return;
139 } 148 }
140 149
141 150
142 if(_modem->opentty()) { 151 if(_modem->opentty())
143 if(_modem->hangup()) { 152 {
144 usleep(100000); // wait 0.1 secs 153 if(_modem->hangup())
145 _modem->writeLine("ATE0Q1V1"); // E0 don't echo the commands I send ... 154 {
155 usleep(100000); // wait 0.1 secs
156 _modem->writeLine("ATE0Q1V1"); // E0 don't echo the commands I send ...
146 157
147 statusBar->setText(QObject::tr("Modem Ready")); 158 statusBar->setText(QObject::tr("Modem Ready"));
148 qApp->processEvents(); 159 qApp->processEvents();
149 usleep(100000); // wait 0.1 secs 160 usleep(100000); // wait 0.1 secs
150 qApp->processEvents(); 161 qApp->processEvents();
151 scripttimer->start(1000); // this one does the ati query 162 scripttimer->start(1000); // this one does the ati query
152 163
153 // clear modem buffer 164 // clear modem buffer
154 _modem->flush(); 165 _modem->flush();
155 166
156 _modem->notify(this, SLOT(readChar(unsigned char))); 167 _modem->notify(this, SLOT(readChar(unsigned char)));
157 return; 168 return;
169 }
158 } 170 }
159 }
160 171
161 // opentty() or hangup() failed 172 // opentty() or hangup() failed
162 statusBar->setText(_modem->modemMessage()); 173 statusBar->setText(_modem->modemMessage());
163 step = 99; // wait until cancel is pressed 174 step = 99; // wait until cancel is pressed
164 _modem->unlockdevice(); 175 _modem->unlockdevice();
165} 176}
@@ -167,54 +178,58 @@ void ModemTransfer::init() {
167 178
168void ModemTransfer::do_script() { 179void ModemTransfer::do_script()
169 QString msg; 180{
170 QString query; 181 QString msg;
171 182 QString query;
172 switch(step) { 183
173 case 0: 184 switch(step)
174 readtty(); 185 {
175 statusBar->setText("ATI..."); 186 case 0:
176 progressBar->setProgress( progressBar->progress() + 1); 187 readtty();
177 _modem->writeLine("ATI\n"); 188 statusBar->setText("ATI...");
178 break; 189 progressBar->setProgress( progressBar->progress() + 1);
179 190 _modem->writeLine("ATI\n");
180 case 1: 191 break;
181 case 2: 192
182 case 3: 193 case 1:
183 case 4: 194 case 2:
184 case 5: 195 case 3:
185 case 6: 196 case 4:
186 case 7: 197 case 5:
187 readtty(); 198 case 6:
188 msg.sprintf("ATI %d ...", step); 199 case 7:
189 query.sprintf("ATI%d\n", step); 200 readtty();
190 statusBar->setText(msg); 201 msg.sprintf("ATI %d ...", step);
191 progressBar->setProgress( progressBar->progress() + 1); 202 query.sprintf("ATI%d\n", step);
192 _modem->writeLine(query.local8Bit()); 203 statusBar->setText(msg);
193 break; 204 progressBar->setProgress( progressBar->progress() + 1);
194 205 _modem->writeLine(query.local8Bit());
195 default: 206 break;
196 readtty(); 207
197 ati_done(); 208 default:
198 } 209 readtty();
199 step++; 210 ati_done();
211 }
212 step++;
200} 213}
201 214
202void ModemTransfer::readChar(unsigned char c) { 215void ModemTransfer::readChar(unsigned char c)
203 if(readbuffer.length() < 255) 216{
204 readbuffer += c; 217 if(readbuffer.length() < 255)
218 readbuffer += c;
205} 219}
206 220
207void ModemTransfer::readtty() { 221void ModemTransfer::readtty()
222{
208 223
209 if (step == 0) 224 if (step == 0)
210 return; 225 return;
211 226
212 readbuffer.replace(QRegExp("[\n\r]")," "); // remove stray \n and \r 227 readbuffer.replace(QRegExp("[\n\r]")," "); // remove stray \n and \r
213 readbuffer = readbuffer.stripWhiteSpace(); // strip of leading or trailing white 228 readbuffer = readbuffer.stripWhiteSpace(); // strip of leading or trailing white
214 // space 229 // space
215 230
216 if(step <= NUM_OF_ATI) 231 if(step <= NUM_OF_ATI)
217 ati_query_strings[step-1] = readbuffer.copy(); 232 ati_query_strings[step-1] = readbuffer.copy();
218 233
219 readbuffer = ""; 234 readbuffer = "";
220} 235}
@@ -222,15 +237,16 @@ void ModemTransfer::readtty() {
222 237
223void ModemTransfer::cancelbutton() { 238void ModemTransfer::cancelbutton()
224 scripttimer->stop(); 239{
225 _modem->stop(); 240 scripttimer->stop();
226 timeout_timer->stop(); 241 _modem->stop();
242 timeout_timer->stop();
227 243
228 statusBar->setText(QObject::tr("One moment please...")); 244 statusBar->setText(QObject::tr("One moment please..."));
229 qApp->processEvents(); 245 qApp->processEvents();
230 246
231 _modem->hangup(); 247 _modem->hangup();
232 248
233 _modem->closetty(); 249 _modem->closetty();
234 _modem->unlockdevice(); 250 _modem->unlockdevice();
235 reject(); 251 reject();
236} 252}
@@ -238,5 +254,6 @@ void ModemTransfer::cancelbutton() {
238 254
239void ModemTransfer::closeEvent( QCloseEvent *e ) { 255void ModemTransfer::closeEvent( QCloseEvent *e )
240 cancelbutton(); 256{
241 e->accept(); 257 cancelbutton();
258 e->accept();
242} 259}
@@ -245,42 +262,43 @@ void ModemTransfer::closeEvent( QCloseEvent *e ) {
245ModemInfo::ModemInfo(QWidget *parent, const char* name) 262ModemInfo::ModemInfo(QWidget *parent, const char* name)
246 : QDialog(parent, name, TRUE, WStyle_Customize|WStyle_NormalBorder) 263 : QDialog(parent, name, TRUE, WStyle_Customize|WStyle_NormalBorder)
247{ 264{
248 QString label_text; 265 QString label_text;
249 266
250 setCaption(QObject::tr("Modem Query Results")); 267 setCaption(QObject::tr("Modem Query Results"));
251 // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); 268 // KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
252 269
253 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10); 270 QVBoxLayout *tl = new QVBoxLayout(this, 10, 10);
254 271
255 QGridLayout *l1 = new QGridLayout(NUM_OF_ATI, 2, 5); 272 QGridLayout *l1 = new QGridLayout(NUM_OF_ATI, 2, 5);
256 tl->addLayout(l1, 1); 273 tl->addLayout(l1, 1);
257 for(int i = 0 ; i < NUM_OF_ATI ; i++) { 274 for(int i = 0 ; i < NUM_OF_ATI ; i++)
275 {
258 276
259 label_text = ""; 277 label_text = "";
260 if ( i == 0) 278 if ( i == 0)
261 label_text.sprintf("ATI :"); 279 label_text.sprintf("ATI :");
262 else 280 else
263 label_text.sprintf("ATI %d:", i ); 281 label_text.sprintf("ATI %d:", i );
264 282
265 ati_label[i] = new QLabel(label_text, this); 283 ati_label[i] = new QLabel(label_text, this);
266 l1->addWidget(ati_label[i], i, 0); 284 l1->addWidget(ati_label[i], i, 0);
267 285
268 ati_label_result[i] = new QLineEdit(this); 286 ati_label_result[i] = new QLineEdit(this);
269 ati_label_result[i]->setMinimumWidth(fontMetrics().width('H') * 24); 287 ati_label_result[i]->setMinimumWidth(fontMetrics().width('H') * 24);
270 l1->addWidget(ati_label_result[i], i, 1); 288 l1->addWidget(ati_label_result[i], i, 1);
271 } 289 }
272 //tl->addSpacing(1); 290 //tl->addSpacing(1);
273 291
274 QHBoxLayout *l2 = new QHBoxLayout; 292 QHBoxLayout *l2 = new QHBoxLayout;
275 QPushButton *ok = new QPushButton(QObject::tr("Close"), this); 293 QPushButton *ok = new QPushButton(QObject::tr("Close"), this);
276 ok->setDefault(TRUE); 294 ok->setDefault(TRUE);
277 ok->setFocus(); 295 ok->setFocus();
278 296
279 tl->addLayout(l2); 297 tl->addLayout(l2);
280 l2->addStretch(1); 298 l2->addStretch(1);
281 299
282 connect(ok, SIGNAL(clicked()), SLOT(accept())); 300 connect(ok, SIGNAL(clicked()), SLOT(accept()));
283 l2->addWidget(ok); 301 l2->addWidget(ok);
284 302
285 setMinimumSize(sizeHint()); 303 setMinimumSize(sizeHint());
286} 304}
@@ -288,5 +306,6 @@ ModemInfo::ModemInfo(QWidget *parent, const char* name)
288 306
289void ModemInfo::setAtiString(int i, QString s) { 307void ModemInfo::setAtiString(int i, QString s)
290 if(i < NUM_OF_ATI) 308{
291 ati_label_result[i]->setText(s); 309 if(i < NUM_OF_ATI)
310 ati_label_result[i]->setText(s);
292} 311}
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
15namespace { 20namespace
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 */
79PPPModule::~PPPModule(){ 89PPPModule::~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 */
100void PPPModule::setProfile(const QString &newProfile){ 113void 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 */
109QString PPPModule::getPixmapName(Interface* ){ 123QString PPPModule::getPixmapName(Interface* )
110 return "ppp"; 124{
125 return "ppp";
111} 126}
@@ -117,3 +132,4 @@ QString PPPModule::getPixmapName(Interface* ){
117 */ 132 */
118bool PPPModule::isOwner(Interface *i){ 133bool 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 */
126QWidget *PPPModule::configure(Interface *i){ 142QWidget *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 */
138QWidget *PPPModule::information(Interface *i){ 155QWidget *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 */
150QList<Interface> PPPModule::getInterfaces(){ 168QList<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 */
162Interface *PPPModule::addNewInterface(const QString &newInterface){ 181Interface *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 */
185bool PPPModule::remove(Interface *i){ 208bool 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
197namespace { 221namespace
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);
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp
index 07bf73f..74d7f8e 100644
--- a/noncore/settings/networksettings/wlan/wlanmodule.cpp
+++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp
@@ -1 +1,2 @@
1
1#include "wlanmodule.h" 2#include "wlanmodule.h"
@@ -6,2 +7,6 @@
6 7
8/* OPIE */
9#include <qpe/qpeapplication.h>
10
11/* QT */
7#include <qcheckbox.h> 12#include <qcheckbox.h>
@@ -15,4 +20,2 @@
15 20
16
17
18/** 21/**
@@ -174,3 +177,3 @@ void WLANModule::receive(const QCString &param, const QByteArray &arg)
174 QWidget *info = getInfo( ifa ); 177 QWidget *info = getInfo( ifa );
175 info->showMaximized(); 178 QPEApplication::showWidget( info );
176 179
@@ -192,3 +195,3 @@ void WLANModule::receive(const QCString &param, const QByteArray &arg)
192 } 195 }
193 wlanconfigWiget->showMaximized(); 196 QPEApplication::showWidget( wlanconfigWiget );
194 stream >> value; 197 stream >> value;