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