summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings
Unidiff
Diffstat (limited to 'noncore/settings/networksettings') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp4
-rw-r--r--noncore/settings/networksettings/mainwindowimp.cpp14
-rw-r--r--noncore/settings/networksettings/ppp/edit.cpp8
-rw-r--r--noncore/settings/networksettings/ppp/general.cpp4
-rw-r--r--noncore/settings/networksettings/ppp/kpppwidget.cpp12
-rw-r--r--noncore/settings/networksettings/ppp/pppdargs.cpp4
-rw-r--r--noncore/settings/networksettings/wlan/wlanimp2.cpp2
7 files changed, 24 insertions, 24 deletions
diff --git a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
index 698dfd3..ff65424 100644
--- a/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
+++ b/noncore/settings/networksettings/interfaces/interfaceinformationimp.cpp
@@ -1,104 +1,104 @@
1 1
2#include "interfaceinformationimp.h" 2#include "interfaceinformationimp.h"
3#include "interfaceadvanced.h" 3#include "interfaceadvanced.h"
4 4
5/* OPIE */ 5/* OPIE */
6#include <qpe/config.h> 6#include <qpe/config.h>
7#include <qpe/qpeapplication.h> 7#include <qpe/qpeapplication.h>
8 8
9/* QT */ 9/* QT */
10#include <qcheckbox.h> 10#include <qcheckbox.h>
11#include <qpushbutton.h> 11#include <qpushbutton.h>
12#include <qlabel.h> 12#include <qlabel.h>
13#include <qgroupbox.h> 13#include <qgroupbox.h>
14#include <qmessagebox.h> 14#include <qmessagebox.h>
15 15
16 16
17#ifdef QWS 17#ifdef QWS
18#else 18#else
19 #define showMaximized show 19 #define showMaximized show
20#endif 20#endif
21 21
22/** 22/**
23 * Constructor for the InterfaceInformationImp class. This class pretty much 23 * Constructor for the InterfaceInformationImp class. This class pretty much
24 * just display's information about the interface that is passed to it. 24 * just display's information about the interface that is passed to it.
25 */ 25 */
26InterfaceInformationImp::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)
27{ 27{
28 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 28 connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*)));
29 connect(i, SIGNAL(updateMessage(const QString &)), this, SLOT(showMessage(const QString &))); 29 connect(i, SIGNAL(updateMessage(const QString&)), this, SLOT(showMessage(const QString&)));
30 updateInterface(interface); 30 updateInterface(interface);
31 connect(startButton, SIGNAL(clicked()), interface, SLOT(start())); 31 connect(startButton, SIGNAL(clicked()), interface, SLOT(start()));
32 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop())); 32 connect(stopButton, SIGNAL(clicked()), interface, SLOT(stop()));
33 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart())); 33 connect(restartButton, SIGNAL(clicked()), interface, SLOT(restart()));
34 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh())); 34 connect(refreshButton, SIGNAL(clicked()), interface, SLOT(refresh()));
35 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced())); 35 connect(advancedButton, SIGNAL(clicked()), this, SLOT(advanced()));
36 Config cfg("networksettings", Config::User); 36 Config cfg("networksettings", Config::User);
37 cfg.setGroup("interface"); 37 cfg.setGroup("interface");
38 CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) ); 38 CheckBoxSilent->setChecked( cfg.readBoolEntry("silent", false) );
39} 39}
40 40
41InterfaceInformationImp::~InterfaceInformationImp() 41InterfaceInformationImp::~InterfaceInformationImp()
42{ 42{
43 Config cfg("networksettings", Config::User); 43 Config cfg("networksettings", Config::User);
44 cfg.setGroup("interface"); 44 cfg.setGroup("interface");
45 cfg.writeEntry("silent", CheckBoxSilent->isChecked() ); 45 cfg.writeEntry("silent", CheckBoxSilent->isChecked() );
46} 46}
47 47
48/** 48/**
49 * Update the interface information and buttons. 49 * Update the interface information and buttons.
50 * @param Intarface *i the interface to update (should be the one we already 50 * @param Intarface *i the interface to update (should be the one we already
51 * know about). 51 * know about).
52 */ 52 */
53void InterfaceInformationImp::updateInterface(Interface *) 53void InterfaceInformationImp::updateInterface(Interface *)
54{ 54{
55 if(interface->getStatus()) 55 if(interface->getStatus())
56 { 56 {
57 startButton->setEnabled(false); 57 startButton->setEnabled(false);
58 stopButton->setEnabled(true); 58 stopButton->setEnabled(true);
59 restartButton->setEnabled(true); 59 restartButton->setEnabled(true);
60 } 60 }
61 else 61 else
62 { 62 {
63 startButton->setEnabled(true); 63 startButton->setEnabled(true);
64 stopButton->setEnabled(false); 64 stopButton->setEnabled(false);
65 restartButton->setEnabled(false); 65 restartButton->setEnabled(false);
66 } 66 }
67 macAddressLabel->setText(interface->getMacAddress()); 67 macAddressLabel->setText(interface->getMacAddress());
68 ipAddressLabel->setText(interface->getIp()); 68 ipAddressLabel->setText(interface->getIp());
69 subnetMaskLabel->setText(interface->getSubnetMask()); 69 subnetMaskLabel->setText(interface->getSubnetMask());
70 broadcastLabel->setText(interface->getBroadcast()); 70 broadcastLabel->setText(interface->getBroadcast());
71} 71}
72 72
73/** 73/**
74 * Create the advanced widget. Fill it with the current interface's information. 74 * Create the advanced widget. Fill it with the current interface's information.
75 * Display it. 75 * Display it.
76 */ 76 */
77void InterfaceInformationImp::advanced() 77void InterfaceInformationImp::advanced()
78{ 78{
79 InterfaceAdvanced *a = new InterfaceAdvanced(this, "InterfaceAdvanced", Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog); 79 InterfaceAdvanced *a = new InterfaceAdvanced(this, "InterfaceAdvanced", Qt::WType_Modal | Qt::WDestructiveClose | Qt::WStyle_Dialog);
80 a->interfaceName->setText(interface->getInterfaceName()); 80 a->interfaceName->setText(interface->getInterfaceName());
81 a->macAddressLabel->setText(interface->getMacAddress()); 81 a->macAddressLabel->setText(interface->getMacAddress());
82 a->ipAddressLabel->setText(interface->getIp()); 82 a->ipAddressLabel->setText(interface->getIp());
83 a->subnetMaskLabel->setText(interface->getSubnetMask()); 83 a->subnetMaskLabel->setText(interface->getSubnetMask());
84 a->broadcastLabel->setText(interface->getBroadcast()); 84 a->broadcastLabel->setText(interface->getBroadcast());
85 a->dhcpServerLabel->setText(interface->getDhcpServerIp()); 85 a->dhcpServerLabel->setText(interface->getDhcpServerIp());
86 a->leaseObtainedLabel->setText(interface->getLeaseObtained()); 86 a->leaseObtainedLabel->setText(interface->getLeaseObtained());
87 a->leaseExpiresLabel->setText(interface->getLeaseExpires()); 87 a->leaseExpiresLabel->setText(interface->getLeaseExpires());
88 a->dhcpInformation->setEnabled(interface->isDhcp()); 88 a->dhcpInformation->setEnabled(interface->isDhcp());
89 QPEApplication::showWidget( a ); 89 QPEApplication::showWidget( a );
90} 90}
91 91
92/** 92/**
93 * Messages from the interface if start/stop went as planned. 93 * Messages from the interface if start/stop went as planned.
94 * Purly for user feedback. 94 * Purly for user feedback.
95 * @param message the message to display. 95 * @param message the message to display.
96 */ 96 */
97void InterfaceInformationImp::showMessage(const QString &message) 97void InterfaceInformationImp::showMessage(const QString &message)
98{ 98{
99 if (CheckBoxSilent->isChecked()) return; 99 if (CheckBoxSilent->isChecked()) return;
100 QMessageBox::information(this, "Message", message, QMessageBox::Ok); 100 QMessageBox::information(this, "Message", message, QMessageBox::Ok);
101} 101}
102 102
103// infoimp.cpp 103// infoimp.cpp
104 104
diff --git a/noncore/settings/networksettings/mainwindowimp.cpp b/noncore/settings/networksettings/mainwindowimp.cpp
index b0a1dd9..1e16b97 100644
--- a/noncore/settings/networksettings/mainwindowimp.cpp
+++ b/noncore/settings/networksettings/mainwindowimp.cpp
@@ -4,365 +4,365 @@
4#include "interfaceinformationimp.h" 4#include "interfaceinformationimp.h"
5#include "interfacesetupimp.h" 5#include "interfacesetupimp.h"
6#include "interfaces.h" 6#include "interfaces.h"
7#include "module.h" 7#include "module.h"
8 8
9/* OPIE */ 9/* OPIE */
10#include <qpe/qcopenvelope_qws.h> 10#include <qpe/qcopenvelope_qws.h>
11#include <qpe/qpeapplication.h> 11#include <qpe/qpeapplication.h>
12#include <qpe/config.h> 12#include <qpe/config.h>
13#include <qpe/qlibrary.h> 13#include <qpe/qlibrary.h>
14#include <qpe/resource.h> 14#include <qpe/resource.h>
15 15
16/* QT */ 16/* QT */
17#include <qpushbutton.h> 17#include <qpushbutton.h>
18#include <qlistbox.h> 18#include <qlistbox.h>
19#include <qlineedit.h> 19#include <qlineedit.h>
20#include <qlistview.h> 20#include <qlistview.h>
21#include <qheader.h> 21#include <qheader.h>
22#include <qlabel.h> 22#include <qlabel.h>
23#include <qtabwidget.h> // in order to disable the profiles tab 23#include <qtabwidget.h> // in order to disable the profiles tab
24#include <qmessagebox.h> 24#include <qmessagebox.h>
25 25
26 26
27#if QT_VERSION < 300 27#if QT_VERSION < 300
28#include <qlist.h> 28#include <qlist.h>
29#else 29#else
30#include <qptrlist.h> 30#include <qptrlist.h>
31#endif 31#endif
32#include <qdir.h> 32#include <qdir.h>
33#include <qfile.h> 33#include <qfile.h>
34#include <qtextstream.h> 34#include <qtextstream.h>
35#include <qregexp.h> 35#include <qregexp.h>
36 36
37/* STD */ 37/* STD */
38#include <net/if.h> 38#include <net/if.h>
39#include <sys/ioctl.h> 39#include <sys/ioctl.h>
40#include <sys/socket.h> 40#include <sys/socket.h>
41 41
42#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme" 42#define DEFAULT_SCHEME "/var/lib/pcmcia/scheme"
43#define _PROCNETDEV "/proc/net/dev" 43#define _PROCNETDEV "/proc/net/dev"
44 44
45MainWindowImp::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)
46{ 46{
47 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked())); 47 connect(addConnectionButton, SIGNAL(clicked()), this, SLOT(addClicked()));
48 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked())); 48 connect(removeConnectionButton, SIGNAL(clicked()), this, SLOT(removeClicked()));
49 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked())); 49 connect(informationConnectionButton, SIGNAL(clicked()), this, SLOT(informationClicked()));
50 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked())); 50 connect(configureConnectionButton, SIGNAL(clicked()), this, SLOT(configureClicked()));
51 51
52 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile())); 52 connect(newProfileButton, SIGNAL(clicked()), this, SLOT(addProfile()));
53 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile())); 53 connect(removeProfileButton, SIGNAL(clicked()), this, SLOT(removeProfile()));
54 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile())); 54 connect(setCurrentProfileButton, SIGNAL(clicked()), this, SLOT(changeProfile()));
55 55
56 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&))); 56 connect(newProfile, SIGNAL(textChanged(const QString&)), this, SLOT(newProfileChanged(const QString&)));
57 57
58 //FIXME: disable profiles for the moment: 58 //FIXME: disable profiles for the moment:
59 tabWidget->setTabEnabled( tab, false ); 59 tabWidget->setTabEnabled( tab, false );
60 60
61 // Load connections. 61 // Load connections.
62 // /usr/local/kde/lib/libinterfaces.la 62 // /usr/local/kde/lib/libinterfaces.la
63#ifdef QWS 63#ifdef QWS
64 loadModules(QPEApplication::qpeDir() + "plugins/networksettings"); 64 loadModules(QPEApplication::qpeDir() + "plugins/networksettings");
65#else 65#else
66 loader = KLibLoader::self(); 66 loader = KLibLoader::self();
67 loadModules(QString("/usr/")+KStandardDirs::kde_default("lib")); 67 loadModules(QString("/usr/")+KStandardDirs::kde_default("lib"));
68#endif 68#endif
69 getAllInterfaces(); 69 getAllInterfaces();
70 70
71 Interfaces i; 71 Interfaces i;
72 QStringList list = i.getInterfaceList(); 72 QStringList list = i.getInterfaceList();
73 QMap<QString, Interface*>::Iterator it; 73 QMap<QString, Interface*>::Iterator it;
74 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni ) 74 for ( QStringList::Iterator ni = list.begin(); ni != list.end(); ++ni )
75 { 75 {
76 /* 76 /*
77 * we skipped it in getAllInterfaces now 77 * we skipped it in getAllInterfaces now
78 * we need to ignore it as well 78 * we need to ignore it as well
79 */ 79 */
80 if (m_handledIfaces.contains( *ni) ) 80 if (m_handledIfaces.contains( *ni) )
81 { 81 {
82 qDebug("Not up iface handled by module"); 82 qDebug("Not up iface handled by module");
83 continue; 83 continue;
84 } 84 }
85 bool found = false; 85 bool found = false;
86 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it ) 86 for( it = interfaceNames.begin(); it != interfaceNames.end(); ++it )
87 { 87 {
88 if(it.key() == (*ni)) 88 if(it.key() == (*ni))
89 found = true; 89 found = true;
90 } 90 }
91 if(!found) 91 if(!found)
92 { 92 {
93 if(!(*ni).contains("_")) 93 if(!(*ni).contains("_"))
94 { 94 {
95 Interface *i = new Interface(this, *ni, false); 95 Interface *i = new Interface(this, *ni, false);
96 i->setAttached(false); 96 i->setAttached(false);
97 i->setHardwareName(tr("Disconnected")); 97 i->setHardwareName(tr("Disconnected"));
98 interfaceNames.insert(i->getInterfaceName(), i); 98 interfaceNames.insert(i->getInterfaceName(), i);
99 updateInterface(i); 99 updateInterface(i);
100 connect(i, SIGNAL(updateInterface(Interface *)), this, SLOT(updateInterface(Interface *))); 100 connect(i, SIGNAL(updateInterface(Interface*)), this, SLOT(updateInterface(Interface*)));
101 } 101 }
102 } 102 }
103 } 103 }
104 104
105 //getInterfaceList(); 105 //getInterfaceList();
106 connectionList->header()->hide(); 106 connectionList->header()->hide();
107 107
108 Config cfg("NetworkSetup"); 108 Config cfg("NetworkSetup");
109 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All")); 109 profiles = QStringList::split(" ", cfg.readEntry("Profiles", "All"));
110 for ( QStringList::Iterator it = profiles.begin(); 110 for ( QStringList::Iterator it = profiles.begin();
111 it != profiles.end(); ++it) 111 it != profiles.end(); ++it)
112 profilesList->insertItem((*it)); 112 profilesList->insertItem((*it));
113 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All")); 113 currentProfileLabel->setText(cfg.readEntry("CurrentProfile", "All"));
114 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false); 114 advancedUserMode = cfg.readBoolEntry("AdvancedUserMode", false);
115 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME); 115 scheme = cfg.readEntry("SchemeFile", DEFAULT_SCHEME);
116 116
117 QFile file(scheme); 117 QFile file(scheme);
118 if ( file.open(IO_ReadOnly) ) 118 if ( file.open(IO_ReadOnly) )
119 { // file opened successfully 119 { // file opened successfully
120 QTextStream stream( &file ); // use a text stream 120 QTextStream stream( &file ); // use a text stream
121 while ( !stream.eof() ) 121 while ( !stream.eof() )
122 { // until end of file... 122 { // until end of file...
123 QString line = stream.readLine(); // line of text excluding '\n' 123 QString line = stream.readLine(); // line of text excluding '\n'
124 if(line.contains("SCHEME")) 124 if(line.contains("SCHEME"))
125 { 125 {
126 line = line.mid(7, line.length()); 126 line = line.mid(7, line.length());
127 currentProfileLabel->setText(line); 127 currentProfileLabel->setText(line);
128 break; 128 break;
129 } 129 }
130 } 130 }
131 file.close(); 131 file.close();
132 } 132 }
133 makeChannel(); 133 makeChannel();
134} 134}
135 135
136/** 136/**
137 * Deconstructor. Save profiles. Delete loaded libraries. 137 * Deconstructor. Save profiles. Delete loaded libraries.
138 */ 138 */
139MainWindowImp::~MainWindowImp() 139MainWindowImp::~MainWindowImp()
140{ 140{
141 // Save profiles. 141 // Save profiles.
142 Config cfg("NetworkSetup"); 142 Config cfg("NetworkSetup");
143 cfg.setGroup("General"); 143 cfg.setGroup("General");
144 cfg.writeEntry("Profiles", profiles.join(" ")); 144 cfg.writeEntry("Profiles", profiles.join(" "));
145 145
146 // Delete all interfaces that don't have owners. 146 // Delete all interfaces that don't have owners.
147 QMap<Interface*, QListViewItem*>::Iterator iIt; 147 QMap<Interface*, QListViewItem*>::Iterator iIt;
148 for( iIt = items.begin(); iIt != items.end(); ++iIt ) 148 for( iIt = items.begin(); iIt != items.end(); ++iIt )
149 { 149 {
150 if(iIt.key()->getModuleOwner() == NULL) 150 if(iIt.key()->getModuleOwner() == NULL)
151 delete iIt.key(); 151 delete iIt.key();
152 } 152 }
153 153
154#ifdef QWS 154#ifdef QWS
155 // Delete Modules and Libraries 155 // Delete Modules and Libraries
156 QMap<Module*, QLibrary*>::Iterator it; 156 QMap<Module*, QLibrary*>::Iterator it;
157 for( it = libraries.begin(); it != libraries.end(); ++it ) 157 for( it = libraries.begin(); it != libraries.end(); ++it )
158 { 158 {
159 delete it.key(); 159 delete it.key();
160 // I wonder why I can't delete the libraries 160 // I wonder why I can't delete the libraries
161 // What fucking shit this is. 161 // What fucking shit this is.
162 //delete it.data(); 162 //delete it.data();
163 } 163 }
164#else 164#else
165 // klibloader automaticly deletes the libraries for us... 165 // klibloader automaticly deletes the libraries for us...
166#endif 166#endif
167} 167}
168 168
169/** 169/**
170 * Query the kernel for all of the interfaces. 170 * Query the kernel for all of the interfaces.
171 */ 171 */
172void MainWindowImp::getAllInterfaces() 172void MainWindowImp::getAllInterfaces()
173{ 173{
174 int sockfd = socket(PF_INET, SOCK_DGRAM, 0); 174 int sockfd = socket(PF_INET, SOCK_DGRAM, 0);
175 if(sockfd == -1) 175 if(sockfd == -1)
176 return; 176 return;
177 177
178 struct ifreq ifr; 178 struct ifreq ifr;
179 QStringList ifaces; 179 QStringList ifaces;
180 QFile procFile(QString(_PROCNETDEV)); 180 QFile procFile(QString(_PROCNETDEV));
181 int result; 181 int result;
182 Interface *i; 182 Interface *i;
183 183
184 if (! procFile.exists()) 184 if (! procFile.exists())
185 { 185 {
186 struct ifreq ifrs[100]; 186 struct ifreq ifrs[100];
187 struct ifconf ifc; 187 struct ifconf ifc;
188 ifc.ifc_len = sizeof(ifrs); 188 ifc.ifc_len = sizeof(ifrs);
189 ifc.ifc_req = ifrs; 189 ifc.ifc_req = ifrs;
190 result = ioctl(sockfd, SIOCGIFCONF, &ifc); 190 result = ioctl(sockfd, SIOCGIFCONF, &ifc);
191 191
192 for (unsigned int i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++) 192 for (unsigned int i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++)
193 { 193 {
194 struct ifreq *pifr = &ifrs[i]; 194 struct ifreq *pifr = &ifrs[i];
195 195
196 ifaces += pifr->ifr_name; 196 ifaces += pifr->ifr_name;
197 } 197 }
198 } 198 }
199 else 199 else
200 { 200 {
201 procFile.open(IO_ReadOnly); 201 procFile.open(IO_ReadOnly);
202 QString line; 202 QString line;
203 QTextStream procTs(&procFile); 203 QTextStream procTs(&procFile);
204 int loc = -1; 204 int loc = -1;
205 205
206 procTs.readLine(); // eat a line 206 procTs.readLine(); // eat a line
207 procTs.readLine(); // eat a line 207 procTs.readLine(); // eat a line
208 while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null) 208 while((line = procTs.readLine().simplifyWhiteSpace()) != QString::null)
209 { 209 {
210 if((loc = line.find(":")) != -1) 210 if((loc = line.find(":")) != -1)
211 { 211 {
212 ifaces += line.left(loc); 212 ifaces += line.left(loc);
213 } 213 }
214 } 214 }
215 } 215 }
216 216
217 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it) 217 for (QStringList::Iterator it = ifaces.begin(); it != ifaces.end(); ++it)
218 { 218 {
219 int flags = 0; 219 int flags = 0;
220 if ( m_handledIfaces.contains( (*it) ) ) 220 if ( m_handledIfaces.contains( (*it) ) )
221 { 221 {
222 qDebug(" %s is handled by a module", (*it).latin1() ); 222 qDebug(" %s is handled by a module", (*it).latin1() );
223 continue; 223 continue;
224 } 224 }
225 // int family; 225 // int family;
226 i = NULL; 226 i = NULL;
227 227
228 strcpy(ifr.ifr_name, (*it).latin1()); 228 strcpy(ifr.ifr_name, (*it).latin1());
229 229
230 struct ifreq ifcopy; 230 struct ifreq ifcopy;
231 ifcopy = ifr; 231 ifcopy = ifr;
232 result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy); 232 result = ioctl(sockfd, SIOCGIFFLAGS, &ifcopy);
233 flags = ifcopy.ifr_flags; 233 flags = ifcopy.ifr_flags;
234 i = new Interface(this, ifr.ifr_name, false); 234 i = new Interface(this, ifr.ifr_name, false);
235 i->setAttached(true); 235 i->setAttached(true);
236 if ((flags & IFF_UP) == IFF_UP) 236 if ((flags & IFF_UP) == IFF_UP)
237 i->setStatus(true); 237 i->setStatus(true);
238 else 238 else
239 i->setStatus(false); 239 i->setStatus(false);
240 240
241 if ((flags & IFF_BROADCAST) == IFF_BROADCAST) 241 if ((flags & IFF_BROADCAST) == IFF_BROADCAST)
242 i->setHardwareName("Ethernet"); 242 i->setHardwareName("Ethernet");
243 else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT) 243 else if ((flags & IFF_POINTOPOINT) == IFF_POINTOPOINT)
244 i->setHardwareName("Point to Point"); 244 i->setHardwareName("Point to Point");
245 else if ((flags & IFF_MULTICAST) == IFF_MULTICAST) 245 else if ((flags & IFF_MULTICAST) == IFF_MULTICAST)
246 i->setHardwareName("Multicast"); 246 i->setHardwareName("Multicast");
247 else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK) 247 else if ((flags & IFF_LOOPBACK) == IFF_LOOPBACK)
248 i->setHardwareName("Loopback"); 248 i->setHardwareName("Loopback");
249 else 249 else
250 i->setHardwareName("Unknown"); 250 i->setHardwareName("Unknown");
251 251
252 qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name); 252 qWarning("Adding interface %s to interfaceNames\n", ifr.ifr_name);
253 interfaceNames.insert(i->getInterfaceName(), i); 253 interfaceNames.insert(i->getInterfaceName(), i);
254 updateInterface(i); 254 updateInterface(i);
255 connect(i, SIGNAL(updateInterface(Interface *)), 255 connect(i, SIGNAL(updateInterface(Interface*)),
256 this, SLOT(updateInterface(Interface *))); 256 this, SLOT(updateInterface(Interface*)));
257 } 257 }
258 // now lets ask the plugins too ;) 258 // now lets ask the plugins too ;)
259 QMap<Module*, QLibrary*>::Iterator it; 259 QMap<Module*, QLibrary*>::Iterator it;
260 QList<Interface> ilist; 260 QList<Interface> ilist;
261 for( it = libraries.begin(); it != libraries.end(); ++it ) 261 for( it = libraries.begin(); it != libraries.end(); ++it )
262 { 262 {
263 if(it.key()) 263 if(it.key())
264 { 264 {
265 ilist = it.key()->getInterfaces(); 265 ilist = it.key()->getInterfaces();
266 for( i = ilist.first(); i != 0; i = ilist.next() ) 266 for( i = ilist.first(); i != 0; i = ilist.next() )
267 { 267 {
268 qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() ); 268 qWarning("Adding interface %s to interfaceNames\n", i->getInterfaceName().latin1() );
269 interfaceNames.insert(i->getInterfaceName(), i); 269 interfaceNames.insert(i->getInterfaceName(), i);
270 updateInterface(i); 270 updateInterface(i);
271 connect(i, SIGNAL(updateInterface(Interface *)), 271 connect(i, SIGNAL(updateInterface(Interface*)),
272 this, SLOT(updateInterface(Interface *))); 272 this, SLOT(updateInterface(Interface*)));
273 } 273 }
274 } 274 }
275 } 275 }
276} 276}
277 277
278/** 278/**
279 * Load all modules that are found in the path 279 * Load all modules that are found in the path
280 * @param path a directory that is scaned for any plugins that can be loaded 280 * @param path a directory that is scaned for any plugins that can be loaded
281 * and attempts to load them 281 * and attempts to load them
282 */ 282 */
283void MainWindowImp::loadModules(const QString &path) 283void MainWindowImp::loadModules(const QString &path)
284{ 284{
285#ifdef DEBUG 285#ifdef DEBUG
286 qDebug("MainWindowImp::loadModules: %s", path.latin1()); 286 qDebug("MainWindowImp::loadModules: %s", path.latin1());
287#endif 287#endif
288 QDir d(path); 288 QDir d(path);
289 if(!d.exists()) 289 if(!d.exists())
290 return; 290 return;
291 291
292 // Don't want sym links 292 // Don't want sym links
293 d.setFilter( QDir::Files | QDir::NoSymLinks ); 293 d.setFilter( QDir::Files | QDir::NoSymLinks );
294 const QFileInfoList *list = d.entryInfoList(); 294 const QFileInfoList *list = d.entryInfoList();
295 QFileInfoListIterator it( *list ); 295 QFileInfoListIterator it( *list );
296 QFileInfo *fi; 296 QFileInfo *fi;
297 while ( (fi=it.current()) ) 297 while ( (fi=it.current()) )
298 { 298 {
299#ifdef QWS 299#ifdef QWS
300 if(fi->fileName().contains(".so")) 300 if(fi->fileName().contains(".so"))
301 { 301 {
302#else 302#else
303 if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_")) 303 if(fi->fileName().contains(".so") && fi->fileName().contains("networksettings_"))
304 { 304 {
305#endif 305#endif
306 loadPlugin(path + "/" + fi->fileName()); 306 loadPlugin(path + "/" + fi->fileName());
307 qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1()); 307 qDebug("loaded plugin: >%s< ",QString(path + "/" + fi->fileName()).latin1());
308 } 308 }
309 ++it; 309 ++it;
310 } 310 }
311} 311}
312 312
313/** 313/**
314 * Attempt to load a function and resolve a function. 314 * Attempt to load a function and resolve a function.
315 * @param pluginFileName - the name of the file in which to attempt to load 315 * @param pluginFileName - the name of the file in which to attempt to load
316 * @param resolveString - function pointer to resolve 316 * @param resolveString - function pointer to resolve
317 * @return pointer to the function with name resolveString or NULL 317 * @return pointer to the function with name resolveString or NULL
318 */ 318 */
319Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString) 319Module* MainWindowImp::loadPlugin(const QString &pluginFileName, const QString &resolveString)
320{ 320{
321#ifdef DEBUG 321#ifdef DEBUG
322 qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1()); 322 qDebug("MainWindowImp::loadPlugin: %s: resolving %s", pluginFileName.latin1(), resolveString.latin1());
323#endif 323#endif
324#ifdef QWS 324#ifdef QWS
325 QLibrary *lib = new QLibrary(pluginFileName); 325 QLibrary *lib = new QLibrary(pluginFileName);
326 void *functionPointer = lib->resolve(resolveString); 326 void *functionPointer = lib->resolve(resolveString);
327 if( !functionPointer ) 327 if( !functionPointer )
328 { 328 {
329#ifdef DEBUG 329#ifdef DEBUG
330 qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1()); 330 qDebug("MainWindowImp::loadPlugin: Warning: %s is not a plugin", pluginFileName.latin1());
331#endif 331#endif
332 delete lib; 332 delete lib;
333 return NULL; 333 return NULL;
334 } 334 }
335 // Try to get an object. 335 // Try to get an object.
336 Module *object = ((Module* (*)()) functionPointer)(); 336 Module *object = ((Module* (*)()) functionPointer)();
337 if(object == NULL) 337 if(object == NULL)
338 { 338 {
339#ifdef DEBUG 339#ifdef DEBUG
340 qDebug("MainWindowImp: Couldn't create object, but did load library!"); 340 qDebug("MainWindowImp: Couldn't create object, but did load library!");
341#endif 341#endif
342 delete lib; 342 delete lib;
343 return NULL; 343 return NULL;
344 } 344 }
345 345
346 m_handledIfaces += object->handledInterfaceNames(); 346 m_handledIfaces += object->handledInterfaceNames();
347 // Store for deletion later 347 // Store for deletion later
348 libraries.insert(object, lib); 348 libraries.insert(object, lib);
349 return object; 349 return object;
350 350
351#else 351#else
352 QLibrary *lib = loader->library(pluginFileName); 352 QLibrary *lib = loader->library(pluginFileName);
353 if( !lib || !lib->hasSymbol(resolveString) ) 353 if( !lib || !lib->hasSymbol(resolveString) )
354 { 354 {
355 qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1()); 355 qDebug(QString("MainWindowImp::loadPlugin: File: %1 is not a plugin, but though was.").arg(pluginFileName).latin1());
356 return NULL; 356 return NULL;
357 } 357 }
358 // Try to get an object. 358 // Try to get an object.
359 Module *object = ((Module* (*)()) lib->symbol(resolveString))(); 359 Module *object = ((Module* (*)()) lib->symbol(resolveString))();
360 if(object == NULL) 360 if(object == NULL)
361 { 361 {
362#ifdef DEBUG 362#ifdef DEBUG
363 qDebug("MainWindowImp: Couldn't create object, but did load library!"); 363 qDebug("MainWindowImp: Couldn't create object, but did load library!");
364#endif 364#endif
365 return NULL; 365 return NULL;
366 } 366 }
367#ifdef DEBUG 367#ifdef DEBUG
368 qDebug("MainWindowImp::loadPlugin:: Found object, storing."); 368 qDebug("MainWindowImp::loadPlugin:: Found object, storing.");
@@ -619,130 +619,130 @@ void MainWindowImp::removeProfile()
619{ 619{
620 if(profilesList->count() <= 1) 620 if(profilesList->count() <= 1)
621 { 621 {
622 QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok); 622 QMessageBox::information(this, "Can't remove.","At least one profile\nis needed.", QMessageBox::Ok);
623 return; 623 return;
624 } 624 }
625 QString profileToRemove = profilesList->currentText(); 625 QString profileToRemove = profilesList->currentText();
626 if(profileToRemove == "All") 626 if(profileToRemove == "All")
627 { 627 {
628 QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok); 628 QMessageBox::information(this, "Can't remove.","Can't remove default.", QMessageBox::Ok);
629 return; 629 return;
630 } 630 }
631 // Can't remove the curent profile 631 // Can't remove the curent profile
632 if(profileToRemove == currentProfileLabel->text()) 632 if(profileToRemove == currentProfileLabel->text())
633 { 633 {
634 QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok); 634 QMessageBox::information(this, "Can't remove.",QString("%1 is the current profile.").arg(profileToRemove), QMessageBox::Ok);
635 return; 635 return;
636 636
637 } 637 }
638 638
639 if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok) 639 if(QMessageBox::information(this, "Question",QString("Remove profile: %1").arg(profileToRemove), QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Ok)
640 { 640 {
641 profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), "")); 641 profiles = QStringList::split(" ", profiles.join(" ").replace(QRegExp(profileToRemove), ""));
642 profilesList->clear(); 642 profilesList->clear();
643 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it) 643 for ( QStringList::Iterator it = profiles.begin(); it != profiles.end(); ++it)
644 profilesList->insertItem((*it)); 644 profilesList->insertItem((*it));
645 645
646 // Remove any interface settings and mappings. 646 // Remove any interface settings and mappings.
647 Interfaces interfaces; 647 Interfaces interfaces;
648 // Go through them one by one 648 // Go through them one by one
649 QMap<Interface*, QListViewItem*>::Iterator it; 649 QMap<Interface*, QListViewItem*>::Iterator it;
650 for( it = items.begin(); it != items.end(); ++it ) 650 for( it = items.begin(); it != items.end(); ++it )
651 { 651 {
652 QString interfaceName = it.key()->getInterfaceName(); 652 QString interfaceName = it.key()->getInterfaceName();
653 qDebug(interfaceName.latin1()); 653 qDebug(interfaceName.latin1());
654 if(interfaces.setInterface(interfaceName + "_" + profileToRemove)) 654 if(interfaces.setInterface(interfaceName + "_" + profileToRemove))
655 { 655 {
656 interfaces.removeInterface(); 656 interfaces.removeInterface();
657 if(interfaces.setMapping(interfaceName)) 657 if(interfaces.setMapping(interfaceName))
658 { 658 {
659 if(profilesList->count() == 1) 659 if(profilesList->count() == 1)
660 interfaces.removeMapping(); 660 interfaces.removeMapping();
661 else 661 else
662 { 662 {
663 interfaces.removeMap("map", interfaceName + "_" + profileToRemove); 663 interfaces.removeMap("map", interfaceName + "_" + profileToRemove);
664 } 664 }
665 } 665 }
666 interfaces.write(); 666 interfaces.write();
667 break; 667 break;
668 } 668 }
669 } 669 }
670 } 670 }
671} 671}
672 672
673/** 673/**
674 * A new profile has been selected, change. 674 * A new profile has been selected, change.
675 * @param newProfile the new profile. 675 * @param newProfile the new profile.
676 */ 676 */
677void MainWindowImp::changeProfile() 677void MainWindowImp::changeProfile()
678{ 678{
679 if(profilesList->currentItem() == -1) 679 if(profilesList->currentItem() == -1)
680 { 680 {
681 QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok); 681 QMessageBox::information(this, "Can't Change.","Please select a profile.", QMessageBox::Ok);
682 return; 682 return;
683 } 683 }
684 QString newProfile = profilesList->text(profilesList->currentItem()); 684 QString newProfile = profilesList->text(profilesList->currentItem());
685 if(newProfile != currentProfileLabel->text()) 685 if(newProfile != currentProfileLabel->text())
686 { 686 {
687 currentProfileLabel->setText(newProfile); 687 currentProfileLabel->setText(newProfile);
688 QFile::remove(scheme); 688 QFile::remove(scheme);
689 QFile file(scheme); 689 QFile file(scheme);
690 if ( file.open(IO_ReadWrite) ) 690 if ( file.open(IO_ReadWrite) )
691 { 691 {
692 QTextStream stream( &file ); 692 QTextStream stream( &file );
693 stream << QString("SCHEME=%1").arg(newProfile); 693 stream << QString("SCHEME=%1").arg(newProfile);
694 file.close(); 694 file.close();
695 } 695 }
696 // restart all up devices? 696 // restart all up devices?
697 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok) 697 if(QMessageBox::information(this, "Question","Restart all running interfaces?", QMessageBox::Ok, QMessageBox::No) == QMessageBox::Ok)
698 { 698 {
699 // Go through them one by one 699 // Go through them one by one
700 QMap<Interface*, QListViewItem*>::Iterator it; 700 QMap<Interface*, QListViewItem*>::Iterator it;
701 for( it = items.begin(); it != items.end(); ++it ) 701 for( it = items.begin(); it != items.end(); ++it )
702 { 702 {
703 if(it.key()->getStatus() == true) 703 if(it.key()->getStatus() == true)
704 it.key()->restart(); 704 it.key()->restart();
705 } 705 }
706 } 706 }
707 } 707 }
708 // TODO change the profile in the modules 708 // TODO change the profile in the modules
709} 709}
710 710
711 711
712void MainWindowImp::makeChannel() 712void MainWindowImp::makeChannel()
713{ 713{
714 channel = new QCopChannel( "QPE/Application/networksettings", this ); 714 channel = new QCopChannel( "QPE/Application/networksettings", this );
715 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 715 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
716 this, SLOT(receive(const QCString&, const QByteArray&)) ); 716 this, SLOT(receive(const QCString&,const QByteArray&)) );
717} 717}
718 718
719void MainWindowImp::receive(const QCString &msg, const QByteArray &arg) 719void MainWindowImp::receive(const QCString &msg, const QByteArray &arg)
720{ 720{
721 bool found = false; 721 bool found = false;
722 qDebug("MainWindowImp::receive QCop msg >"+msg+"<"); 722 qDebug("MainWindowImp::receive QCop msg >"+msg+"<");
723 if (msg == "raise") 723 if (msg == "raise")
724 { 724 {
725 raise(); 725 raise();
726 return; 726 return;
727 } 727 }
728 728
729 QString dest = msg.left(msg.find("(")); 729 QString dest = msg.left(msg.find("("));
730 QCString param = msg.right(msg.length() - msg.find("(") - 1); 730 QCString param = msg.right(msg.length() - msg.find("(") - 1);
731 param = param.left( param.length() - 1 ); 731 param = param.left( param.length() - 1 );
732 qDebug("dest >%s< param >"+param+"<",dest.latin1()); 732 qDebug("dest >%s< param >"+param+"<",dest.latin1());
733 733
734 QMap<Module*, QLibrary*>::Iterator it; 734 QMap<Module*, QLibrary*>::Iterator it;
735 for( it = libraries.begin(); it != libraries.end(); ++it ) 735 for( it = libraries.begin(); it != libraries.end(); ++it )
736 { 736 {
737 qDebug("plugin >%s<", it.key()->type().latin1() ); 737 qDebug("plugin >%s<", it.key()->type().latin1() );
738 if(it.key()->type() == dest) 738 if(it.key()->type() == dest)
739 { 739 {
740 it.key()->receive( param, arg ); 740 it.key()->receive( param, arg );
741 found = true; 741 found = true;
742 } 742 }
743 } 743 }
744 744
745 745
746 if (found) QPEApplication::setKeepRunning(); 746 if (found) QPEApplication::setKeepRunning();
747 else qDebug("Huh what do ya want"); 747 else qDebug("Huh what do ya want");
748} 748}
diff --git a/noncore/settings/networksettings/ppp/edit.cpp b/noncore/settings/networksettings/ppp/edit.cpp
index 7d21605..3b2393c 100644
--- a/noncore/settings/networksettings/ppp/edit.cpp
+++ b/noncore/settings/networksettings/ppp/edit.cpp
@@ -479,194 +479,194 @@ void IPWidget::autoname_t(bool on)
479 "problems with the X-server and applications " 479 "problems with the X-server and applications "
480 "while kppp is connected. Don't use it until " 480 "while kppp is connected. Don't use it until "
481 "you know what you are doing!\n" 481 "you know what you are doing!\n"
482 "For more information take a look at the " 482 "For more information take a look at the "
483 "handbook (or help) in the section \"Frequently " 483 "handbook (or help) in the section \"Frequently "
484 "asked questions\"."), 484 "asked questions\"."),
485 tr("Warning")); 485 tr("Warning"));
486 was_warned = true; 486 was_warned = true;
487 } 487 }
488} 488}
489 489
490 490
491void IPWidget::save() 491void IPWidget::save()
492{ 492{
493 if(dynamicadd_rb->isChecked()) 493 if(dynamicadd_rb->isChecked())
494 { 494 {
495 _pppdata->setIpaddr("0.0.0.0"); 495 _pppdata->setIpaddr("0.0.0.0");
496 _pppdata->setSubnetmask("0.0.0.0"); 496 _pppdata->setSubnetmask("0.0.0.0");
497 } 497 }
498 else 498 else
499 { 499 {
500 _pppdata->setIpaddr(ipaddress_l->text()); 500 _pppdata->setIpaddr(ipaddress_l->text());
501 _pppdata->setSubnetmask(subnetmask_l->text()); 501 _pppdata->setSubnetmask(subnetmask_l->text());
502 } 502 }
503 _pppdata->setAutoname(autoname->isChecked()); 503 _pppdata->setAutoname(autoname->isChecked());
504} 504}
505 505
506 506
507void IPWidget::hitIPSelect( int i ) 507void IPWidget::hitIPSelect( int i )
508{ 508{
509 if(i == 0) 509 if(i == 0)
510 { 510 {
511 ipaddress_label->setEnabled(false); 511 ipaddress_label->setEnabled(false);
512 sub_label->setEnabled(false); 512 sub_label->setEnabled(false);
513 ipaddress_l->setEnabled(false); 513 ipaddress_l->setEnabled(false);
514 subnetmask_l->setEnabled(false); 514 subnetmask_l->setEnabled(false);
515 } 515 }
516 else 516 else
517 { 517 {
518 ipaddress_label->setEnabled(true); 518 ipaddress_label->setEnabled(true);
519 sub_label->setEnabled(true); 519 sub_label->setEnabled(true);
520 ipaddress_l->setEnabled(true); 520 ipaddress_l->setEnabled(true);
521 subnetmask_l->setEnabled(true); 521 subnetmask_l->setEnabled(true);
522 } 522 }
523} 523}
524 524
525 525
526 526
527DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name ) 527DNSWidget::DNSWidget( PPPData *pd, QWidget *parent, bool isnewaccount, const char *name )
528 : QWidget(parent, name), _pppdata(pd) 528 : QWidget(parent, name), _pppdata(pd)
529{ 529{
530 QGridLayout *tl = new QGridLayout(this, 7, 2, 0 ); 530 QGridLayout *tl = new QGridLayout(this, 7, 2, 0 );
531 531
532 dnsdomain_label = new QLabel(tr("Domain name:"), this); 532 dnsdomain_label = new QLabel(tr("Domain name:"), this);
533 tl->addWidget(dnsdomain_label, 0, 0); 533 tl->addWidget(dnsdomain_label, 0, 0);
534 534
535 dnsdomain = new QLineEdit(this); 535 dnsdomain = new QLineEdit(this);
536 536
537 tl->addWidget(dnsdomain, 0, 1); 537 tl->addWidget(dnsdomain, 0, 1);
538 QString tmp = tr("If you enter a domain name here, this domain\n" 538 QString tmp = tr("If you enter a domain name here, this domain\n"
539 "name is used for your computer while you are\n" 539 "name is used for your computer while you are\n"
540 "connected. When the connection is closed, the\n" 540 "connected. When the connection is closed, the\n"
541 "original domain name of your computer is\n" 541 "original domain name of your computer is\n"
542 "restored.\n" 542 "restored.\n"
543 "\n" 543 "\n"
544 "If you leave this field blank, no changes are\n" 544 "If you leave this field blank, no changes are\n"
545 "made to the domain name."); 545 "made to the domain name.");
546 546
547 QWhatsThis::add(dnsdomain_label,tmp); 547 QWhatsThis::add(dnsdomain_label,tmp);
548 QWhatsThis::add(dnsdomain,tmp); 548 QWhatsThis::add(dnsdomain,tmp);
549 549
550 conf_label = new QLabel(tr("Configuration:"), this); 550 conf_label = new QLabel(tr("Configuration:"), this);
551 tl->addWidget(conf_label, 1, 0); 551 tl->addWidget(conf_label, 1, 0);
552 552
553 bg = new QButtonGroup("Group", this); 553 bg = new QButtonGroup("Group", this);
554 connect(bg, SIGNAL(clicked(int)), SLOT(DNS_Mode_Selected(int))); 554 connect(bg, SIGNAL(clicked(int)), SLOT(DNS_Mode_Selected(int)));
555 bg->hide(); 555 bg->hide();
556 556
557 autodns = new QRadioButton(tr("Automatic"), this); 557 autodns = new QRadioButton(tr("Automatic"), this);
558 bg->insert(autodns, 0); 558 bg->insert(autodns, 0);
559 tl->addWidget(autodns, 1, 1); 559 tl->addWidget(autodns, 1, 1);
560 if(!_pppdata->pppdVersionMin(2, 3, 7)) 560 if(!_pppdata->pppdVersionMin(2, 3, 7))
561 autodns->setEnabled(false); 561 autodns->setEnabled(false);
562 562
563 mandns = new QRadioButton(tr("Manual"), this); 563 mandns = new QRadioButton(tr("Manual"), this);
564 bg->insert(mandns, 1); 564 bg->insert(mandns, 1);
565 tl->addWidget(mandns, 2, 1); 565 tl->addWidget(mandns, 2, 1);
566 566
567 dns_label = new QLabel(tr("DNS IP address:"), this); 567 dns_label = new QLabel(tr("DNS IP address:"), this);
568 tl->addWidget(dns_label, 3, 0); 568 tl->addWidget(dns_label, 3, 0);
569 569
570 QHBoxLayout *l2 = new QHBoxLayout; 570 QHBoxLayout *l2 = new QHBoxLayout;
571 tl->addLayout(l2, 3, 1); 571 tl->addLayout(l2, 3, 1);
572 dnsipaddr = new IPLineEdit(this); 572 dnsipaddr = new IPLineEdit(this);
573 connect(dnsipaddr, SIGNAL(returnPressed()), 573 connect(dnsipaddr, SIGNAL(returnPressed()),
574 SLOT(adddns())); 574 SLOT(adddns()));
575 connect(dnsipaddr, SIGNAL(textChanged(const QString &)), 575 connect(dnsipaddr, SIGNAL(textChanged(const QString&)),
576 SLOT(DNS_Edit_Changed(const QString &))); 576 SLOT(DNS_Edit_Changed(const QString&)));
577 l2->addWidget(dnsipaddr, 1); 577 l2->addWidget(dnsipaddr, 1);
578 l2->addStretch(1); 578 l2->addStretch(1);
579 tmp = tr("<p>Allows you to specify a new DNS server to be\n" 579 tmp = tr("<p>Allows you to specify a new DNS server to be\n"
580 "used while you are connected. When the\n" 580 "used while you are connected. When the\n"
581 "connection is closed, this DNS entry will be\n" 581 "connection is closed, this DNS entry will be\n"
582 "removed again.\n" 582 "removed again.\n"
583 "\n" 583 "\n"
584 "To add a DNS server, type in the IP address of\n" 584 "To add a DNS server, type in the IP address of\n"
585 "the DNS server here and click on <b>Add</b>"); 585 "the DNS server here and click on <b>Add</b>");
586 586
587 QWhatsThis::add(dns_label, tmp); 587 QWhatsThis::add(dns_label, tmp);
588 QWhatsThis::add(dnsipaddr, tmp); 588 QWhatsThis::add(dnsipaddr, tmp);
589 589
590 QHBoxLayout *l1 = new QHBoxLayout; 590 QHBoxLayout *l1 = new QHBoxLayout;
591 tl->addLayout(l1, 4, 1); 591 tl->addLayout(l1, 4, 1);
592 add = new QPushButton(tr("Add"), this); 592 add = new QPushButton(tr("Add"), this);
593 connect(add, SIGNAL(clicked()), SLOT(adddns())); 593 connect(add, SIGNAL(clicked()), SLOT(adddns()));
594 l1->addWidget(add); 594 l1->addWidget(add);
595 // l1->addStretch(1); 595 // l1->addStretch(1);
596 QWhatsThis::add(add, 596 QWhatsThis::add(add,
597 tr("Click this button to add the DNS server\n" 597 tr("Click this button to add the DNS server\n"
598 "specified in the field above. The entry\n" 598 "specified in the field above. The entry\n"
599 "will then be added to the list below")); 599 "will then be added to the list below"));
600 600
601 remove = new QPushButton(tr("Remove"), this); 601 remove = new QPushButton(tr("Remove"), this);
602 connect(remove, SIGNAL(clicked()), SLOT(removedns())); 602 connect(remove, SIGNAL(clicked()), SLOT(removedns()));
603 l1->addWidget(remove); 603 l1->addWidget(remove);
604 QWhatsThis::add(remove, 604 QWhatsThis::add(remove,
605 tr("Click this button to remove the selected DNS\n" 605 tr("Click this button to remove the selected DNS\n"
606 "server entry from the list below")); 606 "server entry from the list below"));
607 607
608 servers_label = new QLabel(tr("DNS address list:"), this); 608 servers_label = new QLabel(tr("DNS address list:"), this);
609 servers_label->setAlignment(AlignTop|AlignLeft); 609 servers_label->setAlignment(AlignTop|AlignLeft);
610 tl->addWidget(servers_label, 5, 0); 610 tl->addWidget(servers_label, 5, 0);
611 611
612 dnsservers = new QListBox(this); 612 dnsservers = new QListBox(this);
613 dnsservers->setMinimumSize(150, 80); 613 dnsservers->setMinimumSize(150, 80);
614 connect(dnsservers, SIGNAL(highlighted(int)), 614 connect(dnsservers, SIGNAL(highlighted(int)),
615 SLOT(DNS_Entry_Selected(int))); 615 SLOT(DNS_Entry_Selected(int)));
616 tl->addWidget(dnsservers, 5, 1); 616 tl->addWidget(dnsservers, 5, 1);
617 tmp = tr("<p>This shows all defined DNS servers to use\n" 617 tmp = tr("<p>This shows all defined DNS servers to use\n"
618 "while you are connected. Use the <b>Add</b> and\n" 618 "while you are connected. Use the <b>Add</b> and\n"
619 "<b>Remove</b> buttons to modify the list"); 619 "<b>Remove</b> buttons to modify the list");
620 620
621 QWhatsThis::add(servers_label,tmp); 621 QWhatsThis::add(servers_label,tmp);
622 QWhatsThis::add(dnsservers,tmp); 622 QWhatsThis::add(dnsservers,tmp);
623 623
624 exdnsdisabled_toggle = new QCheckBox(tr("Disable DNS servers during connection"), this); 624 exdnsdisabled_toggle = new QCheckBox(tr("Disable DNS servers during connection"), this);
625 // exdnsdisabled_toggle = new QCheckBox(tr("Disable existing DNS servers during connection"), this); 625 // exdnsdisabled_toggle = new QCheckBox(tr("Disable existing DNS servers during connection"), this);
626 exdnsdisabled_toggle->setChecked(_pppdata->exDNSDisabled()); 626 exdnsdisabled_toggle->setChecked(_pppdata->exDNSDisabled());
627 tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter); 627 tl->addMultiCellWidget(exdnsdisabled_toggle, 6, 6, 0, 1, AlignCenter);
628 QWhatsThis::add(exdnsdisabled_toggle, 628 QWhatsThis::add(exdnsdisabled_toggle,
629 tr("<p>When this option is selected, all DNS\n" 629 tr("<p>When this option is selected, all DNS\n"
630 "servers specified in <tt>/etc/resolv.conf</tt> are\n" 630 "servers specified in <tt>/etc/resolv.conf</tt> are\n"
631 "temporary disabled while the dialup connection\n" 631 "temporary disabled while the dialup connection\n"
632 "is established. After the connection is\n" 632 "is established. After the connection is\n"
633 "closed, the servers will be re-enabled\n" 633 "closed, the servers will be re-enabled\n"
634 "\n" 634 "\n"
635 "Typically, there is no reason to use this\n" 635 "Typically, there is no reason to use this\n"
636 "option, but it may become useful under \n" 636 "option, but it may become useful under \n"
637 "some circumstances.")); 637 "some circumstances."));
638 638
639 639
640 // restore data if editing 640 // restore data if editing
641 if(!isnewaccount) 641 if(!isnewaccount)
642 { 642 {
643 dnsservers->insertStringList(_pppdata->dns()); 643 dnsservers->insertStringList(_pppdata->dns());
644 dnsdomain->setText(_pppdata->domain()); 644 dnsdomain->setText(_pppdata->domain());
645 } 645 }
646 646
647 int mode = _pppdata->autoDNS() ? 0 : 1; 647 int mode = _pppdata->autoDNS() ? 0 : 1;
648 bg->setButton(mode); 648 bg->setButton(mode);
649 DNS_Mode_Selected(mode); 649 DNS_Mode_Selected(mode);
650 650
651 tl->activate(); 651 tl->activate();
652} 652}
653 653
654void DNSWidget::DNS_Edit_Changed(const QString &text) 654void DNSWidget::DNS_Edit_Changed(const QString &text)
655{ 655{
656 QRegExp r("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+"); 656 QRegExp r("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+");
657 add->setEnabled(text.find(r) != -1); 657 add->setEnabled(text.find(r) != -1);
658} 658}
659 659
660void DNSWidget::DNS_Entry_Selected(int) 660void DNSWidget::DNS_Entry_Selected(int)
661{ 661{
662 remove->setEnabled(true); 662 remove->setEnabled(true);
663} 663}
664 664
665void DNSWidget::DNS_Mode_Selected(int mode) 665void DNSWidget::DNS_Mode_Selected(int mode)
666{ 666{
667 bool on = (mode == 1); 667 bool on = (mode == 1);
668 dns_label->setEnabled(on); 668 dns_label->setEnabled(on);
669 servers_label->setEnabled(on); 669 servers_label->setEnabled(on);
670 dnsipaddr->setText(""); 670 dnsipaddr->setText("");
671 dnsipaddr->setEnabled(on); 671 dnsipaddr->setEnabled(on);
672 add->setEnabled(false); 672 add->setEnabled(false);
@@ -1091,121 +1091,121 @@ void ScriptWidget::insertButton()
1091 break; 1091 break;
1092 1092
1093 case ScriptEdit::Timeout: 1093 case ScriptEdit::Timeout:
1094 stl->insertItem("Timeout", stl->currentItem()); 1094 stl->insertItem("Timeout", stl->currentItem());
1095 sl->insertItem(se->text(), sl->currentItem()); 1095 sl->insertItem(se->text(), sl->currentItem());
1096 break; 1096 break;
1097 1097
1098 case ScriptEdit::Password: 1098 case ScriptEdit::Password:
1099 stl->insertItem("Password", stl->currentItem()); 1099 stl->insertItem("Password", stl->currentItem());
1100 sl->insertItem(se->text(), sl->currentItem()); 1100 sl->insertItem(se->text(), sl->currentItem());
1101 break; 1101 break;
1102 1102
1103 case ScriptEdit::ID: 1103 case ScriptEdit::ID:
1104 stl->insertItem("ID", stl->currentItem()); 1104 stl->insertItem("ID", stl->currentItem());
1105 sl->insertItem(se->text(), sl->currentItem()); 1105 sl->insertItem(se->text(), sl->currentItem());
1106 break; 1106 break;
1107 1107
1108 case ScriptEdit::Prompt: 1108 case ScriptEdit::Prompt:
1109 stl->insertItem("Prompt", stl->currentItem()); 1109 stl->insertItem("Prompt", stl->currentItem());
1110 sl->insertItem(se->text(), sl->currentItem()); 1110 sl->insertItem(se->text(), sl->currentItem());
1111 break; 1111 break;
1112 1112
1113 case ScriptEdit::PWPrompt: 1113 case ScriptEdit::PWPrompt:
1114 stl->insertItem("PWPrompt", stl->currentItem()); 1114 stl->insertItem("PWPrompt", stl->currentItem());
1115 sl->insertItem(se->text(), sl->currentItem()); 1115 sl->insertItem(se->text(), sl->currentItem());
1116 break; 1116 break;
1117 1117
1118 case ScriptEdit::LoopStart: 1118 case ScriptEdit::LoopStart:
1119 stl->insertItem("LoopStart", stl->currentItem()); 1119 stl->insertItem("LoopStart", stl->currentItem());
1120 sl->insertItem(se->text(), sl->currentItem()); 1120 sl->insertItem(se->text(), sl->currentItem());
1121 break; 1121 break;
1122 1122
1123 case ScriptEdit::LoopEnd: 1123 case ScriptEdit::LoopEnd:
1124 stl->insertItem("LoopEnd", stl->currentItem()); 1124 stl->insertItem("LoopEnd", stl->currentItem());
1125 sl->insertItem(se->text(), sl->currentItem()); 1125 sl->insertItem(se->text(), sl->currentItem());
1126 break; 1126 break;
1127 1127
1128 case ScriptEdit::Scan: 1128 case ScriptEdit::Scan:
1129 stl->insertItem("Scan", stl->currentItem()); 1129 stl->insertItem("Scan", stl->currentItem());
1130 sl->insertItem(se->text(), sl->currentItem()); 1130 sl->insertItem(se->text(), sl->currentItem());
1131 break; 1131 break;
1132 1132
1133 case ScriptEdit::Save: 1133 case ScriptEdit::Save:
1134 stl->insertItem("Save", stl->currentItem()); 1134 stl->insertItem("Save", stl->currentItem());
1135 sl->insertItem(se->text(), sl->currentItem()); 1135 sl->insertItem(se->text(), sl->currentItem());
1136 break; 1136 break;
1137 1137
1138 default: 1138 default:
1139 break; 1139 break;
1140 } 1140 }
1141 adjustScrollBar(); 1141 adjustScrollBar();
1142 se->setText(""); 1142 se->setText("");
1143} 1143}
1144 1144
1145 1145
1146void ScriptWidget::removeButton() 1146void ScriptWidget::removeButton()
1147{ 1147{
1148 if(sl->currentItem() >= 0) 1148 if(sl->currentItem() >= 0)
1149 { 1149 {
1150 int stlc = stl->currentItem(); 1150 int stlc = stl->currentItem();
1151 sl->removeItem(sl->currentItem()); 1151 sl->removeItem(sl->currentItem());
1152 stl->removeItem(stlc); 1152 stl->removeItem(stlc);
1153 adjustScrollBar(); 1153 adjustScrollBar();
1154 insert->setEnabled(sl->currentItem() != -1); 1154 insert->setEnabled(sl->currentItem() != -1);
1155 remove->setEnabled(sl->currentItem() != -1); 1155 remove->setEnabled(sl->currentItem() != -1);
1156 } 1156 }
1157} 1157}
1158 1158
1159 1159
1160 1160
1161///////////////////////////////////////////////////////////////////////////// 1161/////////////////////////////////////////////////////////////////////////////
1162// 1162//
1163// Used to specify a new phone number 1163// Used to specify a new phone number
1164// 1164//
1165///////////////////////////////////////////////////////////////////////////// 1165/////////////////////////////////////////////////////////////////////////////
1166PhoneNumberDialog::PhoneNumberDialog(QWidget *parent) 1166PhoneNumberDialog::PhoneNumberDialog(QWidget *parent)
1167 : QDialog(parent,"PhoneNumberDialog",true) 1167 : QDialog(parent,"PhoneNumberDialog",true)
1168{ 1168{
1169 setCaption( tr("Add Phone Number") ); 1169 setCaption( tr("Add Phone Number") );
1170 1170
1171 1171
1172 QVBoxLayout *layout = new QVBoxLayout( this ); 1172 QVBoxLayout *layout = new QVBoxLayout( this );
1173 layout->setSpacing( 3 ); 1173 layout->setSpacing( 3 );
1174 layout->setMargin( 3 ); 1174 layout->setMargin( 3 );
1175 1175
1176 // QHBox *hbox = new QHBox(this); 1176 // QHBox *hbox = new QHBox(this);
1177 // setMainWidget(hbox); 1177 // setMainWidget(hbox);
1178 1178
1179 // hbox->setSpacing( 2 );//KDialog::spacingHint()); 1179 // hbox->setSpacing( 2 );//KDialog::spacingHint());
1180 1180
1181 QLabel *label = new QLabel(this, tr("Enter a phone number:")); 1181 QLabel *label = new QLabel(this, tr("Enter a phone number:"));
1182 layout->addWidget( label ); 1182 layout->addWidget( label );
1183 1183
1184 le = new QLineEdit(this, "lineEdit"); 1184 le = new QLineEdit(this, "lineEdit");
1185 layout->addWidget( le ); 1185 layout->addWidget( le );
1186 1186
1187 connect(le, SIGNAL(textChanged(const QString &)), 1187 connect(le, SIGNAL(textChanged(const QString&)),
1188 this, SLOT(textChanged(const QString &))); 1188 this, SLOT(textChanged(const QString&)));
1189 1189
1190 le->setFocus(); 1190 le->setFocus();
1191 textChanged(""); 1191 textChanged("");
1192 1192
1193 1193
1194} 1194}
1195 1195
1196 1196
1197QString PhoneNumberDialog::phoneNumber() 1197QString PhoneNumberDialog::phoneNumber()
1198{ 1198{
1199 QString s = le->text(); 1199 QString s = le->text();
1200 1200
1201 return s; 1201 return s;
1202} 1202}
1203 1203
1204 1204
1205void PhoneNumberDialog::textChanged(const QString &s) 1205void PhoneNumberDialog::textChanged(const QString &s)
1206{ 1206{
1207 // enableButtonOK(s.length() > 0); 1207 // enableButtonOK(s.length() > 0);
1208} 1208}
1209 1209
1210 1210
1211//#include "edit.moc" 1211//#include "edit.moc"
diff --git a/noncore/settings/networksettings/ppp/general.cpp b/noncore/settings/networksettings/ppp/general.cpp
index ff1b11b..81dab38 100644
--- a/noncore/settings/networksettings/ppp/general.cpp
+++ b/noncore/settings/networksettings/ppp/general.cpp
@@ -1,184 +1,184 @@
1/* 1/*
2 * kPPP: A pppd front end for the KDE project 2 * kPPP: A pppd front end for the KDE project
3 * 3 *
4 * $Id$ 4 * $Id$
5 * 5 *
6 * Copyright (C) 1997 Bernd Johannes Wuebben 6 * Copyright (C) 1997 Bernd Johannes Wuebben
7 * wuebben@math.cornell.edu 7 * wuebben@math.cornell.edu
8 * 8 *
9 * based on EzPPP: 9 * based on EzPPP:
10 * Copyright (C) 1997 Jay Painter 10 * Copyright (C) 1997 Jay Painter
11 * 11 *
12 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Library General Public 13 * modify it under the terms of the GNU Library General Public
14 * License as published by the Free Software Foundation; either 14 * License as published by the Free Software Foundation; either
15 * version 2 of the License, or (at your option) any later version. 15 * version 2 of the License, or (at your option) any later version.
16 * 16 *
17 * This program is distributed in the hope that it will be useful, 17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Library General Public License for more details. 20 * Library General Public License for more details.
21 * 21 *
22 * You should have received a copy of the GNU Library General Public 22 * You should have received a copy of the GNU Library General Public
23 * License along with this program; if not, write to the Free 23 * License along with this program; if not, write to the Free
24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 24 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */ 25 */
26 26
27#include "general.h" 27#include "general.h"
28#include "interfaceppp.h" 28#include "interfaceppp.h"
29#include "modeminfo.h" 29#include "modeminfo.h"
30#include "modemcmds.h" 30#include "modemcmds.h"
31#include "pppdata.h" 31#include "pppdata.h"
32 32
33/* OPIE */ 33/* OPIE */
34#include <qpe/config.h> 34#include <qpe/config.h>
35#include <qpe/qpeapplication.h> 35#include <qpe/qpeapplication.h>
36 36
37/* QT */ 37/* QT */
38#include <qcheckbox.h> 38#include <qcheckbox.h>
39#include <qcombobox.h> 39#include <qcombobox.h>
40#include <qlabel.h> 40#include <qlabel.h>
41#include <qlayout.h> 41#include <qlayout.h>
42#include <qpushbutton.h> 42#include <qpushbutton.h>
43#include <qslider.h> 43#include <qslider.h>
44#include <qspinbox.h> 44#include <qspinbox.h>
45#include <qwhatsthis.h> 45#include <qwhatsthis.h>
46 46
47/* STD */ 47/* STD */
48#include <termios.h> 48#include <termios.h>
49#include <string.h> 49#include <string.h>
50 50
51 51
52ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name ) 52ModemWidget::ModemWidget( PPPData *pd, QWidget *parent, const char *name )
53 : QWidget(parent, name), _pppdata(pd) 53 : QWidget(parent, name), _pppdata(pd)
54{ 54{
55 int k; 55 int k;
56 56
57 QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint()); 57 QGridLayout *tl = new QGridLayout(this, 8, 2, 0 );//, KDialog::spacingHint());
58 58
59 QLabel *label1; 59 QLabel *label1;
60 60
61 label1 = new QLabel(tr("Modem &name:"), this); 61 label1 = new QLabel(tr("Modem &name:"), this);
62 tl->addWidget(label1, 0, 0); 62 tl->addWidget(label1, 0, 0);
63 63
64 modemname = new QLineEdit(this, "modemName"); 64 modemname = new QLineEdit(this, "modemName");
65 modemname->setText( _pppdata->devname() ); 65 modemname->setText( _pppdata->devname() );
66 label1->setBuddy(modemname); 66 label1->setBuddy(modemname);
67 tl->addWidget(modemname, 0, 1); 67 tl->addWidget(modemname, 0, 1);
68 68
69 label1 = new QLabel(tr("Modem de&vice:"), this); 69 label1 = new QLabel(tr("Modem de&vice:"), this);
70 tl->addWidget(label1, 1, 0); 70 tl->addWidget(label1, 1, 0);
71 71
72 modemdevice = new QComboBox(false, this); 72 modemdevice = new QComboBox(false, this);
73 modemdevice->setEditable( true ); 73 modemdevice->setEditable( true );
74 modemdevice->setDuplicatesEnabled ( false ); 74 modemdevice->setDuplicatesEnabled ( false );
75 modemdevice->setInsertionPolicy( QComboBox::AtTop ); 75 modemdevice->setInsertionPolicy( QComboBox::AtTop );
76 label1->setBuddy(modemdevice); 76 label1->setBuddy(modemdevice);
77 77
78 Config cfg("NetworkSetupPPP"); 78 Config cfg("NetworkSetupPPP");
79 cfg.setGroup("Devices_General"); 79 cfg.setGroup("Devices_General");
80 QStringList devs = cfg.readListEntry("devices",','); 80 QStringList devs = cfg.readListEntry("devices",',');
81 if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0"; 81 if (devs.isEmpty()) devs << "/dev/modem" << "/dev/ircomm0" << "/dev/ttyS0";
82 modemdevice->insertStringList( devs ); 82 modemdevice->insertStringList( devs );
83 tl->addWidget(modemdevice, 1, 1); 83 tl->addWidget(modemdevice, 1, 1);
84 84
85 // connect(modemdevice, SIGNAL(activated(int)), 85 // connect(modemdevice, SIGNAL(activated(int)),
86 // SLOT(setmodemdc(int))); 86 // SLOT(setmodemdc(int)));
87 // connect(modemdevice, SIGNAL(textChanged( const QString & ) ), 87 // connect(modemdevice, SIGNAL(textChanged(const QString&) ),
88 // SLOT( setmodemdc( const QString &) ) ); 88 // SLOT( setmodemdc(const QString&) ) );
89 89
90 QString tmp = tr("This specifies the serial port your modem is attached \n" 90 QString tmp = tr("This specifies the serial port your modem is attached \n"
91 "to. On Linux/x86, typically this is either /dev/ttyS0 \n" 91 "to. On Linux/x86, typically this is either /dev/ttyS0 \n"
92 "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n" 92 "(COM1 under DOS) or /dev/ttyS1 (COM2 under DOS).\n"
93 "\n" 93 "\n"
94 "If you have an internal ISDN card with AT command\n" 94 "If you have an internal ISDN card with AT command\n"
95 "emulation (most cards under Linux support this), you\n" 95 "emulation (most cards under Linux support this), you\n"
96 "should select one of the /dev/ttyIx devices."); 96 "should select one of the /dev/ttyIx devices.");
97 97
98 QWhatsThis::add(label1,tmp); 98 QWhatsThis::add(label1,tmp);
99 QWhatsThis::add(modemdevice,tmp); 99 QWhatsThis::add(modemdevice,tmp);
100 100
101 101
102 label1 = new QLabel(tr("&Flow control:"), this); 102 label1 = new QLabel(tr("&Flow control:"), this);
103 tl->addWidget(label1, 2, 0); 103 tl->addWidget(label1, 2, 0);
104 104
105 flowcontrol = new QComboBox(false, this); 105 flowcontrol = new QComboBox(false, this);
106 label1->setBuddy(flowcontrol); 106 label1->setBuddy(flowcontrol);
107 flowcontrol->insertItem(tr("Hardware [CRTSCTS]")); 107 flowcontrol->insertItem(tr("Hardware [CRTSCTS]"));
108 flowcontrol->insertItem(tr("Software [XON/XOFF]")); 108 flowcontrol->insertItem(tr("Software [XON/XOFF]"));
109 flowcontrol->insertItem(tr("None")); 109 flowcontrol->insertItem(tr("None"));
110 tl->addWidget(flowcontrol, 2, 1); 110 tl->addWidget(flowcontrol, 2, 1);
111 // connect(flowcontrol, SIGNAL(activated(int)), 111 // connect(flowcontrol, SIGNAL(activated(int)),
112 // SLOT(setflowcontrol(int))); 112 // SLOT(setflowcontrol(int)));
113 113
114 tmp = tr("<p>Specifies how the serial port and modem\n" 114 tmp = tr("<p>Specifies how the serial port and modem\n"
115 "communicate. You should not change this unless\n" 115 "communicate. You should not change this unless\n"
116 "you know what you are doing.\n" 116 "you know what you are doing.\n"
117 "\n" 117 "\n"
118 "<b>Default</b>: CRTSCTS"); 118 "<b>Default</b>: CRTSCTS");
119 119
120 QWhatsThis::add(label1,tmp); 120 QWhatsThis::add(label1,tmp);
121 QWhatsThis::add(flowcontrol,tmp); 121 QWhatsThis::add(flowcontrol,tmp);
122 122
123 QLabel *labelenter = new QLabel(tr("&Line termination:"), this); 123 QLabel *labelenter = new QLabel(tr("&Line termination:"), this);
124 tl->addWidget(labelenter, 3, 0); 124 tl->addWidget(labelenter, 3, 0);
125 125
126 enter = new QComboBox(false, this); 126 enter = new QComboBox(false, this);
127 labelenter->setBuddy(enter); 127 labelenter->setBuddy(enter);
128 enter->insertItem("CR"); 128 enter->insertItem("CR");
129 enter->insertItem("LF"); 129 enter->insertItem("LF");
130 enter->insertItem("CR/LF"); 130 enter->insertItem("CR/LF");
131 tl->addWidget(enter, 3, 1); 131 tl->addWidget(enter, 3, 1);
132 // connect(enter, SIGNAL(activated(int)), SLOT(setenter(int))); 132 // connect(enter, SIGNAL(activated(int)), SLOT(setenter(int)));
133 tmp = tr("<p>Specifies how AT commands are sent to your\n" 133 tmp = tr("<p>Specifies how AT commands are sent to your\n"
134 "modem. Most modems will work fine with the\n" 134 "modem. Most modems will work fine with the\n"
135 "default <i>CR/LF</i>. If your modem does not react\n" 135 "default <i>CR/LF</i>. If your modem does not react\n"
136 "to the init string, you should try different\n" 136 "to the init string, you should try different\n"
137 "settings here\n" 137 "settings here\n"
138 "\n" 138 "\n"
139 "<b>Default</b>: CR/LF"); 139 "<b>Default</b>: CR/LF");
140 140
141 QWhatsThis::add(labelenter,tmp); 141 QWhatsThis::add(labelenter,tmp);
142 QWhatsThis::add(enter, tmp); 142 QWhatsThis::add(enter, tmp);
143 143
144 QLabel *baud_label = new QLabel(tr("Co&nnection speed:"), this); 144 QLabel *baud_label = new QLabel(tr("Co&nnection speed:"), this);
145 tl->addWidget(baud_label, 4, 0); 145 tl->addWidget(baud_label, 4, 0);
146 baud_c = new QComboBox(this); 146 baud_c = new QComboBox(this);
147 baud_label->setBuddy(baud_c); 147 baud_label->setBuddy(baud_c);
148 148
149 static const char *baudrates[] = 149 static const char *baudrates[] =
150 { 150 {
151 151
152#ifdef B460800 152#ifdef B460800
153 "460800", 153 "460800",
154#endif 154#endif
155 155
156#ifdef B230400 156#ifdef B230400
157 "230400", 157 "230400",
158#endif 158#endif
159 159
160#ifdef B115200 160#ifdef B115200
161 "115200", 161 "115200",
162#endif 162#endif
163 163
164#ifdef B57600 164#ifdef B57600
165 "57600", 165 "57600",
166#endif 166#endif
167 167
168 "38400", 168 "38400",
169 "19200", 169 "19200",
170 "9600", 170 "9600",
171 "2400", 171 "2400",
172 0 172 0
173 }; 173 };
174 174
175 for(k = 0; baudrates[k]; k++) 175 for(k = 0; baudrates[k]; k++)
176 baud_c->insertItem(baudrates[k]); 176 baud_c->insertItem(baudrates[k]);
177 177
178 baud_c->setCurrentItem(3); 178 baud_c->setCurrentItem(3);
179 // connect(baud_c, SIGNAL(activated(int)), 179 // connect(baud_c, SIGNAL(activated(int)),
180 // this, SLOT(speed_selection(int))); 180 // this, SLOT(speed_selection(int)));
181 tl->addWidget(baud_c, 4, 1); 181 tl->addWidget(baud_c, 4, 1);
182 182
183 tmp = tr("Specifies the speed your modem and the serial\n" 183 tmp = tr("Specifies the speed your modem and the serial\n"
184 "port talk to each other. You should begin with\n" 184 "port talk to each other. You should begin with\n"
diff --git a/noncore/settings/networksettings/ppp/kpppwidget.cpp b/noncore/settings/networksettings/ppp/kpppwidget.cpp
index e466358..e21bbc7 100644
--- a/noncore/settings/networksettings/ppp/kpppwidget.cpp
+++ b/noncore/settings/networksettings/ppp/kpppwidget.cpp
@@ -303,197 +303,197 @@ KPPPWidget::~KPPPWidget()
303 303
304// bool KPPPWidget::eventFilter(QObject *o, QEvent *e) { 304// bool KPPPWidget::eventFilter(QObject *o, QEvent *e) {
305// if(e->type() == QEvent::User) { 305// if(e->type() == QEvent::User) {
306// switch(((SignalEvent*)e)->sigType()) { 306// switch(((SignalEvent*)e)->sigType()) {
307// case SIGINT: 307// case SIGINT:
308// qDebug( "Received a SIGINT" ); 308// qDebug( "Received a SIGINT" );
309// interruptConnection(); 309// interruptConnection();
310// break; 310// break;
311// case SIGCHLD: 311// case SIGCHLD:
312// sigChld(); 312// sigChld();
313// break; 313// break;
314// case SIGUSR1: 314// case SIGUSR1:
315// sigPPPDDied(); 315// sigPPPDDied();
316// break; 316// break;
317// } 317// }
318// return true; 318// return true;
319// } 319// }
320 320
321// if(o == connect_b) { 321// if(o == connect_b) {
322// if(e->type() == QEvent::KeyPress) { 322// if(e->type() == QEvent::KeyPress) {
323// if(connect_b->hasFocus() && ((QKeyEvent *)e)->key() == Qt::Key_Return) { 323// if(connect_b->hasFocus() && ((QKeyEvent *)e)->key() == Qt::Key_Return) {
324// beginConnect(); 324// beginConnect();
325// return true; 325// return true;
326// } 326// }
327// } 327// }
328// } 328// }
329 329
330// return false; 330// return false;
331// } 331// }
332 332
333 333
334 334
335 335
336void KPPPWidget::enterPressedInID() { 336void KPPPWidget::enterPressedInID() {
337 PW_Edit->setFocus(); 337 PW_Edit->setFocus();
338} 338}
339 339
340 340
341void KPPPWidget::enterPressedInPW() { 341void KPPPWidget::enterPressedInPW() {
342 connect_b->setFocus(); 342 connect_b->setFocus();
343} 343}
344 344
345// triggered by the session manager 345// triggered by the session manager
346void KPPPWidget::saveMyself() { 346void KPPPWidget::saveMyself() {
347 _pppdata->save(); 347 _pppdata->save();
348} 348}
349 349
350void KPPPWidget::shutDown() { 350void KPPPWidget::shutDown() {
351 interruptConnection(); 351 interruptConnection();
352 saveMyself(); 352 saveMyself();
353} 353}
354 354
355void KPPPWidget::log_window_toggled(bool on) { 355void KPPPWidget::log_window_toggled(bool on) {
356 _pppdata->set_show_log_window(on); 356 _pppdata->set_show_log_window(on);
357} 357}
358 358
359 359
360 360
361 361
362// void KPPPWidget::resetaccounts() { 362// void KPPPWidget::resetaccounts() {
363// connectto_c->clear(); 363// connectto_c->clear();
364 364
365// int count = _pppdata->count(); 365// int count = _pppdata->count();
366 366
367// // enable/disable controls 367// // enable/disable controls
368// connectto_c->setEnabled(count > 0); 368// connectto_c->setEnabled(count > 0);
369// connect_b->setEnabled(count > 0); 369// connect_b->setEnabled(count > 0);
370// log->setEnabled(count > 0); 370// log->setEnabled(count > 0);
371// ID_Edit->setEnabled(count > 0); 371// ID_Edit->setEnabled(count > 0);
372// PW_Edit->setEnabled(count > 0); 372// PW_Edit->setEnabled(count > 0);
373 373
374// //load the accounts 374// //load the accounts
375// for(int i=0; i < count; i++) { 375// for(int i=0; i < count; i++) {
376// _pppdata->setAccountbyIndex(i); 376// _pppdata->setAccountbyIndex(i);
377// connectto_c->insertItem(_pppdata->accname()); 377// connectto_c->insertItem(_pppdata->accname());
378// } 378// }
379 379
380// //set the default account 380// //set the default account
381// if(!_pppdata->defaultAccount().isEmpty()) { 381// if(!_pppdata->defaultAccount().isEmpty()) {
382// for(int i=0; i < count; i++) 382// for(int i=0; i < count; i++)
383// if(_pppdata->defaultAccount() == connectto_c->text(i)) { 383// if(_pppdata->defaultAccount() == connectto_c->text(i)) {
384 // connectto_c->setCurrentItem(i); 384 // connectto_c->setCurrentItem(i);
385 // _pppdata->setAccountbyIndex(i); 385 // _pppdata->setAccountbyIndex(i);
386 386
387 // ID_Edit->setText(_pppdata->storedUsername()); 387 // ID_Edit->setText(_pppdata->storedUsername());
388 // PW_Edit->setText(_pppdata->storedPassword()); 388 // PW_Edit->setText(_pppdata->storedPassword());
389// } 389// }
390// } 390// }
391// else 391// else
392// if(count > 0) { 392// if(count > 0) {
393// _pppdata->setDefaultAccount(connectto_c->text(0)); 393// _pppdata->setDefaultAccount(connectto_c->text(0));
394// _pppdata->save(); 394// _pppdata->save();
395 // ID_Edit->setText(_pppdata->storedUsername()); 395 // ID_Edit->setText(_pppdata->storedUsername());
396 // PW_Edit->setText(_pppdata->storedPassword()); 396 // PW_Edit->setText(_pppdata->storedPassword());
397// } 397// }
398 398
399// connect(ID_Edit, SIGNAL(textChanged(const QString &)), 399// connect(ID_Edit, SIGNAL(textChanged(const QString&)),
400 // this, SLOT(usernameChanged(const QString &))); 400 // this, SLOT(usernameChanged(const QString&)));
401 401
402// connect(PW_Edit, SIGNAL(textChanged(const QString &)), 402// connect(PW_Edit, SIGNAL(textChanged(const QString&)),
403 // this, SLOT(passwordChanged(const QString &))); 403 // this, SLOT(passwordChanged(const QString&)));
404 404
405// if (ID_Edit->text().isEmpty()) 405// if (ID_Edit->text().isEmpty())
406// ID_Edit->setFocus(); 406// ID_Edit->setFocus();
407// else if (PW_Edit->text().isEmpty()) 407// else if (PW_Edit->text().isEmpty())
408// PW_Edit->setFocus(); 408// PW_Edit->setFocus();
409// } 409// }
410 410
411 411
412void KPPPWidget::interruptConnection() { 412void KPPPWidget::interruptConnection() {
413 // interrupt dial up 413 // interrupt dial up
414// 414//
415 415
416 if (con->isVisible()) 416 if (con->isVisible())
417 emit con->cancelbutton(); 417 emit con->cancelbutton();
418 418
419 // disconnect if online 419 // disconnect if online
420 if (_pppdata->pppdRunning()) 420 if (_pppdata->pppdRunning())
421 emit disconnect(); 421 emit disconnect();
422} 422}
423 423
424 424
425void KPPPWidget::sigPPPDDied() { 425void KPPPWidget::sigPPPDDied() {
426 qDebug( "Received a SIGUSR1" ); 426 qDebug( "Received a SIGUSR1" );
427 427
428 // if we are not connected pppdpid is -1 so have have to check for that 428 // if we are not connected pppdpid is -1 so have have to check for that
429 // in the followin line to make sure that we don't raise a false alarm 429 // in the followin line to make sure that we don't raise a false alarm
430 // such as would be the case when the log file viewer exits. 430 // such as would be the case when the log file viewer exits.
431 if(_pppdata->pppdRunning() || _pppdata->pppdError()) { 431 if(_pppdata->pppdRunning() || _pppdata->pppdError()) {
432 qDebug( "It was pppd that died" ); 432 qDebug( "It was pppd that died" );
433 433
434 // when we killpppd() on Cancel in ConnectWidget 434 // when we killpppd() on Cancel in ConnectWidget
435 // we set pppid to -1 so we won't 435 // we set pppid to -1 so we won't
436 // enter this block 436 // enter this block
437 437
438 // just to be sure 438 // just to be sure
439 439
440 Modem::modem->removeSecret(AUTH_PAP); 440 Modem::modem->removeSecret(AUTH_PAP);
441 Modem::modem->removeSecret(AUTH_CHAP); 441 Modem::modem->removeSecret(AUTH_CHAP);
442 442
443 _pppdata->setpppdRunning(false); 443 _pppdata->setpppdRunning(false);
444 444
445 qDebug( "Executing command on disconnect since pppd has died." ); 445 qDebug( "Executing command on disconnect since pppd has died." );
446 QApplication::flushX(); 446 QApplication::flushX();
447 execute_command(_pppdata->command_on_disconnect()); 447 execute_command(_pppdata->command_on_disconnect());
448 448
449// stopAccounting(); 449// stopAccounting();
450 450
451 con_win->stopClock(); 451 con_win->stopClock();
452// DockWidget::dock_widget->stop_stats(); 452// DockWidget::dock_widget->stop_stats();
453// DockWidget::dock_widget->hide(); 453// DockWidget::dock_widget->hide();
454 454
455 if(!_pppdata->pppdError()) 455 if(!_pppdata->pppdError())
456 _pppdata->setpppdError(E_PPPD_DIED); 456 _pppdata->setpppdError(E_PPPD_DIED);
457 removedns(); 457 removedns();
458 Modem::modem->unlockdevice(); 458 Modem::modem->unlockdevice();
459 // 459 //
460 con->pppdDied(); 460 con->pppdDied();
461 461
462 if(!_pppdata->automatic_redial()) { 462 if(!_pppdata->automatic_redial()) {
463 quit_b->setFocus(); 463 quit_b->setFocus();
464 show(); 464 show();
465 con_win->stopClock(); 465 con_win->stopClock();
466 //stopAccounting(); 466 //stopAccounting();
467 con_win->hide(); 467 con_win->hide();
468 con->hide(); 468 con->hide();
469 469
470 _pppdata->setpppdRunning(false); 470 _pppdata->setpppdRunning(false);
471 // // not in a signal handler !!! KNotifyClient::beep(); 471 // // not in a signal handler !!! KNotifyClient::beep();
472 QString msg; 472 QString msg;
473 if (_pppdata->pppdError() == E_IF_TIMEOUT) 473 if (_pppdata->pppdError() == E_IF_TIMEOUT)
474 msg = QObject::tr("Timeout expired while waiting for the PPP interface " 474 msg = QObject::tr("Timeout expired while waiting for the PPP interface "
475 "to come up!"); 475 "to come up!");
476 else { 476 else {
477 msg = QObject::tr("<p>The pppd daemon died unexpectedly!</p>"); 477 msg = QObject::tr("<p>The pppd daemon died unexpectedly!</p>");
478 Modem::modem->pppdExitStatus(); 478 Modem::modem->pppdExitStatus();
479 if (Modem::modem->lastStatus != 99) {// more recent pppds only 479 if (Modem::modem->lastStatus != 99) {// more recent pppds only
480 msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus); 480 msg += QObject::tr("<p>Exit status: %1").arg(Modem::modem->lastStatus);
481 msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error " 481 msg += QObject::tr("</p><p>See 'man pppd' for an explanation of the error "
482 "codes or take a look at the kppp FAQ on " 482 "codes or take a look at the kppp FAQ on "
483 " <a href=http://devel-home.kde.org/~kppp/index.html>" 483 " <a href=http://devel-home.kde.org/~kppp/index.html>"
484 "http://devel-home.kde.org/~kppp/index.html</a></p>"); 484 "http://devel-home.kde.org/~kppp/index.html</a></p>");
485 } 485 }
486 } 486 }
487 487
488 // if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No) 488 // if(QMessageBox::warning(0, msg, QObject::tr("Error"), QObject::tr("&OK"), QObject::tr("&Details...")) == QMessageBox::No)
489 // // PPPL_ShowLog(); 489 // // PPPL_ShowLog();
490// } else { /* reconnect on disconnect */ 490// } else { /* reconnect on disconnect */
491 if (false){ 491 if (false){
492 qDebug( "Trying to reconnect... " ); 492 qDebug( "Trying to reconnect... " );
493 493
494 if(_pppdata->authMethod() == AUTH_PAP || 494 if(_pppdata->authMethod() == AUTH_PAP ||
495 _pppdata->authMethod() == AUTH_CHAP || 495 _pppdata->authMethod() == AUTH_CHAP ||
496 _pppdata->authMethod() == AUTH_PAPCHAP) 496 _pppdata->authMethod() == AUTH_PAPCHAP)
497 Modem::modem->setSecret(_pppdata->authMethod(), 497 Modem::modem->setSecret(_pppdata->authMethod(),
498 encodeWord(_pppdata->storedUsername()), 498 encodeWord(_pppdata->storedUsername()),
499 encodeWord(_pppdata->password())); 499 encodeWord(_pppdata->password()));
@@ -628,194 +628,194 @@ void KPPPWidget::disconnect() {
628 con->setCaption(QObject::tr("Disconnecting...")); 628 con->setCaption(QObject::tr("Disconnecting..."));
629 con->setMsg(QObject::tr("Executing command before disconnection.")); 629 con->setMsg(QObject::tr("Executing command before disconnection."));
630 630
631 qApp->processEvents(); 631 qApp->processEvents();
632 QApplication::flushX(); 632 QApplication::flushX();
633// pid_t id = 633// pid_t id =
634 execute_command(_pppdata->command_before_disconnect()); 634 execute_command(_pppdata->command_before_disconnect());
635// int i, status; 635// int i, status;
636 636
637// do { 637// do {
638// kapp->processEvents(); 638// kapp->processEvents();
639// i = waitpid(id, &status, WNOHANG); 639// i = waitpid(id, &status, WNOHANG);
640// usleep(500000); 640// usleep(500000);
641// } while (i == 0 && errno == 0); 641// } while (i == 0 && errno == 0);
642 642
643 con->hide(); 643 con->hide();
644 } 644 }
645 645
646 qApp->processEvents(); 646 qApp->processEvents();
647 647
648// statdlg->stop_stats(); 648// statdlg->stop_stats();
649 Modem::modem->killPPPDaemon(); 649 Modem::modem->killPPPDaemon();
650 650
651 QApplication::flushX(); 651 QApplication::flushX();
652 execute_command(_pppdata->command_on_disconnect()); 652 execute_command(_pppdata->command_on_disconnect());
653 653
654 Modem::modem->removeSecret(AUTH_PAP); 654 Modem::modem->removeSecret(AUTH_PAP);
655 Modem::modem->removeSecret(AUTH_CHAP); 655 Modem::modem->removeSecret(AUTH_CHAP);
656 656
657 removedns(); 657 removedns();
658 Modem::modem->unlockdevice(); 658 Modem::modem->unlockdevice();
659 659
660 con_win->stopClock(); 660 con_win->stopClock();
661// p_kppp->stopAccounting(); 661// p_kppp->stopAccounting();
662 con_win->hide(); 662 con_win->hide();
663 663
664// DockWidget::dock_widget->stop_stats(); 664// DockWidget::dock_widget->stop_stats();
665// DockWidget::dock_widget->hide(); 665// DockWidget::dock_widget->hide();
666 666
667// if(m_bQuitOnDisconnect) 667// if(m_bQuitOnDisconnect)
668// kapp->exit(0); 668// kapp->exit(0);
669// else { 669// else {
670 this->quit_b->setFocus(); 670 this->quit_b->setFocus();
671 this->show(); 671 this->show();
672// } 672// }
673} 673}
674 674
675 675
676// void KPPPWidget::helpbutton() { 676// void KPPPWidget::helpbutton() {
677// kapp->invokeHelp(); 677// kapp->invokeHelp();
678// } 678// }
679 679
680 680
681void KPPPWidget::quitbutton() { 681void KPPPWidget::quitbutton() {
682 if(_pppdata->pppdRunning()) { 682 if(_pppdata->pppdRunning()) {
683 int ok = QMessageBox::warning(this, 683 int ok = QMessageBox::warning(this,
684 QObject::tr("Exiting kPPP will close your PPP Session."), 684 QObject::tr("Exiting kPPP will close your PPP Session."),
685 QObject::tr("Quit kPPP?")); 685 QObject::tr("Quit kPPP?"));
686 if(ok == QMessageBox::Yes) { 686 if(ok == QMessageBox::Yes) {
687 Modem::modem->killPPPDaemon(); 687 Modem::modem->killPPPDaemon();
688 QApplication::flushX(); 688 QApplication::flushX();
689 execute_command(_pppdata->command_on_disconnect()); 689 execute_command(_pppdata->command_on_disconnect());
690 removedns(); 690 removedns();
691 Modem::modem->unlockdevice(); 691 Modem::modem->unlockdevice();
692 } 692 }
693 } else { 693 } else {
694 if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword()) 694 if (!_pppdata->accname().isEmpty() && !_pppdata->storePassword())
695 _pppdata->setStoredPassword(""); 695 _pppdata->setStoredPassword("");
696 } 696 }
697 _pppdata->save(); 697 _pppdata->save();
698 qApp->quit(); 698 qApp->quit();
699} 699}
700 700
701 701
702// void KPPPWidget::rulesetLoadError() { 702// void KPPPWidget::rulesetLoadError() {
703// QMessageBox::warning(this,"error", ruleset_load_errmsg); 703// QMessageBox::warning(this,"error", ruleset_load_errmsg);
704// } 704// }
705 705
706 706
707// void KPPPWidget::startAccounting() { 707// void KPPPWidget::startAccounting() {
708// // volume accounting 708// // volume accounting
709// stats->totalbytes = 0; 709// stats->totalbytes = 0;
710 710
711// kdDebug() << "AcctEnabled: " << _pppdata->AcctEnabled() << endl; 711// kdDebug() << "AcctEnabled: " << _pppdata->AcctEnabled() << endl;
712 712
713// // load the ruleset 713// // load the ruleset
714// if(!_pppdata->AcctEnabled()) 714// if(!_pppdata->AcctEnabled())
715// return; 715// return;
716 716
717// QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile()); 717// QString d = AccountingBase::getAccountingFile(_pppdata->accountingFile());
718// // if(::access(d.data(), X_OK) != 0) 718// // if(::access(d.data(), X_OK) != 0)
719// acct = new Accounting(this, stats); 719// acct = new Accounting(this, stats);
720// // else 720// // else
721// // acct = new ExecutableAccounting(this); 721// // acct = new ExecutableAccounting(this);
722 722
723// // connect to the accounting object 723// // connect to the accounting object
724// connect(acct, SIGNAL(changed(QString, QString)), 724// connect(acct, SIGNAL(changed(QString,QString)),
725 // con_win, SLOT(slotAccounting(QString, QString))); 725 // con_win, SLOT(slotAccounting(QString,QString)));
726 726
727// // if(!acct->loadRuleSet(_pppdata->accountingFile())) { 727// // if(!acct->loadRuleSet(_pppdata->accountingFile())) {
728// // QString s= QObject::tr("Can not load the accounting " 728// // QString s= QObject::tr("Can not load the accounting "
729 // // "ruleset \"%1\"!").arg(_pppdata->accountingFile()); 729 // // "ruleset \"%1\"!").arg(_pppdata->accountingFile());
730 730
731// // starting the messagebox with a timer will prevent us 731// // starting the messagebox with a timer will prevent us
732// // from blocking the calling function ConnectWidget::timerEvent 732// // from blocking the calling function ConnectWidget::timerEvent
733// ruleset_load_errmsg = s; 733// ruleset_load_errmsg = s;
734// QTimer::singleShot(0, this, SLOT(rulesetLoadError())); 734// QTimer::singleShot(0, this, SLOT(rulesetLoadError()));
735// return; 735// return;
736// } 736// }
737// //else 737// //else
738// // acct->slotStart(); 738// // acct->slotStart();
739// } 739// }
740 740
741// void KPPPWidget::stopAccounting() { 741// void KPPPWidget::stopAccounting() {
742// // store volume accounting 742// // store volume accounting
743// // if(stats->totalbytes != 0) 743// // if(stats->totalbytes != 0)
744// // _pppdata->setTotalBytes(stats->totalbytes); 744// // _pppdata->setTotalBytes(stats->totalbytes);
745 745
746// if(!_pppdata->AcctEnabled()) 746// if(!_pppdata->AcctEnabled())
747// return; 747// return;
748 748
749// // if(acct != 0) { 749// // if(acct != 0) {
750// // acct->slotStop(); 750// // acct->slotStop();
751// // delete acct; 751// // delete acct;
752// // acct = 0; 752// // acct = 0;
753// // } 753// // }
754// } 754// }
755 755
756 756
757// void KPPPWidget::showStats() { 757// void KPPPWidget::showStats() {
758// if(statdlg) { 758// if(statdlg) {
759// statdlg->show(); 759// statdlg->show();
760// statdlg->raise(); 760// statdlg->raise();
761// } 761// }
762// } 762// }
763 763
764 764
765void KPPPWidget::usernameChanged(const QString &) { 765void KPPPWidget::usernameChanged(const QString &) {
766 // store username for later use 766 // store username for later use
767 _pppdata->setStoredUsername(ID_Edit->text()); 767 _pppdata->setStoredUsername(ID_Edit->text());
768} 768}
769 769
770 770
771void KPPPWidget::passwordChanged(const QString &) { 771void KPPPWidget::passwordChanged(const QString &) {
772 // store the password if so requested 772 // store the password if so requested
773 if(_pppdata->storePassword()) 773 if(_pppdata->storePassword())
774 _pppdata->setStoredPassword(PW_Edit->text()); 774 _pppdata->setStoredPassword(PW_Edit->text());
775 else 775 else
776 _pppdata->setStoredPassword(""); 776 _pppdata->setStoredPassword("");
777} 777}
778 778
779 779
780void KPPPWidget::setPW_Edit(const QString &pw) { 780void KPPPWidget::setPW_Edit(const QString &pw) {
781 PW_Edit->setText(pw); 781 PW_Edit->setText(pw);
782} 782}
783 783
784 784
785// void KPPPWidget::resetCosts(const QString &s) { 785// void KPPPWidget::resetCosts(const QString &s) {
786// AccountingBase::resetCosts(s); 786// AccountingBase::resetCosts(s);
787// } 787// }
788 788
789 789
790// void KPPPWidget::resetVolume(const QString &s) { 790// void KPPPWidget::resetVolume(const QString &s) {
791// AccountingBase::resetVolume(s); 791// AccountingBase::resetVolume(s);
792// } 792// }
793 793
794/** 794/**
795 * pppd's getword() function knows about escape characters. 795 * pppd's getword() function knows about escape characters.
796 * If we write the username and password to the secrets file 796 * If we write the username and password to the secrets file
797 * we'll therefore have to escape back slashes. 797 * we'll therefore have to escape back slashes.
798 */ 798 */
799QString KPPPWidget::encodeWord(const QString &s) { 799QString KPPPWidget::encodeWord(const QString &s) {
800 QString r = s; 800 QString r = s;
801 r.replace(QRegExp("\\"), "\\\\"); 801 r.replace(QRegExp("\\"), "\\\\");
802 return r; 802 return r;
803} 803}
804 804
805// void KPPPWidget::setQuitOnDisconnect (bool b) 805// void KPPPWidget::setQuitOnDisconnect (bool b)
806// { 806// {
807// m_bQuitOnDisconnect = b; 807// m_bQuitOnDisconnect = b;
808// } 808// }
809 809
810void KPPPWidget::showNews() { 810void KPPPWidget::showNews() {
811#ifdef KPPP_SHOW_NEWS 811#ifdef KPPP_SHOW_NEWS
812 /* 812 /*
813 * Introduce the QuickHelp feature to new users of this version 813 * Introduce the QuickHelp feature to new users of this version
814 */ 814 */
815 #define QUICKHELP_HINT "Hint_QuickHelp" 815 #define QUICKHELP_HINT "Hint_QuickHelp"
816 if(_pppdata->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) { 816 if(_pppdata->readNumConfig(GENERAL_GRP, QUICKHELP_HINT, 0) == 0) {
817 QDialog dlg(0, 0, true); 817 QDialog dlg(0, 0, true);
818 dlg.setCaption(QObject::tr("Recent Changes in KPPP")); 818 dlg.setCaption(QObject::tr("Recent Changes in KPPP"));
819 819
820 QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10); 820 QVBoxLayout *tl = new QVBoxLayout(&dlg, 10, 10);
821 QHBoxLayout *l1 = new QHBoxLayout(10); 821 QHBoxLayout *l1 = new QHBoxLayout(10);
diff --git a/noncore/settings/networksettings/ppp/pppdargs.cpp b/noncore/settings/networksettings/ppp/pppdargs.cpp
index 66a4d82..d6d8d88 100644
--- a/noncore/settings/networksettings/ppp/pppdargs.cpp
+++ b/noncore/settings/networksettings/ppp/pppdargs.cpp
@@ -1,151 +1,151 @@
1/* 1/*
2 * kPPP: A pppd front end for the KDE project 2 * kPPP: A pppd front end for the KDE project
3 * 3 *
4 * $Id$ 4 * $Id$
5 * 5 *
6 * Copyright (C) 1997 Bernd Johannes Wuebben 6 * Copyright (C) 1997 Bernd Johannes Wuebben
7 * wuebben@math.cornell.edu 7 * wuebben@math.cornell.edu
8 * 8 *
9 * based on EzPPP: 9 * based on EzPPP:
10 * Copyright (C) 1997 Jay Painter 10 * Copyright (C) 1997 Jay Painter
11 * 11 *
12 * 12 *
13 * This library is free software; you can redistribute it and/or 13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Library General Public 14 * modify it under the terms of the GNU Library General Public
15 * License as published by the Free Software Foundation; either 15 * License as published by the Free Software Foundation; either
16 * version 2 of the License, or (at your option) any later version. 16 * version 2 of the License, or (at your option) any later version.
17 * 17 *
18 * This library is distributed in the hope that it will be useful, 18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Library General Public License for more details. 21 * Library General Public License for more details.
22 * 22 *
23 * You should have received a copy of the GNU Library General Public 23 * You should have received a copy of the GNU Library General Public
24 * License along with this program; if not, write to the Free 24 * License along with this program; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */ 26 */
27 27
28#include <qlayout.h> 28#include <qlayout.h>
29#include <qbuttongroup.h> 29#include <qbuttongroup.h>
30#include <qapplication.h> 30#include <qapplication.h>
31#include "pppdargs.h" 31#include "pppdargs.h"
32#include "pppdata.h" 32#include "pppdata.h"
33 33
34 34
35PPPdArguments::PPPdArguments( PPPData *pd, QWidget *parent, const char *name) 35PPPdArguments::PPPdArguments( PPPData *pd, QWidget *parent, const char *name)
36 : QDialog(parent, name, TRUE), _pppdata(pd) 36 : QDialog(parent, name, TRUE), _pppdata(pd)
37{ 37{
38 setCaption(tr("Customize pppd Arguments")); 38 setCaption(tr("Customize pppd Arguments"));
39// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon()); 39// KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
40 QVBoxLayout *l = new QVBoxLayout(this, 10, 10); 40 QVBoxLayout *l = new QVBoxLayout(this, 10, 10);
41 QHBoxLayout *tl = new QHBoxLayout(10); 41 QHBoxLayout *tl = new QHBoxLayout(10);
42 l->addLayout(tl); 42 l->addLayout(tl);
43 QVBoxLayout *l1 = new QVBoxLayout(); 43 QVBoxLayout *l1 = new QVBoxLayout();
44 QVBoxLayout *l2 = new QVBoxLayout(); 44 QVBoxLayout *l2 = new QVBoxLayout();
45 tl->addLayout(l1, 1); 45 tl->addLayout(l1, 1);
46 tl->addLayout(l2, 0); 46 tl->addLayout(l2, 0);
47 47
48 QHBoxLayout *l11 = new QHBoxLayout(10); 48 QHBoxLayout *l11 = new QHBoxLayout(10);
49 l1->addLayout(l11); 49 l1->addLayout(l11);
50 50
51 argument_label = new QLabel(tr("Argument:"), this); 51 argument_label = new QLabel(tr("Argument:"), this);
52 l11->addWidget(argument_label); 52 l11->addWidget(argument_label);
53 53
54 argument = new QLineEdit(this); 54 argument = new QLineEdit(this);
55 connect(argument, SIGNAL(returnPressed()), 55 connect(argument, SIGNAL(returnPressed()),
56 SLOT(addbutton())); 56 SLOT(addbutton()));
57 l11->addWidget(argument); 57 l11->addWidget(argument);
58 connect(argument, SIGNAL(textChanged(const QString &)), 58 connect(argument, SIGNAL(textChanged(const QString&)),
59 this, SLOT(textChanged(const QString &))); 59 this, SLOT(textChanged(const QString&)));
60 60
61 arguments = new QListBox(this); 61 arguments = new QListBox(this);
62 arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10); 62 arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10);
63 connect(arguments, SIGNAL(highlighted(int)), 63 connect(arguments, SIGNAL(highlighted(int)),
64 this, SLOT(itemSelected(int))); 64 this, SLOT(itemSelected(int)));
65 l1->addWidget(arguments, 1); 65 l1->addWidget(arguments, 1);
66 66
67 add = new QPushButton(tr("Add"), this); 67 add = new QPushButton(tr("Add"), this);
68 connect(add, SIGNAL(clicked()), SLOT(addbutton())); 68 connect(add, SIGNAL(clicked()), SLOT(addbutton()));
69 l2->addWidget(add); 69 l2->addWidget(add);
70 l2->addStretch(1); 70 l2->addStretch(1);
71 71
72 remove = new QPushButton(tr("Remove"), this); 72 remove = new QPushButton(tr("Remove"), this);
73 connect(remove, SIGNAL(clicked()), SLOT(removebutton())); 73 connect(remove, SIGNAL(clicked()), SLOT(removebutton()));
74 l2->addWidget(remove); 74 l2->addWidget(remove);
75 75
76 defaults = new QPushButton(tr("Defaults"), this); 76 defaults = new QPushButton(tr("Defaults"), this);
77 connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton())); 77 connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton()));
78 l2->addWidget(defaults); 78 l2->addWidget(defaults);
79 79
80 l->addSpacing(5); 80 l->addSpacing(5);
81 81
82 82
83 //load info from gpppdata 83 //load info from gpppdata
84 init(); 84 init();
85 85
86 add->setEnabled(false); 86 add->setEnabled(false);
87 remove->setEnabled(false); 87 remove->setEnabled(false);
88 argument->setFocus(); 88 argument->setFocus();
89} 89}
90 90
91 91
92void PPPdArguments::addbutton() { 92void PPPdArguments::addbutton() {
93 if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) { 93 if(!argument->text().isEmpty() && arguments->count() < MAX_PPPD_ARGUMENTS) {
94 arguments->insertItem(argument->text()); 94 arguments->insertItem(argument->text());
95 argument->setText(""); 95 argument->setText("");
96 } 96 }
97} 97}
98 98
99 99
100void PPPdArguments::removebutton() { 100void PPPdArguments::removebutton() {
101 if(arguments->currentItem() >= 0) 101 if(arguments->currentItem() >= 0)
102 arguments->removeItem(arguments->currentItem()); 102 arguments->removeItem(arguments->currentItem());
103} 103}
104 104
105 105
106void PPPdArguments::defaultsbutton() { 106void PPPdArguments::defaultsbutton() {
107 // all of this is a hack 107 // all of this is a hack
108 // save current list 108 // save current list
109 QStringList arglist(_pppdata->pppdArgument()); 109 QStringList arglist(_pppdata->pppdArgument());
110 110
111 // get defaults 111 // get defaults
112 _pppdata->setpppdArgumentDefaults(); 112 _pppdata->setpppdArgumentDefaults();
113 init(); 113 init();
114 114
115 // restore old list 115 // restore old list
116 _pppdata->setpppdArgument(arglist); 116 _pppdata->setpppdArgument(arglist);
117} 117}
118 118
119 119
120void PPPdArguments::accept() { 120void PPPdArguments::accept() {
121 QStringList arglist; 121 QStringList arglist;
122 for(uint i=0; i < arguments->count(); i++) 122 for(uint i=0; i < arguments->count(); i++)
123 arglist.append(arguments->text(i)); 123 arglist.append(arguments->text(i));
124 _pppdata->setpppdArgument(arglist); 124 _pppdata->setpppdArgument(arglist);
125 125
126 QDialog::accept(); 126 QDialog::accept();
127} 127}
128 128
129 129
130void PPPdArguments::init() { 130void PPPdArguments::init() {
131 while(arguments->count()) 131 while(arguments->count())
132 arguments->removeItem(0); 132 arguments->removeItem(0);
133 133
134 QStringList &arglist = _pppdata->pppdArgument(); 134 QStringList &arglist = _pppdata->pppdArgument();
135 for ( QStringList::Iterator it = arglist.begin(); 135 for ( QStringList::Iterator it = arglist.begin();
136 it != arglist.end(); 136 it != arglist.end();
137 ++it ) 137 ++it )
138 arguments->insertItem(*it); 138 arguments->insertItem(*it);
139} 139}
140 140
141 141
142void PPPdArguments::textChanged(const QString &s) { 142void PPPdArguments::textChanged(const QString &s) {
143 add->setEnabled(s.length() > 0); 143 add->setEnabled(s.length() > 0);
144} 144}
145 145
146 146
147void PPPdArguments::itemSelected(int idx) { 147void PPPdArguments::itemSelected(int idx) {
148 remove->setEnabled(idx != -1); 148 remove->setEnabled(idx != -1);
149} 149}
150 150
151 151
diff --git a/noncore/settings/networksettings/wlan/wlanimp2.cpp b/noncore/settings/networksettings/wlan/wlanimp2.cpp
index 92339d6..dd1db28 100644
--- a/noncore/settings/networksettings/wlan/wlanimp2.cpp
+++ b/noncore/settings/networksettings/wlan/wlanimp2.cpp
@@ -1,153 +1,153 @@
1#include "wlanimp2.h" 1#include "wlanimp2.h"
2#include "keyedit.h" 2#include "keyedit.h"
3#include "interfacesetupimp.h" 3#include "interfacesetupimp.h"
4 4
5#include "../interfaces/interface.h" 5#include "../interfaces/interface.h"
6 6
7#include <assert.h> 7#include <assert.h>
8#include <errno.h> 8#include <errno.h>
9#include <string.h> 9#include <string.h>
10 10
11#include <qapplication.h> 11#include <qapplication.h>
12#include <qfile.h> 12#include <qfile.h>
13#include <qdir.h> 13#include <qdir.h>
14#include <qdialog.h> 14#include <qdialog.h>
15#include <qtextstream.h> 15#include <qtextstream.h>
16#include <qmessagebox.h> 16#include <qmessagebox.h>
17#include <qlineedit.h> 17#include <qlineedit.h>
18#include <qlabel.h> 18#include <qlabel.h>
19#include <qspinbox.h> 19#include <qspinbox.h>
20#include <qradiobutton.h> 20#include <qradiobutton.h>
21#include <qpushbutton.h> 21#include <qpushbutton.h>
22#include <qcheckbox.h> 22#include <qcheckbox.h>
23#include <qtabwidget.h> 23#include <qtabwidget.h>
24#include <qcombobox.h> 24#include <qcombobox.h>
25#include <qlistview.h> 25#include <qlistview.h>
26#include <qvbox.h> 26#include <qvbox.h>
27#include <qprogressbar.h> 27#include <qprogressbar.h>
28 28
29#ifdef QWS 29#ifdef QWS
30 #include <qpe/resource.h> 30 #include <qpe/resource.h>
31 #include <opie2/oprocess.h> 31 #include <opie2/oprocess.h>
32 #include <opie2/onetwork.h> 32 #include <opie2/onetwork.h>
33 #include <opie2/opcap.h> 33 #include <opie2/opcap.h>
34#else 34#else
35 #define OProcess KProcess 35 #define OProcess KProcess
36 #include <kprocess.h> 36 #include <kprocess.h>
37#endif 37#endif
38 38
39#define WIRELESS_OPTS "/etc/pcmcia/wireless.opts" 39#define WIRELESS_OPTS "/etc/pcmcia/wireless.opts"
40#define PREUP "/etc/network/if-pre-up.d/wireless-tools" 40#define PREUP "/etc/network/if-pre-up.d/wireless-tools"
41 41
42/** 42/**
43 * Constructor, read in the wireless.opts file for parsing later. 43 * Constructor, read in the wireless.opts file for parsing later.
44 */ 44 */
45WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") { 45WLANImp::WLANImp( QWidget* parent, const char* name, Interface *i, bool modal, WFlags fl) : WLAN(parent, name, modal, fl), interface(i), currentProfile("*") {
46 interfaces = new Interfaces(); 46 interfaces = new Interfaces();
47 interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces); 47 interfaceSetup = new InterfaceSetupImp(tabWidget, "InterfaceSetupImp", i, interfaces);
48 tabWidget->insertTab(interfaceSetup, "TCP/IP"); 48 tabWidget->insertTab(interfaceSetup, "TCP/IP");
49 49
50 // Check sanity - the existance of the wireless-tools if-pre-up script 50 // Check sanity - the existance of the wireless-tools if-pre-up script
51 QFile file(QString(PREUP)); 51 QFile file(QString(PREUP));
52 if (file.exists()) { 52 if (file.exists()) {
53 qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools")); 53 qWarning(QString("WLANImp: Unable to open /etc/network/if-pre-up.d/wireless-tools"));
54 } 54 }
55 55
56 connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) ); 56 connect( rescanButton, SIGNAL( clicked() ), this, SLOT( rescanNeighbourhood() ) );
57 connect( netView, SIGNAL( clicked( QListViewItem* ) ), this, SLOT( selectNetwork( QListViewItem* ) ) ); 57 connect( netView, SIGNAL( clicked(QListViewItem*) ), this, SLOT( selectNetwork(QListViewItem*) ) );
58 netView->setColumnAlignment( col_chn, AlignCenter ); 58 netView->setColumnAlignment( col_chn, AlignCenter );
59 netView->setItemMargin( 3 ); 59 netView->setItemMargin( 3 );
60 netView->setAllColumnsShowFocus( true ); 60 netView->setAllColumnsShowFocus( true );
61 61
62} 62}
63 63
64WLANImp::~WLANImp() { 64WLANImp::~WLANImp() {
65//FIXME: delete interfaces; 65//FIXME: delete interfaces;
66} 66}
67 67
68/** 68/**
69 * Change the profile for both wireless settings and network settings. 69 * Change the profile for both wireless settings and network settings.
70 */ 70 */
71void WLANImp::setProfile(const QString &profile){ 71void WLANImp::setProfile(const QString &profile){
72 interfaceSetup->setProfile(profile); 72 interfaceSetup->setProfile(profile);
73 parseOpts(); 73 parseOpts();
74} 74}
75 75
76void WLANImp::parseOpts() { 76void WLANImp::parseOpts() {
77 bool error; 77 bool error;
78 QString opt; 78 QString opt;
79 79
80 if (! interfaces->isInterfaceSet()) 80 if (! interfaces->isInterfaceSet())
81 return; 81 return;
82 82
83 83
84 opt = interfaces->getInterfaceOption("wireless_essid", error); 84 opt = interfaces->getInterfaceOption("wireless_essid", error);
85 if(opt == "any" || opt == "off" || opt.isNull()){ 85 if(opt == "any" || opt == "off" || opt.isNull()){
86 essid->setEditText("any"); 86 essid->setEditText("any");
87 } else { 87 } else {
88 essid->setEditText(opt); 88 essid->setEditText(opt);
89 } 89 }
90 90
91 opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace(); 91 opt = interfaces->getInterfaceOption("wireless_mode", error).simplifyWhiteSpace();
92 92
93 for ( int i = 0; i < mode->count(); i++) 93 for ( int i = 0; i < mode->count(); i++)
94 if ( mode->text( i ) == opt ) mode->setCurrentItem( i ); 94 if ( mode->text( i ) == opt ) mode->setCurrentItem( i );
95 95
96 opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace(); 96 opt = interfaces->getInterfaceOption("wireless_ap", error).simplifyWhiteSpace();
97 if (! opt.isNull()) { 97 if (! opt.isNull()) {
98 specifyAp->setChecked(true); 98 specifyAp->setChecked(true);
99 macEdit->setText(opt); 99 macEdit->setText(opt);
100 } 100 }
101 101
102 opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace(); 102 opt = interfaces->getInterfaceOption("wireless_channel", error).simplifyWhiteSpace();
103 if (! opt.isNull()) { 103 if (! opt.isNull()) {
104 specifyChan->setChecked(true); 104 specifyChan->setChecked(true);
105 networkChannel->setValue(opt.toInt()); 105 networkChannel->setValue(opt.toInt());
106 } 106 }
107 107
108 opt = interfaces->getInterfaceOption("wireless_key", error).simplifyWhiteSpace(); 108 opt = interfaces->getInterfaceOption("wireless_key", error).simplifyWhiteSpace();
109 if (opt.isNull()) 109 if (opt.isNull())
110 opt = interfaces->getInterfaceOption("wireless_enc", error).simplifyWhiteSpace(); 110 opt = interfaces->getInterfaceOption("wireless_enc", error).simplifyWhiteSpace();
111 parseKeyStr(opt); 111 parseKeyStr(opt);
112} 112}
113 113
114void WLANImp::parseKeyStr(QString keystr) { 114void WLANImp::parseKeyStr(QString keystr) {
115 int loc = 0; 115 int loc = 0;
116 int index = 1; 116 int index = 1;
117 QString key; 117 QString key;
118 QStringList keys = QStringList::split(QRegExp("\\s+"), keystr); 118 QStringList keys = QStringList::split(QRegExp("\\s+"), keystr);
119 int enc = -1; // encryption state 119 int enc = -1; // encryption state
120 120
121 for (QStringList::Iterator it = keys.begin(); it != keys.end(); ++it) { 121 for (QStringList::Iterator it = keys.begin(); it != keys.end(); ++it) {
122 if ((*it).left(3) == "off") { 122 if ((*it).left(3) == "off") {
123 // encryption disabled 123 // encryption disabled
124 enc = 0; 124 enc = 0;
125 } else if ((*it).left(2) == "on") { 125 } else if ((*it).left(2) == "on") {
126 // encryption enabled 126 // encryption enabled
127 enc = 1; 127 enc = 1;
128 } else if ((*it).left(4) == "open") { 128 } else if ((*it).left(4) == "open") {
129 // open mode, accept non encrypted packets 129 // open mode, accept non encrypted packets
130 acceptNonEnc->setChecked(true); 130 acceptNonEnc->setChecked(true);
131 } else if ((*it).left(10) == "restricted") { 131 } else if ((*it).left(10) == "restricted") {
132 // restricted mode, only accept encrypted packets 132 // restricted mode, only accept encrypted packets
133 rejectNonEnc->setChecked(true); 133 rejectNonEnc->setChecked(true);
134 } else if ((*it).left(3) == "key") { 134 } else if ((*it).left(3) == "key") {
135 // new set of options 135 // new set of options
136 } else if ((*it).left(1) == "[") { 136 } else if ((*it).left(1) == "[") {
137 index = (*it).mid(1, 1).toInt(); 137 index = (*it).mid(1, 1).toInt();
138 // switch current key to index 138 // switch current key to index
139 switch (index) { 139 switch (index) {
140 case 1: 140 case 1:
141 keyRadio0->setChecked(true); 141 keyRadio0->setChecked(true);
142 break; 142 break;
143 case 2: 143 case 2:
144 keyRadio1->setChecked(true); 144 keyRadio1->setChecked(true);
145 break; 145 break;
146 case 3: 146 case 3:
147 keyRadio2->setChecked(true); 147 keyRadio2->setChecked(true);
148 break; 148 break;
149 case 4: 149 case 4:
150 keyRadio3->setChecked(true); 150 keyRadio3->setChecked(true);
151 break; 151 break;
152 } 152 }
153 } else { 153 } else {