|
|
@ -60,22 +60,18 @@ VPNWidgetImpl::Init()
|
|
|
|
// fill in all possible VPN services
|
|
|
|
// fill in all possible VPN services
|
|
|
|
VPNServiceList list = VPNManager::getVPNServices();
|
|
|
|
VPNServiceList list = VPNManager::getVPNServices();
|
|
|
|
|
|
|
|
|
|
|
|
if (list.isEmpty())
|
|
|
|
if (list.isEmpty()) {
|
|
|
|
{
|
|
|
|
|
|
|
|
// FIXME Do something useful here
|
|
|
|
// FIXME Do something useful here
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else {
|
|
|
|
{
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
int index = 0;
|
|
|
|
for (VPNServiceList::Iterator it = list.begin(); it != list.end(); ++it)
|
|
|
|
for (VPNServiceList::Iterator it = list.begin(); it != list.end(); ++it) {
|
|
|
|
{
|
|
|
|
|
|
|
|
TQString icon;
|
|
|
|
TQString icon;
|
|
|
|
TQString disp_name;
|
|
|
|
TQString disp_name;
|
|
|
|
|
|
|
|
|
|
|
|
// get service icon and display name
|
|
|
|
// get service icon and display name
|
|
|
|
VPNService* service = *it;
|
|
|
|
VPNService* service = *it;
|
|
|
|
if (service)
|
|
|
|
if (service) {
|
|
|
|
{
|
|
|
|
|
|
|
|
icon = service->getIcon();
|
|
|
|
icon = service->getIcon();
|
|
|
|
disp_name = service->getDisplayName();
|
|
|
|
disp_name = service->getDisplayName();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -99,14 +95,14 @@ VPNWidgetImpl::Init()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// no special icon for this service, use default
|
|
|
|
// no special icon for this service, use default
|
|
|
|
if (icon.isEmpty())
|
|
|
|
if (icon.isEmpty()) {
|
|
|
|
icon = "encrypted";
|
|
|
|
icon = "encrypted";
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_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->vpnPluginID)
|
|
|
|
if (service->getService() == _vpnsetting->vpnPluginID) {
|
|
|
|
{
|
|
|
|
|
|
|
|
// preselect the correct service
|
|
|
|
// preselect the correct service
|
|
|
|
_mainWid->cboServices->setCurrentItem(index - 1);
|
|
|
|
_mainWid->cboServices->setCurrentItem(index - 1);
|
|
|
|
slotServiceComboActivated(index - 1);
|
|
|
|
slotServiceComboActivated(index - 1);
|
|
|
@ -115,10 +111,10 @@ VPNWidgetImpl::Init()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// lock the combo when editing an already existing connection
|
|
|
|
// lock the combo when editing an already existing connection
|
|
|
|
if (!_new_conn)
|
|
|
|
if (!_new_conn) {
|
|
|
|
_mainWid->cboServices->setEnabled(false);
|
|
|
|
_mainWid->cboServices->setEnabled(false);
|
|
|
|
else
|
|
|
|
}
|
|
|
|
{
|
|
|
|
else {
|
|
|
|
// preselect the correct service
|
|
|
|
// preselect the correct service
|
|
|
|
_mainWid->cboServices->setCurrentItem(0);
|
|
|
|
_mainWid->cboServices->setCurrentItem(0);
|
|
|
|
slotServiceComboActivated(0);
|
|
|
|
slotServiceComboActivated(0);
|
|
|
@ -135,17 +131,14 @@ VPNWidgetImpl::Init()
|
|
|
|
VPNConfigWidget*
|
|
|
|
VPNConfigWidget*
|
|
|
|
VPNWidgetImpl::getVPNConfigWidget(VPNService* service)
|
|
|
|
VPNWidgetImpl::getVPNConfigWidget(VPNService* service)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (_mapServiceWidget.find(service) != _mapServiceWidget.end())
|
|
|
|
if (_mapServiceWidget.find(service) != _mapServiceWidget.end()) {
|
|
|
|
{
|
|
|
|
|
|
|
|
// return the already available config widget
|
|
|
|
// return the already available config widget
|
|
|
|
return *_mapServiceWidget.find(service);
|
|
|
|
return *_mapServiceWidget.find(service);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else {
|
|
|
|
{
|
|
|
|
|
|
|
|
// we have to create a new one
|
|
|
|
// we have to create a new one
|
|
|
|
VPNPlugin* plugin = service->getVPNPlugin();
|
|
|
|
VPNPlugin* plugin = service->getVPNPlugin();
|
|
|
|
if (plugin)
|
|
|
|
if (plugin) {
|
|
|
|
{
|
|
|
|
|
|
|
|
VPNConfigWidget* config = plugin->CreateConfigWidget(_mainWid->widgetStack);
|
|
|
|
VPNConfigWidget* config = plugin->CreateConfigWidget(_mainWid->widgetStack);
|
|
|
|
_mapServiceWidget.insert(service, config);
|
|
|
|
_mapServiceWidget.insert(service, config);
|
|
|
|
return config;
|
|
|
|
return config;
|
|
|
@ -159,19 +152,16 @@ void
|
|
|
|
VPNWidgetImpl::slotServiceComboActivated(int index)
|
|
|
|
VPNWidgetImpl::slotServiceComboActivated(int index)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
VPNService* service;
|
|
|
|
VPNService* service;
|
|
|
|
if (_mapServiceCombo.find(index) != _mapServiceCombo.end())
|
|
|
|
if (_mapServiceCombo.find(index) != _mapServiceCombo.end()) {
|
|
|
|
{
|
|
|
|
|
|
|
|
service = *_mapServiceCombo.find(index);
|
|
|
|
service = *_mapServiceCombo.find(index);
|
|
|
|
if (service)
|
|
|
|
if (service) {
|
|
|
|
{
|
|
|
|
|
|
|
|
VPNConfigWidget* config = getVPNConfigWidget(service);
|
|
|
|
VPNConfigWidget* config = getVPNConfigWidget(service);
|
|
|
|
_mainWid->widgetStack->raiseWidget(config);
|
|
|
|
_mainWid->widgetStack->raiseWidget(config);
|
|
|
|
|
|
|
|
|
|
|
|
config->setVPNData(_vpnsetting->ipConfig.routeConfigurations, _vpnsetting->pluginData, _vpnsetting->pluginSecrets);
|
|
|
|
config->setVPNData(_vpnsetting->ipConfig.routeConfigurations, _vpnsetting->pluginData, _vpnsetting->pluginSecrets);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
else {
|
|
|
|
{
|
|
|
|
|
|
|
|
//FIXME - do something useful here
|
|
|
|
//FIXME - do something useful here
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -181,14 +171,12 @@ VPNWidgetImpl::Deactivate()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// update the setting from the currently selected vpn service
|
|
|
|
// update the setting from the currently selected vpn service
|
|
|
|
VPNService* service = *_mapServiceCombo.find(_mainWid->cboServices->currentItem());
|
|
|
|
VPNService* service = *_mapServiceCombo.find(_mainWid->cboServices->currentItem());
|
|
|
|
if (service)
|
|
|
|
if (service) {
|
|
|
|
{
|
|
|
|
|
|
|
|
// set the correct service type
|
|
|
|
// set the correct service type
|
|
|
|
_vpnsetting->vpnPluginID = 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->pluginData = config->getVPNProperties();
|
|
|
|
_vpnsetting->pluginData = config->getVPNProperties();
|
|
|
|
// update the vpn secrets
|
|
|
|
// update the vpn secrets
|
|
|
|