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 /noncore/net/networksetup/wlan | |
parent | 8c9e2e893540c0a405637f10ac2f656df69991a7 (diff) | |
download | opie-d7449e1e0070a068c5e83366cb75b64142b71b89.zip opie-d7449e1e0070a068c5e83366cb75b64142b71b89.tar.gz opie-d7449e1e0070a068c5e83366cb75b64142b71b89.tar.bz2 |
Cleaned up Config handling a bit.
Diffstat (limited to 'noncore/net/networksetup/wlan') (more/less context) (ignore whitespace changes)
-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 |
3 files changed, 48 insertions, 48 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 | |||
@@ -16,33 +16,34 @@ | |||
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 ); |
@@ -57,46 +58,46 @@ void WLANImp::readConfig() | |||
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 | /** |
@@ -113,7 +114,7 @@ void WLANImp::done ( int 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"; |
@@ -131,7 +132,7 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) | |||
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; |
@@ -159,7 +160,7 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) | |||
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; |
@@ -168,7 +169,7 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) | |||
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(); |
@@ -183,20 +184,20 @@ bool WLANImp::writeWirelessOpts( Config &config, QString scheme ) | |||
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"; |
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 | |||
@@ -3,13 +3,13 @@ | |||
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(); |
@@ -18,9 +18,9 @@ protected: | |||
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 |
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 | |||
@@ -63,8 +63,7 @@ bool WLANModule::isOwner(Interface *i){ | |||
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 | } |