|
|
@ -45,6 +45,8 @@
|
|
|
|
#include "tdenetman-connection_editor.h"
|
|
|
|
#include "tdenetman-connection_editor.h"
|
|
|
|
#include "tdenetman-connection_settings_dialog.h"
|
|
|
|
#include "tdenetman-connection_settings_dialog.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extern unsigned int tdenetworkmanager_editor_dialog_count;
|
|
|
|
|
|
|
|
|
|
|
|
using namespace ConnectionSettings;
|
|
|
|
using namespace ConnectionSettings;
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -54,21 +56,24 @@ class ConnectionListViewItem : public KListViewItem
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
|
|
ConnectionListViewItem(TQListView* parent, TDENetworkConnection* connection)
|
|
|
|
ConnectionListViewItem(TQListView* parent, TQString connection)
|
|
|
|
: KListViewItem(parent)
|
|
|
|
: KListViewItem(parent)
|
|
|
|
, _conn(connection)
|
|
|
|
, _conn(connection)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (_conn) {
|
|
|
|
TDEGlobalNetworkManager* nm = KGlobal::networkManager();
|
|
|
|
setText(0, _conn->friendlyName);
|
|
|
|
TDENetworkConnection* conn = (nm)?nm->findConnectionByUUID(connection):NULL;
|
|
|
|
setText(1, TDENetworkConnectionManager::friendlyConnectionTypeName(_conn->type()));
|
|
|
|
|
|
|
|
|
|
|
|
if (conn) {
|
|
|
|
|
|
|
|
setText(0, conn->friendlyName);
|
|
|
|
|
|
|
|
setText(1, TDENetworkConnectionManager::friendlyConnectionTypeName(conn->type()));
|
|
|
|
// TODO: Move to a Factory
|
|
|
|
// TODO: Move to a Factory
|
|
|
|
if (_conn->type() == TDENetworkConnectionType::WiredEthernet) {
|
|
|
|
if (conn->type() == TDENetworkConnectionType::WiredEthernet) {
|
|
|
|
setPixmap(0, KGlobal::iconLoader()->loadIcon("wired", KIcon::Small));
|
|
|
|
setPixmap(0, KGlobal::iconLoader()->loadIcon("wired", KIcon::Small));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (_conn->type() == TDENetworkConnectionType::WiFi) {
|
|
|
|
else if (conn->type() == TDENetworkConnectionType::WiFi) {
|
|
|
|
setPixmap(0, KGlobal::iconLoader()->loadIcon("wireless", KIcon::Small));
|
|
|
|
setPixmap(0, KGlobal::iconLoader()->loadIcon("wireless", KIcon::Small));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (_conn->type() == TDENetworkConnectionType::VPN) {
|
|
|
|
else if (conn->type() == TDENetworkConnectionType::VPN) {
|
|
|
|
setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small));
|
|
|
|
setPixmap(0, KGlobal::iconLoader()->loadIcon("encrypted", KIcon::Small));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
else {
|
|
|
@ -77,7 +82,7 @@ class ConnectionListViewItem : public KListViewItem
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TDENetworkConnection* _conn;
|
|
|
|
TQString _conn;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -86,6 +91,7 @@ class ConnectionListViewItem : public KListViewItem
|
|
|
|
ConnectionEditorImpl::ConnectionEditorImpl(TQWidget* parent, const char* name, bool modal, WFlags fl)
|
|
|
|
ConnectionEditorImpl::ConnectionEditorImpl(TQWidget* parent, const char* name, bool modal, WFlags fl)
|
|
|
|
: ConnectionEditor(parent, name, modal, fl)
|
|
|
|
: ConnectionEditor(parent, name, modal, fl)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
tdenetworkmanager_editor_dialog_count++;
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: enable combobox if implemented
|
|
|
|
// TODO: enable combobox if implemented
|
|
|
|
cboConnectionType->hide();
|
|
|
|
cboConnectionType->hide();
|
|
|
@ -126,6 +132,8 @@ ConnectionEditorImpl::~ConnectionEditorImpl()
|
|
|
|
if (pbNew->popup()) {
|
|
|
|
if (pbNew->popup()) {
|
|
|
|
delete pbNew->popup();
|
|
|
|
delete pbNew->popup();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
tdenetworkmanager_editor_dialog_count--;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
@ -184,13 +192,15 @@ void ConnectionEditorImpl::slotEditCurrentConnection()
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TDENetworkConnection* conn = item->_conn;
|
|
|
|
TDENetworkConnection* conn = nm->findConnectionByUUID(item->_conn);
|
|
|
|
|
|
|
|
|
|
|
|
// we need the secrets for editing
|
|
|
|
if (conn) {
|
|
|
|
nm->loadConnectionSecrets(conn->UUID);
|
|
|
|
// we need the secrets for editing
|
|
|
|
|
|
|
|
nm->loadConnectionSecrets(conn->UUID);
|
|
|
|
|
|
|
|
|
|
|
|
ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, TQByteArray(), this, "connect_something", false, TQt::WDestructiveClose);
|
|
|
|
ConnectionSettingsDialogImpl* dlg = new ConnectionSettingsDialogImpl(conn, false, TQByteArray(), this, "connect_something", false, TQt::WDestructiveClose);
|
|
|
|
dlg->show();
|
|
|
|
dlg->show();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -209,11 +219,11 @@ void ConnectionEditorImpl::slotRemoveCurrentConnection()
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TDENetworkConnection* conn = item->_conn;
|
|
|
|
TDENetworkConnection* conn = nm->findConnectionByUUID(item->_conn);
|
|
|
|
|
|
|
|
|
|
|
|
lvConnections->takeItem(item);
|
|
|
|
lvConnections->takeItem(item);
|
|
|
|
delete item;
|
|
|
|
delete item;
|
|
|
|
|
|
|
|
|
|
|
|
nm->deleteConnection(conn->UUID);
|
|
|
|
nm->deleteConnection(conn->UUID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -232,7 +242,7 @@ void ConnectionEditorImpl::fillConnectionList()
|
|
|
|
TDENetworkConnectionList* allconmap = nm->connections();
|
|
|
|
TDENetworkConnectionList* allconmap = nm->connections();
|
|
|
|
for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) {
|
|
|
|
for (TDENetworkConnectionList::Iterator it = allconmap->begin(); it != allconmap->end(); ++it) {
|
|
|
|
TDENetworkConnection* conn = *it;
|
|
|
|
TDENetworkConnection* conn = *it;
|
|
|
|
new ConnectionListViewItem(lvConnections, conn);
|
|
|
|
new ConnectionListViewItem(lvConnections, conn->UUID);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|