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