|
|
@ -35,20 +35,17 @@
|
|
|
|
#include <kuser.h>
|
|
|
|
#include <kuser.h>
|
|
|
|
|
|
|
|
|
|
|
|
// tdenm headers
|
|
|
|
// tdenm headers
|
|
|
|
#include "tdenetman-connection.h"
|
|
|
|
|
|
|
|
#include "tdenetman-connection_setting_vpn.h"
|
|
|
|
|
|
|
|
#include "tdenetman-connection_setting_vpn_widget.h"
|
|
|
|
#include "tdenetman-connection_setting_vpn_widget.h"
|
|
|
|
#include "tdenetman-device.h"
|
|
|
|
|
|
|
|
#include "tdenetman-vpnmanager.h"
|
|
|
|
#include "tdenetman-vpnmanager.h"
|
|
|
|
#include "tdenetman-vpnservice.h"
|
|
|
|
#include "tdenetman-vpnservice.h"
|
|
|
|
|
|
|
|
|
|
|
|
using namespace ConnectionSettings;
|
|
|
|
using namespace ConnectionSettings;
|
|
|
|
|
|
|
|
|
|
|
|
VPNWidgetImpl::VPNWidgetImpl(Connection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl)
|
|
|
|
VPNWidgetImpl::VPNWidgetImpl(TDENetworkConnection* conn, bool new_conn, TQWidget* parent, const char* name, WFlags fl)
|
|
|
|
: WidgetInterface(parent, name, fl)
|
|
|
|
: WidgetInterface(parent, name, fl)
|
|
|
|
, _new_conn(new_conn)
|
|
|
|
, _new_conn(new_conn)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_vpnsetting = dynamic_cast<ConnectionSettings::VPN*> (conn->getSetting(NM_SETTING_VPN_SETTING_NAME));
|
|
|
|
_vpnsetting = dynamic_cast<TDEVPNConnection*>(conn);
|
|
|
|
|
|
|
|
|
|
|
|
TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
|
|
|
|
TQVBoxLayout* layout = new TQVBoxLayout(this, 1, 1);
|
|
|
|
_mainWid = new ConnectionSettingVPNWidget(this);
|
|
|
|
_mainWid = new ConnectionSettingVPNWidget(this);
|
|
|
@ -96,9 +93,10 @@ VPNWidgetImpl::Init()
|
|
|
|
disp_name = "StrongSwan VPN";
|
|
|
|
disp_name = "StrongSwan VPN";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// the service should not get changed when editing a connection
|
|
|
|
// the service should not be changed when editing a connection
|
|
|
|
if (service->getService() != _vpnsetting->getServiceType() && !_new_conn)
|
|
|
|
if (service->getService() != _vpnsetting->vpnPluginID && !_new_conn) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// no special icon for this service, use default
|
|
|
|
// no special icon for this service, use default
|
|
|
|
if (icon.isEmpty())
|
|
|
|
if (icon.isEmpty())
|
|
|
@ -107,7 +105,7 @@ VPNWidgetImpl::Init()
|
|
|
|
_mainWid->cboServices->insertItem(SmallIcon(icon, TQIconSet::Automatic), disp_name, index);
|
|
|
|
_mainWid->cboServices->insertItem(SmallIcon(icon, TQIconSet::Automatic), disp_name, index);
|
|
|
|
_mapServiceCombo.insert(index++, *it);
|
|
|
|
_mapServiceCombo.insert(index++, *it);
|
|
|
|
|
|
|
|
|
|
|
|
if (service->getService() == _vpnsetting->getServiceType())
|
|
|
|
if (service->getService() == _vpnsetting->vpnPluginID)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// preselect the correct service
|
|
|
|
// preselect the correct service
|
|
|
|
_mainWid->cboServices->setCurrentItem(index - 1);
|
|
|
|
_mainWid->cboServices->setCurrentItem(index - 1);
|
|
|
@ -128,7 +126,7 @@ VPNWidgetImpl::Init()
|
|
|
|
|
|
|
|
|
|
|
|
// update the username to the current one
|
|
|
|
// update the username to the current one
|
|
|
|
KUser user;
|
|
|
|
KUser user;
|
|
|
|
_vpnsetting->setUserName(user.loginName());
|
|
|
|
_vpnsetting->lockedUserName = user.loginName();
|
|
|
|
|
|
|
|
|
|
|
|
// notification if VPN service is selected
|
|
|
|
// notification if VPN service is selected
|
|
|
|
connect(_mainWid->cboServices, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotServiceComboActivated(int)));
|
|
|
|
connect(_mainWid->cboServices, TQT_SIGNAL(activated(int)), this, TQT_SLOT(slotServiceComboActivated(int)));
|
|
|
@ -169,7 +167,7 @@ VPNWidgetImpl::slotServiceComboActivated(int index)
|
|
|
|
VPNConfigWidget* config = getVPNConfigWidget(service);
|
|
|
|
VPNConfigWidget* config = getVPNConfigWidget(service);
|
|
|
|
_mainWid->widgetStack->raiseWidget(config);
|
|
|
|
_mainWid->widgetStack->raiseWidget(config);
|
|
|
|
|
|
|
|
|
|
|
|
config->setVPNData(_vpnsetting->getRoutes(), _vpnsetting->getData());
|
|
|
|
config->setVPNData(_vpnsetting->ipConfig.routeConfigurations, _vpnsetting->pluginData, _vpnsetting->pluginSecrets);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else
|
|
|
@ -186,13 +184,15 @@ VPNWidgetImpl::Deactivate()
|
|
|
|
if (service)
|
|
|
|
if (service)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// set the correct service type
|
|
|
|
// set the correct service type
|
|
|
|
_vpnsetting->setServiceType(service->getService());
|
|
|
|
_vpnsetting->vpnPluginID = service->getService();
|
|
|
|
|
|
|
|
|
|
|
|
VPNConfigWidget* config = *_mapServiceWidget.find(service);
|
|
|
|
VPNConfigWidget* config = *_mapServiceWidget.find(service);
|
|
|
|
if (config)
|
|
|
|
if (config)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// update the vpn properties
|
|
|
|
// update the vpn properties
|
|
|
|
_vpnsetting->setData(config->getVPNProperties());
|
|
|
|
_vpnsetting->pluginData = config->getVPNProperties();
|
|
|
|
|
|
|
|
// update the vpn secrets
|
|
|
|
|
|
|
|
_vpnsetting->pluginSecrets = config->getVPNSecrets();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|