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