summaryrefslogtreecommitdiff
path: root/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
authorwimpie <wimpie>2004-04-10 13:06:13 (UTC)
committer wimpie <wimpie>2004-04-10 13:06:13 (UTC)
commitdb9f0e2a7fd93157d95f421534fcc3015abe53e0 (patch) (side-by-side diff)
tree001918ca18d0d74f3e49597f766c070bea71e25c /noncore/settings/networksettings2/wlan/wlan_NNI.cpp
parent6bcdc8cd41199dce849b800b4296011faf6281df (diff)
downloadopie-db9f0e2a7fd93157d95f421534fcc3015abe53e0.zip
opie-db9f0e2a7fd93157d95f421534fcc3015abe53e0.tar.gz
opie-db9f0e2a7fd93157d95f421534fcc3015abe53e0.tar.bz2
*** empty log message ***
Diffstat (limited to 'noncore/settings/networksettings2/wlan/wlan_NNI.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/networksettings2/wlan/wlan_NNI.cpp114
1 files changed, 109 insertions, 5 deletions
diff --git a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
index 78e756c..61969f2 100644
--- a/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
+++ b/noncore/settings/networksettings2/wlan/wlan_NNI.cpp
@@ -1,3 +1,4 @@
+#include <unistd.h>
#include "wlanedit.h"
#include "wlan_NNI.h"
#include "wlan_NN.h"
@@ -5,16 +6,66 @@
AWLan::AWLan( WLanNetNode * PNN ) : ANetNodeInstance( PNN ) {
GUI = 0;
RT = 0;
+ Data.ESSID = "";
+ Data.NodeName = tr("<UseHostName>");
+ Data.Mode = 0;
+ Data.SpecificAP = 0;
+ Data.APMac = "";
+ Data.Encrypted = 0;
+ Data.AcceptNonEncrypted = 0;
+ Data.Key[0] = "";
+ Data.Key[1] = "";
+ Data.Key[2] = "";
+ Data.Key[3] = "";
}
-void AWLan::setSpecificAttribute( QString & , QString & ) {
+void AWLan::setSpecificAttribute( QString & A, QString & V ) {
+ if( A == "essid" ) {
+ Data.ESSID = V;
+ } else if( A == "nodename" ) {
+ Data.NodeName = V;
+ } else if( A == "mode" ) {
+ Data.Mode = V.toShort();
+ } else if( A == "specificap" ) {
+ Data.SpecificAP = (V=="yes");
+ } else if( A == "apmac" ) {
+ Data.APMac = V;
+ } else if( A == "encrypted" ) {
+ Data.Encrypted = (V=="yes");
+ } else if( A == "acceptnonencrypted" ) {
+ Data.AcceptNonEncrypted = (V=="yes");
+ } else if( A == "key0" ) {
+ Data.Key[0] = V;
+ } else if( A == "key1" ) {
+ Data.Key[1] = V;
+ } else if( A == "key2" ) {
+ Data.Key[2] = V;
+ } else if( A == "key3" ) {
+ Data.Key[3] = V;
+ }
}
-void AWLan::saveSpecificAttribute( QTextStream & ) {
+void AWLan::saveSpecificAttribute( QTextStream & S ) {
+ S << "essid=" << quote( Data.ESSID ) << endl;
+ S << "nodename=" << quote( Data.NodeName ) << endl;
+ S << "mode=" << Data.Mode << endl;
+ S << "specificap="
+ << ((Data.SpecificAP) ? "yes" : "no")
+ << endl;
+ S << "apmac=" << Data.APMac << endl;
+ S << "encrypted="
+ << ((Data.Encrypted) ? "yes" : "no")
+ << endl;
+ S << "acceptnonencrypted="
+ << ((Data.AcceptNonEncrypted) ? "yes" : "no")
+ << endl;
+ for( int i = 0 ;i < 4 ; i ++ ) {
+ S << "key" << i << "=" << Data.Key[i] << endl;
+ }
}
QWidget * AWLan::edit( QWidget * parent ) {
- GUI = new WLanEdit( parent );
+ GUI = new WLanEdit( parent, this );
GUI->showData( Data );
return GUI;
}
@@ -29,8 +80,61 @@ void AWLan::commit( void ) {
}
bool AWLan::generateDataForCommonFile(
- SystemFile &,
+ SystemFile & S,
long ) {
- return 1;
+
+ S << " wireless_essid \""
+ << Data.ESSID
+ << "\""
+ << endl;
+
+ if( ! Data.NodeName.isEmpty() ) {
+ if( Data.NodeName == tr("<UseHostName>") ) {
+ char Buf[100];
+ if( gethostname(Buf, sizeof(Buf) ) == 0 ) {
+ Buf[99] = '\0'; // just to make sure
+ S << " wireless_nick "
+ << Buf
+ << endl;
+ }
+ } else {
+ S << " wireless_nick \""
+ << Data.NodeName
+ << "\""
+ << endl;
+ }
+ }
+
+ char * M;
+ switch ( Data.Mode ) {
+ case 0 :
+ M = "Auto";
+ break;
+ case 1 :
+ M = "Managed";
+ break;
+ case 2 :
+ M = "Ad-Hoc";
+ break;
+ }
+
+ S << " wireless_mode "
+ << M
+ << endl;
+ if( Data.Encrypted ) {
+ for( int i = 0; i < 4; i ++ ) {
+ if( ! Data.Key[i].isEmpty() ) {
+ S << " wireless_key"
+ << i
+ << " "
+ << Data.Key[i]
+ << endl;
+ }
+ }
+ S << " wireless_keymode "
+ << ((Data.AcceptNonEncrypted) ? "open" : "restricted")
+ << endl;
+ }
+ return 0;
}