More API porting

pull/1/head
Timothy Pearson 12 years ago
parent c5bbf78c1b
commit fed6fccc41

@ -57,10 +57,12 @@ tde_add_tdeinit_executable( knetworkmanager AUTOMOC
knetworkmanager-menu_subhead.cpp
sha1.cpp md5.cpp
knetworkmanager-wireless_network.cpp knetworkmanager-wireless_manager.cpp
knetworkmanager-connection_editor.cpp knetworkmanager-plugin.cpp knetworkmanager-vpnplugin.cpp
knetworkmanager-pluginmanager.cpp knetworkmanager-vpnservice.cpp knetworkmanager-vpnmanager.cpp
knetworkmanager-vpnauthenticationdialog.cpp devicetraycomponent.cpp traycomponent.cpp
vpn_tray_component.cpp
knetworkmanager-connection_editor.cpp
devicetraycomponent.cpp traycomponent.cpp
#knetworkmanager-plugin.cpp knetworkmanager-vpnplugin.cpp
#knetworkmanager-pluginmanager.cpp knetworkmanager-vpnservice.cpp knetworkmanager-vpnmanager.cpp
#knetworkmanager-vpnauthenticationdialog.cpp
#vpn_tray_component.cpp
EMBED tdenetwork-connection-configwidgets-static tdenetwork-connection-settings-static
LINK tdecore-shared tdeui-shared kutils-shared ${DBUS_TQT_LIBRARIES}
)

@ -24,10 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <klocale.h>
#include <ksystemtray.h>
#include "knetworkmanager-device.h"
#include "knetworkmanager-nm_proxy.h"
TQString pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) {
TQString DeviceTrayComponent::pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) {
TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000;
while (flag > 0) {
if (state & flag) {
@ -40,7 +37,7 @@ TQString pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStat
return TQString::null;
}
TQString movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) {
TQString DeviceTrayComponent::movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) {
TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000;
while (flag > 0) {
if (state & flag) {
@ -53,7 +50,7 @@ TQString movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatu
return TQString::null;
}
TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) {
TQString DeviceTrayComponent::tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state) {
TDENetworkConnectionStatus::TDENetworkConnectionStatus flag = (TDENetworkConnectionStatus::TDENetworkConnectionStatus)0x80000000;
while (flag > 0) {
if (state & flag) {
@ -66,7 +63,7 @@ TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionSta
return TQString::null;
}
DeviceTrayComponent::DeviceTrayComponent(Device * device, KSystemTray * parent, const char * name )
DeviceTrayComponent::DeviceTrayComponent(TDENetworkDevice * device, KSystemTray * parent, const char * name )
: TrayComponent(parent, name), m_device(device)
{
connect( m_device, TQT_SIGNAL(StateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)), TQT_SLOT(deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus)));
@ -107,9 +104,10 @@ TDENetworkDevice* DeviceTrayComponent::device() const
TQStringList DeviceTrayComponent::getToolTipText()
{
TQStringList list;
TDENetworkConnectionStatus::TDENetworkConnectionStatus state = m_device->getState();
TDENetworkConnectionManager* deviceConnMan = m_device->connectionManager();
TDENetworkConnectionStatus::TDENetworkConnectionStatus state = deviceConnMan->deviceInformation().statusFlags;
if (tooltipForConnState(state) != "") {
list.append(i18n("Device: %1").arg(m_device->getInterface()));
list.append(i18n("Device: %1").arg(m_device->deviceNode()));
list.append(i18n("State: %1").arg(tooltipForConnState(state)));
}
return list;
@ -120,7 +118,8 @@ TQPixmap DeviceTrayComponent::pixmapForState(TDENetworkConnectionStatus::TDENetw
{
if (pixmapForConnState(state) != "") {
return KSystemTray::loadIcon(pixmapForConnState(state));
} else {
}
else {
return TQPixmap();
}
}
@ -129,7 +128,8 @@ TQMovie DeviceTrayComponent::movieForState(TDENetworkConnectionStatus::TDENetwor
{
if (movieForConnState(state) != "") {
return TQMovie( KGlobal::iconLoader()->moviePath(movieForConnState(state), KIcon::Panel));
} else {
}
else {
return TQMovie();
}
}
@ -149,16 +149,14 @@ void DeviceTrayComponent::deviceStateChanged(TDENetworkConnectionStatus::TDENetw
//check if our device now holds the default active connection
// if it is the default active connection
// or if it is activating. what if 2 devices are activating simultaneously?
NMProxy * nm = 0;
switch (state) {
case TDENetworkConnectionStatus::EstablishingLink:
emit needsCenterStage(this, true);
break;
case TDENetworkConnectionStatus::Connected:
nm = NMProxy::getInstance();
if ( m_device == nm->getDefaultDevice() ) {
// if ( m_device == nm->getDefaultDevice() ) {
emit needsCenterStage(this, true);
}
// }
break;
case TDENetworkConnectionStatus::LinkUnavailable:
case TDENetworkConnectionStatus::Disconnected:

@ -37,25 +37,35 @@ class KSystemTray;
class DeviceTrayComponent : public TrayComponent
{
Q_OBJECT
Q_OBJECT
public:
public:
DeviceTrayComponent(TDENetworkDevice * device, KSystemTray * parent, const char * name );
virtual ~DeviceTrayComponent();
TQPixmap pixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state);
TQMovie movieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state);
virtual TQStringList getToolTipText();
TDENetworkDevice* device() const;
signals:
signals:
void needsCenterStage(TrayComponent *, bool);
public slots:
public slots:
virtual void newConnection() = 0;
protected slots:
protected slots:
void deviceStateChanged(TDENetworkConnectionStatus::TDENetworkConnectionStatus);
protected:
protected:
void setMovieForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString);
void setPixmapForState(TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString);
private:
private:
TQString pixmapForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state);
TQString movieForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state);
TQString tooltipForConnState(TDENetworkConnectionStatus::TDENetworkConnectionStatus state);
private:
TDENetworkDevice * m_device;
TQMap<TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString> m_movies;
TQMap<TDENetworkConnectionStatus::TDENetworkConnectionStatus, TQString> m_pixmaps;

@ -43,15 +43,8 @@
// knm headers
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection.h"
#include "knetworkmanager-wired_connection.h"
#include "knetworkmanager-wireless_connection.h"
#include "knetworkmanager-vpn_connection.h"
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-connection_editor.h"
#include "knetworkmanager-connection_settings_dialog.h"
#include "knetworkmanager-vpnservice.h"
#include "knetworkmanager-vpnmanager.h"
using namespace ConnectionSettings;
@ -66,22 +59,24 @@ class ConnectionListViewItem : public KListViewItem
: KListViewItem(parent)
, _conn(connection)
{
Info* info = _conn->getInfoSetting();
if (info)
{
setText(0, info->getName());
setText(1, info->getDevType());
if (_conn) {
setText(0, _conn->friendlyName);
setText(1, TDENetworkConnectionManager::friendlyConnectionTypeName(_conn->type()));
// TODO: Move to a Factory
if (info->getDevType() == NM_SETTING_WIRED_SETTING_NAME)
if (_conn->type() == TDENetworkConnectionType::WiredEthernet) {
setPixmap(0, KGlobal::iconLoader()->loadIcon("wired", KIcon::Small));
else if (info->getDevType() == NM_SETTING_WIRELESS_SETTING_NAME)
}
else if (_conn->type() == TDENetworkConnectionType::WiFi) {
setPixmap(0, KGlobal::iconLoader()->loadIcon("wireless", KIcon::Small));
else if (info->getDevType() == NM_SETTING_VPN_SETTING_NAME)
setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small));
else
}
// else if (_conn->type() == TDENetworkConnectionType::VPN) {
// setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small));
// }
else {
setPixmap(0, KGlobal::iconLoader()->loadIcon("help", KIcon::Small));
}
}
}
TDENetworkConnection* _conn;
};
@ -109,8 +104,9 @@ ConnectionEditorImpl::ConnectionEditorImpl(TQWidget* parent, const char* name, b
popup->insertItem(KGlobal::iconLoader()->loadIcon("wireless", KIcon::Small), i18n("Wireless"), this, TQT_SLOT(slotNewWirelessConnection()));
popup->insertItem(KGlobal::iconLoader()->loadIcon("wired", KIcon::Small), i18n("Wired"), this, TQT_SLOT(slotNewWiredConnection()));
if (!VPNManager::getVPNServices().isEmpty())
popup->insertItem(KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small), i18n("VPN"), this, TQT_SLOT(slotNewVPNConnection()));
// if (!VPNManager::getVPNServices().isEmpty()) {
// popup->insertItem(KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small), i18n("VPN"), this, TQT_SLOT(slotNewVPNConnection()));
// }
pbNew->setPopup(popup);
@ -128,8 +124,9 @@ ConnectionEditorImpl::ConnectionEditorImpl(TQWidget* parent, const char* name, b
ConnectionEditorImpl::~ConnectionEditorImpl()
{
// remove the popupmenu
if (pbNew->popup())
if (pbNew->popup()) {
delete pbNew->popup();
}
}
/*
@ -138,7 +135,7 @@ ConnectionEditorImpl::~ConnectionEditorImpl()
void ConnectionEditorImpl::slotNewWirelessConnection()
{
// create a new wireless connection
slotEditNewConnection(new WirelessConnection());
slotEditNewConnection(new TDEWiFiConnection());
}
/*
@ -146,7 +143,7 @@ void ConnectionEditorImpl::slotNewWirelessConnection()
*/
void ConnectionEditorImpl::slotNewWiredConnection()
{
slotEditNewConnection(new WiredConnection());
slotEditNewConnection(new TDEWiredEthernetConnection());
}
/*
@ -154,7 +151,7 @@ void ConnectionEditorImpl::slotNewWiredConnection()
*/
void ConnectionEditorImpl::slotNewVPNConnection()
{
slotEditNewConnection(new VPNConnection());
// slotEditNewConnection(new TDEVPNConnection());
}
/*
@ -164,11 +161,11 @@ void ConnectionEditorImpl::slotEditNewConnection(TDENetworkConnection* conn)
{
// open a dialog for editing the connection
ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, true, this, "connect_something", false, TQt::WDestructiveClose);
connect(dlg, TQT_SIGNAL(connectionSaved()), this, TQT_SLOT(slotRefershConnectionList()));
connect(dlg, TQT_SIGNAL(connectionSaved()), this, TQT_SLOT(slotRefreshConnectionList()));
dlg->show();
}
void ConnectionEditorImpl::slotRefershConnectionList()
void ConnectionEditorImpl::slotRefreshConnectionList()
{
fillConnectionList();
}
@ -179,22 +176,25 @@ void ConnectionEditorImpl::slotRefershConnectionList()
void ConnectionEditorImpl::slotEditCurrentConnection()
{
ConnectionListViewItem* item = dynamic_cast<ConnectionListViewItem*>(lvConnections->currentItem());
if (!item)
if (!item) {
return;
}
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
if (!nm) {
return;
}
TDENetworkConnection* conn = item->_conn;
Storage* storage = Storage::getInstance();
bool hasSecretsStored = storage->hasSecretsStored(conn);
// we need the secrets for editing
if (hasSecretsStored)
storage->restoreAllSecrets(conn);
nm->loadConnectionSecrets(conn->UUID);
ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, this, "connect_something", false, TQt::WDestructiveClose);
dlg->show();
// save all connections (if not done already)
storage->saveConnections();
nm->saveConnection(conn);
}
@ -204,16 +204,21 @@ void ConnectionEditorImpl::slotEditCurrentConnection()
void ConnectionEditorImpl::slotRemoveCurrentConnection()
{
ConnectionListViewItem* item = dynamic_cast<ConnectionListViewItem*>(lvConnections->currentItem());
if (!item)
if (!item) {
return;
}
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
if (!nm) {
return;
}
ConnectionStore* cstore = ConnectionStore::getInstance();
TDENetworkConnection* conn = item->_conn;
lvConnections->takeItem(item);
delete item;
cstore->removeConnection(conn);
nm->deleteConnection(conn->UUID);
}
/*
@ -221,29 +226,18 @@ void ConnectionEditorImpl::slotRemoveCurrentConnection()
*/
void ConnectionEditorImpl::fillConnectionList()
{
ConnectionStore* cstore = ConnectionStore::getInstance();
TQValueList<TDENetworkConnection*> conns = cstore->getConnections();
TQValueList<TDENetworkConnection*>::Iterator it = conns.begin();
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
if (!nm) {
return;
}
lvConnections->clear();
for (; it != conns.end(); ++it)
{
TDENetworkConnectionList* allconmap = nm->connections();
for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) {
TDENetworkConnection* conn = *it;
if (conn)
{
Info* info = conn->getInfoSetting();
if (info)
{
new ConnectionListViewItem(lvConnections, conn);
}
else
kdWarning() << k_funcinfo << "Connection without Info setting, drop it." << endl;
}
else
kdWarning() << k_funcinfo << "non-generic connection, dropping it." << endl;
}
}
#include "knetworkmanager-connection_editor.moc"

@ -25,12 +25,16 @@
#ifndef KNETWORKMANAGER_CONNECTION_EDITOR_H
#define KNETWORKMANAGER_CONNECTION_EDITOR_H
// qt headers
// tqt headers
#include <tqvaluelist.h>
// qt autogenerated headers
// tqt autogenerated headers
#include "connection_editor.h"
// TDE headers
#include <tdehardwaredevices.h>
#include <tdenetworkconnections.h>
// knm headers
#include "knetworkmanager-connection_setting.h"
@ -57,7 +61,7 @@ class ConnectionEditorImpl : public ConnectionEditor
void slotNewWirelessConnection();
void slotNewWiredConnection();
void slotEditNewConnection(TDENetworkConnection* conn);
void slotRefershConnectionList();
void slotRefreshConnectionList();
void slotNewVPNConnection();
private:

@ -42,6 +42,9 @@
#include <tqprogressbar.h>
#include <tqguardedptr.h>
#include <tdehardwaredevices.h>
#include <tdenetworkconnections.h>
#include "knetworkmanager.h"
class DeviceTrayPrivate;

@ -25,21 +25,8 @@
// other includes
#include <time.h>
// QT DBus
#include <tqdbusobjectpath.h>
// KNM includes
#include "knetworkmanager-wireless_manager.h"
#include "knetworkmanager-wireless_device.h"
#include "knetworkmanager-wireless_network.h"
#include "knetworkmanager-accesspoint.h"
#include "knetworkmanager-connection_store.h"
#include "knetworkmanager-wireless_connection.h"
#include "knetworkmanager-connection_setting_info.h"
#include "knetworkmanager-connection_setting_wireless.h"
#include "knetworkmanager-connection_setting_wireless_security.h"
#include "knetworkmanager-nm_proxy.h"
#include "knetworkmanager-devicestore.h"
TQValueList<WirelessNetwork> WirelessManager::getWirelessNetworks(TDENetworkDevice* dev, TQ_UINT32 match)
{
@ -56,17 +43,13 @@ TQValueList<WirelessNetwork> WirelessManager::getWirelessNetworks(TDENetworkDevi
// no hidden APs
TDENetworkWiFiAPInfo * ap = *apit;
if ( ap ) {
if (!ap->isValid())
continue;
if (ap->getSsid().count() == 0)
if (ap->SSID.count() == 0) {
continue;
}
// check if we have a network matching this AP
for (TQValueList<WirelessNetwork>::Iterator netIt = nets.begin(); netIt != nets.end(); ++netIt)
{
if ((*netIt).contains(ap) )
{
for (TQValueList<WirelessNetwork>::Iterator netIt = nets.begin(); netIt != nets.end(); ++netIt) {
if ((*netIt).contains(ap) ) {
// we alread have a network where this AP belongs to
found = true;
@ -84,8 +67,7 @@ TQValueList<WirelessNetwork> WirelessManager::getWirelessNetworks(TDENetworkDevi
}
}
if (!found)
{
if (!found) {
// create a new network-descriptor according to this ap
WirelessNetwork net(match);
net.addAP(ap);
@ -96,25 +78,39 @@ TQValueList<WirelessNetwork> WirelessManager::getWirelessNetworks(TDENetworkDevi
return nets;
}
TQValueList<TDENetworkWiFiAPInfo*> internalGetAccessPoints(TDENetworkDevice* dev) {
TQValueList<TDENetworkWiFiAPInfo*> list;
if (dev) {
TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
TDENetworkHWNeighbor* neighbor;
TDENetworkHWNeighborList* neighbors = deviceConnMan->siteSurvey();
for (neighbor = neighbors->first(); neighbor; neighbor = neighbors->next()) {
TDENetworkWiFiAPInfo* apInfo = dynamic_cast<TDENetworkWiFiAPInfo*>(neighbor);
if (!apInfo) {
continue;
}
list.append(apInfo);
}
}
return list;
}
TQValueList<TDENetworkWiFiAPInfo*> WirelessManager::getAccessPoints(TDENetworkDevice* dev)
{
// build up AP list depending on one device or on all devices
if (dev) {
return dev->accessPoints();
return internalGetAccessPoints(dev);
}
else {
TQValueList<TDENetworkWiFiAPInfo *> aps;
DeviceStore* store = DeviceStore::getInstance();
if (store)
{
TQValueList<Device*> devs = store->getDevices(NM_DEVICE_TYPE_WIFI);
for (TQValueList<Device*>::Iterator it = devs.begin(); it != devs.end(); ++it)
{
TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices();
if (hwdevices) {
TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network);
for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) {
TDENetworkDevice* wdev = dynamic_cast<TDENetworkDevice*>(*it);
if (!wdev)
continue;
// add all APs from this device
aps +=wdev->accessPoints();
if (wdev) {
aps += internalGetAccessPoints(wdev);
}
}
}
return aps;
@ -124,40 +120,58 @@ TQValueList<TDENetworkWiFiAPInfo*> WirelessManager::getAccessPoints(TDENetworkDe
TQValueList<TDEWiFiConnection*> WirelessManager::getWirelessConnections()
{
TQValueList<TDEWiFiConnection*> conns;
ConnectionStore* store = ConnectionStore::getInstance();
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
if (nm) {
// get all wireless connections
TQValueList<Connection*> connections = store->getConnections(NM_SETTING_WIRELESS_SETTING_NAME);
for (TQValueList<Connection*>::Iterator it = connections.begin(); it != connections.end(); ++it)
{
// cast to TDEWiFiConnection*
TDENetworkConnectionList* allconmap = nm->connections();
for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) {
TDEWiFiConnection* wireless_conn = dynamic_cast<TDEWiFiConnection*>(*it);
if (!wireless_conn)
if (!wireless_conn) {
continue;
}
conns.append(wireless_conn);
}
}
return conns;
}
TQValueList<TDENetworkWiFiAPInfo*> internalGetAccessPointsWithESSID(TQByteArray essid, TDENetworkDevice* dev) {
TQValueList<TDENetworkWiFiAPInfo*> list;
if (dev) {
TDENetworkConnectionManager* deviceConnMan = dev->connectionManager();
TDENetworkHWNeighbor* neighbor;
TDENetworkHWNeighborList* neighbors = deviceConnMan->siteSurvey();
for (neighbor = neighbors->first(); neighbor; neighbor = neighbors->next()) {
TDENetworkWiFiAPInfo* apInfo = dynamic_cast<TDENetworkWiFiAPInfo*>(neighbor);
if (!apInfo) {
continue;
}
if (apInfo->SSID == essid) {
list.append(apInfo);
}
}
}
return list;
}
TQValueList<TDENetworkWiFiAPInfo*> WirelessManager::getAccessPointsForEssid(TQByteArray essid, TDENetworkDevice* dev)
{
// build up AP list depending on one device or on all devices
if (dev)
return dev->accessPointsForEssid(essid);
else
{
if (dev) {
return internalGetAccessPointsWithESSID(essid, dev);
}
else {
TQValueList<TDENetworkWiFiAPInfo*> aps;
DeviceStore* store = DeviceStore::getInstance();
if (store)
{
TQValueList<Device*> devs = store->getDevices(NM_DEVICE_TYPE_WIFI);
for (TQValueList<Device*>::Iterator it = devs.begin(); it != devs.end(); ++it)
{
TDEHardwareDevices *hwdevices = KGlobal::hardwareDevices();
if (hwdevices) {
TDEGenericHardwareList devices = hwdevices->listByDeviceClass(TDEGenericDeviceType::Network);
for (TDEGenericHardwareList::iterator it = devices.begin(); it != devices.end(); ++it) {
TDENetworkDevice* wdev = dynamic_cast<TDENetworkDevice*>(*it);
if (!wdev)
continue;
// add all APs from this device
aps += wdev->accessPointsForEssid(essid);
if (wdev) {
aps += internalGetAccessPointsWithESSID(essid, wdev);
}
}
}
return aps;

@ -79,8 +79,9 @@ WirelessNetwork& WirelessNetwork::operator= (const WirelessNetwork& other)
bool WirelessNetwork::contains (const TDENetworkWiFiAPInfo * const ap)
{
if ( (d->match & MATCH_SSID) && getSsid() != ap->getSsidByteArray())
if ( (d->match & MATCH_SSID) && getSsid() != ap->SSID) {
return false;
}
// AP matches
return true;
@ -88,8 +89,7 @@ bool WirelessNetwork::contains (const TDENetworkWiFiAPInfo * const ap)
bool WirelessNetwork::addAP(const TDENetworkWiFiAPInfo * const ap)
{
if ( this->contains( ap ) || d->aps.isEmpty())
{
if ( this->contains( ap ) || d->aps.isEmpty()) {
d->aps.append(ap);
return true;
}
@ -99,8 +99,9 @@ bool WirelessNetwork::addAP(const TDENetworkWiFiAPInfo * const ap)
const TQByteArray WirelessNetwork::getSsid() const
{
if ( !d->aps.isEmpty() ) {
return (*(d->aps.begin()))->getSsidByteArray();
} else {
return (*(d->aps.begin()))->SSID;
}
else {
return TQByteArray();
}
}
@ -108,8 +109,9 @@ const TQByteArray WirelessNetwork::getSsid() const
TQString WirelessNetwork::getDisplaySsid() const
{
if (!d->aps.isEmpty()) {
return (*(d->aps.begin()))->getDisplaySsid();
} else {
return (*(d->aps.begin()))->friendlySSID();
}
else {
return TQString();
}
}
@ -117,9 +119,9 @@ TQString WirelessNetwork::getDisplaySsid() const
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getFlags() const
{
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None;
for (TQValueList<const TDENetworkWiFiAPInfo*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
{
flags |= (*it)->getFlags();
for (TQValueList<const TDENetworkWiFiAPInfo*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) {
flags |= ((*it)->wpaFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask);
flags |= ((*it)->rsnFlags & TDENetworkWiFiAPFlags::GeneralFlagsMask);
}
return flags;
}
@ -129,7 +131,7 @@ TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getWpaFlags() cons
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None;
for (TQValueList<const TDENetworkWiFiAPInfo*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
{
flags |= (*it)->getWpaFlags();
flags |= ((*it)->wpaFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask);
}
return flags;
}
@ -139,7 +141,7 @@ TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags WirelessNetwork::getRsnFlags() cons
TDENetworkWiFiAPFlags::TDENetworkWiFiAPFlags flags = TDENetworkWiFiAPFlags::None;
for (TQValueList<const TDENetworkWiFiAPInfo*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
{
flags |= (*it)->getRsnFlags();
flags |= ((*it)->rsnFlags & TDENetworkWiFiAPFlags::EncryptionFlagsMask);
}
return flags;
}
@ -152,10 +154,10 @@ bool WirelessNetwork::isEncrypted() const
TQ_UINT8 WirelessNetwork::getStrength() const
{
TQ_UINT8 strength = 0;
for (TQValueList<const TDENetworkWiFiAPInfo*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it)
{
if ((*it)->getStrength() > strength)
strength = (*it)->getStrength();
for (TQValueList<const TDENetworkWiFiAPInfo*>::Iterator it = d->aps.begin(); it != d->aps.end(); ++it) {
if (((*it)->signalQuality*100.0) > strength) {
strength = ((*it)->signalQuality*100.0);
}
}
return strength;
}

@ -294,35 +294,15 @@ int
ConnectionSettingsDialogImpl::getDeviceTypeFromConnection(Connection* conn)
{
if (conn->getType() == NM_SETTING_WIRELESS_SETTING_NAME)
#if NM_CHECK_VERSION(0,8,992)
return NM_DEVICE_TYPE_WIFI;
#else
return DEVICE_TYPE_802_11_WIRELESS;
#endif
else if (conn->getType() == NM_SETTING_WIRED_SETTING_NAME)
#if NM_CHECK_VERSION(0,8,992)
return NM_DEVICE_TYPE_ETHERNET;
#else
return DEVICE_TYPE_802_3_ETHERNET;
#endif
else if (conn->getType() == NM_SETTING_GSM_SETTING_NAME)
#if NM_CHECK_VERSION(0,8,992)
return NM_DEVICE_TYPE_MODEM;
#else
return DEVICE_TYPE_GSM;
#endif
else if (conn->getType() == NM_SETTING_CDMA_SETTING_NAME)
#if NM_CHECK_VERSION(0,8,992)
return NM_DEVICE_TYPE_MODEM;
#else
return DEVICE_TYPE_CDMA;
#endif
#if NM_CHECK_VERSION(0,8,992)
return NM_DEVICE_TYPE_UNKNOWN;
#else
return DEVICE_TYPE_UNKNOWN;
#endif
}
void
@ -353,20 +333,12 @@ ConnectionSettingsDialogImpl::slotConnect()
{
TQT_DBusObjectPath act_conn = nm->getDefaultActiveConnection();
TQT_DBusObjectPath device = nm->getDeviceForActiveConnection(act_conn);
#if NM_CHECK_VERSION(0,8,992)
nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), device, act_conn, err);
#else
nm->ActivateConnectionAsync(id,NM_DBUS_SERVICE_USER_SETTINGS, _conn->getObjectPath(), device, act_conn, err);
#endif
}
else
{
// we need to call ActivateDevice async
#if NM_CHECK_VERSION(0,8,992)
nm->ActivateConnectionAsync(id, "org.freedesktop.NetworkManagerUserSettings", _conn->getObjectPath(), TQT_DBusObjectPath(QCString(dev->getObjectPath())), _conn->getObjectPath(), err);
#else
nm->ActivateConnectionAsync(id, NM_DBUS_SERVICE_USER_SETTINGS, _conn->getObjectPath(), TQT_DBusObjectPath(TQCString(dev->getObjectPath())), _conn->getObjectPath(), err);
#endif
}
}
}

Loading…
Cancel
Save