author | kergoth <kergoth> | 2002-10-19 20:58:09 (UTC) |
---|---|---|
committer | kergoth <kergoth> | 2002-10-19 20:58:09 (UTC) |
commit | d7449e1e0070a068c5e83366cb75b64142b71b89 (patch) (unidiff) | |
tree | 0049f8b29e274c2b973ac74ce8f8a93b8bc38a77 | |
parent | 8c9e2e893540c0a405637f10ac2f656df69991a7 (diff) | |
download | opie-d7449e1e0070a068c5e83366cb75b64142b71b89.zip opie-d7449e1e0070a068c5e83366cb75b64142b71b89.tar.gz opie-d7449e1e0070a068c5e83366cb75b64142b71b89.tar.bz2 |
Cleaned up Config handling a bit.
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.cpp | 83 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanimp.h | 10 | ||||
-rw-r--r-- | noncore/net/networksetup/wlan/wlanmodule.cpp | 3 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.cpp | 83 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanimp.h | 10 | ||||
-rw-r--r-- | noncore/settings/networksettings/wlan/wlanmodule.cpp | 3 |
6 files changed, 96 insertions, 96 deletions
diff --git a/noncore/net/networksetup/wlan/wlanimp.cpp b/noncore/net/networksetup/wlan/wlanimp.cpp index 517604f..3b0e0b7 100644 --- a/noncore/net/networksetup/wlan/wlanimp.cpp +++ b/noncore/net/networksetup/wlan/wlanimp.cpp | |||
@@ -1,223 +1,224 @@ | |||
1 | #include "wlanimp.h" | 1 | #include "wlanimp.h" |
2 | 2 | ||
3 | /* Config class */ | 3 | /* Config class */ |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | /* Global namespace */ | 5 | /* Global namespace */ |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | /* system() */ | 7 | /* system() */ |
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qtextstream.h> | 11 | #include <qtextstream.h> |
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
13 | #include <qlineedit.h> | 13 | #include <qlineedit.h> |
14 | #include <qspinbox.h> | 14 | #include <qspinbox.h> |
15 | #include <qradiobutton.h> | 15 | #include <qradiobutton.h> |
16 | #include <qcheckbox.h> | 16 | #include <qcheckbox.h> |
17 | #include <qregexp.h> | 17 | #include <qregexp.h> |
18 | 18 | ||
19 | WLANImp::WLANImp( Config &cfg, QWidget* parent, const char* name):WLAN(parent, name),config(cfg){ | 19 | WLANImp::WLANImp( QWidget* parent, const char* name):WLAN(parent, name){ |
20 | config = new Config("wireless"); | ||
20 | readConfig(); | 21 | readConfig(); |
21 | } | 22 | } |
22 | 23 | ||
23 | void WLANImp::readConfig() | 24 | void WLANImp::readConfig() |
24 | { | 25 | { |
25 | qWarning( "WLANImp::readConfig() called." ); | 26 | qWarning( "WLANImp::readConfig() called." ); |
26 | config.setGroup( "Properties" ); | 27 | config->setGroup( "Properties" ); |
27 | QString ssid = config.readEntry( "SSID", "any" ); | 28 | QString ssid = config->readEntry( "SSID", "any" ); |
28 | if( ssid == "any" || ssid == "ANY" ){ | 29 | if( ssid == "any" || ssid == "ANY" ){ |
29 | essNon->setChecked( true ); | 30 | essNon->setChecked( true ); |
30 | } else { | 31 | } else { |
31 | essSpecific->setChecked( true ); | 32 | essSpecific->setChecked( true ); |
32 | essSpecificLineEdit->setText( ssid ); | 33 | essSpecificLineEdit->setText( ssid ); |
33 | } | 34 | } |
34 | QString mode = config.readEntry( "Mode", "Managed" ); | 35 | QString mode = config->readEntry( "Mode", "Managed" ); |
35 | if( mode == "adhoc" ) { | 36 | if( mode == "adhoc" ) { |
36 | network802->setChecked( true ); | 37 | network802->setChecked( true ); |
37 | } else { | 38 | } else { |
38 | networkInfrastructure->setChecked( true ); | 39 | networkInfrastructure->setChecked( true ); |
39 | } | 40 | } |
40 | networkChannel->setValue( config.readNumEntry( "CHANNEL", 1 ) ); | 41 | networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); |
41 | // config.readEntry( "RATE", "auto" ); | 42 | // config->readEntry( "RATE", "auto" ); |
42 | config.readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); | 43 | config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); |
43 | config.readEntry( "AuthType", "opensystem" ); | 44 | config->readEntry( "AuthType", "opensystem" ); |
44 | config.readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); | 45 | config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); |
45 | int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 ); | 46 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); |
46 | switch( defaultkey ){ | 47 | switch( defaultkey ){ |
47 | case 0: | 48 | case 0: |
48 | keyRadio0->setChecked( true ); | 49 | keyRadio0->setChecked( true ); |
49 | break; | 50 | break; |
50 | case 1: | 51 | case 1: |
51 | keyRadio1->setChecked( true ); | 52 | keyRadio1->setChecked( true ); |
52 | break; | 53 | break; |
53 | case 2: | 54 | case 2: |
54 | keyRadio2->setChecked( true ); | 55 | keyRadio2->setChecked( true ); |
55 | break; | 56 | break; |
56 | case 3: | 57 | case 3: |
57 | keyRadio3->setChecked( true ); | 58 | keyRadio3->setChecked( true ); |
58 | break; | 59 | break; |
59 | } | 60 | } |
60 | keyLineEdit0->setText(config.readEntry( "dot11WEPDefaultKey0" )); | 61 | keyLineEdit0->setText(config->readEntry( "dot11WEPDefaultKey0" )); |
61 | keyLineEdit1->setText(config.readEntry( "dot11WEPDefaultKey1" )); | 62 | keyLineEdit1->setText(config->readEntry( "dot11WEPDefaultKey1" )); |
62 | keyLineEdit2->setText(config.readEntry( "dot11WEPDefaultKey2" )); | 63 | keyLineEdit2->setText(config->readEntry( "dot11WEPDefaultKey2" )); |
63 | keyLineEdit3->setText(config.readEntry( "dot11WEPDefaultKey3" )); | 64 | keyLineEdit3->setText(config->readEntry( "dot11WEPDefaultKey3" )); |
64 | return; | 65 | return; |
65 | } | 66 | } |
66 | 67 | ||
67 | bool WLANImp::writeConfig() | 68 | bool WLANImp::writeConfig() |
68 | { | 69 | { |
69 | qWarning( "WLANImp::writeConfig() called." ); | 70 | qWarning( "WLANImp::writeConfig() called." ); |
70 | config.setGroup( "Properties" ); | 71 | config->setGroup( "Properties" ); |
71 | if( essNon->isChecked() ) { | 72 | if( essNon->isChecked() ) { |
72 | config.writeEntry( "SSID", "any" ); | 73 | config->writeEntry( "SSID", "any" ); |
73 | } else { | 74 | } else { |
74 | config.writeEntry( "SSID", essSpecificLineEdit->text() ); | 75 | config->writeEntry( "SSID", essSpecificLineEdit->text() ); |
75 | } | 76 | } |
76 | if( networkInfrastructure->isChecked() ){ | 77 | if( networkInfrastructure->isChecked() ){ |
77 | config.writeEntry( "Mode", "Managed" ); | 78 | config->writeEntry( "Mode", "Managed" ); |
78 | } else if( network802->isChecked() ){ | 79 | } else if( network802->isChecked() ){ |
79 | config.writeEntry( "Mode", "adhoc" ); | 80 | config->writeEntry( "Mode", "adhoc" ); |
80 | } | 81 | } |
81 | config.writeEntry( "CHANNEL", networkChannel->value() ); | 82 | config->writeEntry( "CHANNEL", networkChannel->value() ); |
82 | // config.readEntry( "RATE", "auto" ); | 83 | // config->readEntry( "RATE", "auto" ); |
83 | wepEnabled->isChecked() ? config.writeEntry( "dot11PrivacyInvoked", "true" ) : config.writeEntry( "dot11PrivacyInvoked", "false" ); | 84 | wepEnabled->isChecked() ? config->writeEntry( "dot11PrivacyInvoked", "true" ) : config->writeEntry( "dot11PrivacyInvoked", "false" ); |
84 | authOpen->isChecked() ? config.writeEntry( "AuthType", "opensystem" ) : config.writeEntry( "AuthType", "sharedkey" ); | 85 | authOpen->isChecked() ? config->writeEntry( "AuthType", "opensystem" ) : config->writeEntry( "AuthType", "sharedkey" ); |
85 | key40->isChecked() ? config.writeEntry( "PRIV_KEY128", "false" ) : config.writeEntry( "PRIV_KEY128", "true" ); | 86 | key40->isChecked() ? config->writeEntry( "PRIV_KEY128", "false" ) : config->writeEntry( "PRIV_KEY128", "true" ); |
86 | if( keyRadio0->isChecked() ){ | 87 | if( keyRadio0->isChecked() ){ |
87 | config.writeEntry( "dot11WEPDefaultKeyID", 0 ); | 88 | config->writeEntry( "dot11WEPDefaultKeyID", 0 ); |
88 | } else if( keyRadio1->isChecked() ){ | 89 | } else if( keyRadio1->isChecked() ){ |
89 | config.writeEntry( "dot11WEPDefaultKeyID", 1 ); | 90 | config->writeEntry( "dot11WEPDefaultKeyID", 1 ); |
90 | } else if( keyRadio2->isChecked() ){ | 91 | } else if( keyRadio2->isChecked() ){ |
91 | config.writeEntry( "dot11WEPDefaultKeyID", 2 ); | 92 | config->writeEntry( "dot11WEPDefaultKeyID", 2 ); |
92 | } else if( keyRadio3->isChecked() ){ | 93 | } else if( keyRadio3->isChecked() ){ |
93 | config.writeEntry( "dot11WEPDefaultKeyID", 3 ); | 94 | config->writeEntry( "dot11WEPDefaultKeyID", 3 ); |
94 | } | 95 | } |
95 | config.writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); | 96 | config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); |
96 | config.writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); | 97 | config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); |
97 | config.writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); | 98 | config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); |
98 | config.writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); | 99 | config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); |
99 | return writeWirelessOpts( config ); | 100 | return writeWirelessOpts( ); |
100 | } | 101 | } |
101 | 102 | ||
102 | /** | 103 | /** |
103 | */ | 104 | */ |
104 | void WLANImp::accept() | 105 | void WLANImp::accept() |
105 | { | 106 | { |
106 | if ( writeConfig() ) | 107 | if ( writeConfig() ) |
107 | QDialog::accept(); | 108 | QDialog::accept(); |
108 | } | 109 | } |
109 | 110 | ||
110 | void WLANImp::done ( int r ) | 111 | void WLANImp::done ( int r ) |
111 | { | 112 | { |
112 | QDialog::done ( r ); | 113 | QDialog::done ( r ); |
113 | close ( ); | 114 | close ( ); |
114 | } | 115 | } |
115 | 116 | ||
116 | bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) | 117 | bool WLANImp::writeWirelessOpts( QString scheme ) |
117 | { | 118 | { |
118 | qWarning( "WLANImp::writeWirelessOpts entered." ); | 119 | qWarning( "WLANImp::writeWirelessOpts entered." ); |
119 | QString prev = "/etc/pcmcia/wireless.opts"; | 120 | QString prev = "/etc/pcmcia/wireless.opts"; |
120 | QFile prevFile(prev); | 121 | QFile prevFile(prev); |
121 | if ( !prevFile.open( IO_ReadOnly ) ) | 122 | if ( !prevFile.open( IO_ReadOnly ) ) |
122 | return false; | 123 | return false; |
123 | 124 | ||
124 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; | 125 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; |
125 | QFile tmpFile(tmp); | 126 | QFile tmpFile(tmp); |
126 | if ( !tmpFile.open( IO_WriteOnly ) ) | 127 | if ( !tmpFile.open( IO_WriteOnly ) ) |
127 | return false; | 128 | return false; |
128 | 129 | ||
129 | bool retval = true; | 130 | bool retval = true; |
130 | 131 | ||
131 | QTextStream in( &prevFile ); | 132 | QTextStream in( &prevFile ); |
132 | QTextStream out( &tmpFile ); | 133 | QTextStream out( &tmpFile ); |
133 | 134 | ||
134 | config.setGroup("Properties"); | 135 | config->setGroup("Properties"); |
135 | 136 | ||
136 | QString line; | 137 | QString line; |
137 | bool found=false; | 138 | bool found=false; |
138 | bool done=false; | 139 | bool done=false; |
139 | while ( !in.atEnd() ) { | 140 | while ( !in.atEnd() ) { |
140 | QString line = in.readLine(); | 141 | QString line = in.readLine(); |
141 | QString wline = line.simplifyWhiteSpace(); | 142 | QString wline = line.simplifyWhiteSpace(); |
142 | if ( !done ) { | 143 | if ( !done ) { |
143 | if ( found ) { | 144 | if ( found ) { |
144 | // skip existing entry for this scheme, and write our own. | 145 | // skip existing entry for this scheme, and write our own. |
145 | if ( wline == ";;" ) { | 146 | if ( wline == ";;" ) { |
146 | found = false; | 147 | found = false; |
147 | continue; | 148 | continue; |
148 | } else { | 149 | } else { |
149 | continue; | 150 | continue; |
150 | } | 151 | } |
151 | } else { | 152 | } else { |
152 | if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) { | 153 | if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) { |
153 | found=true; | 154 | found=true; |
154 | continue; // skip this line | 155 | continue; // skip this line |
155 | } else if ( wline == "esac" || wline == "*,*,*,*)" ) { | 156 | } else if ( wline == "esac" || wline == "*,*,*,*)" ) { |
156 | // end - add new entry | 157 | // end - add new entry |
157 | // Not all fields have a GUI, but all are supported | 158 | // Not all fields have a GUI, but all are supported |
158 | // in the letwork configuration files. | 159 | // in the letwork configuration files. |
159 | static const char* txtfields[] = { | 160 | static const char* txtfields[] = { |
160 | 0 | 161 | 0 |
161 | }; | 162 | }; |
162 | QString readmode = config.readEntry( "Mode", "Managed" ); | 163 | QString readmode = config->readEntry( "Mode", "Managed" ); |
163 | QString mode; | 164 | QString mode; |
164 | if( readmode == "Managed" ){ | 165 | if( readmode == "Managed" ){ |
165 | mode = readmode; | 166 | mode = readmode; |
166 | } else if( readmode == "adhoc" ){ | 167 | } else if( readmode == "adhoc" ){ |
167 | mode = "Ad-Hoc"; | 168 | mode = "Ad-Hoc"; |
168 | } | 169 | } |
169 | QString key; | 170 | QString key; |
170 | if( wepEnabled->isChecked() ){ | 171 | if( wepEnabled->isChecked() ){ |
171 | int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 ); | 172 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); |
172 | switch( defaultkey ){ | 173 | switch( defaultkey ){ |
173 | case 0: | 174 | case 0: |
174 | key += keyLineEdit0->text(); | 175 | key += keyLineEdit0->text(); |
175 | break; | 176 | break; |
176 | case 1: | 177 | case 1: |
177 | key += keyLineEdit1->text(); | 178 | key += keyLineEdit1->text(); |
178 | break; | 179 | break; |
179 | case 2: | 180 | case 2: |
180 | key += keyLineEdit2->text(); | 181 | key += keyLineEdit2->text(); |
181 | break; | 182 | break; |
182 | case 3: | 183 | case 3: |
183 | key += keyLineEdit3->text(); | 184 | key += keyLineEdit3->text(); |
184 | break; | 185 | break; |
185 | } | 186 | } |
186 | if( config.readEntry( "AuthType", "opensystem" ) == "opensystem") | 187 | if( config->readEntry( "AuthType", "opensystem" ) == "opensystem") |
187 | key += " open"; | 188 | key += " open"; |
188 | } | 189 | } |
189 | out << scheme << ",*,*,*)" << "\n" | 190 | out << scheme << ",*,*,*)" << "\n" |
190 | << " ESSID=" << Global::shellQuote( config.readEntry( "SSID", "any" ) ) << "\n" | 191 | << " ESSID=" << Global::shellQuote( config->readEntry( "SSID", "any" ) ) << "\n" |
191 | << " MODE=" << mode << "\n" | 192 | << " MODE=" << mode << "\n" |
192 | << " KEY=" << Global::shellQuote( key ) << "\n" | 193 | << " KEY=" << Global::shellQuote( key ) << "\n" |
193 | << " RATE=" << "auto" << "\n" | 194 | << " RATE=" << "auto" << "\n" |
194 | ; | 195 | ; |
195 | if( mode != "Managed" ) | 196 | if( mode != "Managed" ) |
196 | out << " CHANNEL=" << config.readNumEntry( "CHANNEL", 1 ) << "\n"; | 197 | out << " CHANNEL=" << config->readNumEntry( "CHANNEL", 1 ) << "\n"; |
197 | const char** f = txtfields; | 198 | const char** f = txtfields; |
198 | while (*f) { | 199 | while (*f) { |
199 | out << " " << *f << "=" << config.readEntry(*f,"") << "\n"; | 200 | out << " " << *f << "=" << config->readEntry(*f,"") << "\n"; |
200 | ++f; | 201 | ++f; |
201 | } | 202 | } |
202 | out << " ;;\n"; | 203 | out << " ;;\n"; |
203 | done = true; | 204 | done = true; |
204 | } | 205 | } |
205 | } | 206 | } |
206 | } | 207 | } |
207 | out << line << "\n"; | 208 | out << line << "\n"; |
208 | } | 209 | } |
209 | 210 | ||
210 | prevFile.close(); | 211 | prevFile.close(); |
211 | tmpFile.close(); | 212 | tmpFile.close(); |
212 | QString initpath; | 213 | QString initpath; |
213 | //system("cardctl suspend"); | 214 | //system("cardctl suspend"); |
214 | if( QDir("/etc/rc.d/init.d").exists() ){ | 215 | if( QDir("/etc/rc.d/init.d").exists() ){ |
215 | initpath = "/etc/rc.d/init.d"; | 216 | initpath = "/etc/rc.d/init.d"; |
216 | } else if( QDir("/etc/init.d").exists() ){ | 217 | } else if( QDir("/etc/init.d").exists() ){ |
217 | initpath = "/etc/init.d"; | 218 | initpath = "/etc/init.d"; |
218 | } | 219 | } |
219 | if( initpath ) | 220 | if( initpath ) |
220 | system(QString("%1/pcmcia stop").arg(initpath)); | 221 | system(QString("%1/pcmcia stop").arg(initpath)); |
221 | 222 | ||
222 | if( system( "mv " + tmp + " " + prev ) ) | 223 | if( system( "mv " + tmp + " " + prev ) ) |
223 | retval = false; | 224 | retval = false; |
diff --git a/noncore/net/networksetup/wlan/wlanimp.h b/noncore/net/networksetup/wlan/wlanimp.h index 8e355ce..79e931d 100644 --- a/noncore/net/networksetup/wlan/wlanimp.h +++ b/noncore/net/networksetup/wlan/wlanimp.h | |||
@@ -1,27 +1,27 @@ | |||
1 | #ifndef WLANIMP_H | 1 | #ifndef WLANIMP_H |
2 | #define WLANIMP_H | 2 | #define WLANIMP_H |
3 | 3 | ||
4 | #include "wlan.h" | 4 | #include "wlan.h" |
5 | 5 | ||
6 | class Config; | 6 | #include <qpe/config.h> |
7 | 7 | ||
8 | class WLANImp : public WLAN { | 8 | class WLANImp : public WLAN { |
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | 10 | ||
11 | public: | 11 | public: |
12 | WLANImp( Config& cfg, QWidget* parent = 0, const char* name = 0); | 12 | WLANImp( QWidget* parent = 0, const char* name = 0); |
13 | 13 | ||
14 | protected: | 14 | protected: |
15 | void accept(); | 15 | void accept(); |
16 | void done ( int r ); | 16 | void done ( int r ); |
17 | 17 | ||
18 | private: | 18 | private: |
19 | void readConfig(); | 19 | void readConfig(); |
20 | bool writeConfig(); | 20 | bool writeConfig(); |
21 | bool writeWirelessOpts( Config &cfg, QString scheme = "*" ); | 21 | bool writeWirelessOpts( QString scheme = "*" ); |
22 | bool writeWlanngOpts( Config &cfg, QString scheme = "*" ); | 22 | bool writeWlanngOpts( QString scheme = "*" ); |
23 | Config& config; | 23 | Config* config; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | #endif | 26 | #endif |
27 | 27 | ||
diff --git a/noncore/net/networksetup/wlan/wlanmodule.cpp b/noncore/net/networksetup/wlan/wlanmodule.cpp index f12e608..cbb520d 100644 --- a/noncore/net/networksetup/wlan/wlanmodule.cpp +++ b/noncore/net/networksetup/wlan/wlanmodule.cpp | |||
@@ -42,50 +42,49 @@ void WLANModule::setProfile(QString newProfile){ | |||
42 | */ | 42 | */ |
43 | QString WLANModule::getPixmapName(Interface* ){ | 43 | QString WLANModule::getPixmapName(Interface* ){ |
44 | return "wlan"; | 44 | return "wlan"; |
45 | } | 45 | } |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Check to see if the interface i is owned by this module. | 48 | * Check to see if the interface i is owned by this module. |
49 | * @param Interface* interface to check against | 49 | * @param Interface* interface to check against |
50 | * @return bool true if i is owned by this module, false otherwise. | 50 | * @return bool true if i is owned by this module, false otherwise. |
51 | */ | 51 | */ |
52 | bool WLANModule::isOwner(Interface *i){ | 52 | bool WLANModule::isOwner(Interface *i){ |
53 | if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ | 53 | if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ |
54 | i->setHardwareName("802.11b"); | 54 | i->setHardwareName("802.11b"); |
55 | return true; | 55 | return true; |
56 | } | 56 | } |
57 | return false; | 57 | return false; |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Create, set tabWiget and return the WLANConfigure Module | 61 | * Create, set tabWiget and return the WLANConfigure Module |
62 | * @param tabWidget a pointer to the tab widget that this configure has. | 62 | * @param tabWidget a pointer to the tab widget that this configure has. |
63 | * @return QWidget* pointer to the tab widget in this modules configure. | 63 | * @return QWidget* pointer to the tab widget in this modules configure. |
64 | */ | 64 | */ |
65 | QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){ | 65 | QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){ |
66 | Config *cfg = new Config("wireless config"); | 66 | WLANImp *wlanconfig = new WLANImp( ); |
67 | WLANImp *wlanconfig = new WLANImp(*cfg); | ||
68 | (*tabWidget) = wlanconfig->tabWidget; | 67 | (*tabWidget) = wlanconfig->tabWidget; |
69 | return wlanconfig; | 68 | return wlanconfig; |
70 | } | 69 | } |
71 | 70 | ||
72 | /** | 71 | /** |
73 | * Create, set tabWiget and return the Information Module | 72 | * Create, set tabWiget and return the Information Module |
74 | * @param tabWidget a pointer to the tab widget that this information has. | 73 | * @param tabWidget a pointer to the tab widget that this information has. |
75 | * @return QWidget* pointer to the tab widget in this modules info. | 74 | * @return QWidget* pointer to the tab widget in this modules info. |
76 | */ | 75 | */ |
77 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ | 76 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ |
78 | WlanInfo *info = new WlanInfo(0, "wireless info"); | 77 | WlanInfo *info = new WlanInfo(0, "wireless info"); |
79 | (*tabWidget) = info->tabWidget; | 78 | (*tabWidget) = info->tabWidget; |
80 | 79 | ||
81 | struct ifreq ifr; | 80 | struct ifreq ifr; |
82 | struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr; | 81 | struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr; |
83 | int fd = socket( AF_INET, SOCK_DGRAM, 0 ); | 82 | int fd = socket( AF_INET, SOCK_DGRAM, 0 ); |
84 | 83 | ||
85 | const char* buffer[200]; | 84 | const char* buffer[200]; |
86 | struct iwreq iwr; | 85 | struct iwreq iwr; |
87 | memset( &iwr, 0, sizeof( iwr ) ); | 86 | memset( &iwr, 0, sizeof( iwr ) ); |
88 | iwr.u.essid.pointer = (caddr_t) buffer; | 87 | iwr.u.essid.pointer = (caddr_t) buffer; |
89 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; | 88 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; |
90 | iwr.u.essid.flags = 0; | 89 | iwr.u.essid.flags = 0; |
91 | 90 | ||
diff --git a/noncore/settings/networksettings/wlan/wlanimp.cpp b/noncore/settings/networksettings/wlan/wlanimp.cpp index 517604f..3b0e0b7 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.cpp +++ b/noncore/settings/networksettings/wlan/wlanimp.cpp | |||
@@ -1,223 +1,224 @@ | |||
1 | #include "wlanimp.h" | 1 | #include "wlanimp.h" |
2 | 2 | ||
3 | /* Config class */ | 3 | /* Config class */ |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | /* Global namespace */ | 5 | /* Global namespace */ |
6 | #include <qpe/global.h> | 6 | #include <qpe/global.h> |
7 | /* system() */ | 7 | /* system() */ |
8 | #include <stdlib.h> | 8 | #include <stdlib.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | #include <qdir.h> | 10 | #include <qdir.h> |
11 | #include <qtextstream.h> | 11 | #include <qtextstream.h> |
12 | #include <qmessagebox.h> | 12 | #include <qmessagebox.h> |
13 | #include <qlineedit.h> | 13 | #include <qlineedit.h> |
14 | #include <qspinbox.h> | 14 | #include <qspinbox.h> |
15 | #include <qradiobutton.h> | 15 | #include <qradiobutton.h> |
16 | #include <qcheckbox.h> | 16 | #include <qcheckbox.h> |
17 | #include <qregexp.h> | 17 | #include <qregexp.h> |
18 | 18 | ||
19 | WLANImp::WLANImp( Config &cfg, QWidget* parent, const char* name):WLAN(parent, name),config(cfg){ | 19 | WLANImp::WLANImp( QWidget* parent, const char* name):WLAN(parent, name){ |
20 | config = new Config("wireless"); | ||
20 | readConfig(); | 21 | readConfig(); |
21 | } | 22 | } |
22 | 23 | ||
23 | void WLANImp::readConfig() | 24 | void WLANImp::readConfig() |
24 | { | 25 | { |
25 | qWarning( "WLANImp::readConfig() called." ); | 26 | qWarning( "WLANImp::readConfig() called." ); |
26 | config.setGroup( "Properties" ); | 27 | config->setGroup( "Properties" ); |
27 | QString ssid = config.readEntry( "SSID", "any" ); | 28 | QString ssid = config->readEntry( "SSID", "any" ); |
28 | if( ssid == "any" || ssid == "ANY" ){ | 29 | if( ssid == "any" || ssid == "ANY" ){ |
29 | essNon->setChecked( true ); | 30 | essNon->setChecked( true ); |
30 | } else { | 31 | } else { |
31 | essSpecific->setChecked( true ); | 32 | essSpecific->setChecked( true ); |
32 | essSpecificLineEdit->setText( ssid ); | 33 | essSpecificLineEdit->setText( ssid ); |
33 | } | 34 | } |
34 | QString mode = config.readEntry( "Mode", "Managed" ); | 35 | QString mode = config->readEntry( "Mode", "Managed" ); |
35 | if( mode == "adhoc" ) { | 36 | if( mode == "adhoc" ) { |
36 | network802->setChecked( true ); | 37 | network802->setChecked( true ); |
37 | } else { | 38 | } else { |
38 | networkInfrastructure->setChecked( true ); | 39 | networkInfrastructure->setChecked( true ); |
39 | } | 40 | } |
40 | networkChannel->setValue( config.readNumEntry( "CHANNEL", 1 ) ); | 41 | networkChannel->setValue( config->readNumEntry( "CHANNEL", 1 ) ); |
41 | // config.readEntry( "RATE", "auto" ); | 42 | // config->readEntry( "RATE", "auto" ); |
42 | config.readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); | 43 | config->readEntry( "dot11PrivacyInvoked" ) == "true" ? wepEnabled->setChecked( true ) : wepEnabled->setChecked( false ); |
43 | config.readEntry( "AuthType", "opensystem" ); | 44 | config->readEntry( "AuthType", "opensystem" ); |
44 | config.readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); | 45 | config->readEntry( "PRIV_KEY128", "false" ) == "false" ? key40->setChecked( true ) : key128->setChecked( true ); |
45 | int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 ); | 46 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); |
46 | switch( defaultkey ){ | 47 | switch( defaultkey ){ |
47 | case 0: | 48 | case 0: |
48 | keyRadio0->setChecked( true ); | 49 | keyRadio0->setChecked( true ); |
49 | break; | 50 | break; |
50 | case 1: | 51 | case 1: |
51 | keyRadio1->setChecked( true ); | 52 | keyRadio1->setChecked( true ); |
52 | break; | 53 | break; |
53 | case 2: | 54 | case 2: |
54 | keyRadio2->setChecked( true ); | 55 | keyRadio2->setChecked( true ); |
55 | break; | 56 | break; |
56 | case 3: | 57 | case 3: |
57 | keyRadio3->setChecked( true ); | 58 | keyRadio3->setChecked( true ); |
58 | break; | 59 | break; |
59 | } | 60 | } |
60 | keyLineEdit0->setText(config.readEntry( "dot11WEPDefaultKey0" )); | 61 | keyLineEdit0->setText(config->readEntry( "dot11WEPDefaultKey0" )); |
61 | keyLineEdit1->setText(config.readEntry( "dot11WEPDefaultKey1" )); | 62 | keyLineEdit1->setText(config->readEntry( "dot11WEPDefaultKey1" )); |
62 | keyLineEdit2->setText(config.readEntry( "dot11WEPDefaultKey2" )); | 63 | keyLineEdit2->setText(config->readEntry( "dot11WEPDefaultKey2" )); |
63 | keyLineEdit3->setText(config.readEntry( "dot11WEPDefaultKey3" )); | 64 | keyLineEdit3->setText(config->readEntry( "dot11WEPDefaultKey3" )); |
64 | return; | 65 | return; |
65 | } | 66 | } |
66 | 67 | ||
67 | bool WLANImp::writeConfig() | 68 | bool WLANImp::writeConfig() |
68 | { | 69 | { |
69 | qWarning( "WLANImp::writeConfig() called." ); | 70 | qWarning( "WLANImp::writeConfig() called." ); |
70 | config.setGroup( "Properties" ); | 71 | config->setGroup( "Properties" ); |
71 | if( essNon->isChecked() ) { | 72 | if( essNon->isChecked() ) { |
72 | config.writeEntry( "SSID", "any" ); | 73 | config->writeEntry( "SSID", "any" ); |
73 | } else { | 74 | } else { |
74 | config.writeEntry( "SSID", essSpecificLineEdit->text() ); | 75 | config->writeEntry( "SSID", essSpecificLineEdit->text() ); |
75 | } | 76 | } |
76 | if( networkInfrastructure->isChecked() ){ | 77 | if( networkInfrastructure->isChecked() ){ |
77 | config.writeEntry( "Mode", "Managed" ); | 78 | config->writeEntry( "Mode", "Managed" ); |
78 | } else if( network802->isChecked() ){ | 79 | } else if( network802->isChecked() ){ |
79 | config.writeEntry( "Mode", "adhoc" ); | 80 | config->writeEntry( "Mode", "adhoc" ); |
80 | } | 81 | } |
81 | config.writeEntry( "CHANNEL", networkChannel->value() ); | 82 | config->writeEntry( "CHANNEL", networkChannel->value() ); |
82 | // config.readEntry( "RATE", "auto" ); | 83 | // config->readEntry( "RATE", "auto" ); |
83 | wepEnabled->isChecked() ? config.writeEntry( "dot11PrivacyInvoked", "true" ) : config.writeEntry( "dot11PrivacyInvoked", "false" ); | 84 | wepEnabled->isChecked() ? config->writeEntry( "dot11PrivacyInvoked", "true" ) : config->writeEntry( "dot11PrivacyInvoked", "false" ); |
84 | authOpen->isChecked() ? config.writeEntry( "AuthType", "opensystem" ) : config.writeEntry( "AuthType", "sharedkey" ); | 85 | authOpen->isChecked() ? config->writeEntry( "AuthType", "opensystem" ) : config->writeEntry( "AuthType", "sharedkey" ); |
85 | key40->isChecked() ? config.writeEntry( "PRIV_KEY128", "false" ) : config.writeEntry( "PRIV_KEY128", "true" ); | 86 | key40->isChecked() ? config->writeEntry( "PRIV_KEY128", "false" ) : config->writeEntry( "PRIV_KEY128", "true" ); |
86 | if( keyRadio0->isChecked() ){ | 87 | if( keyRadio0->isChecked() ){ |
87 | config.writeEntry( "dot11WEPDefaultKeyID", 0 ); | 88 | config->writeEntry( "dot11WEPDefaultKeyID", 0 ); |
88 | } else if( keyRadio1->isChecked() ){ | 89 | } else if( keyRadio1->isChecked() ){ |
89 | config.writeEntry( "dot11WEPDefaultKeyID", 1 ); | 90 | config->writeEntry( "dot11WEPDefaultKeyID", 1 ); |
90 | } else if( keyRadio2->isChecked() ){ | 91 | } else if( keyRadio2->isChecked() ){ |
91 | config.writeEntry( "dot11WEPDefaultKeyID", 2 ); | 92 | config->writeEntry( "dot11WEPDefaultKeyID", 2 ); |
92 | } else if( keyRadio3->isChecked() ){ | 93 | } else if( keyRadio3->isChecked() ){ |
93 | config.writeEntry( "dot11WEPDefaultKeyID", 3 ); | 94 | config->writeEntry( "dot11WEPDefaultKeyID", 3 ); |
94 | } | 95 | } |
95 | config.writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); | 96 | config->writeEntry( "dot11WEPDefaultKey0", keyLineEdit0->text() ); |
96 | config.writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); | 97 | config->writeEntry( "dot11WEPDefaultKey1", keyLineEdit1->text() ); |
97 | config.writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); | 98 | config->writeEntry( "dot11WEPDefaultKey2", keyLineEdit2->text() ); |
98 | config.writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); | 99 | config->writeEntry( "dot11WEPDefaultKey3", keyLineEdit3->text() ); |
99 | return writeWirelessOpts( config ); | 100 | return writeWirelessOpts( ); |
100 | } | 101 | } |
101 | 102 | ||
102 | /** | 103 | /** |
103 | */ | 104 | */ |
104 | void WLANImp::accept() | 105 | void WLANImp::accept() |
105 | { | 106 | { |
106 | if ( writeConfig() ) | 107 | if ( writeConfig() ) |
107 | QDialog::accept(); | 108 | QDialog::accept(); |
108 | } | 109 | } |
109 | 110 | ||
110 | void WLANImp::done ( int r ) | 111 | void WLANImp::done ( int r ) |
111 | { | 112 | { |
112 | QDialog::done ( r ); | 113 | QDialog::done ( r ); |
113 | close ( ); | 114 | close ( ); |
114 | } | 115 | } |
115 | 116 | ||
116 | bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) | 117 | bool WLANImp::writeWirelessOpts( QString scheme ) |
117 | { | 118 | { |
118 | qWarning( "WLANImp::writeWirelessOpts entered." ); | 119 | qWarning( "WLANImp::writeWirelessOpts entered." ); |
119 | QString prev = "/etc/pcmcia/wireless.opts"; | 120 | QString prev = "/etc/pcmcia/wireless.opts"; |
120 | QFile prevFile(prev); | 121 | QFile prevFile(prev); |
121 | if ( !prevFile.open( IO_ReadOnly ) ) | 122 | if ( !prevFile.open( IO_ReadOnly ) ) |
122 | return false; | 123 | return false; |
123 | 124 | ||
124 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; | 125 | QString tmp = "/etc/pcmcia/wireless.opts-qpe-new"; |
125 | QFile tmpFile(tmp); | 126 | QFile tmpFile(tmp); |
126 | if ( !tmpFile.open( IO_WriteOnly ) ) | 127 | if ( !tmpFile.open( IO_WriteOnly ) ) |
127 | return false; | 128 | return false; |
128 | 129 | ||
129 | bool retval = true; | 130 | bool retval = true; |
130 | 131 | ||
131 | QTextStream in( &prevFile ); | 132 | QTextStream in( &prevFile ); |
132 | QTextStream out( &tmpFile ); | 133 | QTextStream out( &tmpFile ); |
133 | 134 | ||
134 | config.setGroup("Properties"); | 135 | config->setGroup("Properties"); |
135 | 136 | ||
136 | QString line; | 137 | QString line; |
137 | bool found=false; | 138 | bool found=false; |
138 | bool done=false; | 139 | bool done=false; |
139 | while ( !in.atEnd() ) { | 140 | while ( !in.atEnd() ) { |
140 | QString line = in.readLine(); | 141 | QString line = in.readLine(); |
141 | QString wline = line.simplifyWhiteSpace(); | 142 | QString wline = line.simplifyWhiteSpace(); |
142 | if ( !done ) { | 143 | if ( !done ) { |
143 | if ( found ) { | 144 | if ( found ) { |
144 | // skip existing entry for this scheme, and write our own. | 145 | // skip existing entry for this scheme, and write our own. |
145 | if ( wline == ";;" ) { | 146 | if ( wline == ";;" ) { |
146 | found = false; | 147 | found = false; |
147 | continue; | 148 | continue; |
148 | } else { | 149 | } else { |
149 | continue; | 150 | continue; |
150 | } | 151 | } |
151 | } else { | 152 | } else { |
152 | if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) { | 153 | if ( wline.left(scheme.length()+7) == scheme + ",*,*,*)" ) { |
153 | found=true; | 154 | found=true; |
154 | continue; // skip this line | 155 | continue; // skip this line |
155 | } else if ( wline == "esac" || wline == "*,*,*,*)" ) { | 156 | } else if ( wline == "esac" || wline == "*,*,*,*)" ) { |
156 | // end - add new entry | 157 | // end - add new entry |
157 | // Not all fields have a GUI, but all are supported | 158 | // Not all fields have a GUI, but all are supported |
158 | // in the letwork configuration files. | 159 | // in the letwork configuration files. |
159 | static const char* txtfields[] = { | 160 | static const char* txtfields[] = { |
160 | 0 | 161 | 0 |
161 | }; | 162 | }; |
162 | QString readmode = config.readEntry( "Mode", "Managed" ); | 163 | QString readmode = config->readEntry( "Mode", "Managed" ); |
163 | QString mode; | 164 | QString mode; |
164 | if( readmode == "Managed" ){ | 165 | if( readmode == "Managed" ){ |
165 | mode = readmode; | 166 | mode = readmode; |
166 | } else if( readmode == "adhoc" ){ | 167 | } else if( readmode == "adhoc" ){ |
167 | mode = "Ad-Hoc"; | 168 | mode = "Ad-Hoc"; |
168 | } | 169 | } |
169 | QString key; | 170 | QString key; |
170 | if( wepEnabled->isChecked() ){ | 171 | if( wepEnabled->isChecked() ){ |
171 | int defaultkey = config.readNumEntry( "dot11WEPDefaultKeyID", 0 ); | 172 | int defaultkey = config->readNumEntry( "dot11WEPDefaultKeyID", 0 ); |
172 | switch( defaultkey ){ | 173 | switch( defaultkey ){ |
173 | case 0: | 174 | case 0: |
174 | key += keyLineEdit0->text(); | 175 | key += keyLineEdit0->text(); |
175 | break; | 176 | break; |
176 | case 1: | 177 | case 1: |
177 | key += keyLineEdit1->text(); | 178 | key += keyLineEdit1->text(); |
178 | break; | 179 | break; |
179 | case 2: | 180 | case 2: |
180 | key += keyLineEdit2->text(); | 181 | key += keyLineEdit2->text(); |
181 | break; | 182 | break; |
182 | case 3: | 183 | case 3: |
183 | key += keyLineEdit3->text(); | 184 | key += keyLineEdit3->text(); |
184 | break; | 185 | break; |
185 | } | 186 | } |
186 | if( config.readEntry( "AuthType", "opensystem" ) == "opensystem") | 187 | if( config->readEntry( "AuthType", "opensystem" ) == "opensystem") |
187 | key += " open"; | 188 | key += " open"; |
188 | } | 189 | } |
189 | out << scheme << ",*,*,*)" << "\n" | 190 | out << scheme << ",*,*,*)" << "\n" |
190 | << " ESSID=" << Global::shellQuote( config.readEntry( "SSID", "any" ) ) << "\n" | 191 | << " ESSID=" << Global::shellQuote( config->readEntry( "SSID", "any" ) ) << "\n" |
191 | << " MODE=" << mode << "\n" | 192 | << " MODE=" << mode << "\n" |
192 | << " KEY=" << Global::shellQuote( key ) << "\n" | 193 | << " KEY=" << Global::shellQuote( key ) << "\n" |
193 | << " RATE=" << "auto" << "\n" | 194 | << " RATE=" << "auto" << "\n" |
194 | ; | 195 | ; |
195 | if( mode != "Managed" ) | 196 | if( mode != "Managed" ) |
196 | out << " CHANNEL=" << config.readNumEntry( "CHANNEL", 1 ) << "\n"; | 197 | out << " CHANNEL=" << config->readNumEntry( "CHANNEL", 1 ) << "\n"; |
197 | const char** f = txtfields; | 198 | const char** f = txtfields; |
198 | while (*f) { | 199 | while (*f) { |
199 | out << " " << *f << "=" << config.readEntry(*f,"") << "\n"; | 200 | out << " " << *f << "=" << config->readEntry(*f,"") << "\n"; |
200 | ++f; | 201 | ++f; |
201 | } | 202 | } |
202 | out << " ;;\n"; | 203 | out << " ;;\n"; |
203 | done = true; | 204 | done = true; |
204 | } | 205 | } |
205 | } | 206 | } |
206 | } | 207 | } |
207 | out << line << "\n"; | 208 | out << line << "\n"; |
208 | } | 209 | } |
209 | 210 | ||
210 | prevFile.close(); | 211 | prevFile.close(); |
211 | tmpFile.close(); | 212 | tmpFile.close(); |
212 | QString initpath; | 213 | QString initpath; |
213 | //system("cardctl suspend"); | 214 | //system("cardctl suspend"); |
214 | if( QDir("/etc/rc.d/init.d").exists() ){ | 215 | if( QDir("/etc/rc.d/init.d").exists() ){ |
215 | initpath = "/etc/rc.d/init.d"; | 216 | initpath = "/etc/rc.d/init.d"; |
216 | } else if( QDir("/etc/init.d").exists() ){ | 217 | } else if( QDir("/etc/init.d").exists() ){ |
217 | initpath = "/etc/init.d"; | 218 | initpath = "/etc/init.d"; |
218 | } | 219 | } |
219 | if( initpath ) | 220 | if( initpath ) |
220 | system(QString("%1/pcmcia stop").arg(initpath)); | 221 | system(QString("%1/pcmcia stop").arg(initpath)); |
221 | 222 | ||
222 | if( system( "mv " + tmp + " " + prev ) ) | 223 | if( system( "mv " + tmp + " " + prev ) ) |
223 | retval = false; | 224 | retval = false; |
diff --git a/noncore/settings/networksettings/wlan/wlanimp.h b/noncore/settings/networksettings/wlan/wlanimp.h index 8e355ce..79e931d 100644 --- a/noncore/settings/networksettings/wlan/wlanimp.h +++ b/noncore/settings/networksettings/wlan/wlanimp.h | |||
@@ -1,27 +1,27 @@ | |||
1 | #ifndef WLANIMP_H | 1 | #ifndef WLANIMP_H |
2 | #define WLANIMP_H | 2 | #define WLANIMP_H |
3 | 3 | ||
4 | #include "wlan.h" | 4 | #include "wlan.h" |
5 | 5 | ||
6 | class Config; | 6 | #include <qpe/config.h> |
7 | 7 | ||
8 | class WLANImp : public WLAN { | 8 | class WLANImp : public WLAN { |
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | 10 | ||
11 | public: | 11 | public: |
12 | WLANImp( Config& cfg, QWidget* parent = 0, const char* name = 0); | 12 | WLANImp( QWidget* parent = 0, const char* name = 0); |
13 | 13 | ||
14 | protected: | 14 | protected: |
15 | void accept(); | 15 | void accept(); |
16 | void done ( int r ); | 16 | void done ( int r ); |
17 | 17 | ||
18 | private: | 18 | private: |
19 | void readConfig(); | 19 | void readConfig(); |
20 | bool writeConfig(); | 20 | bool writeConfig(); |
21 | bool writeWirelessOpts( Config &cfg, QString scheme = "*" ); | 21 | bool writeWirelessOpts( QString scheme = "*" ); |
22 | bool writeWlanngOpts( Config &cfg, QString scheme = "*" ); | 22 | bool writeWlanngOpts( QString scheme = "*" ); |
23 | Config& config; | 23 | Config* config; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | #endif | 26 | #endif |
27 | 27 | ||
diff --git a/noncore/settings/networksettings/wlan/wlanmodule.cpp b/noncore/settings/networksettings/wlan/wlanmodule.cpp index f12e608..cbb520d 100644 --- a/noncore/settings/networksettings/wlan/wlanmodule.cpp +++ b/noncore/settings/networksettings/wlan/wlanmodule.cpp | |||
@@ -42,50 +42,49 @@ void WLANModule::setProfile(QString newProfile){ | |||
42 | */ | 42 | */ |
43 | QString WLANModule::getPixmapName(Interface* ){ | 43 | QString WLANModule::getPixmapName(Interface* ){ |
44 | return "wlan"; | 44 | return "wlan"; |
45 | } | 45 | } |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Check to see if the interface i is owned by this module. | 48 | * Check to see if the interface i is owned by this module. |
49 | * @param Interface* interface to check against | 49 | * @param Interface* interface to check against |
50 | * @return bool true if i is owned by this module, false otherwise. | 50 | * @return bool true if i is owned by this module, false otherwise. |
51 | */ | 51 | */ |
52 | bool WLANModule::isOwner(Interface *i){ | 52 | bool WLANModule::isOwner(Interface *i){ |
53 | if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ | 53 | if(i->getInterfaceName() == "eth0" || i->getInterfaceName() == "wlan0"){ |
54 | i->setHardwareName("802.11b"); | 54 | i->setHardwareName("802.11b"); |
55 | return true; | 55 | return true; |
56 | } | 56 | } |
57 | return false; | 57 | return false; |
58 | } | 58 | } |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Create, set tabWiget and return the WLANConfigure Module | 61 | * Create, set tabWiget and return the WLANConfigure Module |
62 | * @param tabWidget a pointer to the tab widget that this configure has. | 62 | * @param tabWidget a pointer to the tab widget that this configure has. |
63 | * @return QWidget* pointer to the tab widget in this modules configure. | 63 | * @return QWidget* pointer to the tab widget in this modules configure. |
64 | */ | 64 | */ |
65 | QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){ | 65 | QWidget *WLANModule::configure(Interface *i, QTabWidget **tabWidget){ |
66 | Config *cfg = new Config("wireless config"); | 66 | WLANImp *wlanconfig = new WLANImp( ); |
67 | WLANImp *wlanconfig = new WLANImp(*cfg); | ||
68 | (*tabWidget) = wlanconfig->tabWidget; | 67 | (*tabWidget) = wlanconfig->tabWidget; |
69 | return wlanconfig; | 68 | return wlanconfig; |
70 | } | 69 | } |
71 | 70 | ||
72 | /** | 71 | /** |
73 | * Create, set tabWiget and return the Information Module | 72 | * Create, set tabWiget and return the Information Module |
74 | * @param tabWidget a pointer to the tab widget that this information has. | 73 | * @param tabWidget a pointer to the tab widget that this information has. |
75 | * @return QWidget* pointer to the tab widget in this modules info. | 74 | * @return QWidget* pointer to the tab widget in this modules info. |
76 | */ | 75 | */ |
77 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ | 76 | QWidget *WLANModule::information(Interface *i, QTabWidget **tabWidget){ |
78 | WlanInfo *info = new WlanInfo(0, "wireless info"); | 77 | WlanInfo *info = new WlanInfo(0, "wireless info"); |
79 | (*tabWidget) = info->tabWidget; | 78 | (*tabWidget) = info->tabWidget; |
80 | 79 | ||
81 | struct ifreq ifr; | 80 | struct ifreq ifr; |
82 | struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr; | 81 | struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr; |
83 | int fd = socket( AF_INET, SOCK_DGRAM, 0 ); | 82 | int fd = socket( AF_INET, SOCK_DGRAM, 0 ); |
84 | 83 | ||
85 | const char* buffer[200]; | 84 | const char* buffer[200]; |
86 | struct iwreq iwr; | 85 | struct iwreq iwr; |
87 | memset( &iwr, 0, sizeof( iwr ) ); | 86 | memset( &iwr, 0, sizeof( iwr ) ); |
88 | iwr.u.essid.pointer = (caddr_t) buffer; | 87 | iwr.u.essid.pointer = (caddr_t) buffer; |
89 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; | 88 | iwr.u.essid.length = IW_ESSID_MAX_SIZE; |
90 | iwr.u.essid.flags = 0; | 89 | iwr.u.essid.flags = 0; |
91 | 90 | ||