diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui b/tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui index c89a749..0830da7 100644 --- a/tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_gsm.ui @@ -41,17 +41,6 @@ mNetworkId - - - textLabel2_2_2 - - - PU&K: - - - mUsername - - textLabel1 @@ -79,22 +68,22 @@ - GPRS + Only 3G - GSM + Only GPRS/EDGE - Prefer GPRS + Prefer 3G - Prefer GSM + Prefer 2G @@ -151,17 +140,6 @@ mBand - - - mPuk - - - Personal Unblocking Code - - - A code used to unblock a blocked SIM card - - mBand @@ -283,7 +261,6 @@ mUsername mPassword mPin - mPuk mNumber mApn mNetworkId diff --git a/tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui b/tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui index 7db6e5e..734fe78 100644 --- a/tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui +++ b/tdenetworkmanager/src/configwidgets/connection_setting_ppp.ui @@ -210,14 +210,6 @@ Require MPPE - - - mRequireMppc - - - Require MPPC - - mRefuseMschapV2 @@ -308,7 +300,6 @@ mRequireMppe mRequireMppe128 mStatefulMppe - mRequireMppc mCrtscts mBaudRate mMru diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp index c803b4a..09b9ed3 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_cdma_widget.cpp @@ -44,7 +44,7 @@ using namespace ConnectionSettings; CDMAWidgetImpl::CDMAWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, const char* name, WFlags fl) : WidgetInterface(parent, name, fl) { - _cdmasetting = dynamic_cast (conn); + _cdmasetting = dynamic_cast(conn); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingCdmaWidget(this); @@ -56,12 +56,16 @@ CDMAWidgetImpl::CDMAWidgetImpl(TDENetworkConnection* conn, TQWidget* parent, con void CDMAWidgetImpl::Init() { - _mainWid->mUsername->setText( _cdmasetting->getUsername() ); - _mainWid->mPassword->setText( _cdmasetting->getPassword( ) ); - _mainWid->mNumber->setText( _cdmasetting->getNumber() ); - 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())); + if (_cdmasetting->cdmaConfig.valid) { + _mainWid->mUsername->setText( _cdmasetting->cdmaConfig.username ); + _mainWid->mNumber->setText( _cdmasetting->cdmaConfig.providerDataNumber ); + if (_cdmasetting->cdmaConfig.secretsValid) { + _mainWid->mPassword->setText( _cdmasetting->cdmaConfig.password ); + } + } + 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 @@ -78,9 +82,11 @@ CDMAWidgetImpl::Activate() void CDMAWidgetImpl::dirty() { - _cdmasetting->setUsername( _mainWid->mUsername->text() ); - _cdmasetting->setPassword( _mainWid->mPassword->text() ); - _cdmasetting->setNumber( _mainWid->mNumber->text() ); + _cdmasetting->cdmaConfig.username = _mainWid->mUsername->text(); + _cdmasetting->cdmaConfig.password = _mainWid->mPassword->text(); + _cdmasetting->cdmaConfig.providerDataNumber = _mainWid->mNumber->text(); + _cdmasetting->cdmaConfig.valid = true; + _cdmasetting->cdmaConfig.secretsValid = true; } diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp index 88af9bb..36a9a57 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.cpp @@ -35,19 +35,17 @@ #include // knm headers -#include "knetworkmanager-connection.h" #include "knetworkmanager-connection_setting_gsm.h" #include "knetworkmanager-connection_setting_gsm_widget.h" -#include "knetworkmanager-device.h" #include "connection_setting_gsm.h" 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) { - _gsmsetting = dynamic_cast (conn->getSetting(NM_SETTING_GSM_SETTING_NAME)); + _gsmsetting = dynamic_cast(conn); TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingGsmWidget(this); @@ -59,25 +57,27 @@ GSMWidgetImpl::GSMWidgetImpl(Connection* conn, TQWidget* parent, const char* nam void GSMWidgetImpl::Init() { - _mainWid->mUsername->setText( _gsmsetting->getUsername() ); - _mainWid->mPassword->setText( _gsmsetting->getPassword( ) ); - _mainWid->mPin->setText( _gsmsetting->getPin() ); - _mainWid->mPuk->setText( _gsmsetting->getPuk() ); - _mainWid->mNumber->setText( _gsmsetting->getNumber() ); - _mainWid->mApn->setText( _gsmsetting->getAPN() ); - _mainWid->mNetworkId->setText( _gsmsetting->getNetworkID( )); - _mainWid->mNetworkType->setCurrentItem( _gsmsetting->getNetworkType( ) +1); - _mainWid->mBand->setValue( _gsmsetting->getBand() ); - - 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->mNumber, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty())); - connect( _mainWid->mApn, TQT_SIGNAL(textChanged(const TQString&)), 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())); + if (_gsmsetting->gsmConfig.valid) { + _mainWid->mUsername->setText( _gsmsetting->gsmConfig.username ); + _mainWid->mNumber->setText( _gsmsetting->gsmConfig.providerDataNumber ); + _mainWid->mApn->setText( _gsmsetting->gsmConfig.accessPointName ); + _mainWid->mNetworkId->setText( _gsmsetting->gsmConfig.networkID ); + setNetworkType( _gsmsetting->gsmConfig.networkType ); + _mainWid->mBand->setValue( _gsmsetting->gsmConfig.allowedFrequencyBands ); + if (_gsmsetting->gsmConfig.secretsValid) { + _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->mNumber, TQT_SIGNAL(textChanged(const TQString&)), TQT_SLOT(dirty())); + connect( _mainWid->mApn, TQT_SIGNAL(textChanged(const TQString&)), 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 @@ -94,15 +94,64 @@ GSMWidgetImpl::Activate() void GSMWidgetImpl::dirty() { - _gsmsetting->setUsername( _mainWid->mUsername->text() ); - _gsmsetting->setPassword( _mainWid->mPassword->text() ); - _gsmsetting->setPin( _mainWid->mPin->text() ); - _gsmsetting->setPuk( _mainWid->mPuk->text() ); - _gsmsetting->setNumber( _mainWid->mNumber->text() ); - _gsmsetting->setAPN( _mainWid->mApn->text() ); - _gsmsetting->setNetworkID( _mainWid->mNetworkId->text() ); - _gsmsetting->setNetworkType( _mainWid->mNetworkType->currentItem() - 1 ); - _gsmsetting->setBand( _mainWid->mBand->value() ); + _gsmsetting->gsmConfig.username = _mainWid->mUsername->text(); + _gsmsetting->gsmConfig.password = _mainWid->mPassword->text(); + _gsmsetting->gsmConfig.pin = _mainWid->mPin->text(); + _gsmsetting->gsmConfig.providerDataNumber = _mainWid->mNumber->text(); + _gsmsetting->gsmConfig.accessPointName = _mainWid->mApn->text(); + _gsmsetting->gsmConfig.networkID = _mainWid->mNetworkId->text(); + _gsmsetting->gsmConfig.networkType = getNetworkType(); + _gsmsetting->gsmConfig.allowedFrequencyBands = _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" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h index df77606..f4fd439 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_gsm_widget.h @@ -26,14 +26,17 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_GSM_WIDGET_H -// qt headers +// tqt headers #include #include +// tde headers +#include +#include + // knm headers #include "knetworkmanager-connection_setting_gsm.h" #include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" //class VPNService; class ConnectionSettingGsmWidget; @@ -48,7 +51,7 @@ class GSMWidgetImpl : public WidgetInterface Q_OBJECT 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 Deactivate(); public slots: @@ -58,8 +61,10 @@ class GSMWidgetImpl : public WidgetInterface void Init(); //VPNConfigWidget* getVPNConfigWidget(VPNService* service); + void setNetworkType(TDEGSMNetworkType::TDEGSMNetworkType); + TDEGSMNetworkType::TDEGSMNetworkType getNetworkType(); - GSM* _gsmsetting; + TDEModemConnection* _gsmsetting; ConnectionSettingGsmWidget* _mainWid; }; diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp index e0982e8..f0c1972 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.cpp @@ -30,17 +30,15 @@ #include // knm headers -#include "knetworkmanager-connection.h" #include "knetworkmanager-connection_setting_info.h" #include "knetworkmanager-connection_setting_info_widget.h" -#include "knetworkmanager-device.h" 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) { - _infosetting = dynamic_cast (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); + _infosetting = conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); @@ -60,20 +58,20 @@ InfoWidgetImpl::Init() void InfoWidgetImpl::Activate() { - _mainWid->txtConnectionName->setText(_infosetting->getName()); - _mainWid->chkAutoConnect->setChecked(_infosetting->getAutoconnect()); + _mainWid->txtConnectionName->setText(_infosetting->friendlyName); + _mainWid->chkAutoConnect->setChecked(_infosetting->autoConnect); } void InfoWidgetImpl::slotNameChanged(const TQString& name) { - _infosetting->setName(name); + _infosetting->friendlyName = name; } void InfoWidgetImpl::slotAutoconnectChanged(bool autoconnect) { - _infosetting->setAutoconnect(autoconnect); + _infosetting->autoConnect = autoconnect; } #include "knetworkmanager-connection_setting_info_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h index 16a7ace..c5900ce 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_info_widget.h @@ -27,14 +27,17 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_INFO_WIDGET_H -// qt headers +// tqt headers #include #include +// tde headers +#include +#include + // knm headers #include "connection_setting_info.h" #include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" namespace ConnectionSettings { @@ -47,7 +50,7 @@ class InfoWidgetImpl : public WidgetInterface Q_OBJECT 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(); public slots: @@ -57,7 +60,7 @@ class InfoWidgetImpl : public WidgetInterface private: void Init(); - Info* _infosetting; + TDENetworkConnection* _infosetting; ConnectionSettingInfoWidget* _mainWid; }; diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp index ca00a49..7b48dfe 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.cpp @@ -36,10 +36,10 @@ using namespace ConnectionSettings; #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) { - _ipv4_setting = dynamic_cast (conn->getSetting(NM_SETTING_IP4_CONFIG_SETTING_NAME)); + _ipv4_setting = conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingIPv4Widget(this); @@ -51,7 +51,7 @@ IPv4WidgetImpl::IPv4WidgetImpl(Connection* conn, TQWidget* parent, const char* n void 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))); @@ -59,26 +59,34 @@ IPv4WidgetImpl::Init() _mainWid->txtNetmask->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->txtNetmask->setText(_ipv4_setting->getAddresses()[0].netmask.toString()); - _mainWid->txtGateway->setText(_ipv4_setting->getAddresses()[0].gateway.toString()); + _mainWid->txtIP->setText(_ipv4_setting->ipConfig.ipConfigurations[0].ipAddress.toString()); + _mainWid->txtNetmask->setText(_ipv4_setting->ipConfig.ipConfigurations[0].networkMask.toString()); + _mainWid->txtGateway->setText(_ipv4_setting->ipConfig.ipConfigurations[0].gateway.toString()); } - if (!_ipv4_setting->getDNS().isEmpty()) + if (!_ipv4_setting->ipConfig.resolvers.isEmpty()) { - TQValueList hosts = _ipv4_setting->getDNS(); + TDENetworkAddressList hosts = _ipv4_setting->ipConfig.resolvers; TQStringList list; - for (TQValueList::Iterator it = hosts.begin(); it != hosts.end(); ++it) + for (TDENetworkAddressList::Iterator it = hosts.begin(); it != hosts.end(); ++it) { list.append((*it).toString()); } _mainWid->txtDNSAddresses->setText(list.join(" ")); } - if (!_ipv4_setting->getDNSSearch().isEmpty()) - _mainWid->txtDNSSearch->setText(_ipv4_setting->getDNSSearch().join(" ")); + if (!_ipv4_setting->ipConfig.searchDomains.isEmpty()) + { + 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(_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 TQStringList list = TQStringList::split(" ", adr); - TQValueList hosts; + TDENetworkAddressList hosts; for (TQStringList::Iterator it = list.begin(); it != list.end(); ++it) { TQHostAddress host(*it); if (!host.isNull()) + { hosts.append(host); + } } - _ipv4_setting->setDNS(hosts); + _ipv4_setting->ipConfig.resolvers = hosts; } @@ -114,13 +124,30 @@ void IPv4WidgetImpl::slotDNSSearchChanged(const TQString& search) { // 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 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 @@ -129,28 +156,33 @@ IPv4WidgetImpl::slotIPAddressChanged(const TQString& ip) TQHostAddress ipadr(ip); if (!ipadr.isNull()) { - TQValueList addrs = _ipv4_setting->getAddresses(); + TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; if (addrs.size() > 0) - addrs[0].address = ipadr; + { + addrs[0].ipAddress = ipadr; + } else { - IPv4Address adr; - adr.address = ipadr; + TDENetworkSingleIPConfiguration adr; + adr.ipAddress = ipadr; 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 (_mainWid->txtNetmask->text() == "...") { if ( (ipadr.toIPv4Address() & 0xFF000000) < 0xDF000000) { - if ( (ipadr.toIPv4Address() & 0xFF000000) >= 0xC0000000) + if ( (ipadr.toIPv4Address() & 0xFF000000) >= 0xC0000000) { _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 - else + } + else { _mainWid->txtNetmask->setText("255.0.0.0"); // class A + } } } } @@ -159,17 +191,19 @@ IPv4WidgetImpl::slotIPAddressChanged(const TQString& ip) void IPv4WidgetImpl::slotNetmaskChanged(const TQString& ip) { - TQValueList addrs = _ipv4_setting->getAddresses(); - addrs[0].netmask = TQHostAddress(ip); - _ipv4_setting->setAddresses(addrs); + TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; + TDENetMask mask; + mask.fromString(ip); + addrs[0].networkMask = mask; + _ipv4_setting->ipConfig.ipConfigurations = addrs; } void IPv4WidgetImpl::slotGatewayChanged(const TQString& ip) { - TQValueList addrs = _ipv4_setting->getAddresses(); + TDENetworkSingleIPConfigurationList addrs = _ipv4_setting->ipConfig.ipConfigurations; addrs[0].gateway = TQHostAddress(ip); - _ipv4_setting->setAddresses(addrs); + _ipv4_setting->ipConfig.ipConfigurations = addrs; } #include "knetworkmanager-connection_setting_ipv4_widget.moc" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h index 4fabdce..cfee028 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ipv4_widget.h @@ -25,11 +25,14 @@ #ifndef KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_IPV4_WIDGET_H -// qt autogenerated headers +// tde headers +#include +#include + +// ui headers #include "connection_setting_ipv4.h" // knetworkmanager headers -#include "knetworkmanager-connection.h" #include "knetworkmanager-connection_setting_widget_interface.h" #include "knetworkmanager-connection_setting_ipv4.h" @@ -43,7 +46,7 @@ namespace ConnectionSettings 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(); public slots: @@ -57,7 +60,7 @@ namespace ConnectionSettings private: void Init(); - IPv4* _ipv4_setting; + TDENetworkConnection* _ipv4_setting; ConnectionSettingIPv4Widget* _mainWid; }; diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp index e735969..3bc4783 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.cpp @@ -37,19 +37,17 @@ #include // knm headers -#include "knetworkmanager-connection.h" #include "knetworkmanager-connection_setting_ppp.h" #include "knetworkmanager-connection_setting_ppp_widget.h" -#include "knetworkmanager-device.h" #include "connection_setting_ppp.h" 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) { - _pppsetting = dynamic_cast (conn->getSetting(NM_SETTING_PPP_SETTING_NAME)); + _pppsetting = conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingPppWidget(this); @@ -61,39 +59,40 @@ PPPWidgetImpl::PPPWidgetImpl(Connection* conn, TQWidget* parent, const char* nam void PPPWidgetImpl::Init() { - _mainWid->mNoAuth->setChecked( _pppsetting->getNoAuth() ); - _mainWid->mRefuseEap->setChecked( _pppsetting->getRefuseEAP( ) ); - _mainWid->mRefusePap->setChecked( _pppsetting->getRefusePAP( ) ); - _mainWid->mRefuseChap->setChecked( _pppsetting->getRefuseChap() ); - _mainWid->mRefuseMschap->setChecked( _pppsetting->getRefuseMSChap() ); - _mainWid->mRefuseMschapV2->setChecked( _pppsetting->getRefuseMSChapV2() ); - _mainWid->mNoBsd->setChecked( _pppsetting->getNoBSDComp() ); - _mainWid->mNoDeflate->setChecked( _pppsetting->getNoDeflate() ); - _mainWid->mNoVjComp->setChecked( _pppsetting->getNoVJComp() ); - _mainWid->mRequireMppe->setChecked( _pppsetting->getRequireMPPE( )); - _mainWid->mRequireMppe128->setChecked( _pppsetting->getRequireMPPE128( )); - _mainWid->mStatefulMppe->setChecked( _pppsetting->getMPPEStateful() ); - _mainWid->mRequireMppc->setChecked( _pppsetting->getRequireMPPC() ); - _mainWid->mCrtscts->setChecked( _pppsetting->getCRTSCTS() ); - - _mainWid->mBaudRate->setValue(_pppsetting->getBaud()); - _mainWid->mMru->setValue(_pppsetting->getMRU()); - _mainWid->mMtu->setValue(_pppsetting->getMTU()); - _mainWid->mLcpEchoFailure->setValue(_pppsetting->getLCPEchoFailure()); - _mainWid->mLcpEchoInterval->setValue(_pppsetting->getLCPEchoInterval()); - 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->mRefuseChap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); - connect( _mainWid->mRefuseMschap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); - connect( _mainWid->mRefuseMschapV2, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); - connect( _mainWid->mNoBsd, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); - connect( _mainWid->mNoDeflate, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); - connect( _mainWid->mRequireMppe, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); - connect( _mainWid->mRequireMppe128, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); - connect( _mainWid->mStatefulMppe, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); - connect( _mainWid->mRequireMppc, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); - connect( _mainWid->mCrtscts, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); + if (_pppsetting->pppConfig.valid) { + _mainWid->mNoAuth->setChecked( !(_pppsetting->pppConfig.requireServerAuthentication) ); + _mainWid->mRefuseEap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableEAP ); + _mainWid->mRefusePap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisablePAP ); + _mainWid->mRefuseChap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableCHAP ); + _mainWid->mRefuseMschap->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAP ); + _mainWid->mRefuseMschapV2->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::DisableMSCHAPv2 ); + _mainWid->mNoBsd->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowBSDCompression) ); + _mainWid->mNoDeflate->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowDeflateCompression) ); + _mainWid->mNoVjComp->setChecked( !(_pppsetting->pppConfig.flags & TDENetworkPPPFlags::AllowVJCompression) ); + _mainWid->mRequireMppe->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE ); + _mainWid->mRequireMppe128->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::RequireMPPE128 ); + _mainWid->mStatefulMppe->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::StatefulMPPE ); + _mainWid->mCrtscts->setChecked( _pppsetting->pppConfig.flags & TDENetworkPPPFlags::UseHardwareFlowControl ); + + _mainWid->mBaudRate->setValue(_pppsetting->pppConfig.baudRate); + _mainWid->mMru->setValue(_pppsetting->pppConfig.mru); + _mainWid->mMtu->setValue(_pppsetting->pppConfig.mtu); + _mainWid->mLcpEchoFailure->setValue(_pppsetting->pppConfig.lcpEchoFailureThreshold); + _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->mRefuseChap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); + connect( _mainWid->mRefuseMschap, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); + connect( _mainWid->mRefuseMschapV2, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); + connect( _mainWid->mNoBsd, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); + connect( _mainWid->mNoDeflate, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); + connect( _mainWid->mRequireMppe, TQT_SIGNAL(toggled(bool)), TQT_SLOT(dirty())); + connect( _mainWid->mRequireMppe128, 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 @@ -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 PPPWidgetImpl::dirty() { - _pppsetting->setNoAuth( _mainWid->mNoAuth->isChecked() ); - _pppsetting->setRefuseEAP( _mainWid->mRefuseEap->isChecked() ); - _pppsetting->setRefuseChap( _mainWid->mRefuseChap->isChecked() ); - _pppsetting->setRefuseMSChap( _mainWid->mRefuseMschap->isChecked() ); - _pppsetting->setNoBSDComp( _mainWid->mNoBsd->isChecked() ); - _pppsetting->setNoDeflate( _mainWid->mNoDeflate->isChecked() ); - _pppsetting->setRequireMPPE( _mainWid->mRequireMppe->isChecked() ); - _pppsetting->setRequireMPPE( _mainWid->mRequireMppe128->isChecked() ); - _pppsetting->setMPPEStateful( _mainWid->mStatefulMppe->isChecked() ); - - _pppsetting->setBaud(_mainWid->mBaudRate->value()); - _pppsetting->setMRU(_mainWid->mMru->value()); - _pppsetting->setMTU(_mainWid->mMtu->value()); - _pppsetting->setLCPEchoFailure(_mainWid->mLcpEchoFailure->value()); - _pppsetting->setLCPEchoInterval(_mainWid->mLcpEchoInterval->value()); + _pppsetting->pppConfig.requireServerAuthentication = ( !(_mainWid->mNoAuth->isChecked()) ); + + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableEAP, _mainWid->mRefuseEap->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisablePAP, _mainWid->mRefusePap->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableCHAP, _mainWid->mRefuseChap->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableMSCHAP, _mainWid->mRefuseMschap->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::DisableMSCHAPv2, _mainWid->mRefuseMschapV2->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::AllowBSDCompression, !(_mainWid->mNoBsd->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()) ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::RequireMPPE, _mainWid->mRequireMppe->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::RequireMPPE128, _mainWid->mRequireMppe128->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::StatefulMPPE, _mainWid->mStatefulMppe->isChecked() ); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE( _pppsetting->pppConfig.flags, TDENetworkPPPFlags::UseHardwareFlowControl, _mainWid->mCrtscts->isChecked() ); + + _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" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h index acdc2a2..7cd4121 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_ppp_widget.h @@ -26,14 +26,17 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_PPP_WIDGET_H -// qt headers +// tqt headers #include #include +// tde headers +#include +#include + // knm headers #include "knetworkmanager-connection_setting_ppp.h" #include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" //class VPNService; class ConnectionSettingPppWidget; @@ -48,7 +51,7 @@ class PPPWidgetImpl : public WidgetInterface Q_OBJECT 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 Deactivate(); public slots: @@ -57,7 +60,7 @@ class PPPWidgetImpl : public WidgetInterface private: void Init(); - PPP* _pppsetting; + TDENetworkConnection* _pppsetting; ConnectionSettingPppWidget* _mainWid; }; diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp index 87b92db..574cdb7 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.cpp @@ -36,41 +36,41 @@ #include // knm headers -#include "knetworkmanager-connection.h" #include "knetworkmanager-connection_setting_serial.h" #include "knetworkmanager-connection_setting_serial_widget.h" -#include "knetworkmanager-device.h" #include "connection_setting_serial.h" 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) { - _serialsetting = dynamic_cast (conn->getSetting(NM_SETTING_SERIAL_SETTING_NAME)); + _serialsetting = conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); _mainWid = new ConnectionSettingSerialWidget(this); layout->addWidget(_mainWid); - _mainWid->mBaudRate->setMaxValue(INT_MAX); + _mainWid->mBaudRate->setMaxValue(INT_MAX); Init(); } void SerialWidgetImpl::Init() { - _mainWid->mBaudRate->setValue(_serialsetting->getBaud()); - _mainWid->mDataBits->setCurrentItem(_serialsetting->getBits() - 7); - _mainWid->mParity->setCurrentItem(_serialsetting->getParity()); - _mainWid->mStopBits->setCurrentItem(_serialsetting->getStopBits()); - _mainWid->mSendDelay->setValue(_serialsetting->getSendDelay()); - - 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->mStopBits, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty())); - connect( _mainWid->mSendDelay, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty())); + if (_serialsetting->serialConfig.valid) { + _mainWid->mBaudRate->setValue(_serialsetting->serialConfig.baudRate); + _mainWid->mDataBits->setCurrentItem(_serialsetting->serialConfig.byteWidth - 7); + setParityType(_serialsetting->serialConfig.parity); + _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->mStopBits, TQT_SIGNAL(activated(int)), TQT_SLOT(dirty())); + connect( _mainWid->mSendDelay, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dirty())); } void @@ -87,11 +87,48 @@ SerialWidgetImpl::Activate() void SerialWidgetImpl::dirty() { - _serialsetting->setBaud( _mainWid->mBaudRate->value() ); - _serialsetting->setBits( _mainWid->mDataBits->currentItem() + 7 ); - _serialsetting->setParity( (ConnectionSettings::Serial::PARITY_MODE)_mainWid->mParity->currentItem() ); - _serialsetting->setStopBits( _mainWid->mStopBits->currentItem() ); - _serialsetting->setSendDelay( _mainWid->mSendDelay->value() ); + _serialsetting->serialConfig.baudRate = _mainWid->mBaudRate->value(); + _serialsetting->serialConfig.byteWidth = _mainWid->mDataBits->currentItem() + 7; + _serialsetting->serialConfig.parity = getParityType(); + _serialsetting->serialConfig.stopBits = _mainWid->mStopBits->currentItem(); + _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" diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h index 5b3bf28..d12db89 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_serial_widget.h @@ -26,14 +26,17 @@ #define KNETWORKMANAGER_CONNECTION_SETTING_SERIAL_WIDGET_H -// qt headers +// tqt headers #include #include +// tde headers +#include +#include + // knm headers #include "knetworkmanager-connection_setting_serial.h" #include "knetworkmanager-connection_setting_widget_interface.h" -#include "knetworkmanager-device.h" //class VPNService; class ConnectionSettingSerialWidget; @@ -48,7 +51,7 @@ class SerialWidgetImpl : public WidgetInterface Q_OBJECT 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 Deactivate(); public slots: @@ -57,7 +60,10 @@ class SerialWidgetImpl : public WidgetInterface private: void Init(); - Serial* _serialsetting; + void setParityType(TDENetworkParity::TDENetworkParity type); + TDENetworkParity::TDENetworkParity getParityType(); + + TDENetworkConnection* _serialsetting; ConnectionSettingSerialWidget* _mainWid; }; diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp index 1adea03..4b6d70a 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.cpp @@ -41,48 +41,52 @@ #include /* 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.h" -#include "knetworkmanager-connection_setting_wireless.h" -#include "knetworkmanager-connection_setting_8021x.h" #include "sha1.h" #include "md5.h" #include "knetworkmanager-wireless_manager.h" #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; /* 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) , _security_setting(sec) , _wepKeyType( WEPKEY_TYPE_HEX ) { cboAuthentication->insertItem(i18n("Open System"), 0); cboAuthentication->insertItem(i18n("Shared Key"), 1); - if (_security_setting->getAuthAlg() == WirelessSecurity::AUTH_ALG_OPEN) + if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Open) { cboAuthentication->setCurrentItem(0); - else if (_security_setting->getAuthAlg() == WirelessSecurity::AUTH_ALG_SHARED) + } + else if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Shared) { cboAuthentication->setCurrentItem(1); + } 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 128-bit passphrase"), WEPKEY_TYPE_PASSPHRASE); cbKeyType->setCurrentItem(_wepKeyType ); - txtWEPKey0->setText(_security_setting->getWepKey(0)); - txtWEPKey1->setText(_security_setting->getWepKey(1)); - txtWEPKey2->setText(_security_setting->getWepKey(2)); - txtWEPKey3->setText(_security_setting->getWepKey(3)); + txtWEPKey0->setText(_security_setting->securitySettings.wepKey0); + txtWEPKey1->setText(_security_setting->securitySettings.wepKey1); + txtWEPKey2->setText(_security_setting->securitySettings.wepKey2); + txtWEPKey3->setText(_security_setting->securitySettings.wepKey3); - switch(_security_setting->getWepTxidx()) + switch(_security_setting->securitySettings.wepKeyIndex) { case 0: rbKeyIdx0->setChecked(true); @@ -116,10 +120,12 @@ WirelessSecurityWEPImpl::WirelessSecurityWEPImpl(WirelessSecurity* sec, TQWidget void WirelessSecurityWEPImpl::slotAuthAlgChanged(int index) { - if (index == 0) - _security_setting->setAuthAlg(WirelessSecurity::AUTH_ALG_OPEN); - else if (index == 1) - _security_setting->setAuthAlg(WirelessSecurity::AUTH_ALG_SHARED); + if (index == 0) { + _security_setting->securitySettings.authType =TDENetworkWiFiAuthType::Open; + } + else if (index == 1) { + _security_setting->securitySettings.authType = TDENetworkWiFiAuthType::Shared; + } } void WirelessSecurityWEPImpl::slotKeyTypeChanged(int index) @@ -132,49 +138,53 @@ void WirelessSecurityWEPImpl::slotKeyTypeChanged(int index) void WirelessSecurityWEPImpl::slotWepKey0Changed(const TQString &key) { TQCString hashed = getHashedWEPKey(key, _wepKeyType); - _security_setting->setWepKey(0, hashed); + _security_setting->securitySettings.wepKey0 = hashed; } void WirelessSecurityWEPImpl::slotWepKey1Changed(const TQString &key) { TQCString hashed = getHashedWEPKey(key, _wepKeyType); - _security_setting->setWepKey(1, hashed); + _security_setting->securitySettings.wepKey1 = hashed; } void WirelessSecurityWEPImpl::slotWepKey2Changed(const TQString &key) { TQCString hashed = getHashedWEPKey(key, _wepKeyType); - _security_setting->setWepKey(2, hashed); + _security_setting->securitySettings.wepKey2 = hashed; } void WirelessSecurityWEPImpl::slotWepKey3Changed(const TQString& key) { TQCString hashed = getHashedWEPKey(key, _wepKeyType); - _security_setting->setWepKey(3, hashed); + _security_setting->securitySettings.wepKey3 = hashed; } void WirelessSecurityWEPImpl::slotWepIdx0Checked(bool check) { - if (check) - _security_setting->setWepTxidx(0); + if (check) { + _security_setting->securitySettings.wepKeyIndex = 0; + } } void WirelessSecurityWEPImpl::slotWepIdx1Checked(bool check) { - if (check) - _security_setting->setWepTxidx(1); + if (check) { + _security_setting->securitySettings.wepKeyIndex = 1; + } } void WirelessSecurityWEPImpl::slotWepIdx2Checked(bool check) { - if (check) - _security_setting->setWepTxidx(2); + if (check) { + _security_setting->securitySettings.wepKeyIndex = 2; + } } void WirelessSecurityWEPImpl::slotWepIdx3Checked(bool check) { - if (check) - _security_setting->setWepTxidx(3); + if (check) { + _security_setting->securitySettings.wepKeyIndex = 3; + } } TQCString @@ -243,7 +253,7 @@ WirelessSecurityWEPImpl::String2Hex(TQByteArray bytes, int final_len) const /* 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) , _security_setting(security_setting) { @@ -255,12 +265,12 @@ WirelessSecurityWEPEncryptionImpl::WirelessSecurityWEPEncryptionImpl(WirelessSec /* 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) , _security_setting(security_setting) { - cbWPA->setChecked(_security_setting->getProto() & WirelessSecurity::PROTO_WPA); - cbRSN->setChecked(_security_setting->getProto() & WirelessSecurity::PROTO_RSN); + cbWPA->setChecked(_security_setting->securitySettings.wpaVersion & TDENetworkWiFiWPAVersionFlags::WPA); + cbRSN->setChecked(_security_setting->securitySettings.wpaVersion & TDENetworkWiFiWPAVersionFlags::RSN); connect(cbWPA, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWPA1(bool))); connect(cbRSN, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotWPA2(bool))); @@ -271,45 +281,39 @@ WirelessSecurityWPAVersionImpl::WirelessSecurityWPAVersionImpl(WirelessSecurity* void WirelessSecurityWPAVersionImpl::slotAuto(bool on) { - if (!on) - { + if (!on) { // auto-select proto - _security_setting->setProto(WirelessSecurity::PROTO_AUTO); + _security_setting->securitySettings.wpaVersion = TDENetworkWiFiWPAVersionFlags::Any; } - else - { + else { // use selected wpa-version - TQ_UINT32 proto = WirelessSecurity::PROTO_NONE; - if (cbWPA->isChecked()) - proto |= WirelessSecurity::PROTO_WPA; - if (cbRSN->isChecked()) - proto |= WirelessSecurity::PROTO_RSN; - _security_setting->setProto(proto); + TDENetworkWiFiWPAVersionFlags::TDENetworkWiFiWPAVersionFlags proto = TDENetworkWiFiWPAVersionFlags::None; + if (cbWPA->isChecked()) { + proto |= TDENetworkWiFiWPAVersionFlags::WPA; + } + if (cbRSN->isChecked()) { + proto |= TDENetworkWiFiWPAVersionFlags::RSN; + } + _security_setting->securitySettings.wpaVersion = proto; } } void WirelessSecurityWPAVersionImpl::slotWPA1(bool on) { - if (on) - _security_setting->addProto(WirelessSecurity::PROTO_WPA); - else - _security_setting->delProto(WirelessSecurity::PROTO_WPA); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(_security_setting->securitySettings.wpaVersion, TDENetworkWiFiWPAVersionFlags::WPA, on); } void WirelessSecurityWPAVersionImpl::slotWPA2(bool on) { - if (on) - _security_setting->addProto(WirelessSecurity::PROTO_RSN); - else - _security_setting->delProto(WirelessSecurity::PROTO_RSN); + SET_FLAG_IF_TRUE_CLEAR_IF_FALSE(_security_setting->securitySettings.wpaVersion, TDENetworkWiFiWPAVersionFlags::RSN, on); } /* 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) , _security_setting(security_setting) { @@ -323,13 +327,13 @@ WirelessSecurityWPACipherImpl::WirelessSecurityWPACipherImpl(WirelessSecurity* s connect(chkPairwiseCipherTKIP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotPairwiseCipherChangedTKIP(bool))); connect(chkPairwiseCipherCCMP, TQT_SIGNAL(toggled(bool)), this, TQT_SLOT(slotPairwiseCipherChangedCCMP(bool))); - chkPairwiseCipherCCMP->setChecked(_security_setting->getPairwiseCiphers() & WirelessSecurity::CIPHER_CCMP); - chkPairwiseCipherTKIP->setChecked(_security_setting->getPairwiseCiphers() & WirelessSecurity::CIPHER_TKIP); + chkPairwiseCipherCCMP->setChecked(_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)); + chkPairwiseCipherTKIP->setChecked(_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)); - chkGroupCipherCCMP->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_CCMP); - chkGroupCipherTKIP->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_TKIP); - chkGroupCipherWEP40->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_WEP40); - chkGroupCipherWEP104->setChecked(_security_setting->getGroupCiphers() & WirelessSecurity::CIPHER_WEP104); + chkGroupCipherCCMP->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)); + chkGroupCipherTKIP->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)); + chkGroupCipherWEP40->setChecked(_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::Any) || _security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)); + 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) { // select auto for both ciphers - _security_setting->setGroupCiphers(WirelessSecurity::CIPHER_AUTO); - _security_setting->setPairwiseCiphers(WirelessSecurity::CIPHER_AUTO); + _security_setting->securitySettings.allowedGroupWiseCiphers.clear(); + _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any); + _security_setting->securitySettings.allowedPairWiseCiphers.clear(); + _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::Any); } else { // use the already selected ciphers // group cipher - TQ_UINT32 cipher = WirelessSecurity::CIPHER_NONE; - if (chkGroupCipherTKIP->isChecked()) - cipher |= WirelessSecurity::CIPHER_TKIP; - if (chkGroupCipherCCMP->isChecked()) - cipher |= WirelessSecurity::CIPHER_CCMP; - if (chkGroupCipherWEP40->isChecked()) - cipher |= WirelessSecurity::CIPHER_WEP40; - if (chkGroupCipherWEP104->isChecked()) - cipher |= WirelessSecurity::CIPHER_WEP104; - _security_setting->setGroupCiphers(cipher); + TDENetworkWiFiConnectionCipherList cipher; + if (chkGroupCipherTKIP->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherTKIP); + } + if (chkGroupCipherCCMP->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherCCMP); + } + if (chkGroupCipherWEP40->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherWEP40); + } + if (chkGroupCipherWEP104->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherWEP104); + } + _security_setting->securitySettings.allowedGroupWiseCiphers = cipher; // pairwise cipher - cipher = WirelessSecurity::CIPHER_NONE; - if (chkPairwiseCipherTKIP->isChecked()) - cipher |= WirelessSecurity::CIPHER_TKIP; - if (chkPairwiseCipherCCMP->isChecked()) - cipher |= WirelessSecurity::CIPHER_CCMP; - _security_setting->setPairwiseCiphers(cipher); + cipher.clear(); + if (chkPairwiseCipherTKIP->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherTKIP); + } + if (chkPairwiseCipherCCMP->isChecked()) { + cipher.append(TDENetworkWiFiConnectionCipher::CipherCCMP); + } + _security_setting->securitySettings.allowedPairWiseCiphers = cipher; } } @@ -372,66 +384,80 @@ WirelessSecurityWPACipherImpl::slotCipherChangedAuto(bool checked) void WirelessSecurityWPACipherImpl::slotGroupCipherChangedTKIP(bool checked) { - if (checked) - _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_TKIP); - else - _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_TKIP)); + if (checked) { + if (!_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP); + } + else { + _security_setting->securitySettings.allowedGroupWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherTKIP); + } } void WirelessSecurityWPACipherImpl::slotGroupCipherChangedCCMP(bool checked) { - if (checked) - _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_CCMP); - else - _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_CCMP)); + if (checked) { + if (!_security_setting->securitySettings.allowedGroupWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) _security_setting->securitySettings.allowedGroupWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP); + } + else { + _security_setting->securitySettings.allowedGroupWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherCCMP); + } } void WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP40(bool checked) { - if (checked) - _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_WEP40); - else - _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_WEP40)); + if (checked) { + if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP40)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP40); + } + else { + _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherWEP40); + } } void WirelessSecurityWPACipherImpl::slotGroupCipherChangedWEP104(bool checked) { - if (checked) - _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() | WirelessSecurity::CIPHER_WEP104); - else - _security_setting->setGroupCiphers(_security_setting->getGroupCiphers() & (!WirelessSecurity::CIPHER_WEP104)); + if (checked) { + if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherWEP104)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherWEP104); + } + else { + _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherWEP104); + } } void WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedTKIP(bool checked) { - if (checked) - _security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() | WirelessSecurity::CIPHER_TKIP); - else - _security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() & (!WirelessSecurity::CIPHER_TKIP)); + if (checked) { + if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherTKIP)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherTKIP); + } + else { + _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherTKIP); + } } void WirelessSecurityWPACipherImpl::slotPairwiseCipherChangedCCMP(bool checked) { - if (checked) - _security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() | WirelessSecurity::CIPHER_CCMP); - else - _security_setting->setPairwiseCiphers(_security_setting->getPairwiseCiphers() & (!WirelessSecurity::CIPHER_CCMP)); + if (checked) { + if (!_security_setting->securitySettings.allowedPairWiseCiphers.contains(TDENetworkWiFiConnectionCipher::CipherCCMP)) _security_setting->securitySettings.allowedPairWiseCiphers.append(TDENetworkWiFiConnectionCipher::CipherCCMP); + } + else { + _security_setting->securitySettings.allowedPairWiseCiphers.remove(TDENetworkWiFiConnectionCipher::CipherCCMP); + } } /* 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) , _security_setting(security_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&))); } @@ -440,7 +466,8 @@ WirelessSecurityWPAPSKImpl::slotPSKChanged(const TQString& psk) { 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 */ -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) , _security_setting(security_setting) , _phase2_widget(phase2_widget) @@ -472,42 +499,44 @@ WirelessSecurityEAPImpl::WirelessSecurityEAPImpl(IEEE8021x* security_setting, Wi // insert all EAP-Methods int index = 0; cboMethod->insertItem(i18n("None"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_NONE; + _eapIndexMap[index] = TDENetworkIEEE8021xType::None; cboMethod->insertItem(i18n("TTLS"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_TTLS; + _eapIndexMap[index] = TDENetworkIEEE8021xType::TTLS; cboMethod->insertItem(i18n("PEAP"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_PEAP; + _eapIndexMap[index] = TDENetworkIEEE8021xType::PEAP; cboMethod->insertItem(i18n("TLS"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_TLS; + _eapIndexMap[index] = TDENetworkIEEE8021xType::TLS; cboMethod->insertItem(i18n("Leap"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_LEAP; + _eapIndexMap[index] = TDENetworkIEEE8021xType::LEAP; cboMethod->insertItem(i18n("MD5"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_MD5; + _eapIndexMap[index] = TDENetworkIEEE8021xType::MD5; cboMethod->insertItem(i18n("FAST"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_FAST; + _eapIndexMap[index] = TDENetworkIEEE8021xType::Fast; cboMethod->insertItem(i18n("SIM"), ++index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE1_SIM; + _eapIndexMap[index] = TDENetworkIEEE8021xType::SIM; // preselect the correct method - TQBiDirectionalMap::Iterator it = _eapIndexMap.findData(_security_setting->getEAP()); + TQBiDirectionalMap::Iterator it = _eapIndexMap.findData(_security_setting->eapConfig.type); cboMethod->setCurrentItem(it.key()); // update phase2 combobox - _phase2_widget->setAllowedPhase2Methods(_security_setting->getAllowedPhase2Methods()); + _phase2_widget->setAllowedPhase2Methods(_security_setting->eapConfig.allowedPhase2EAPMethods); - txtIdentity->setText(_security_setting->getIdentity()); - txtAnonIdentity->setText(_security_setting->getAnonIdentity()); - txtPassword->setText(_security_setting->getPassword()); + txtIdentity->setText(_security_setting->eapConfig.userName); + txtAnonIdentity->setText(_security_setting->eapConfig.anonymousUserName); + if (_security_setting->eapConfig.secretsValid) { + txtPassword->setText(_security_setting->eapConfig.password); + } - chkCAStore->setChecked(_security_setting->getUseSystemCaCert()); - kURLCACert->setEnabled(!_security_setting->getUseSystemCaCert()); + chkCAStore->setChecked(_security_setting->eapConfig.forceSystemCaCertificates); + kURLCACert->setEnabled(!_security_setting->eapConfig.forceSystemCaCertificates); // get notified if the method changes 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) { - _security_setting->setUseSystemCaCert(on); + _security_setting->eapConfig.forceSystemCaCertificates = on; kURLCACert->setEnabled(!on); } void WirelessSecurityEAPImpl::slotMethodChanged(int index) { // new method choosen - IEEE8021x::EAP_PHASE1 eap = _eapIndexMap[index]; - _security_setting->setEAP(eap); + TDENetworkIEEE8021xType::TDENetworkIEEE8021xType eap = _eapIndexMap[index]; + _security_setting->eapConfig.type = eap; - _phase2_widget->setAllowedPhase2Methods(_security_setting->getAllowedPhase2Methods()); + _phase2_widget->setAllowedPhase2Methods(_security_setting->eapConfig.allowedPhase2EAPMethods); } void WirelessSecurityEAPImpl::slotIdentityChanged(const TQString& identity) { - _security_setting->setIdentity(identity); + _security_setting->eapConfig.userName = identity; } void WirelessSecurityEAPImpl::slotAnonIdentityChanged(const TQString& identity) { - _security_setting->setAnonIdentity(identity); + _security_setting->eapConfig.anonymousUserName = identity; } 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 */ -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) , _security_setting(security_setting) { - _allowed_methods.append(IEEE8021x::EAP_PHASE2_AUTH_NONE); + _allowed_methods.append(TDENetworkIEEE8021xType::None); updateMethodComboBox(); connect(cboPhase2Method, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotPhase2MethodChanged(int))); @@ -567,79 +597,79 @@ void WirelessSecurityPhase2Impl::updateMethodComboBox() cboPhase2Method->clear(); _eapIndexMap.clear(); - for (TQValueList::Iterator it = _allowed_methods.begin(); it != _allowed_methods.end(); ++it) + for (TQValueList::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); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_NONE; + _eapIndexMap[index] = TDENetworkIEEE8021xType::None; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MSCHAPV2) + else if ((*it) == TDENetworkIEEE8021xType::MSCHAPV2) { cboPhase2Method->insertItem(i18n("MSCHAPv2"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MSCHAPV2; + _eapIndexMap[index] = TDENetworkIEEE8021xType::MSCHAPV2; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_PAP) + else if ((*it) == TDENetworkIEEE8021xType::PAP) { cboPhase2Method->insertItem(i18n("PAP"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_PAP; + _eapIndexMap[index] = TDENetworkIEEE8021xType::PAP; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_CHAP) + else if ((*it) == TDENetworkIEEE8021xType::CHAP) { cboPhase2Method->insertItem(i18n("CHAP"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_CHAP; + _eapIndexMap[index] = TDENetworkIEEE8021xType::CHAP; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MSCHAP) + else if ((*it) == TDENetworkIEEE8021xType::MSCHAP) { cboPhase2Method->insertItem(i18n("MSCHAP"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MSCHAP; + _eapIndexMap[index] = TDENetworkIEEE8021xType::MSCHAP; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_GTC) + else if ((*it) == TDENetworkIEEE8021xType::GTC) { cboPhase2Method->insertItem(i18n("GTC"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_GTC; + _eapIndexMap[index] = TDENetworkIEEE8021xType::GTC; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_OTP) + else if ((*it) == TDENetworkIEEE8021xType::OTP) { cboPhase2Method->insertItem(i18n("OTP"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_OTP; + _eapIndexMap[index] = TDENetworkIEEE8021xType::OTP; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_MD5) + else if ((*it) == TDENetworkIEEE8021xType::MD5) { cboPhase2Method->insertItem(i18n("MD5"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_MD5; + _eapIndexMap[index] = TDENetworkIEEE8021xType::MD5; index++; } - else if ((*it) == IEEE8021x::EAP_PHASE2_AUTH_TLS) + else if ((*it) == TDENetworkIEEE8021xType::TLS) { cboPhase2Method->insertItem(i18n("TLS"), index); - _eapIndexMap[index] = IEEE8021x::EAP_PHASE2_AUTH_TLS; + _eapIndexMap[index] = TDENetworkIEEE8021xType::TLS; index++; } } // preselect the correct method - TQBiDirectionalMap::Iterator it = _eapIndexMap.findData(_security_setting->getPhase2EAP()); + TQBiDirectionalMap::Iterator it = _eapIndexMap.findData(_security_setting->eapConfig.phase2EAPAuthMethod); if (it != _eapIndexMap.end()) { cboPhase2Method->setCurrentItem(it.key()); - _security_setting->setPhase2EAP(it.data()); + _security_setting->eapConfig.phase2EAPAuthMethod = it.data(); } else { cboPhase2Method->setCurrentItem(0); - _security_setting->setPhase2EAP(_eapIndexMap[0]); + _security_setting->eapConfig.phase2EAPAuthMethod = _eapIndexMap[0]; } } -void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueList& list) +void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueList& list) { _allowed_methods = list; updateMethodComboBox(); @@ -648,20 +678,20 @@ void WirelessSecurityPhase2Impl::setAllowedPhase2Methods(const TQValueListsetPhase2EAP(eap); + TDENetworkIEEE8021xType::TDENetworkIEEE8021xType eap = _eapIndexMap[index]; + _security_setting->eapConfig.phase2EAPAuthMethod = eap; } /* 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) { - _security_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); - _wireless_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); - _ieee8021x_setting = dynamic_cast (conn->getSetting(NM_SETTING_802_1X_SETTING_NAME)); + _security_setting = dynamic_cast (conn); + _wireless_setting = dynamic_cast (conn); + _ieee8021x_setting = dynamic_cast (conn); _new_conn = new_conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); @@ -737,41 +767,41 @@ WirelessSecurityWidgetImpl::comboSecurityInit() // TODO: Preselect the right security method // We should have an Essid already, fetch all possible APs - TQValueList aps; - if (_new_conn && !_wireless_setting->getEssid().isEmpty()) - { - aps = WirelessManager::getAccessPointsForEssid(_wireless_setting->getEssid()); + TQValueList aps; + if (_new_conn && !_wireless_setting->SSID.isEmpty()) { + aps = WirelessManager::getAccessPointsForEssid(_wireless_setting->SSID); #if 0 kdDebug() << "Hugo " << TQString(TQCString(_wireless_setting->getEssid())).ascii() << endl; #endif } - if (!aps.isEmpty()) - { + if (!aps.isEmpty()) { // if at least one AP has this security setting show the entry in the combobox - for (TQValueList::Iterator it = aps.begin(); it != aps.end(); ++it) - { - if((*it)->isEncrypted()) - { - 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) - { + for (TQValueList::Iterator it = aps.begin(); it != aps.end(); ++it) { + if (((*it)->wpaFlags & TDENetworkWiFiAPFlags::PrivacySupport) || ((*it)->rsnFlags & TDENetworkWiFiAPFlags::PrivacySupport)) { + kdDebug() << "AP " << (*it)->friendlySSID().ascii() << " is encrypted" << endl; + if ((((*it)->rsnFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None) || (((*it)->wpaFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask) != TDENetworkWiFiAPFlags::None)) { // 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 (!allowed_methods.contains(SECURITY_WPA_PSK)) + if ((*it)->rsnFlags & TDENetworkWiFiAPFlags::KeyManagementPSK || (*it)->wpaFlags & TDENetworkWiFiAPFlags::KeyManagementPSK) { + if (!allowed_methods.contains(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 (!allowed_methods.contains(SECURITY_WPA_EAP)) + if ((*it)->rsnFlags & TDENetworkWiFiAPFlags::KeyManagement80211 || (*it)->wpaFlags & TDENetworkWiFiAPFlags::KeyManagement80211) { + if (!allowed_methods.contains(SECURITY_WPA_EAP)) { allowed_methods.append(SECURITY_WPA_EAP); + } + } } // No WPA & RSN => WEP or dynamic WEP with 802.1x authentication // 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); - 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) { - switch(_security_setting->getKeyMgmt()) + switch(_security_setting->securitySettings.keyType) { - case WirelessSecurity::KEY_MGMT_NONE: - if (_security_setting->getAuthAlg() == WirelessSecurity::AUTH_ALG_SHARED || - !_security_setting->getWepKey(0).isEmpty() || - !_security_setting->getWepKey(1).isEmpty() || - !_security_setting->getWepKey(2).isEmpty() || - !_security_setting->getWepKey(3).isEmpty() ) + case TDENetworkWiFiKeyType::WEP: + if (_security_setting->securitySettings.authType == TDENetworkWiFiAuthType::Shared || + !_security_setting->securitySettings.wepKey0.isEmpty() || + !_security_setting->securitySettings.wepKey1.isEmpty() || + !_security_setting->securitySettings.wepKey2.isEmpty() || + !_security_setting->securitySettings.wepKey3.isEmpty() ) { _mainWid->groupUseEncryption->setChecked(true); _mainWid->cboSecurity->setCurrentItem(SECURITY_WEP); @@ -831,17 +861,17 @@ WirelessSecurityWidgetImpl::comboSecurityInit() else _mainWid->groupUseEncryption->setChecked(false); break; - case WirelessSecurity::KEY_MGMT_WPA_PSK: + case TDENetworkWiFiKeyType::WPAInfrastructure: _mainWid->groupUseEncryption->setChecked(true); _mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_PSK); slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_PSK]); break; - case WirelessSecurity::KEY_MGMT_WPA_EAP: + case TDENetworkWiFiKeyType::WPAEnterprise: _mainWid->groupUseEncryption->setChecked(true); _mainWid->cboSecurity->setCurrentItem(SECURITY_WPA_EAP); slotComboSecurityActivated(_securityComboMap[SECURITY_WPA_EAP]); break; - case WirelessSecurity::KEY_MGMT_IEEE8021X: + case TDENetworkWiFiKeyType::DynamicWEP: _mainWid->groupUseEncryption->setChecked(true); _mainWid->cboSecurity->setCurrentItem(SECURITY_IEEE8021X); slotComboSecurityActivated(_securityComboMap[SECURITY_IEEE8021X]); @@ -872,7 +902,7 @@ WirelessSecurityWidgetImpl::comboSecurityInit() void WirelessSecurityWidgetImpl::slotUseEncryptionToggled(bool on) { - _wireless_setting->setSecurity(on ? _security_setting->getType() : NULL); + _wireless_setting->securityRequired = on; } void @@ -968,28 +998,28 @@ WirelessSecurityWidgetImpl::slotExtraSettingsToggled(bool on) void WirelessSecurityWidgetImpl::configureForWEP() { - _security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_NONE); + _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WEP; configureWidgets(SECURITY_WEP); } void WirelessSecurityWidgetImpl::configureForWPAPSK() { - _security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_WPA_PSK); + _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WPAInfrastructure; configureWidgets(SECURITY_WPA_PSK); } void WirelessSecurityWidgetImpl::configureForWPAEAP() { - _security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_WPA_EAP); + _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::WPAEnterprise; configureWidgets(SECURITY_WPA_EAP); } void WirelessSecurityWidgetImpl::configureForIEEE8021X() { - _security_setting->setKeyMgmt(WirelessSecurity::KEY_MGMT_IEEE8021X); + _security_setting->securitySettings.keyType = TDENetworkWiFiKeyType::DynamicWEP; configureWidgets(SECURITY_IEEE8021X); } diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h index 7e90694..b6e4a5e 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_security_widget.h @@ -25,7 +25,7 @@ #ifndef 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_eap.h" #include "connection_setting_wireless_security_phase2.h" @@ -35,9 +35,12 @@ #include "connection_setting_wireless_security_wpapsk.h" #include "connection_setting_wireless_security_wepencryption.h" +// tde headers +#include +#include + /* knetworkmanager headers */ -#include "knetworkmanager-connection_setting.h" -#include "knetworkmanager-connection_setting_8021x.h" +#include "qbidirectionalmap.h" #include "knetworkmanager-connection_setting_widget_interface.h" namespace ConnectionSettings @@ -45,7 +48,6 @@ namespace ConnectionSettings /* class declarations */ class WirelessSecurity; class Wireless; - class IEEE8021x; class WirelessSecurityPhase2Impl; class WirelessSecurityWEPImpl : public ConnectionSettingWirelessSecurityWEP @@ -60,7 +62,7 @@ namespace ConnectionSettings , 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 getWEP128PassphraseHash(TQCString input) const; TQCString String2Hex(TQByteArray bytes, int final_len) const; @@ -77,7 +79,7 @@ namespace ConnectionSettings void slotWepIdx2Checked(bool); void slotWepIdx3Checked(bool); private: - WirelessSecurity* _security_setting; + TDEWiFiConnection* _security_setting; WEPKEY_TYPE _wepKeyType; }; @@ -86,9 +88,9 @@ namespace ConnectionSettings Q_OBJECT 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: - WirelessSecurity* _security_setting; + TDEWiFiConnection* _security_setting; }; class WirelessSecurityWPAVersionImpl : public ConnectionSettingWirelessSecurityWPAVersion @@ -96,7 +98,7 @@ namespace ConnectionSettings Q_OBJECT 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: void slotAuto(bool); @@ -104,7 +106,7 @@ namespace ConnectionSettings void slotWPA2(bool); private: - WirelessSecurity* _security_setting; + TDEWiFiConnection* _security_setting; }; @@ -121,7 +123,7 @@ namespace ConnectionSettings , WPA_CIPHER_LAST }; 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: void slotCipherChangedAuto(bool); @@ -133,7 +135,7 @@ namespace ConnectionSettings void slotPairwiseCipherChangedCCMP(bool); private: - WirelessSecurity* _security_setting; + TDEWiFiConnection* _security_setting; }; class WirelessSecurityWPAPSKImpl : public ConnectionSettingWirelessSecurityWPAPSK @@ -141,15 +143,15 @@ namespace ConnectionSettings Q_OBJECT 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; public slots: void slotPSKChanged(const TQString&); private: - WirelessSecurity* _security_setting; - Wireless* _wireless_setting; + TDEWiFiConnection* _security_setting; + TDEWiFiConnection* _wireless_setting; }; class WirelessSecurityEAPImpl : public ConnectionSettingWirelessSecurityEAP @@ -157,7 +159,7 @@ namespace ConnectionSettings Q_OBJECT 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: void slotMethodChanged(int index); @@ -167,8 +169,8 @@ namespace ConnectionSettings void slotUseSystemCaCertChanged(bool on); private: - IEEE8021x* _security_setting; - TQBiDirectionalMap _eapIndexMap; + TDEWiFiConnection* _security_setting; + TQBiDirectionalMap _eapIndexMap; WirelessSecurityPhase2Impl* _phase2_widget; }; @@ -177,16 +179,16 @@ namespace ConnectionSettings Q_OBJECT 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: - void setAllowedPhase2Methods(const TQValueList&); + void setAllowedPhase2Methods(const TQValueList&); void slotPhase2MethodChanged(int index); private: void updateMethodComboBox(); - IEEE8021x* _security_setting; - TQBiDirectionalMap _eapIndexMap; - TQValueList _allowed_methods; + TDEWiFiConnection* _security_setting; + TQBiDirectionalMap _eapIndexMap; + TQValueList _allowed_methods; }; class WirelessSecurityWidgetImpl : public WidgetInterface @@ -204,7 +206,7 @@ namespace ConnectionSettings }; 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(); public slots: @@ -226,9 +228,9 @@ namespace ConnectionSettings SecurityMethods _currentMethod; TQValueList _widgets[SECURITY_COUNT]; TQValueList _extra_widgets[SECURITY_COUNT]; - WirelessSecurity* _security_setting; - Wireless* _wireless_setting; - IEEE8021x* _ieee8021x_setting; + TDEWiFiConnection* _security_setting; + TDEWiFiConnection* _wireless_setting; + TDEWiFiConnection* _ieee8021x_setting; ConnectionSettingWirelessSecurityWidget* _mainWid; bool _new_conn; TQMap _securityComboMap; diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp index e6bd9c2..5d34190 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.cpp @@ -34,14 +34,11 @@ #include #include #include +#include -#include "knetworkmanager-connection.h" #include "knetworkmanager-connection_setting_widget_interface.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-wireless_network.h" #include "knetworkmanager-wireless_manager.h" using namespace ConnectionSettings; @@ -73,13 +70,13 @@ class NetworkListViewItem : public KListViewItem 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) { - _wireless_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SETTING_NAME)); - _info_setting = dynamic_cast (conn->getSetting(NM_SETTING_CONNECTION_SETTING_NAME)); - _security_setting = dynamic_cast (conn->getSetting(NM_SETTING_WIRELESS_SECURITY_SETTING_NAME)); - _hasName = !_info_setting->getName().isEmpty(); + _wireless_setting = dynamic_cast(conn); + _info_setting = dynamic_cast(conn); + _security_setting = dynamic_cast(conn); + _hasName = !_info_setting->friendlyName.isEmpty(); _new_conn = new_conn; TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1); @@ -128,7 +125,7 @@ WirelessWidgetImpl::Activate() } // 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) @@ -176,12 +173,15 @@ WirelessWidgetImpl::slotEssidChanged(const TQString& new_essid) void WirelessWidgetImpl::updateEssid(const TQByteArray& essid) { - _wireless_setting->setEssid(essid); + _wireless_setting->SSID = essid; if (!_hasName) { // 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") + ">"; + } } } diff --git a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h index 0baba65..37a3de7 100644 --- a/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h +++ b/tdenetworkmanager/src/configwidgets/knetworkmanager-connection_setting_wireless_widget.h @@ -26,9 +26,12 @@ #ifndef KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H #define KNETWORKMANAGER_CONNECTION_SETTING_WIRELESS_WIDGET_H +// tde headers +#include +#include + #include "knetworkmanager-connection_setting_widget_interface.h" #include "connection_setting_wireless.h" -#include "knetworkmanager-connection_setting.h" class KListViewSearchLineWidget; @@ -44,7 +47,7 @@ namespace ConnectionSettings Q_OBJECT 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(); @@ -60,9 +63,9 @@ namespace ConnectionSettings TQString hexStringFromByteArray(const TQByteArray& ); bool _hasName; - Wireless* _wireless_setting; - Info* _info_setting; - WirelessSecurity* _security_setting; + TDEWiFiConnection* _wireless_setting; + TDEWiFiConnection* _info_setting; + TDEWiFiConnection* _security_setting; ConnectionSettingWirelessWidget* _mainWid; KListViewSearchLineWidget* _searchLine; bool _new_conn;