Convert config widgets to new API

pull/1/head
Timothy Pearson 12 years ago
parent 4e6c7c0e4e
commit 9dce208848

@ -41,17 +41,6 @@
<cstring>mNetworkId</cstring> <cstring>mNetworkId</cstring>
</property> </property>
</widget> </widget>
<widget class="TQLabel" row="3" column="0">
<property name="name">
<cstring>textLabel2_2_2</cstring>
</property>
<property name="text">
<string>PU&amp;K:</string>
</property>
<property name="buddy" stdset="0">
<cstring>mUsername</cstring>
</property>
</widget>
<widget class="TQLabel" row="0" column="2"> <widget class="TQLabel" row="0" column="2">
<property name="name"> <property name="name">
<cstring>textLabel1</cstring> <cstring>textLabel1</cstring>
@ -79,22 +68,22 @@
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>GPRS</string> <string>Only 3G</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>GSM</string> <string>Only GPRS/EDGE</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Prefer GPRS</string> <string>Prefer 3G</string>
</property> </property>
</item> </item>
<item> <item>
<property name="text"> <property name="text">
<string>Prefer GSM</string> <string>Prefer 2G</string>
</property> </property>
</item> </item>
<property name="name"> <property name="name">
@ -151,17 +140,6 @@
<cstring>mBand</cstring> <cstring>mBand</cstring>
</property> </property>
</widget> </widget>
<widget class="TQLineEdit" row="3" column="1">
<property name="name">
<cstring>mPuk</cstring>
</property>
<property name="toolTip" stdset="0">
<string>Personal Unblocking Code</string>
</property>
<property name="whatsThis" stdset="0">
<string> A code used to unblock a blocked SIM card</string>
</property>
</widget>
<widget class="TQSpinBox" row="4" column="3"> <widget class="TQSpinBox" row="4" column="3">
<property name="name"> <property name="name">
<cstring>mBand</cstring> <cstring>mBand</cstring>
@ -283,7 +261,6 @@
<tabstop>mUsername</tabstop> <tabstop>mUsername</tabstop>
<tabstop>mPassword</tabstop> <tabstop>mPassword</tabstop>
<tabstop>mPin</tabstop> <tabstop>mPin</tabstop>
<tabstop>mPuk</tabstop>
<tabstop>mNumber</tabstop> <tabstop>mNumber</tabstop>
<tabstop>mApn</tabstop> <tabstop>mApn</tabstop>
<tabstop>mNetworkId</tabstop> <tabstop>mNetworkId</tabstop>

@ -210,14 +210,6 @@
<string>Require MPPE</string> <string>Require MPPE</string>
</property> </property>
</widget> </widget>
<widget class="TQCheckBox" row="5" column="1">
<property name="name">
<cstring>mRequireMppc</cstring>
</property>
<property name="text">
<string>Require MPPC</string>
</property>
</widget>
<widget class="TQCheckBox" row="5" column="0"> <widget class="TQCheckBox" row="5" column="0">
<property name="name"> <property name="name">
<cstring>mRefuseMschapV2</cstring> <cstring>mRefuseMschapV2</cstring>
@ -308,7 +300,6 @@
<tabstop>mRequireMppe</tabstop> <tabstop>mRequireMppe</tabstop>
<tabstop>mRequireMppe128</tabstop> <tabstop>mRequireMppe128</tabstop>
<tabstop>mStatefulMppe</tabstop> <tabstop>mStatefulMppe</tabstop>
<tabstop>mRequireMppc</tabstop>
<tabstop>mCrtscts</tabstop> <tabstop>mCrtscts</tabstop>
<tabstop>mBaudRate</tabstop> <tabstop>mBaudRate</tabstop>
<tabstop>mMru</tabstop> <tabstop>mMru</tabstop>

@ -44,7 +44,7 @@ using namespace ConnectionSettings;
CDMAWidgetImpl::CDMAWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) CDMAWidgetImpl::CDMAWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl) : WidgetInterface(parent, name, fl)
{ {
_cdmasetting = dynamic_cast<TDEModemConnection*> (conn); _cdmasetting = dynamic_cast<TDEModemConnection*>(conn);
TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingCdmaWidget(this); _mainWid = new ConnectionSettingCdmaWidget(this);
@ -56,12 +56,16 @@ CDMAWidgetImpl::CDMAWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, con
void void
CDMAWidgetImpl::Init() CDMAWidgetImpl::Init()
{ {
_mainWid->mUsername->setText( _cdmasetting->getUsername() ); if (_cdmasetting->cdmaConfig.valid) {
_mainWid->mPassword->setText( _cdmasetting->getPassword( ) ); _mainWid->mUsername->setText( _cdmasetting->cdmaConfig.username );
_mainWid->mNumber->setText( _cdmasetting->getNumber() ); _mainWid->mNumber->setText( _cdmasetting->cdmaConfig.providerDataNumber );
connect( _mainWid->mUsername, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty())); if (_cdmasetting->cdmaConfig.secretsValid) {
connect( _mainWid->mPassword, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty())); _mainWid->mPassword->setText( _cdmasetting->cdmaConfig.password );
connect( _mainWid->mNumber, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty())); }
}
connect( _mainWid->mUsername, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mPassword, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mNumber, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
} }
void void
@ -78,9 +82,11 @@ CDMAWidgetImpl::Activate()
void void
CDMAWidgetImpl::dirty() CDMAWidgetImpl::dirty()
{ {
_cdmasetting->setUsername( _mainWid->mUsername->text() ); _cdmasetting->cdmaConfig.username = _mainWid->mUsername->text();
_cdmasetting->setPassword( _mainWid->mPassword->text() ); _cdmasetting->cdmaConfig.password = _mainWid->mPassword->text();
_cdmasetting->setNumber( _mainWid->mNumber->text() ); _cdmasetting->cdmaConfig.providerDataNumber = _mainWid->mNumber->text();
_cdmasetting->cdmaConfig.valid = true;
_cdmasetting->cdmaConfig.secretsValid = true;
} }

@ -35,19 +35,17 @@
#include <kuser.h> #include <kuser.h>
// knm headers // knm headers
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_gsm.h" #include "knetworkmanager-connection_setting_gsm.h"
#include "knetworkmanager-connection_setting_gsm_widget.h" #include "knetworkmanager-connection_setting_gsm_widget.h"
#include "knetworkmanager-device.h"
#include "connection_setting_gsm.h" #include "connection_setting_gsm.h"
using namespace ConnectionSettings; using namespace ConnectionSettings;
GSMWidgetImpl::GSMWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl) GSMWidgetImpl::GSMWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl) : WidgetInterface(parent, name, fl)
{ {
_gsmsetting = dynamic_cast<ConnectionSettings::GSM*> (conn->getSetting(NM_SETTING_GSM_SETTING_NAME)); _gsmsetting = dynamic_cast<TDEModemConnection*>(conn);
TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingGsmWidget(this); _mainWid = new ConnectionSettingGsmWidget(this);
@ -59,25 +57,27 @@ GSMWidgetImpl::GSMWidgetImpl(Connection* conn, TQWidget* parent, const char* nam
void void
GSMWidgetImpl::Init() GSMWidgetImpl::Init()
{ {
_mainWid->mUsername->setText( _gsmsetting->getUsername() ); if (_gsmsetting->gsmConfig.valid) {
_mainWid->mPassword->setText( _gsmsetting->getPassword( ) ); _mainWid->mUsername->setText( _gsmsetting->gsmConfig.username );
_mainWid->mPin->setText( _gsmsetting->getPin() ); _mainWid->mNumber->setText( _gsmsetting->gsmConfig.providerDataNumber );
_mainWid->mPuk->setText( _gsmsetting->getPuk() ); _mainWid->mApn->setText( _gsmsetting->gsmConfig.accessPointName );
_mainWid->mNumber->setText( _gsmsetting->getNumber() ); _mainWid->mNetworkId->setText( _gsmsetting->gsmConfig.networkID );
_mainWid->mApn->setText( _gsmsetting->getAPN() ); setNetworkType( _gsmsetting->gsmConfig.networkType );
_mainWid->mNetworkId->setText( _gsmsetting->getNetworkID( )); _mainWid->mBand->setValue( _gsmsetting->gsmConfig.allowedFrequencyBands );
_mainWid->mNetworkType->setCurrentItem( _gsmsetting->getNetworkType( ) +1); if (_gsmsetting->gsmConfig.secretsValid) {
_mainWid->mBand->setValue( _gsmsetting->getBand() ); _mainWid->mPassword->setText( _gsmsetting->gsmConfig.password );
_mainWid->mPin->setText( _gsmsetting->gsmConfig.pin );
connect( _mainWid->mUsername, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty())); }
connect( _mainWid->mPassword, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty())); }
connect( _mainWid->mPin, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mPuk, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty())); connect( _mainWid->mUsername, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mNumber, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty())); connect( _mainWid->mPassword, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mApn, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty())); connect( _mainWid->mPin, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mNetworkId, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty())); connect( _mainWid->mNumber, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mNetworkType, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty())); connect( _mainWid->mApn, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mBand, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty())); connect( _mainWid->mNetworkId, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty()));
connect( _mainWid->mNetworkType, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty()));
connect( _mainWid->mBand, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty()));
} }
void void
@ -94,15 +94,64 @@ GSMWidgetImpl::Activate()
void void
GSMWidgetImpl::dirty() GSMWidgetImpl::dirty()
{ {
_gsmsetting->setUsername( _mainWid->mUsername->text() ); _gsmsetting->gsmConfig.username = _mainWid->mUsername->text();
_gsmsetting->setPassword( _mainWid->mPassword->text() ); _gsmsetting->gsmConfig.password = _mainWid->mPassword->text();
_gsmsetting->setPin( _mainWid->mPin->text() ); _gsmsetting->gsmConfig.pin = _mainWid->mPin->text();
_gsmsetting->setPuk( _mainWid->mPuk->text() ); _gsmsetting->gsmConfig.providerDataNumber = _mainWid->mNumber->text();
_gsmsetting->setNumber( _mainWid->mNumber->text() ); _gsmsetting->gsmConfig.accessPointName = _mainWid->mApn->text();
_gsmsetting->setAPN( _mainWid->mApn->text() ); _gsmsetting->gsmConfig.networkID = _mainWid->mNetworkId->text();
_gsmsetting->setNetworkID( _mainWid->mNetworkId->text() ); _gsmsetting->gsmConfig.networkType = getNetworkType();
_gsmsetting->setNetworkType( _mainWid->mNetworkType->currentItem() - 1 ); _gsmsetting->gsmConfig.allowedFrequencyBands = _mainWid->mBand->value();
_gsmsetting->setBand( _mainWid->mBand->value() );
_gsmsetting->gsmConfig.valid = true;
_gsmsetting->gsmConfig.secretsValid = true;
}
void
GSMWidgetImpl::setNetworkType(TDEGSMNetworkType::TDEGSMNetworkType type)
{
if (type == TDEGSMNetworkType::Any) {
_mainWid->mBand->setValue(0);
}
else if (type == TDEGSMNetworkType::Only3G) {
_mainWid->mBand->setValue(1);
}
else if (type == TDEGSMNetworkType::GPRSEdge) {
_mainWid->mBand->setValue(2);
}
else if (type == TDEGSMNetworkType::Prefer3G) {
_mainWid->mBand->setValue(3);
}
else if (type == TDEGSMNetworkType::Prefer2G) {
_mainWid->mBand->setValue(4);
}
else {
_mainWid->mBand->setValue(0);
}
}
TDEGSMNetworkType::TDEGSMNetworkType
GSMWidgetImpl::getNetworkType()
{
int itemNo = _mainWid->mNetworkType->currentItem();
if (itemNo == 0) {
return TDEGSMNetworkType::Any;
}
else if (itemNo == 1) {
return TDEGSMNetworkType::Only3G;
}
else if (itemNo == 2) {
return TDEGSMNetworkType::GPRSEdge;
}
else if (itemNo == 3) {
return TDEGSMNetworkType::Prefer3G;
}
else if (itemNo == 4) {
return TDEGSMNetworkType::Prefer2G;
}
else {
return TDEGSMNetworkType::Any;
}
} }
#include "knetworkmanager-connection_setting_gsm_widget.moc" #include "knetworkmanager-connection_setting_gsm_widget.moc"

@ -26,14 +26,17 @@
#define KNETWORKMANAGER_CONNECTION_SETTING_GSM_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_GSM_WIDGET_H
// qt headers // tqt headers
#include <tqwidget.h> #include <tqwidget.h>
#include <tqlineedit.h> #include <tqlineedit.h>
// tde headers
#include <tdehardwaredevices.h>
#include <tdenetworkconnections.h>
// knm headers // knm headers
#include "knetworkmanager-connection_setting_gsm.h" #include "knetworkmanager-connection_setting_gsm.h"
#include "knetworkmanager-connection_setting_widget_interface.h" #include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-device.h"
//class VPNService; //class VPNService;
class ConnectionSettingGsmWidget; class ConnectionSettingGsmWidget;
@ -48,7 +51,7 @@ class GSMWidgetImpl : public WidgetInterface
Q_OBJECT Q_OBJECT
public: public:
GSMWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); GSMWidgetImpl(TDENetworkConnection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
void Activate(); void Activate();
void Deactivate(); void Deactivate();
public slots: public slots:
@ -58,8 +61,10 @@ class GSMWidgetImpl : public WidgetInterface
void Init(); void Init();
//VPNConfigWidget* getVPNConfigWidget(VPNService* service); //VPNConfigWidget* getVPNConfigWidget(VPNService* service);
void setNetworkType(TDEGSMNetworkType::TDEGSMNetworkType);
TDEGSMNetworkType::TDEGSMNetworkType getNetworkType();
GSM* _gsmsetting; TDEModemConnection* _gsmsetting;
ConnectionSettingGsmWidget* _mainWid; ConnectionSettingGsmWidget* _mainWid;
}; };

@ -30,17 +30,15 @@
#include <tqlayout.h> #include <tqlayout.h>
// knm headers // knm headers
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_info.h" #include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_info_widget.h" #include "knetworkmanager-connection_setting_info_widget.h"
#include "knetworkmanager-device.h"
using namespace ConnectionSettings; using namespace ConnectionSettings;
InfoWidgetImpl::InfoWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl) InfoWidgetImpl::InfoWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl) : WidgetInterface(parent, name, fl)
{ {
_infosetting = dynamic_cast<ConnectionSettings::Info*> (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); _infosetting = conn;
TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
@ -60,20 +58,20 @@ InfoWidgetImpl::Init()
void void
InfoWidgetImpl::Activate() InfoWidgetImpl::Activate()
{ {
_mainWid->txtConnectionName->setText(_infosetting->getName()); _mainWid->txtConnectionName->setText(_infosetting->friendlyName);
_mainWid->chkAutoConnect->setChecked(_infosetting->getAutoconnect()); _mainWid->chkAutoConnect->setChecked(_infosetting->autoConnect);
} }
void void
InfoWidgetImpl::slotNameChanged(const TQString& name) InfoWidgetImpl::slotNameChanged(const TQString& name)
{ {
_infosetting->setName(name); _infosetting->friendlyName = name;
} }
void void
InfoWidgetImpl::slotAutoconnectChanged(bool autoconnect) InfoWidgetImpl::slotAutoconnectChanged(bool autoconnect)
{ {
_infosetting->setAutoconnect(autoconnect); _infosetting->autoConnect = autoconnect;
} }
#include "knetworkmanager-connection_setting_info_widget.moc" #include "knetworkmanager-connection_setting_info_widget.moc"

@ -27,14 +27,17 @@
#define KNETWORKMANAGER_CONNECTION_SETTING_INFO_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_INFO_WIDGET_H
// qt headers // tqt headers
#include <tqwidget.h> #include <tqwidget.h>
#include <tqlineedit.h> #include <tqlineedit.h>
// tde headers
#include <tdehardwaredevices.h>
#include <tdenetworkconnections.h>
// knm headers // knm headers
#include "connection_setting_info.h" #include "connection_setting_info.h"
#include "knetworkmanager-connection_setting_widget_interface.h" #include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-device.h"
namespace ConnectionSettings namespace ConnectionSettings
{ {
@ -47,7 +50,7 @@ class InfoWidgetImpl : public WidgetInterface
Q_OBJECT Q_OBJECT
public: public:
InfoWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); InfoWidgetImpl(TDENetworkConnection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
void Activate(); void Activate();
public slots: public slots:
@ -57,7 +60,7 @@ class InfoWidgetImpl : public WidgetInterface
private: private:
void Init(); void Init();
Info* _infosetting; TDENetworkConnection* _infosetting;
ConnectionSettingInfoWidget* _mainWid; ConnectionSettingInfoWidget* _mainWid;
}; };

@ -36,10 +36,10 @@ using namespace ConnectionSettings;
#define IP_INPUT_MASK "900.900.900.900" #define IP_INPUT_MASK "900.900.900.900"
IPv4WidgetImpl::IPv4WidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl) IPv4WidgetImpl::IPv4WidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl) : WidgetInterface(parent, name, fl)
{ {
_ipv4_setting = dynamic_cast<ConnectionSettings::IPv4*> (conn->getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME)); _ipv4_setting = conn;
TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingIPv4Widget(this); _mainWid = new ConnectionSettingIPv4Widget(this);
@ -51,7 +51,7 @@ IPv4WidgetImpl::IPv4WidgetImpl(Connection* conn, TQWidget* parent, const char* n
void void
IPv4WidgetImpl::Init() IPv4WidgetImpl::Init()
{ {
_mainWid->groupIPConfig->setChecked(_ipv4_setting->getMethod() == IPv4::METHOD_MANUAL); _mainWid->groupIPConfig->setChecked(!(_ipv4_setting->ipConfig.connectionFlags & TDENetworkIPConfigurationFlags::IPV4DHCPIP));
connect(_mainWid->groupIPConfig, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotIPConfigEnabled(bool))); connect(_mainWid->groupIPConfig, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotIPConfigEnabled(bool)));
@ -59,26 +59,34 @@ IPv4WidgetImpl::Init()
_mainWid->txtNetmask->setInputMask(IP_INPUT_MASK); _mainWid->txtNetmask->setInputMask(IP_INPUT_MASK);
_mainWid->txtGateway->setInputMask(IP_INPUT_MASK); _mainWid->txtGateway->setInputMask(IP_INPUT_MASK);
if (!_ipv4_setting->getAddresses().isEmpty()) if (!_ipv4_setting->ipConfig.ipConfigurations.isEmpty())
{ {
_mainWid->txtIP->setText(_ipv4_setting->getAddresses()[0].address.toString()); _mainWid->txtIP->setText(_ipv4_setting->ipConfig.ipConfigurations[0].ipAddress.toString());
_mainWid->txtNetmask->setText(_ipv4_setting->getAddresses()[0].netmask.toString()); _mainWid->txtNetmask->setText(_ipv4_setting->ipConfig.ipConfigurations[0].networkMask.toString());
_mainWid->txtGateway->setText(_ipv4_setting->getAddresses()[0].gateway.toString()); _mainWid->txtGateway->setText(_ipv4_setting->ipConfig.ipConfigurations[0].gateway.toString());
} }
if (!_ipv4_setting->getDNS().isEmpty()) if (!_ipv4_setting->ipConfig.resolvers.isEmpty())
{ {
TQValueList<TQHostAddress> hosts = _ipv4_setting->getDNS(); TDENetworkAddressList hosts = _ipv4_setting->ipConfig.resolvers;
TQStringList list; TQStringList list;
for (TQValueList<TQHostAddress>::Iterator it = hosts.begin(); it != hosts.end(); ++it) for (TDENetworkAddressList::Iterator it = hosts.begin(); it != hosts.end(); ++it)
{ {
list.append((*it).toString()); list.append((*it).toString());
} }
_mainWid->txtDNSAddresses->setText(list.join(" ")); _mainWid->txtDNSAddresses->setText(list.join(" "));
} }
if (!_ipv4_setting->getDNSSearch().isEmpty()) if (!_ipv4_setting->ipConfig.searchDomains.isEmpty())
_mainWid->txtDNSSearch->setText(_ipv4_setting->getDNSSearch().join(" ")); {
TDENetworkSearchDomainList domains = _ipv4_setting->ipConfig.searchDomains;
TQStringList list;
for (TDENetworkSearchDomainList::Iterator it = domains.begin(); it != domains.end(); ++it)
{
list.append((*it).searchDomain());
}
_mainWid->txtDNSSearch->setText(list.join(" "));
}
// connect the signals after setting up the values // connect the signals after setting up the values
connect(_mainWid->txtIP, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotIPAddressChanged(const TQString&))); connect(_mainWid->txtIP, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotIPAddressChanged(const TQString&)));
@ -99,14 +107,16 @@ IPv4WidgetImpl::slotDNSAddressesChanged(const TQString& adr)
{ {
// TODO: use , and ; for splitting too // TODO: use , and ; for splitting too
TQStringList list = TQStringList::split(" ", adr); TQStringList list = TQStringList::split(" ", adr);
TQValueList<TQHostAddress> hosts; TDENetworkAddressList hosts;
for (TQStringList::Iterator it = list.begin(); it != list.end(); ++it) for (TQStringList::Iterator it = list.begin(); it != list.end(); ++it)
{ {
TQHostAddress host(*it); TQHostAddress host(*it);
if (!host.isNull()) if (!host.isNull())
{
hosts.append(host); hosts.append(host);
}
} }
_ipv4_setting->setDNS(hosts); _ipv4_setting->ipConfig.resolvers = hosts;
} }
@ -114,13 +124,30 @@ void
IPv4WidgetImpl::slotDNSSearchChanged(const TQString& search) IPv4WidgetImpl::slotDNSSearchChanged(const TQString& search)
{ {
// TODO: use , and ; for splitting too // TODO: use , and ; for splitting too
_ipv4_setting->setDNSSearch(TQStringList::split(" ", search));
TQStringList list = TQStringList::split(" ", search);
TDENetworkSearchDomainList domains;
for (TQStringList::Iterator it = list.begin(); it != list.end(); ++it)
{
if ((*it) != "") {
TDENetworkSearchDomain domain(*it);
domains.append(domain);
}
}
_ipv4_setting->ipConfig.searchDomains = domains;
} }
void void
IPv4WidgetImpl::slotIPConfigEnabled(bool enabled) IPv4WidgetImpl::slotIPConfigEnabled(bool enabled)
{ {
_ipv4_setting->setMethod(enabled ? IPv4::METHOD_MANUAL : IPv4::METHOD_DHCP ); if (enabled)
{
_ipv4_setting->ipConfig.connectionFlags &= (~TDENetworkIPConfigurationFlags::IPV4DHCPIP);
}
else
{
_ipv4_setting->ipConfig.connectionFlags |= TDENetworkIPConfigurationFlags::IPV4DHCPIP;
}
} }
void void
@ -129,28 +156,33 @@ IPv4WidgetImpl::slotIPAddressChanged(const TQString& ip)
TQHostAddress ipadr(ip); TQHostAddress ipadr(ip);
if (!ipadr.isNull()) if (!ipadr.isNull())
{ {
TQValueList<IPv4Address> addrs = _ipv4_setting->getAddresses(); TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations;
if (addrs.size() > 0) if (addrs.size() > 0)
addrs[0].address = ipadr; {
addrs[0].ipAddress = ipadr;
}
else else
{ {
IPv4Address adr; TDENetworkSingleIPConfiguration adr;
adr.address = ipadr; adr.ipAddress = ipadr;
addrs.append(adr); addrs.append(adr);
} }
_ipv4_setting->setAddresses(addrs); _ipv4_setting->ipConfig.ipConfigurations = addrs;
// if netmask is not set yet we preset it to a default value depending on the network class // if netmask is not set yet we preset it to a default value depending on the network class
if (_mainWid->txtNetmask->text() == "...") if (_mainWid->txtNetmask->text() == "...")
{ {
if ( (ipadr.toIPv4Address() & 0xFF000000) < 0xDF000000) if ( (ipadr.toIPv4Address() & 0xFF000000) < 0xDF000000)
{ {
if ( (ipadr.toIPv4Address() & 0xFF000000) >= 0xC0000000) if ( (ipadr.toIPv4Address() & 0xFF000000) >= 0xC0000000) {
_mainWid->txtNetmask->setText("255.255.255.0"); // class C _mainWid->txtNetmask->setText("255.255.255.0"); // class C
else if ( (ipadr.toIPv4Address() & 0xFF000000) >= 0x80000000) }
else if ( (ipadr.toIPv4Address() & 0xFF000000) >= 0x80000000) {
_mainWid->txtNetmask->setText("255.255.0.0"); // class B _mainWid->txtNetmask->setText("255.255.0.0"); // class B
else }
else {
_mainWid->txtNetmask->setText("255.0.0.0"); // class A _mainWid->txtNetmask->setText("255.0.0.0"); // class A
}
} }
} }
} }
@ -159,17 +191,19 @@ IPv4WidgetImpl::slotIPAddressChanged(const TQString& ip)
void void
IPv4WidgetImpl::slotNetmaskChanged(const TQString& ip) IPv4WidgetImpl::slotNetmaskChanged(const TQString& ip)
{ {
TQValueList<IPv4Address> addrs = _ipv4_setting->getAddresses(); TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations;
addrs[0].netmask = TQHostAddress(ip); TDENetMask mask;
_ipv4_setting->setAddresses(addrs); mask.fromString(ip);
addrs[0].networkMask = mask;
_ipv4_setting->ipConfig.ipConfigurations = addrs;
} }
void void
IPv4WidgetImpl::slotGatewayChanged(const TQString& ip) IPv4WidgetImpl::slotGatewayChanged(const TQString& ip)
{ {
TQValueList<IPv4Address> addrs = _ipv4_setting->getAddresses(); TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations;
addrs[0].gateway = TQHostAddress(ip); addrs[0].gateway = TQHostAddress(ip);
_ipv4_setting->setAddresses(addrs); _ipv4_setting->ipConfig.ipConfigurations = addrs;
} }
#include "knetworkmanager-connection_setting_ipv4_widget.moc" #include "knetworkmanager-connection_setting_ipv4_widget.moc"

@ -25,11 +25,14 @@
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H #ifndef KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H
#define KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H
// qt autogenerated headers // tde headers
#include <tdehardwaredevices.h>
#include <tdenetworkconnections.h>
// ui headers
#include "connection_setting_ipv4.h" #include "connection_setting_ipv4.h"
// knetworkmanager headers // knetworkmanager headers
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_widget_interface.h" #include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-connection_setting_ipv4.h" #include "knetworkmanager-connection_setting_ipv4.h"
@ -43,7 +46,7 @@ namespace ConnectionSettings
public: public:
IPv4WidgetImpl(Connection* conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); IPv4WidgetImpl(TDENetworkConnection* conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
void Activate(); void Activate();
public slots: public slots:
@ -57,7 +60,7 @@ namespace ConnectionSettings
private: private:
void Init(); void Init();
IPv4* _ipv4_setting; TDENetworkConnection* _ipv4_setting;
ConnectionSettingIPv4Widget* _mainWid; ConnectionSettingIPv4Widget* _mainWid;
}; };

@ -37,19 +37,17 @@
#include <kuser.h> #include <kuser.h>
// knm headers // knm headers
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_ppp.h" #include "knetworkmanager-connection_setting_ppp.h"
#include "knetworkmanager-connection_setting_ppp_widget.h" #include "knetworkmanager-connection_setting_ppp_widget.h"
#include "knetworkmanager-device.h"
#include "connection_setting_ppp.h" #include "connection_setting_ppp.h"
using namespace ConnectionSettings; using namespace ConnectionSettings;
PPPWidgetImpl::PPPWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl) PPPWidgetImpl::PPPWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl) : WidgetInterface(parent, name, fl)
{ {
_pppsetting = dynamic_cast<ConnectionSettings::PPP*> (conn->getSetting(NM_SETTING_PPP_SETTING_NAME)); _pppsetting = conn;
TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingPppWidget(this); _mainWid = new ConnectionSettingPppWidget(this);
@ -61,39 +59,40 @@ PPPWidgetImpl::PPPWidgetImpl(Connection* conn, TQWidget* parent, const char* nam
void void
PPPWidgetImpl::Init() PPPWidgetImpl::Init()
{ {
_mainWid->mNoAuth->setChecked( _pppsetting->getNoAuth() ); if (_pppsetting->pppConfig.valid) {
_mainWid->mRefuseEap->setChecked( _pppsetting->getRefuseEAP( ) ); _mainWid->mNoAuth->setChecked( !(_pppsetting->pppConfig.requireServerAuthentication) );
_mainWid->mRefusePap->setChecked( _pppsetting->getRefusePAP( ) ); _mainWid->mRefuseEap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableEAP );
_mainWid->mRefuseChap->setChecked( _pppsetting->getRefuseChap() ); _mainWid->mRefusePap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisablePAP );
_mainWid->mRefuseMschap->setChecked( _pppsetting->getRefuseMSChap() ); _mainWid->mRefuseChap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableCHAP );
_mainWid->mRefuseMschapV2->setChecked( _pppsetting->getRefuseMSChapV2() ); _mainWid->mRefuseMschap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAP );
_mainWid->mNoBsd->setChecked( _pppsetting->getNoBSDComp() ); _mainWid->mRefuseMschapV2->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAPv2 );
_mainWid->mNoDeflate->setChecked( _pppsetting->getNoDeflate() ); _mainWid->mNoBsd->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowBSDCompression) );
_mainWid->mNoVjComp->setChecked( _pppsetting->getNoVJComp() ); _mainWid->mNoDeflate->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowDeflateCompression) );
_mainWid->mRequireMppe->setChecked( _pppsetting->getRequireMPPE( )); _mainWid->mNoVjComp->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowVJCompression) );
_mainWid->mRequireMppe128->setChecked( _pppsetting->getRequireMPPE128( )); _mainWid->mRequireMppe->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE );
_mainWid->mStatefulMppe->setChecked( _pppsetting->getMPPEStateful() ); _mainWid->mRequireMppe128->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE128 );
_mainWid->mRequireMppc->setChecked( _pppsetting->getRequireMPPC() ); _mainWid->mStatefulMppe->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::StatefulMPPE );
_mainWid->mCrtscts->setChecked( _pppsetting->getCRTSCTS() ); _mainWid->mCrtscts->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::UseHardwareFlowControl );
_mainWid->mBaudRate->setValue(_pppsetting->getBaud()); _mainWid->mBaudRate->setValue(_pppsetting->pppConfig.baudRate);
_mainWid->mMru->setValue(_pppsetting->getMRU()); _mainWid->mMru->setValue(_pppsetting->pppConfig.mru);
_mainWid->mMtu->setValue(_pppsetting->getMTU()); _mainWid->mMtu->setValue(_pppsetting->pppConfig.mtu);
_mainWid->mLcpEchoFailure->setValue(_pppsetting->getLCPEchoFailure()); _mainWid->mLcpEchoFailure->setValue(_pppsetting->pppConfig.lcpEchoFailureThreshold);
_mainWid->mLcpEchoInterval->setValue(_pppsetting->getLCPEchoInterval()); _mainWid->mLcpEchoInterval->setValue(_pppsetting->pppConfig.lcpEchoPingInterval);
connect( _mainWid->mNoAuth, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); }
connect( _mainWid->mRefuseEap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRefusePap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); connect( _mainWid->mNoAuth, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRefuseChap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); connect( _mainWid->mRefuseEap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRefuseMschap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); connect( _mainWid->mRefusePap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRefuseMschapV2, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); connect( _mainWid->mRefuseChap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mNoBsd, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); connect( _mainWid->mRefuseMschap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mNoDeflate, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); connect( _mainWid->mRefuseMschapV2, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRequireMppe, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); connect( _mainWid->mNoBsd, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRequireMppe128, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); connect( _mainWid->mNoDeflate, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mStatefulMppe, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); connect( _mainWid->mRequireMppe, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mRequireMppc, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); connect( _mainWid->mRequireMppe128, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mCrtscts, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); connect( _mainWid->mStatefulMppe, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
connect( _mainWid->mCrtscts, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty()));
} }
void void
@ -107,24 +106,40 @@ PPPWidgetImpl::Activate()
} }
#define SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(x,y,z) { \
if (z) { \
x |= y; \
} \
else { \
x &= (~y); \
} \
}
void void
PPPWidgetImpl::dirty() PPPWidgetImpl::dirty()
{ {
_pppsetting->setNoAuth( _mainWid->mNoAuth->isChecked() ); _pppsetting->pppConfig.requireServerAuthentication = ( !(_mainWid->mNoAuth->isChecked()) );
_pppsetting->setRefuseEAP( _mainWid->mRefuseEap->isChecked() );
_pppsetting->setRefuseChap( _mainWid->mRefuseChap->isChecked() ); SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableEAP, _mainWid->mRefuseEap->isChecked() );
_pppsetting->setRefuseMSChap( _mainWid->mRefuseMschap->isChecked() ); SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisablePAP, _mainWid->mRefusePap->isChecked() );
_pppsetting->setNoBSDComp( _mainWid->mNoBsd->isChecked() ); SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableCHAP, _mainWid->mRefuseChap->isChecked() );
_pppsetting->setNoDeflate( _mainWid->mNoDeflate->isChecked() ); SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableMSCHAP, _mainWid->mRefuseMschap->isChecked() );
_pppsetting->setRequireMPPE( _mainWid->mRequireMppe->isChecked() ); SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableMSCHAPv2, _mainWid->mRefuseMschapV2->isChecked() );
_pppsetting->setRequireMPPE( _mainWid->mRequireMppe128->isChecked() ); SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::AllowBSDCompression, !(_mainWid->mNoBsd->isChecked()) );
_pppsetting->setMPPEStateful( _mainWid->mStatefulMppe->isChecked() ); SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::AllowDeflateCompression, !(_mainWid->mNoDeflate->isChecked()) );
SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::AllowVJCompression, !(_mainWid->mNoVjComp->isChecked()) );
_pppsetting->setBaud(_mainWid->mBaudRate->value()); SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::RequireMPPE, _mainWid->mRequireMppe->isChecked() );
_pppsetting->setMRU(_mainWid->mMru->value()); SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::RequireMPPE128, _mainWid->mRequireMppe128->isChecked() );
_pppsetting->setMTU(_mainWid->mMtu->value()); SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::StatefulMPPE, _mainWid->mStatefulMppe->isChecked() );
_pppsetting->setLCPEchoFailure(_mainWid->mLcpEchoFailure->value()); SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::UseHardwareFlowControl, _mainWid->mCrtscts->isChecked() );
_pppsetting->setLCPEchoInterval(_mainWid->mLcpEchoInterval->value());
_pppsetting->pppConfig.baudRate = _mainWid->mBaudRate->value();
_pppsetting->pppConfig.mru = _mainWid->mMru->value();
_pppsetting->pppConfig.mtu = _mainWid->mMtu->value();
_pppsetting->pppConfig.lcpEchoFailureThreshold = _mainWid->mLcpEchoFailure->value();
_pppsetting->pppConfig.lcpEchoPingInterval = _mainWid->mLcpEchoInterval->value();
_pppsetting->pppConfig.valid = true;
} }
#include "knetworkmanager-connection_setting_ppp_widget.moc" #include "knetworkmanager-connection_setting_ppp_widget.moc"

@ -26,14 +26,17 @@
#define KNETWORKMANAGER_CONNECTION_SETTING_PPP_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_PPP_WIDGET_H
// qt headers // tqt headers
#include <tqwidget.h> #include <tqwidget.h>
#include <tqlineedit.h> #include <tqlineedit.h>
// tde headers
#include <tdehardwaredevices.h>
#include <tdenetworkconnections.h>
// knm headers // knm headers
#include "knetworkmanager-connection_setting_ppp.h" #include "knetworkmanager-connection_setting_ppp.h"
#include "knetworkmanager-connection_setting_widget_interface.h" #include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-device.h"
//class VPNService; //class VPNService;
class ConnectionSettingPppWidget; class ConnectionSettingPppWidget;
@ -48,7 +51,7 @@ class PPPWidgetImpl : public WidgetInterface
Q_OBJECT Q_OBJECT
public: public:
PPPWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); PPPWidgetImpl(TDENetworkConnection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
void Activate(); void Activate();
void Deactivate(); void Deactivate();
public slots: public slots:
@ -57,7 +60,7 @@ class PPPWidgetImpl : public WidgetInterface
private: private:
void Init(); void Init();
PPP* _pppsetting; TDENetworkConnection* _pppsetting;
ConnectionSettingPppWidget* _mainWid; ConnectionSettingPppWidget* _mainWid;
}; };

@ -36,41 +36,41 @@
#include <kuser.h> #include <kuser.h>
// knm headers // knm headers
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_serial.h" #include "knetworkmanager-connection_setting_serial.h"
#include "knetworkmanager-connection_setting_serial_widget.h" #include "knetworkmanager-connection_setting_serial_widget.h"
#include "knetworkmanager-device.h"
#include "connection_setting_serial.h" #include "connection_setting_serial.h"
using namespace ConnectionSettings; using namespace ConnectionSettings;
SerialWidgetImpl::SerialWidgetImpl(Connection* conn, TQWidget* parent, const char* name, WFlags fl) SerialWidgetImpl::SerialWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl) : WidgetInterface(parent, name, fl)
{ {
_serialsetting = dynamic_cast<ConnectionSettings::Serial*> (conn->getSetting(NM_SETTING_SERIAL_SETTING_NAME)); _serialsetting = conn;
TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
_mainWid = new ConnectionSettingSerialWidget(this); _mainWid = new ConnectionSettingSerialWidget(this);
layout->addWidget(_mainWid); layout->addWidget(_mainWid);
_mainWid->mBaudRate->setMaxValue(INT_MAX); _mainWid->mBaudRate->setMaxValue(INT_MAX);
Init(); Init();
} }
void void
SerialWidgetImpl::Init() SerialWidgetImpl::Init()
{ {
_mainWid->mBaudRate->setValue(_serialsetting->getBaud()); if (_serialsetting->serialConfig.valid) {
_mainWid->mDataBits->setCurrentItem(_serialsetting->getBits() - 7); _mainWid->mBaudRate->setValue(_serialsetting->serialConfig.baudRate);
_mainWid->mParity->setCurrentItem(_serialsetting->getParity()); _mainWid->mDataBits->setCurrentItem(_serialsetting->serialConfig.byteWidth - 7);
_mainWid->mStopBits->setCurrentItem(_serialsetting->getStopBits()); setParityType(_serialsetting->serialConfig.parity);
_mainWid->mSendDelay->setValue(_serialsetting->getSendDelay()); _mainWid->mStopBits->setCurrentItem(_serialsetting->serialConfig.stopBits);
_mainWid->mSendDelay->setValue(_serialsetting->serialConfig.txDelay);
connect( _mainWid->mBaudRate, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty())); }
connect( _mainWid->mDataBits, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty()));
connect( _mainWid->mParity, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty())); connect( _mainWid->mBaudRate, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty()));
connect( _mainWid->mStopBits, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty())); connect( _mainWid->mDataBits, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty()));
connect( _mainWid->mSendDelay, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty())); connect( _mainWid->mParity, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty()));
connect( _mainWid->mStopBits, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty()));
connect( _mainWid->mSendDelay, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty()));
} }
void void
@ -87,11 +87,48 @@ SerialWidgetImpl::Activate()
void void
SerialWidgetImpl::dirty() SerialWidgetImpl::dirty()
{ {
_serialsetting->setBaud( _mainWid->mBaudRate->value() ); _serialsetting->serialConfig.baudRate = _mainWid->mBaudRate->value();
_serialsetting->setBits( _mainWid->mDataBits->currentItem() + 7 ); _serialsetting->serialConfig.byteWidth = _mainWid->mDataBits->currentItem() + 7;
_serialsetting->setParity( (ConnectionSettings::Serial::PARITY_MODE)_mainWid->mParity->currentItem() ); _serialsetting->serialConfig.parity = getParityType();
_serialsetting->setStopBits( _mainWid->mStopBits->currentItem() ); _serialsetting->serialConfig.stopBits = _mainWid->mStopBits->currentItem();
_serialsetting->setSendDelay( _mainWid->mSendDelay->value() ); _serialsetting->serialConfig.txDelay = _mainWid->mSendDelay->value();
_serialsetting->serialConfig.valid = true;
}
void
SerialWidgetImpl::setParityType(TDENetworkParity::TDENetworkParity type)
{
if (type == TDENetworkParity::None) {
_mainWid->mParity->setCurrentItem(0);
}
else if (type == TDENetworkParity::Even) {
_mainWid->mParity->setCurrentItem(1);
}
else if (type == TDENetworkParity::Odd) {
_mainWid->mParity->setCurrentItem(2);
}
else {
_mainWid->mParity->setCurrentItem(0);
}
}
TDENetworkParity::TDENetworkParity
SerialWidgetImpl::getParityType()
{
int itemNo = _mainWid->mParity->currentItem();
if (itemNo == 0) {
return TDENetworkParity::None;
}
else if (itemNo == 1) {
return TDENetworkParity::Even;
}
else if (itemNo == 2) {
return TDENetworkParity::Odd;
}
else {
return TDENetworkParity::None;
}
} }
#include "knetworkmanager-connection_setting_serial_widget.moc" #include "knetworkmanager-connection_setting_serial_widget.moc"

@ -26,14 +26,17 @@
#define KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_WIDGET_H
// qt headers // tqt headers
#include <tqwidget.h> #include <tqwidget.h>
#include <tqlineedit.h> #include <tqlineedit.h>
// tde headers
#include <tdehardwaredevices.h>
#include <tdenetworkconnections.h>
// knm headers // knm headers
#include "knetworkmanager-connection_setting_serial.h" #include "knetworkmanager-connection_setting_serial.h"
#include "knetworkmanager-connection_setting_widget_interface.h" #include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-device.h"
//class VPNService; //class VPNService;
class ConnectionSettingSerialWidget; class ConnectionSettingSerialWidget;
@ -48,7 +51,7 @@ class SerialWidgetImpl : public WidgetInterface
Q_OBJECT Q_OBJECT
public: public:
SerialWidgetImpl(Connection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0); SerialWidgetImpl(TDENetworkConnection* conn, TQWidget* parent = NULL, const char* name = NULL, WFlags fl = 0);
void Activate(); void Activate();
void Deactivate(); void Deactivate();
public slots: public slots:
@ -57,7 +60,10 @@ class SerialWidgetImpl : public WidgetInterface
private: private:
void Init(); void Init();
Serial* _serialsetting; void setParityType(TDENetworkParity::TDENetworkParity type);
TDENetworkParity::TDENetworkParity getParityType();
TDENetworkConnection* _serialsetting;
ConnectionSettingSerialWidget* _mainWid; ConnectionSettingSerialWidget* _mainWid;
}; };

@ -41,48 +41,52 @@
#include <kpassdlg.h> #include <kpassdlg.h>
/* knetworkmanager headers */ /* knetworkmanager headers */
#include "knetworkmanager-accesspoint.h"
#include "knetworkmanager-wireless_device.h"
#include "knetworkmanager-device.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_wireless_security_widget.h" #include "knetworkmanager-connection_setting_wireless_security_widget.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection_setting_8021x.h"
#include "sha1.h" #include "sha1.h"
#include "md5.h" #include "md5.h"
#include "knetworkmanager-wireless_manager.h" #include "knetworkmanager-wireless_manager.h"
#define WPA_PMK_LEN 32 #define WPA_PMK_LEN 32
#define SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(x,y,z) { \
if (z) { \
x |= y; \
} \
else { \
x &= (~y); \
} \
}
using namespace ConnectionSettings; using namespace ConnectionSettings;
/* /*
class WirelessSecurityWEPImpl class WirelessSecurityWEPImpl
*/ */
WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(WirelessSecurity* sec, TQWidget* parent, const char* name, WFlags fl) WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(TDEWiFiConnection* sec, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityWEP(parent, name, fl) : ConnectionSettingWirelessSecurityWEP(parent, name, fl)
, _security_setting(sec) , _security_setting(sec)
, _wepKeyType( WEPKEY_TYPE_HEX ) , _wepKeyType( WEPKEY_TYPE_HEX )
{ {
cboAuthentication->insertItem(i18n("Open System"), 0); cboAuthentication->insertItem(i18n("Open System"), 0);
cboAuthentication->insertItem(i18n("Shared Key"), 1); cboAuthentication->insertItem(i18n("Shared Key"), 1);
if (_security_setting->getAuthAlg() == WirelessSecurity::AUTH_ALG_OPEN) if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Open) {
cboAuthentication->setCurrentItem(0); cboAuthentication->setCurrentItem(0);
else if (_security_setting->getAuthAlg() == WirelessSecurity::AUTH_ALG_SHARED) }
else if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Shared) {
cboAuthentication->setCurrentItem(1); cboAuthentication->setCurrentItem(1);
}
cbKeyType->insertItem(i18n("WEP 40/128-bit ASCII"), WEPKEY_TYPE_ASCII); cbKeyType->insertItem(i18n("WEP 40/128-bit ASCII"), WEPKEY_TYPE_ASCII);
cbKeyType->insertItem(i18n("WEP 40/128-bit Hexadecimal"), WEPKEY_TYPE_HEX); cbKeyType->insertItem(i18n("WEP 40/128-bit Hexadecimal"), WEPKEY_TYPE_HEX);
cbKeyType->insertItem(i18n("WEP 128-bit passphrase"), WEPKEY_TYPE_PASSPHRASE); cbKeyType->insertItem(i18n("WEP 128-bit passphrase"), WEPKEY_TYPE_PASSPHRASE);
cbKeyType->setCurrentItem(_wepKeyType ); cbKeyType->setCurrentItem(_wepKeyType );
txtWEPKey0->setText(_security_setting->getWepKey(0)); txtWEPKey0->setText(_security_setting->securitySettings.wepKey0);
txtWEPKey1->setText(_security_setting->getWepKey(1)); txtWEPKey1->setText(_security_setting->securitySettings.wepKey1);
txtWEPKey2->setText(_security_setting->getWepKey(2)); txtWEPKey2->setText(_security_setting->securitySettings.wepKey2);
txtWEPKey3->setText(_security_setting->getWepKey(3)); txtWEPKey3->setText(_security_setting->securitySettings.wepKey3);
switch(_security_setting->getWepTxidx()) switch(_security_setting->securitySettings.wepKeyIndex)
{ {
case 0: case 0:
rbKeyIdx0->setChecked(true); rbKeyIdx0->setChecked(true);
@ -116,10 +120,12 @@ WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(WirelessSecurity* sec, TQWidget
void WirelessSecurityWEPImpl::slotAuthAlgChanged(int index) void WirelessSecurityWEPImpl::slotAuthAlgChanged(int index)
{ {
if (index == 0) if (index == 0) {
_security_setting->setAuthAlg(WirelessSecurity::AUTH_ALG_OPEN); _security_setting->securitySettings.authType =TDENetworkWiFiAuthType::Open;
else if (index == 1) }
_security_setting->setAuthAlg(WirelessSecurity::AUTH_ALG_SHARED); else if (index == 1) {
_security_setting->securitySettings.authType = TDENetworkWiFiAuthType::Shared;
}
} }
void WirelessSecurityWEPImpl::slotKeyTypeChanged(int index) void WirelessSecurityWEPImpl::slotKeyTypeChanged(int index)
@ -132,49 +138,53 @@ void WirelessSecurityWEPImpl::slotKeyTypeChanged(int index)
void WirelessSecurityWEPImpl::slotWepKey0Changed(const TQString &key) void WirelessSecurityWEPImpl::slotWepKey0Changed(const TQString &key)
{ {
TQCString hashed = getHashedWEPKey(key, _wepKeyType); TQCString hashed = getHashedWEPKey(key, _wepKeyType);
_security_setting->setWepKey(0, hashed); _security_setting->securitySettings.wepKey0 = hashed;
} }
void WirelessSecurityWEPImpl::slotWepKey1Changed(const TQString &key) void WirelessSecurityWEPImpl::slotWepKey1Changed(const TQString &key)
{ {
TQCString hashed = getHashedWEPKey(key, _wepKeyType); TQCString hashed = getHashedWEPKey(key, _wepKeyType);
_security_setting->setWepKey(1, hashed); _security_setting->securitySettings.wepKey1 = hashed;
} }
void WirelessSecurityWEPImpl::slotWepKey2Changed(const TQString &key) void WirelessSecurityWEPImpl::slotWepKey2Changed(const TQString &key)
{ {
TQCString hashed = getHashedWEPKey(key, _wepKeyType); TQCString hashed = getHashedWEPKey(key, _wepKeyType);
_security_setting->setWepKey(2, hashed); _security_setting->securitySettings.wepKey2 = hashed;
} }
void WirelessSecurityWEPImpl::slotWepKey3Changed(const TQString& key) void WirelessSecurityWEPImpl::slotWepKey3Changed(const TQString& key)
{ {
TQCString hashed = getHashedWEPKey(key, _wepKeyType); TQCString hashed = getHashedWEPKey(key, _wepKeyType);
_security_setting->setWepKey(3, hashed); _security_setting->securitySettings.wepKey3 = hashed;
} }
void WirelessSecurityWEPImpl::slotWepIdx0Checked(bool check) void WirelessSecurityWEPImpl::slotWepIdx0Checked(bool check)
{ {
if (check) if (check) {
_security_setting->setWepTxidx(0); _security_setting->securitySettings.wepKeyIndex = 0;
}
} }
void WirelessSecurityWEPImpl::slotWepIdx1Checked(bool check) void WirelessSecurityWEPImpl::slotWepIdx1Checked(bool check)
{ {
if (check) if (check) {
_security_setting->setWepTxidx(1); _security_setting->securitySettings.wepKeyIndex = 1;
}
} }
void WirelessSecurityWEPImpl::slotWepIdx2Checked(bool check) void WirelessSecurityWEPImpl::slotWepIdx2Checked(bool check)
{ {
if (check) if (check) {
_security_setting->setWepTxidx(2); _security_setting->securitySettings.wepKeyIndex = 2;
}
} }
void WirelessSecurityWEPImpl::slotWepIdx3Checked(bool check) void WirelessSecurityWEPImpl::slotWepIdx3Checked(bool check)
{ {
if (check) if (check) {
_security_setting->setWepTxidx(3); _security_setting->securitySettings.wepKeyIndex = 3;
}
} }
TQCString TQCString
@ -243,7 +253,7 @@ WirelessSecurityWEPImpl::String2Hex(TQByteArray bytes, int final_len) const
/* /*
class WirelessSecurityWEPEncryptionImpl class WirelessSecurityWEPEncryptionImpl
*/ */
WirelessSecurityWEPEncryptionImpl::WirelessSecurityWEPEncryptionImpl(WirelessSecurity* security_setting, TQWidget* parent, const char* name, WFlags fl) WirelessSecurityWEPEncryptionImpl::WirelessSecurityWEPEncryptionImpl(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityWEPEncryption(parent, name, fl) : ConnectionSettingWirelessSecurityWEPEncryption(parent, name, fl)
, _security_setting(security_setting) , _security_setting(security_setting)
{ {
@ -255,12 +265,12 @@ WirelessSecurityWEPEncryptionImpl::WirelessSecurityWEPEncryptionImpl(WirelessSec
/* /*
class WirelessSecurityWPAVersionImpl class WirelessSecurityWPAVersionImpl
*/ */
WirelessSecurityWPAVersionImpl::WirelessSecurityWPAVersionImpl(WirelessSecurity* security_setting, TQWidget* parent, const char* name, WFlags fl) WirelessSecurityWPAVersionImpl::WirelessSecurityWPAVersionImpl(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityWPAVersion(parent, name, fl) : ConnectionSettingWirelessSecurityWPAVersion(parent, name, fl)
, _security_setting(security_setting) , _security_setting(security_setting)
{ {
cbWPA->setChecked(_security_setting->getProto() & WirelessSecurity::PROTO_WPA); cbWPA->setChecked(_security_setting->securitySettings.wpaVersion & TDENetworkWiFiWPAVersionFlags::WPA);
cbRSN->setChecked(_security_setting->getProto() & WirelessSecurity::PROTO_RSN); cbRSN->setChecked(_security_setting->securitySettings.wpaVersion & TDENetworkWiFiWPAVersionFlags::RSN);
connect(cbWPA, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWPA1(bool))); connect(cbWPA, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWPA1(bool)));
connect(cbRSN, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWPA2(bool))); connect(cbRSN, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWPA2(bool)));
@ -271,45 +281,39 @@ WirelessSecurityWPAVersionImpl::WirelessSecurityWPAVersionImpl(WirelessSecurity*
void void
WirelessSecurityWPAVersionImpl::slotAuto(bool on) WirelessSecurityWPAVersionImpl::slotAuto(bool on)
{ {
if (!on) if (!on) {
{
// auto-select proto // auto-select proto
_security_setting->setProto(WirelessSecurity::PROTO_AUTO); _security_setting->securitySettings.wpaVersion = TDENetworkWiFiWPAVersionFlags::Any;
} }
else else {
{
// use selected wpa-version // use selected wpa-version
TQ_UINT32 proto = WirelessSecurity::PROTO_NONE; TDENetworkWiFiWPAVersionFlags::TDENetworkWiFiWPAVersionFlags proto = TDENetworkWiFiWPAVersionFlags::None;
if (cbWPA->isChecked()) if (cbWPA->isChecked()) {
proto |= WirelessSecurity::PROTO_WPA; proto |= TDENetworkWiFiWPAVersionFlags::WPA;
if (cbRSN->isChecked()) }
proto |= WirelessSecurity::PROTO_RSN; if (cbRSN->isChecked()) {
_security_setting->setProto(proto); proto |= TDENetworkWiFiWPAVersionFlags::RSN;
}
_security_setting->securitySettings.wpaVersion = proto;
} }
} }
void void
WirelessSecurityWPAVersionImpl::slotWPA1(bool on) WirelessSecurityWPAVersionImpl::slotWPA1(bool on)
{ {
if (on) SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(_security_setting->securitySettings.wpaVersion, TDENetworkWiFiWPAVersionFlags::WPA, on);
_security_setting->addProto(WirelessSecurity::PROTO_WPA);
else
_security_setting->delProto(WirelessSecurity::PROTO_WPA);
} }
void void
WirelessSecurityWPAVersionImpl::slotWPA2(bool on) WirelessSecurityWPAVersionImpl::slotWPA2(bool on)
{ {
if (on) SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(_security_setting->securitySettings.wpaVersion, TDENetworkWiFiWPAVersionFlags::RSN, on);
_security_setting->addProto(WirelessSecurity::PROTO_RSN);
else
_security_setting->delProto(WirelessSecurity::PROTO_RSN);
} }
/* /*
class WirelessSecurityWPACipherImpl class WirelessSecurityWPACipherImpl
*/ */
WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(WirelessSecurity* security_setting, TQWidget* parent, const char* name, WFlags fl) WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityWPACipher(parent, name, fl) : ConnectionSettingWirelessSecurityWPACipher(parent, name, fl)
, _security_setting(security_setting) , _security_setting(security_setting)
{ {
@ -323,13 +327,13 @@ WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(WirelessSecurity* s
connect(chkPairwiseCipherTKIP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotPairwiseCipherChangedTKIP(bool))); connect(chkPairwiseCipherTKIP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotPairwiseCipherChangedTKIP(bool)));
connect(chkPairwiseCipherCCMP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotPairwiseCipherChangedCCMP(bool))); connect(chkPairwiseCipherCCMP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotPairwiseCipherChangedCCMP(bool)));
chkPairwiseCipherCCMP->setChecked(_security_setting->getPairwiseCiphers() & WirelessSecurity::CIPHER_CCMP); chkPairwiseCipherCCMP->setChecked(_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP));
chkPairwiseCipherTKIP->setChecked(_security_setting->getPairwiseCiphers() & WirelessSecurity::CIPHER_TKIP); chkPairwiseCipherTKIP->setChecked(_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP));
chkGroupCipherCCMP->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_CCMP); chkGroupCipherCCMP->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP));
chkGroupCipherTKIP->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_TKIP); chkGroupCipherTKIP->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP));
chkGroupCipherWEP40->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_WEP40); chkGroupCipherWEP40->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40));
chkGroupCipherWEP104->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_WEP104); chkGroupCipherWEP104->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104));
} }
@ -339,32 +343,40 @@ WirelessSecurityWPACipherImpl::slotCipherChangedAuto(bool checked)
if (!checked) if (!checked)
{ {
// select auto for both ciphers // select auto for both ciphers
_security_setting->setGroupCiphers(WirelessSecurity::CIPHER_AUTO); _security_setting->securitySettings.allowedGroupWiseCiphers.clear();
_security_setting->setPairwiseCiphers(WirelessSecurity::CIPHER_AUTO); _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any);
_security_setting->securitySettings.allowedPairWiseCiphers.clear();
_security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any);
} }
else else
{ {
// use the already selected ciphers // use the already selected ciphers
// group cipher // group cipher
TQ_UINT32 cipher = WirelessSecurity::CIPHER_NONE; TDENetworkWiFiConnectionCipherList cipher;
if (chkGroupCipherTKIP->isChecked()) if (chkGroupCipherTKIP->isChecked()) {
cipher |= WirelessSecurity::CIPHER_TKIP; cipher.append(TDENetworkWiFiConnectionCipher::CipherTKIP);
if (chkGroupCipherCCMP->isChecked()) }
cipher |= WirelessSecurity::CIPHER_CCMP; if (chkGroupCipherCCMP->isChecked()) {
if (chkGroupCipherWEP40->isChecked()) cipher.append(TDENetworkWiFiConnectionCipher::CipherCCMP);
cipher |= WirelessSecurity::CIPHER_WEP40; }
if (chkGroupCipherWEP104->isChecked()) if (chkGroupCipherWEP40->isChecked()) {
cipher |= WirelessSecurity::CIPHER_WEP104; cipher.append(TDENetworkWiFiConnectionCipher::CipherWEP40);
_security_setting->setGroupCiphers(cipher); }
if (chkGroupCipherWEP104->isChecked()) {
cipher.append(TDENetworkWiFiConnectionCipher::CipherWEP104);
}
_security_setting->securitySettings.allowedGroupWiseCiphers = cipher;
// pairwise cipher // pairwise cipher
cipher = WirelessSecurity::CIPHER_NONE; cipher.clear();
if (chkPairwiseCipherTKIP->isChecked()) if (chkPairwiseCipherTKIP->isChecked()) {
cipher |= WirelessSecurity::CIPHER_TKIP; cipher.append(TDENetworkWiFiConnectionCipher::CipherTKIP);
if (chkPairwiseCipherCCMP->isChecked()) }
cipher |= WirelessSecurity::CIPHER_CCMP; if (chkPairwiseCipherCCMP->isChecked()) {
_security_setting->setPairwiseCiphers(cipher); cipher.append(TDENetworkWiFiConnectionCipher::CipherCCMP);
}
_security_setting->securitySettings.allowedPairWiseCiphers = cipher;
} }
} }
@ -372,66 +384,80 @@ WirelessSecurityWPACipherImpl::slotCipherChangedAuto(bool checked)
void void
WirelessSecurityWPACipherImpl::slotGroupCipherChangedTKIP(bool checked) WirelessSecurityWPACipherImpl::slotGroupCipherChangedTKIP(bool checked)
{ {
if (checked) if (checked) {
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_TKIP); if (!_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP);
else }
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_TKIP)); else {
_security_setting->securitySettings.allowedGroupWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherTKIP);
}
} }
void void
WirelessSecurityWPACipherImpl::slotGroupCipherChangedCCMP(bool checked) WirelessSecurityWPACipherImpl::slotGroupCipherChangedCCMP(bool checked)
{ {
if (checked) if (checked) {
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_CCMP); if (!_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP);
else }
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_CCMP)); else {
_security_setting->securitySettings.allowedGroupWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherCCMP);
}
} }
void void
WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP40(bool checked) WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP40(bool checked)
{ {
if (checked) if (checked) {
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_WEP40); if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP40);
else }
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_WEP40)); else {
_security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherWEP40);
}
} }
void void
WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP104(bool checked) WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP104(bool checked)
{ {
if (checked) if (checked) {
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_WEP104); if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP104);
else }
_security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_WEP104)); else {
_security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherWEP104);
}
} }
void void
WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedTKIP(bool checked) WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedTKIP(bool checked)
{ {
if (checked) if (checked) {
_security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() | WirelessSecurity::CIPHER_TKIP); if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP);
else }
_security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() & (!WirelessSecurity::CIPHER_TKIP)); else {
_security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherTKIP);
}
} }
void void
WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedCCMP(bool checked) WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedCCMP(bool checked)
{ {
if (checked) if (checked) {
_security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() | WirelessSecurity::CIPHER_CCMP); if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP);
else }
_security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() & (!WirelessSecurity::CIPHER_CCMP)); else {
_security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherCCMP);
}
} }
/* /*
class WirelessSecurityWPAPSK class WirelessSecurityWPAPSK
*/ */
WirelessSecurityWPAPSKImpl::WirelessSecurityWPAPSKImpl(WirelessSecurity* security_setting, Wireless* wireless_setting, TQWidget* parent, const char* name, WFlags fl) WirelessSecurityWPAPSKImpl::WirelessSecurityWPAPSKImpl(TDEWiFiConnection* security_setting, TDEWiFiConnection* wireless_setting, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityWPAPSK(parent, name, fl) : ConnectionSettingWirelessSecurityWPAPSK(parent, name, fl)
, _security_setting(security_setting) , _security_setting(security_setting)
, _wireless_setting(wireless_setting) , _wireless_setting(wireless_setting)
{ {
txtPSK->setText(_security_setting->getPSK()); if (_security_setting->securitySettings.secretsValid) {
txtPSK->setText(_security_setting->securitySettings.psk);
}
connect(txtPSK, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotPSKChanged(const TQString&))); connect(txtPSK, TQT_SIGNAL(textChanged(const TQString&)), this, TQT_SLOT(slotPSKChanged(const TQString&)));
} }
@ -440,7 +466,8 @@ WirelessSecurityWPAPSKImpl::slotPSKChanged(const TQString& psk)
{ {
if (_wireless_setting) if (_wireless_setting)
{ {
_security_setting->setPSK(psk); _security_setting->securitySettings.psk = psk;
_security_setting->securitySettings.secretsValid = true;
} }
} }
@ -464,7 +491,7 @@ WirelessSecurityWPAPSKImpl::String2Hex(TQByteArray bytes, int final_len) const
/* /*
class WirelessSecurityEAPImpl class WirelessSecurityEAPImpl
*/ */
WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(IEEE8021x* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent, const char* name, WFlags fl) WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(TDEWiFiConnection* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityEAP(parent, name, fl) : ConnectionSettingWirelessSecurityEAP(parent, name, fl)
, _security_setting(security_setting) , _security_setting(security_setting)
, _phase2_widget(phase2_widget) , _phase2_widget(phase2_widget)
@ -472,42 +499,44 @@ WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(IEEE8021x* security_setting, Wi
// insert all EAP-Methods // insert all EAP-Methods
int index = 0; int index = 0;
cboMethod->insertItem(i18n("None"), index); cboMethod->insertItem(i18n("None"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_NONE; _eapIndexMap[index] = TDENetworkIEEE8021xType::None;
cboMethod->insertItem(i18n("TTLS"), ++index); cboMethod->insertItem(i18n("TTLS"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_TTLS; _eapIndexMap[index] = TDENetworkIEEE8021xType::TTLS;
cboMethod->insertItem(i18n("PEAP"), ++index); cboMethod->insertItem(i18n("PEAP"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_PEAP; _eapIndexMap[index] = TDENetworkIEEE8021xType::PEAP;
cboMethod->insertItem(i18n("TLS"), ++index); cboMethod->insertItem(i18n("TLS"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_TLS; _eapIndexMap[index] = TDENetworkIEEE8021xType::TLS;
cboMethod->insertItem(i18n("Leap"), ++index); cboMethod->insertItem(i18n("Leap"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_LEAP; _eapIndexMap[index] = TDENetworkIEEE8021xType::LEAP;
cboMethod->insertItem(i18n("MD5"), ++index); cboMethod->insertItem(i18n("MD5"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_MD5; _eapIndexMap[index] = TDENetworkIEEE8021xType::MD5;
cboMethod->insertItem(i18n("FAST"), ++index); cboMethod->insertItem(i18n("FAST"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_FAST; _eapIndexMap[index] = TDENetworkIEEE8021xType::Fast;
cboMethod->insertItem(i18n("SIM"), ++index); cboMethod->insertItem(i18n("SIM"), ++index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE1_SIM; _eapIndexMap[index] = TDENetworkIEEE8021xType::SIM;
// preselect the correct method // preselect the correct method
TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE1>::Iterator it = _eapIndexMap.findData(_security_setting->getEAP()); TQBiDirectionalMap<int, TDENetworkIEEE8021xType::TDENetworkIEEE8021xType>::Iterator it = _eapIndexMap.findData(_security_setting->eapConfig.type);
cboMethod->setCurrentItem(it.key()); cboMethod->setCurrentItem(it.key());
// update phase2 combobox // update phase2 combobox
_phase2_widget->setAllowedPhase2Methods(_security_setting->getAllowedPhase2Methods()); _phase2_widget->setAllowedPhase2Methods(_security_setting->eapConfig.allowedPhase2EAPMethods);
txtIdentity->setText(_security_setting->getIdentity()); txtIdentity->setText(_security_setting->eapConfig.userName);
txtAnonIdentity->setText(_security_setting->getAnonIdentity()); txtAnonIdentity->setText(_security_setting->eapConfig.anonymousUserName);
txtPassword->setText(_security_setting->getPassword()); if (_security_setting->eapConfig.secretsValid) {
txtPassword->setText(_security_setting->eapConfig.password);
}
chkCAStore->setChecked(_security_setting->getUseSystemCaCert()); chkCAStore->setChecked(_security_setting->eapConfig.forceSystemCaCertificates);
kURLCACert->setEnabled(!_security_setting->getUseSystemCaCert()); kURLCACert->setEnabled(!_security_setting->eapConfig.forceSystemCaCertificates);
// get notified if the method changes // get notified if the method changes
connect(cboMethod, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotMethodChanged(int))); connect(cboMethod, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotMethodChanged(int)));
@ -519,42 +548,43 @@ WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(IEEE8021x* security_setting, Wi
void WirelessSecurityEAPImpl::slotUseSystemCaCertChanged(bool on) void WirelessSecurityEAPImpl::slotUseSystemCaCertChanged(bool on)
{ {
_security_setting->setUseSystemCaCert(on); _security_setting->eapConfig.forceSystemCaCertificates = on;
kURLCACert->setEnabled(!on); kURLCACert->setEnabled(!on);
} }
void WirelessSecurityEAPImpl::slotMethodChanged(int index) void WirelessSecurityEAPImpl::slotMethodChanged(int index)
{ {
// new method choosen // new method choosen
IEEE8021x::EAP_PHASE1 eap = _eapIndexMap[index]; TDENetworkIEEE8021xType::TDENetworkIEEE8021xType eap = _eapIndexMap[index];
_security_setting->setEAP(eap); _security_setting->eapConfig.type = eap;
_phase2_widget->setAllowedPhase2Methods(_security_setting->getAllowedPhase2Methods()); _phase2_widget->setAllowedPhase2Methods(_security_setting->eapConfig.allowedPhase2EAPMethods);
} }
void WirelessSecurityEAPImpl::slotIdentityChanged(const TQString& identity) void WirelessSecurityEAPImpl::slotIdentityChanged(const TQString& identity)
{ {
_security_setting->setIdentity(identity); _security_setting->eapConfig.userName = identity;
} }
void WirelessSecurityEAPImpl::slotAnonIdentityChanged(const TQString& identity) void WirelessSecurityEAPImpl::slotAnonIdentityChanged(const TQString& identity)
{ {
_security_setting->setAnonIdentity(identity); _security_setting->eapConfig.anonymousUserName = identity;
} }
void WirelessSecurityEAPImpl::slotPasswordChanged(const TQString& pwd) void WirelessSecurityEAPImpl::slotPasswordChanged(const TQString& pwd)
{ {
_security_setting->setPassword(TQString(txtPassword->password())); _security_setting->eapConfig.password = TQString(txtPassword->password());
_security_setting->eapConfig.secretsValid = true;
} }
/* /*
class WirelessSecurityPhase2Impl class WirelessSecurityPhase2Impl
*/ */
WirelessSecurityPhase2Impl::WirelessSecurityPhase2Impl(IEEE8021x* security_setting, TQWidget* parent, const char* name, WFlags fl) WirelessSecurityPhase2Impl::WirelessSecurityPhase2Impl(TDEWiFiConnection* security_setting, TQWidget* parent, const char* name, WFlags fl)
: ConnectionSettingWirelessSecurityPhase2(parent, name, fl) : ConnectionSettingWirelessSecurityPhase2(parent, name, fl)
, _security_setting(security_setting) , _security_setting(security_setting)
{ {
_allowed_methods.append(IEEE8021x::EAP_PHASE2_AUTH_NONE); _allowed_methods.append(TDENetworkIEEE8021xType::None);
updateMethodComboBox(); updateMethodComboBox();
connect(cboPhase2Method, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotPhase2MethodChanged(int))); connect(cboPhase2Method, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotPhase2MethodChanged(int)));
@ -567,79 +597,79 @@ void WirelessSecurityPhase2Impl::updateMethodComboBox()
cboPhase2Method->clear(); cboPhase2Method->clear();
_eapIndexMap.clear(); _eapIndexMap.clear();
for (TQValueList<IEEE8021x::EAP_PHASE2>::Iterator it = _allowed_methods.begin(); it != _allowed_methods.end(); ++it) for (TQValueList<TDENetworkIEEE8021xType::TDENetworkIEEE8021xType>::Iterator it = _allowed_methods.begin(); it != _allowed_methods.end(); ++it)
{ {
if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_NONE) if ((*it) == TDENetworkIEEE8021xType::None)
{ {
cboPhase2Method->insertItem(i18n("None"), index); cboPhase2Method->insertItem(i18n("None"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_NONE; _eapIndexMap[index] = TDENetworkIEEE8021xType::None;
index++; index++;
} }
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MSCHAPV2) else if ((*it) == TDENetworkIEEE8021xType::MSCHAPV2)
{ {
cboPhase2Method->insertItem(i18n("MSCHAPv2"), index); cboPhase2Method->insertItem(i18n("MSCHAPv2"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MSCHAPV2; _eapIndexMap[index] = TDENetworkIEEE8021xType::MSCHAPV2;
index++; index++;
} }
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_PAP) else if ((*it) == TDENetworkIEEE8021xType::PAP)
{ {
cboPhase2Method->insertItem(i18n("PAP"), index); cboPhase2Method->insertItem(i18n("PAP"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_PAP; _eapIndexMap[index] = TDENetworkIEEE8021xType::PAP;
index++; index++;
} }
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_CHAP) else if ((*it) == TDENetworkIEEE8021xType::CHAP)
{ {
cboPhase2Method->insertItem(i18n("CHAP"), index); cboPhase2Method->insertItem(i18n("CHAP"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_CHAP; _eapIndexMap[index] = TDENetworkIEEE8021xType::CHAP;
index++; index++;
} }
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MSCHAP) else if ((*it) == TDENetworkIEEE8021xType::MSCHAP)
{ {
cboPhase2Method->insertItem(i18n("MSCHAP"), index); cboPhase2Method->insertItem(i18n("MSCHAP"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MSCHAP; _eapIndexMap[index] = TDENetworkIEEE8021xType::MSCHAP;
index++; index++;
} }
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_GTC) else if ((*it) == TDENetworkIEEE8021xType::GTC)
{ {
cboPhase2Method->insertItem(i18n("GTC"), index); cboPhase2Method->insertItem(i18n("GTC"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_GTC; _eapIndexMap[index] = TDENetworkIEEE8021xType::GTC;
index++; index++;
} }
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_OTP) else if ((*it) == TDENetworkIEEE8021xType::OTP)
{ {
cboPhase2Method->insertItem(i18n("OTP"), index); cboPhase2Method->insertItem(i18n("OTP"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_OTP; _eapIndexMap[index] = TDENetworkIEEE8021xType::OTP;
index++; index++;
} }
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MD5) else if ((*it) == TDENetworkIEEE8021xType::MD5)
{ {
cboPhase2Method->insertItem(i18n("MD5"), index); cboPhase2Method->insertItem(i18n("MD5"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MD5; _eapIndexMap[index] = TDENetworkIEEE8021xType::MD5;
index++; index++;
} }
else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_TLS) else if ((*it) == TDENetworkIEEE8021xType::TLS)
{ {
cboPhase2Method->insertItem(i18n("TLS"), index); cboPhase2Method->insertItem(i18n("TLS"), index);
_eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_TLS; _eapIndexMap[index] = TDENetworkIEEE8021xType::TLS;
index++; index++;
} }
} }
// preselect the correct method // preselect the correct method
TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE2>::Iterator it = _eapIndexMap.findData(_security_setting->getPhase2EAP()); TQBiDirectionalMap<int, TDENetworkIEEE8021xType::TDENetworkIEEE8021xType>::Iterator it = _eapIndexMap.findData(_security_setting->eapConfig.phase2EAPAuthMethod);
if (it != _eapIndexMap.end()) if (it != _eapIndexMap.end())
{ {
cboPhase2Method->setCurrentItem(it.key()); cboPhase2Method->setCurrentItem(it.key());
_security_setting->setPhase2EAP(it.data()); _security_setting->eapConfig.phase2EAPAuthMethod = it.data();
} }
else else
{ {
cboPhase2Method->setCurrentItem(0); cboPhase2Method->setCurrentItem(0);
_security_setting->setPhase2EAP(_eapIndexMap[0]); _security_setting->eapConfig.phase2EAPAuthMethod = _eapIndexMap[0];
} }
} }
void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueList<IEEE8021x::EAP_PHASE2>& list) void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueList<TDENetworkIEEE8021xType::TDENetworkIEEE8021xType>& list)
{ {
_allowed_methods = list; _allowed_methods = list;
updateMethodComboBox(); updateMethodComboBox();
@ -648,20 +678,20 @@ void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueList<IEEE8
void WirelessSecurityPhase2Impl::slotPhase2MethodChanged(int index) void WirelessSecurityPhase2Impl::slotPhase2MethodChanged(int index)
{ {
// new method choosen // new method choosen
IEEE8021x::EAP_PHASE2 eap = _eapIndexMap[index]; TDENetworkIEEE8021xType::TDENetworkIEEE8021xType eap = _eapIndexMap[index];
_security_setting->setPhase2EAP(eap); _security_setting->eapConfig.phase2EAPAuthMethod = eap;
} }
/* /*
class WirelessSecurityWidgetImpl class WirelessSecurityWidgetImpl
*/ */
WirelessSecurityWidgetImpl::WirelessSecurityWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) WirelessSecurityWidgetImpl::WirelessSecurityWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl) : WidgetInterface(parent, name, fl)
{ {
_security_setting = dynamic_cast<WirelessSecurity*> (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); _security_setting = dynamic_cast<TDEWiFiConnection*> (conn);
_wireless_setting = dynamic_cast<Wireless*> (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); _wireless_setting = dynamic_cast<TDEWiFiConnection*> (conn);
_ieee8021x_setting = dynamic_cast<IEEE8021x*> (conn->getSetting(NM_SETTING_802_1X_SETTING_NAME)); _ieee8021x_setting = dynamic_cast<TDEWiFiConnection*> (conn);
_new_conn = new_conn; _new_conn = new_conn;
TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
@ -737,41 +767,41 @@ WirelessSecurityWidgetImpl::comboSecurityInit()
// TODO: Preselect the right security method // TODO: Preselect the right security method
// We should have an Essid already, fetch all possible APs // We should have an Essid already, fetch all possible APs
TQValueList<AccessPoint *> aps; TQValueList<TDENetworkWiFiAPInfo*> aps;
if (_new_conn && !_wireless_setting->getEssid().isEmpty()) if (_new_conn && !_wireless_setting->SSID.isEmpty()) {
{ aps = WirelessManager::getAccessPointsForEssid(_wireless_setting->SSID);
aps = WirelessManager::getAccessPointsForEssid(_wireless_setting->getEssid());
#if 0 #if 0
kdDebug() << "Hugo " << TQString(TQCString(_wireless_setting->getEssid())).ascii() << endl; kdDebug() << "Hugo " << TQString(TQCString(_wireless_setting->getEssid())).ascii() << endl;
#endif #endif
} }
if (!aps.isEmpty()) if (!aps.isEmpty()) {
{
// if at least one AP has this security setting show the entry in the combobox // if at least one AP has this security setting show the entry in the combobox
for (TQValueList<AccessPoint*>::Iterator it = aps.begin(); it != aps.end(); ++it) for (TQValueList<TDENetworkWiFiAPInfo*>::Iterator it = aps.begin(); it != aps.end(); ++it) {
{ if (((*it)->wpaFlags & TDENetworkWiFiAPFlags::PrivacySupport) || ((*it)->rsnFlags & TDENetworkWiFiAPFlags::PrivacySupport)) {
if((*it)->isEncrypted()) kdDebug() << "AP " << (*it)->friendlySSID().ascii() << " is encrypted" << endl;
{ if ((((*it)->rsnFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) || (((*it)->wpaFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None)) {
kdDebug() << "AP " << (*it)->getDisplaySsid().ascii() << " is encrypted" << endl;
if ((*it)->getRsnFlags() != NM_802_11_AP_SEC_NONE || (*it)->getWpaFlags() != NM_802_11_AP_SEC_NONE)
{
// WPA or RSN // WPA or RSN
if ((*it)->getRsnFlags() & NM_802_11_AP_SEC_KEY_MGMT_PSK || (*it)->getWpaFlags() & NM_802_11_AP_SEC_KEY_MGMT_PSK) if ((*it)->rsnFlags & TDENetworkWiFiAPFlags::KeyManagementPSK || (*it)->wpaFlags & TDENetworkWiFiAPFlags::KeyManagementPSK) {
if (!allowed_methods.contains(SECURITY_WPA_PSK)) if (!allowed_methods.contains(SECURITY_WPA_PSK)) {
allowed_methods.append(SECURITY_WPA_PSK); allowed_methods.append(SECURITY_WPA_PSK);
}
}
if ((*it)->getRsnFlags() & NM_802_11_AP_SEC_KEY_MGMT_802_1X || (*it)->getWpaFlags() & NM_802_11_AP_SEC_KEY_MGMT_802_1X) if ((*it)->rsnFlags & TDENetworkWiFiAPFlags::KeyManagement80211 || (*it)->wpaFlags & TDENetworkWiFiAPFlags::KeyManagement80211) {
if (!allowed_methods.contains(SECURITY_WPA_EAP)) if (!allowed_methods.contains(SECURITY_WPA_EAP)) {
allowed_methods.append(SECURITY_WPA_EAP); allowed_methods.append(SECURITY_WPA_EAP);
}
}
} }
// No WPA & RSN => WEP or dynamic WEP with 802.1x authentication // No WPA & RSN => WEP or dynamic WEP with 802.1x authentication
// TODO: an AP can provide WEP in addition to WPA // TODO: an AP can provide WEP in addition to WPA
if (!allowed_methods.contains(SECURITY_WEP)) if (!allowed_methods.contains(SECURITY_WEP)) {
allowed_methods.append(SECURITY_WEP); allowed_methods.append(SECURITY_WEP);
if (!allowed_methods.contains(SECURITY_IEEE8021X)) }
allowed_methods.append(SECURITY_IEEE8021X); if (!allowed_methods.contains(SECURITY_IEEE8021X)) {
allowed_methods.append(SECURITY_IEEE8021X);
}
} }
} }
@ -815,14 +845,14 @@ WirelessSecurityWidgetImpl::comboSecurityInit()
if (!_new_conn) if (!_new_conn)
{ {
switch(_security_setting->getKeyMgmt()) switch(_security_setting->securitySettings.keyType)
{ {
case WirelessSecurity::KEY_MGMT_NONE: case TDENetworkWiFiKeyType::WEP:
if (_security_setting->getAuthAlg() == WirelessSecurity::AUTH_ALG_SHARED || if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Shared ||
!_security_setting->getWepKey(0).isEmpty() || !_security_setting->securitySettings.wepKey0.isEmpty() ||
!_security_setting->getWepKey(1).isEmpty() || !_security_setting->securitySettings.wepKey1.isEmpty() ||
!_security_setting->getWepKey(2).isEmpty() || !_security_setting->securitySettings.wepKey2.isEmpty() ||
!_security_setting->getWepKey(3).isEmpty() ) !_security_setting->securitySettings.wepKey3.isEmpty() )
{ {
_mainWid->groupUseEncryption->setChecked(true); _mainWid->groupUseEncryption->setChecked(true);
_mainWid->cboSecurity->setCurrentItem(SECURITY_WEP); _mainWid->cboSecurity->setCurrentItem(SECURITY_WEP);
@ -831,17 +861,17 @@ WirelessSecurityWidgetImpl::comboSecurityInit()
else else
_mainWid->groupUseEncryption->setChecked(false); _mainWid->groupUseEncryption->setChecked(false);
break; break;
case WirelessSecurity::KEY_MGMT_WPA_PSK: case TDENetworkWiFiKeyType::WPAInfrastructure:
_mainWid->groupUseEncryption->setChecked(true); _mainWid->groupUseEncryption->setChecked(true);
_mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_PSK); _mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_PSK);
slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_PSK]); slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_PSK]);
break; break;
case WirelessSecurity::KEY_MGMT_WPA_EAP: case TDENetworkWiFiKeyType::WPAEnterprise:
_mainWid->groupUseEncryption->setChecked(true); _mainWid->groupUseEncryption->setChecked(true);
_mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_EAP); _mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_EAP);
slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_EAP]); slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_EAP]);
break; break;
case WirelessSecurity::KEY_MGMT_IEEE8021X: case TDENetworkWiFiKeyType::DynamicWEP:
_mainWid->groupUseEncryption->setChecked(true); _mainWid->groupUseEncryption->setChecked(true);
_mainWid->cboSecurity->setCurrentItem(SECURITY_IEEE8021X); _mainWid->cboSecurity->setCurrentItem(SECURITY_IEEE8021X);
slotComboSecurityActivated(_securityComboMap[SECURITY_IEEE8021X]); slotComboSecurityActivated(_securityComboMap[SECURITY_IEEE8021X]);
@ -872,7 +902,7 @@ WirelessSecurityWidgetImpl::comboSecurityInit()
void void
WirelessSecurityWidgetImpl::slotUseEncryptionToggled(bool on) WirelessSecurityWidgetImpl::slotUseEncryptionToggled(bool on)
{ {
_wireless_setting->setSecurity(on ? _security_setting->getType() : NULL); _wireless_setting->securityRequired = on;
} }
void void
@ -968,28 +998,28 @@ WirelessSecurityWidgetImpl::slotExtraSettingsToggled(bool on)
void void
WirelessSecurityWidgetImpl::configureForWEP() WirelessSecurityWidgetImpl::configureForWEP()
{ {
_security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_NONE); _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WEP;
configureWidgets(SECURITY_WEP); configureWidgets(SECURITY_WEP);
} }
void void
WirelessSecurityWidgetImpl::configureForWPAPSK() WirelessSecurityWidgetImpl::configureForWPAPSK()
{ {
_security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_WPA_PSK); _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WPAInfrastructure;
configureWidgets(SECURITY_WPA_PSK); configureWidgets(SECURITY_WPA_PSK);
} }
void void
WirelessSecurityWidgetImpl::configureForWPAEAP() WirelessSecurityWidgetImpl::configureForWPAEAP()
{ {
_security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_WPA_EAP); _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WPAEnterprise;
configureWidgets(SECURITY_WPA_EAP); configureWidgets(SECURITY_WPA_EAP);
} }
void void
WirelessSecurityWidgetImpl::configureForIEEE8021X() WirelessSecurityWidgetImpl::configureForIEEE8021X()
{ {
_security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_IEEE8021X); _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::DynamicWEP;
configureWidgets(SECURITY_IEEE8021X); configureWidgets(SECURITY_IEEE8021X);
} }

@ -25,7 +25,7 @@
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H #ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H
#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_SECURITY_WIDGET_H
/* qt autogenerated headers */ /* ui autogenerated headers */
#include "connection_setting_wireless_security.h" #include "connection_setting_wireless_security.h"
#include "connection_setting_wireless_security_eap.h" #include "connection_setting_wireless_security_eap.h"
#include "connection_setting_wireless_security_phase2.h" #include "connection_setting_wireless_security_phase2.h"
@ -35,9 +35,12 @@
#include "connection_setting_wireless_security_wpapsk.h" #include "connection_setting_wireless_security_wpapsk.h"
#include "connection_setting_wireless_security_wepencryption.h" #include "connection_setting_wireless_security_wepencryption.h"
// tde headers
#include <tdehardwaredevices.h>
#include <tdenetworkconnections.h>
/* knetworkmanager headers */ /* knetworkmanager headers */
#include "knetworkmanager-connection_setting.h" #include "qbidirectionalmap.h"
#include "knetworkmanager-connection_setting_8021x.h"
#include "knetworkmanager-connection_setting_widget_interface.h" #include "knetworkmanager-connection_setting_widget_interface.h"
namespace ConnectionSettings namespace ConnectionSettings
@ -45,7 +48,6 @@ namespace ConnectionSettings
/* class declarations */ /* class declarations */
class WirelessSecurity; class WirelessSecurity;
class Wireless; class Wireless;
class IEEE8021x;
class WirelessSecurityPhase2Impl; class WirelessSecurityPhase2Impl;
class WirelessSecurityWEPImpl : public ConnectionSettingWirelessSecurityWEP class WirelessSecurityWEPImpl : public ConnectionSettingWirelessSecurityWEP
@ -60,7 +62,7 @@ namespace ConnectionSettings
, WEPKEY_TYPE_PASSPHRASE , WEPKEY_TYPE_PASSPHRASE
}; };
WirelessSecurityWEPImpl(WirelessSecurity* security, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); WirelessSecurityWEPImpl(TDEWiFiConnection* security, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
TQCString getHashedWEPKey(TQString key, WEPKEY_TYPE type) const; TQCString getHashedWEPKey(TQString key, WEPKEY_TYPE type) const;
TQCString getWEP128PassphraseHash(TQCString input) const; TQCString getWEP128PassphraseHash(TQCString input) const;
TQCString String2Hex(TQByteArray bytes, int final_len) const; TQCString String2Hex(TQByteArray bytes, int final_len) const;
@ -77,7 +79,7 @@ namespace ConnectionSettings
void slotWepIdx2Checked(bool); void slotWepIdx2Checked(bool);
void slotWepIdx3Checked(bool); void slotWepIdx3Checked(bool);
private: private:
WirelessSecurity* _security_setting; TDEWiFiConnection* _security_setting;
WEPKEY_TYPE _wepKeyType; WEPKEY_TYPE _wepKeyType;
}; };
@ -86,9 +88,9 @@ namespace ConnectionSettings
Q_OBJECT Q_OBJECT
public: public:
WirelessSecurityWEPEncryptionImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); WirelessSecurityWEPEncryptionImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
private: private:
WirelessSecurity* _security_setting; TDEWiFiConnection* _security_setting;
}; };
class WirelessSecurityWPAVersionImpl : public ConnectionSettingWirelessSecurityWPAVersion class WirelessSecurityWPAVersionImpl : public ConnectionSettingWirelessSecurityWPAVersion
@ -96,7 +98,7 @@ namespace ConnectionSettings
Q_OBJECT Q_OBJECT
public: public:
WirelessSecurityWPAVersionImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); WirelessSecurityWPAVersionImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
public slots: public slots:
void slotAuto(bool); void slotAuto(bool);
@ -104,7 +106,7 @@ namespace ConnectionSettings
void slotWPA2(bool); void slotWPA2(bool);
private: private:
WirelessSecurity* _security_setting; TDEWiFiConnection* _security_setting;
}; };
@ -121,7 +123,7 @@ namespace ConnectionSettings
, WPA_CIPHER_LAST , WPA_CIPHER_LAST
}; };
public: public:
WirelessSecurityWPACipherImpl(WirelessSecurity* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); WirelessSecurityWPACipherImpl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
public slots: public slots:
void slotCipherChangedAuto(bool); void slotCipherChangedAuto(bool);
@ -133,7 +135,7 @@ namespace ConnectionSettings
void slotPairwiseCipherChangedCCMP(bool); void slotPairwiseCipherChangedCCMP(bool);
private: private:
WirelessSecurity* _security_setting; TDEWiFiConnection* _security_setting;
}; };
class WirelessSecurityWPAPSKImpl : public ConnectionSettingWirelessSecurityWPAPSK class WirelessSecurityWPAPSKImpl : public ConnectionSettingWirelessSecurityWPAPSK
@ -141,15 +143,15 @@ namespace ConnectionSettings
Q_OBJECT Q_OBJECT
public: public:
WirelessSecurityWPAPSKImpl(WirelessSecurity* security_setting, Wireless* wireless_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); WirelessSecurityWPAPSKImpl(TDEWiFiConnection* security_setting, TDEWiFiConnection* wireless_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
TQCString String2Hex(TQByteArray bytes, int final_len) const; TQCString String2Hex(TQByteArray bytes, int final_len) const;
public slots: public slots:
void slotPSKChanged(const TQString&); void slotPSKChanged(const TQString&);
private: private:
WirelessSecurity* _security_setting; TDEWiFiConnection* _security_setting;
Wireless* _wireless_setting; TDEWiFiConnection* _wireless_setting;
}; };
class WirelessSecurityEAPImpl : public ConnectionSettingWirelessSecurityEAP class WirelessSecurityEAPImpl : public ConnectionSettingWirelessSecurityEAP
@ -157,7 +159,7 @@ namespace ConnectionSettings
Q_OBJECT Q_OBJECT
public: public:
WirelessSecurityEAPImpl(IEEE8021x* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); WirelessSecurityEAPImpl(TDEWiFiConnection* security_setting, WirelessSecurityPhase2Impl* phase2_widget, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
public slots: public slots:
void slotMethodChanged(int index); void slotMethodChanged(int index);
@ -167,8 +169,8 @@ namespace ConnectionSettings
void slotUseSystemCaCertChanged(bool on); void slotUseSystemCaCertChanged(bool on);
private: private:
IEEE8021x* _security_setting; TDEWiFiConnection* _security_setting;
TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE1> _eapIndexMap; TQBiDirectionalMap<int, TDENetworkIEEE8021xType::TDENetworkIEEE8021xType> _eapIndexMap;
WirelessSecurityPhase2Impl* _phase2_widget; WirelessSecurityPhase2Impl* _phase2_widget;
}; };
@ -177,16 +179,16 @@ namespace ConnectionSettings
Q_OBJECT Q_OBJECT
public: public:
WirelessSecurityPhase2Impl(IEEE8021x* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); WirelessSecurityPhase2Impl(TDEWiFiConnection* security_setting, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
public slots: public slots:
void setAllowedPhase2Methods(const TQValueList<IEEE8021x::EAP_PHASE2>&); void setAllowedPhase2Methods(const TQValueList<TDENetworkIEEE8021xType::TDENetworkIEEE8021xType>&);
void slotPhase2MethodChanged(int index); void slotPhase2MethodChanged(int index);
private: private:
void updateMethodComboBox(); void updateMethodComboBox();
IEEE8021x* _security_setting; TDEWiFiConnection* _security_setting;
TQBiDirectionalMap<int, IEEE8021x::EAP_PHASE2> _eapIndexMap; TQBiDirectionalMap<int, TDENetworkIEEE8021xType::TDENetworkIEEE8021xType> _eapIndexMap;
TQValueList<IEEE8021x::EAP_PHASE2> _allowed_methods; TQValueList<TDENetworkIEEE8021xType::TDENetworkIEEE8021xType> _allowed_methods;
}; };
class WirelessSecurityWidgetImpl : public WidgetInterface class WirelessSecurityWidgetImpl : public WidgetInterface
@ -204,7 +206,7 @@ namespace ConnectionSettings
}; };
public: public:
WirelessSecurityWidgetImpl(Connection*, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); WirelessSecurityWidgetImpl(TDENetworkConnection*, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
void Activate(); void Activate();
public slots: public slots:
@ -226,9 +228,9 @@ namespace ConnectionSettings
SecurityMethods _currentMethod; SecurityMethods _currentMethod;
TQValueList<TQWidget*> _widgets[SECURITY_COUNT]; TQValueList<TQWidget*> _widgets[SECURITY_COUNT];
TQValueList<TQWidget*> _extra_widgets[SECURITY_COUNT]; TQValueList<TQWidget*> _extra_widgets[SECURITY_COUNT];
WirelessSecurity* _security_setting; TDEWiFiConnection* _security_setting;
Wireless* _wireless_setting; TDEWiFiConnection* _wireless_setting;
IEEE8021x* _ieee8021x_setting; TDEWiFiConnection* _ieee8021x_setting;
ConnectionSettingWirelessSecurityWidget* _mainWid; ConnectionSettingWirelessSecurityWidget* _mainWid;
bool _new_conn; bool _new_conn;
TQMap<int, SecurityMethods> _securityComboMap; TQMap<int, SecurityMethods> _securityComboMap;

@ -34,14 +34,11 @@
#include <kiconloader.h> #include <kiconloader.h>
#include <kglobal.h> #include <kglobal.h>
#include <kpushbutton.h> #include <kpushbutton.h>
#include <klocale.h>
#include "knetworkmanager-connection.h"
#include "knetworkmanager-connection_setting_widget_interface.h" #include "knetworkmanager-connection_setting_widget_interface.h"
#include "knetworkmanager-connection_setting_wireless_widget.h" #include "knetworkmanager-connection_setting_wireless_widget.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
#include "knetworkmanager-connection_setting_info.h" #include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-wireless_network.h"
#include "knetworkmanager-wireless_manager.h" #include "knetworkmanager-wireless_manager.h"
using namespace ConnectionSettings; using namespace ConnectionSettings;
@ -73,13 +70,13 @@ class NetworkListViewItem : public KListViewItem
WirelessNetwork _net; WirelessNetwork _net;
}; };
WirelessWidgetImpl::WirelessWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl) WirelessWidgetImpl::WirelessWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl)
: WidgetInterface(parent, name, fl) : WidgetInterface(parent, name, fl)
{ {
_wireless_setting = dynamic_cast<Wireless*> (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); _wireless_setting = dynamic_cast<TDEWiFiConnection*>(conn);
_info_setting = dynamic_cast<Info*> (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); _info_setting = dynamic_cast<TDEWiFiConnection*>(conn);
_security_setting = dynamic_cast<WirelessSecurity*> (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); _security_setting = dynamic_cast<TDEWiFiConnection*>(conn);
_hasName = !_info_setting->getName().isEmpty(); _hasName = !_info_setting->friendlyName.isEmpty();
_new_conn = new_conn; _new_conn = new_conn;
TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
@ -128,7 +125,7 @@ WirelessWidgetImpl::Activate()
} }
// FIXME, if essid contains unprintable characters show the essid in hex // FIXME, if essid contains unprintable characters show the essid in hex
_mainWid->txtEssid->setText(_wireless_setting->getEssid()); _mainWid->txtEssid->setText(_wireless_setting->SSID);
} }
void WirelessWidgetImpl::slotEssidChanged(TQListViewItem* item) void WirelessWidgetImpl::slotEssidChanged(TQListViewItem* item)
@ -176,12 +173,15 @@ WirelessWidgetImpl::slotEssidChanged(const TQString& new_essid)
void void
WirelessWidgetImpl::updateEssid(const TQByteArray& essid) WirelessWidgetImpl::updateEssid(const TQByteArray& essid)
{ {
_wireless_setting->setEssid(essid); _wireless_setting->SSID = essid;
if (!_hasName) if (!_hasName)
{ {
// the connection has no name yet -> just take the essid for it // the connection has no name yet -> just take the essid for it
_info_setting->setName(essid); _info_setting->friendlyName = TQString(essid);
if (_info_setting->friendlyName == "") {
_info_setting->friendlyName = "<" + i18n("hidden") + ">";
}
} }
} }

@ -26,9 +26,12 @@
#ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H #ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H
#define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H
// tde headers
#include <tdehardwaredevices.h>
#include <tdenetworkconnections.h>
#include "knetworkmanager-connection_setting_widget_interface.h" #include "knetworkmanager-connection_setting_widget_interface.h"
#include "connection_setting_wireless.h" #include "connection_setting_wireless.h"
#include "knetworkmanager-connection_setting.h"
class KListViewSearchLineWidget; class KListViewSearchLineWidget;
@ -44,7 +47,7 @@ namespace ConnectionSettings
Q_OBJECT Q_OBJECT
public: public:
WirelessWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0); WirelessWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent = 0, const char* name = 0, WFlags fl = 0);
void Activate(); void Activate();
@ -60,9 +63,9 @@ namespace ConnectionSettings
TQString hexStringFromByteArray(const TQByteArray& ); TQString hexStringFromByteArray(const TQByteArray& );
bool _hasName; bool _hasName;
Wireless* _wireless_setting; TDEWiFiConnection* _wireless_setting;
Info* _info_setting; TDEWiFiConnection* _info_setting;
WirelessSecurity* _security_setting; TDEWiFiConnection* _security_setting;
ConnectionSettingWirelessWidget* _mainWid; ConnectionSettingWirelessWidget* _mainWid;
KListViewSearchLineWidget* _searchLine; KListViewSearchLineWidget* _searchLine;
bool _new_conn; bool _new_conn;

Loading…
Cancel
Save