File add-novellvpn-plugin.diff of Package NetworkManager-kde4

Index: vpnplugins/novellvpn/nm-novellvpn-service.h
===================================================================
--- vpnplugins/novellvpn/nm-novellvpn-service.h	(revision 0)
+++ vpnplugins/novellvpn/nm-novellvpn-service.h	(revision 0)
@@ -0,0 +1,83 @@
+/* nm-novellvpn-service - novellvpn integration with NetworkManager
+ *
+ * Authors:
+ *          Bin Li <bili@novell.com>
+ *          Sureshkumar T <tsureshkumar@novell.com>
+ * 
+ * Based on work by Dan Williams <dcbw@redhat.com>
+ *                  Tim Niemueller <tim@niemueller.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+#ifndef NM_NOVELLVPN_SERVICE_H
+#define NM_NOVELLVPN_SERVICE_H
+
+/* 
+   Do not change numbers, only add if needed!
+   See properties/nm-novellvpn.c:connection_type_changed() for details
+ */
+
+#define NM_DBUS_SERVICE_NOVELLVPN   "org.freedesktop.NetworkManager.novellvpn"
+#define NM_DBUS_INTERFACE_NOVELLVPN "org.freedesktop.NetworkManager.novellvpn"
+#define NM_DBUS_PATH_NOVELLVPN          "/org/freedesktop/NetworkManager/novellvpn"
+
+#define NM_NOVELLVPN_CONTYPE_INVALID               -1
+#define NM_NOVELLVPN_CONTYPE_GROUPAUTH             0
+#define NM_NOVELLVPN_CONTYPE_X509                  1
+
+#define NM_NOVELLVPN_KEY_GWTYPE             "gateway-type"
+#define NM_NOVELLVPN_KEY_AUTHTYPE           "auth-type"
+#define NM_NOVELLVPN_KEY_NAME               "name"
+#define NM_NOVELLVPN_KEY_GATEWAY            "remote"
+#define NM_NOVELLVPN_KEY_USER_NAME          "username"
+#define NM_NOVELLVPN_KEY_GROUP_NAME         "group-name"
+#define NM_NOVELLVPN_KEY_DHGROUP            "dhgroup"
+#define NM_NOVELLVPN_KEY_PFSGROUP           "pfsgroup"
+#define NM_NOVELLVPN_KEY_CERTIFICATE        "certificate"
+#define NM_NOVELLVPN_KEY_NOSPLITTUNNEL      "nosplittunnel"
+
+#define NM_NOVELLVPN_KEY_HOW_MANY_PWD       "how_many_passwords"
+#define NM_NOVELLVPN_KEY_USER_PWD           "unenc-user-password"
+#define NM_NOVELLVPN_KEY_GRP_PWD            "unenc-group-password"
+#define NM_NOVELLVPN_KEY_ENC_GRP_PWD        "enc-group-password"
+#define NM_NOVELLVPN_KEY_CERT_PWD           "unenc-cert-password"
+
+#define NM_NOVELLVPN_GWTYPE_NORTEL_STRING     "nortel"
+#define NM_NOVELLVPN_GWTYPE_STDGW_STRING      "standard-gateway"
+#define NM_NOVELLVPN_CONTYPE_GROUPAUTH_STRING "XAUTH"
+#define NM_NOVELLVPN_CONTYPE_X509_STRING      "X.509"
+
+
+#define NM_NOVELLVPN_GWTYPE_INVALID   -1 
+#define NM_NOVELLVPN_GWTYPE_NORTEL     0
+#define NM_NOVELLVPN_GWTYPE_STDGW      1
+
+typedef enum {
+  DHGROUP_INVALID = -1,
+  DHGROUP_DH1 = 0,
+  DHGROUP_DH2
+} DHGroup;
+
+
+typedef enum {
+  PFSGROUP_INVALID = -1,
+  PFSGROUP_OFF = 0,
+  PFSGROUP_PFS1,
+  PFSGROUP_PFS2
+} PFSGroup;
+
+#endif
Index: vpnplugins/novellvpn/networkmanagement_novellvpnui.desktop
===================================================================
--- vpnplugins/novellvpn/networkmanagement_novellvpnui.desktop	(revision 0)
+++ vpnplugins/novellvpn/networkmanagement_novellvpnui.desktop	(revision 0)
@@ -0,0 +1,18 @@
+[Desktop Entry]
+Type=Service
+Icon=
+ServiceTypes=NetworkManagement/VpnUiPlugin
+X-KDE-Library=networkmanagement_novellvpnui
+X-NetworkManager-Services=novellvpn
+X-KDE-PluginInfo-Author=Will Stephenson
+X-KDE-PluginInfo-Email=wstephenson@kde.org
+X-KDE-PluginInfo-Name=networkmanagement_novellvpnui
+X-KDE-PluginInfo-Version=0.1
+X-KDE-PluginInfo-Website=
+X-KDE-PluginInfo-Category=VPNService
+X-KDE-PluginInfo-Depends=
+X-KDE-PluginInfo-License=GPL
+X-KDE-PluginInfo-EnabledByDefault=false
+Name=Novell VPN (turnpike)
+Comment=Enables KNetworkManager to connect to Novell VPN (turnpike) VPNs.
+
Index: vpnplugins/novellvpn/novellvpnprop.ui
===================================================================
--- vpnplugins/novellvpn/novellvpnprop.ui	(revision 0)
+++ vpnplugins/novellvpn/novellvpnprop.ui	(revision 0)
@@ -0,0 +1,253 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>NovellVpnWidget</class>
+ <widget class="QWidget" name="NovellVpnWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>336</width>
+    <height>382</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Novell VPN</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>General</string>
+     </property>
+     <layout class="QFormLayout" name="formLayout_2">
+      <item row="0" column="0">
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>&amp;Gateway:</string>
+        </property>
+        <property name="buddy">
+         <cstring>leGateway</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="KLineEdit" name="leGateway"/>
+      </item>
+      <item row="1" column="0">
+       <widget class="QLabel" name="label_2">
+        <property name="text">
+         <string>Gate&amp;way Type:</string>
+        </property>
+        <property name="buddy">
+         <cstring>cmbGwType</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QComboBox" name="cmbGwType">
+        <item>
+         <property name="text">
+          <string>Nortel</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>Standard Gateway</string>
+         </property>
+        </item>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="title">
+      <string>Authentication</string>
+     </property>
+     <layout class="QGridLayout" name="gridLayout">
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_4">
+        <property name="text">
+         <string>&amp;Type:</string>
+        </property>
+        <property name="buddy">
+         <cstring>cmbAuthType</cstring>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="1">
+       <widget class="QComboBox" name="cmbAuthType">
+        <item>
+         <property name="text">
+          <string>XAUTH</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>X.509</string>
+         </property>
+        </item>
+       </widget>
+      </item>
+      <item row="1" column="0" colspan="2">
+       <widget class="QStackedWidget" name="authTypeStack">
+        <property name="currentIndex">
+         <number>0</number>
+        </property>
+        <widget class="QWidget" name="page">
+         <layout class="QFormLayout" name="formLayout">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_3">
+            <property name="text">
+             <string>&amp;User Name:</string>
+            </property>
+            <property name="buddy">
+             <cstring>leUserName</cstring>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="KLineEdit" name="leUserName"/>
+          </item>
+          <item row="1" column="0">
+           <widget class="QLabel" name="label_5">
+            <property name="text">
+             <string>&amp;Group Name:</string>
+            </property>
+            <property name="buddy">
+             <cstring>leGroupName</cstring>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="KLineEdit" name="leGroupName"/>
+          </item>
+          <item row="2" column="0">
+           <widget class="QLabel" name="label_6">
+            <property name="text">
+             <string>U&amp;ser Password:</string>
+            </property>
+            <property name="buddy">
+             <cstring>leUserPass</cstring>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1">
+           <widget class="KLineEdit" name="leUserPass">
+            <property name="passwordMode">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item row="3" column="0">
+           <widget class="QLabel" name="label_7">
+            <property name="text">
+             <string>G&amp;roup Password:</string>
+            </property>
+            <property name="buddy">
+             <cstring>leGroupPass</cstring>
+            </property>
+           </widget>
+          </item>
+          <item row="3" column="1">
+           <widget class="KLineEdit" name="leGroupPass">
+            <property name="passwordMode">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+        <widget class="QWidget" name="page_2">
+         <layout class="QFormLayout" name="formLayout_3">
+          <item row="0" column="0">
+           <widget class="QLabel" name="label_13">
+            <property name="text">
+             <string>Certificate &amp;file:</string>
+            </property>
+            <property name="buddy">
+             <cstring>x509Cert</cstring>
+            </property>
+           </widget>
+          </item>
+          <item row="0" column="1">
+           <widget class="KUrlRequester" name="x509Cert"/>
+          </item>
+          <item row="1" column="0">
+           <widget class="QLabel" name="label_14">
+            <property name="text">
+             <string>Certificate &amp;password:</string>
+            </property>
+            <property name="buddy">
+             <cstring>x509CertPass</cstring>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="KLineEdit" name="x509CertPass">
+            <property name="passwordMode">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </widget>
+      </item>
+      <item row="2" column="0">
+       <widget class="QCheckBox" name="cbShowPasswords">
+        <property name="text">
+         <string>Show Passwords</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1">
+       <widget class="KPushButton" name="btnAdvanced">
+        <property name="text">
+         <string>Ad&amp;vanced...</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>KUrlRequester</class>
+   <extends>QFrame</extends>
+   <header>kurlrequester.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KPushButton</class>
+   <extends>QPushButton</extends>
+   <header>kpushbutton.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KLineEdit</class>
+   <extends>QLineEdit</extends>
+   <header>klineedit.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>cmbAuthType</sender>
+   <signal>currentIndexChanged(int)</signal>
+   <receiver>authTypeStack</receiver>
+   <slot>setCurrentIndex(int)</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>187</x>
+     <y>150</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>45</x>
+     <y>183</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>
Index: vpnplugins/novellvpn/novellvpn.cpp
===================================================================
--- vpnplugins/novellvpn/novellvpn.cpp	(revision 0)
+++ vpnplugins/novellvpn/novellvpn.cpp	(revision 0)
@@ -0,0 +1,47 @@
+/*
+Copyright 2009 Will Stephenson <wstephenson@kde.org>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "novellvpn.h"
+
+#include <KPluginFactory>
+
+#include "novellvpnwidget.h"
+
+#include "connection.h"
+
+K_PLUGIN_FACTORY( NovellVpnUiPluginFactory, registerPlugin<NovellVpnUiPlugin>(); )
+K_EXPORT_PLUGIN( NovellVpnUiPluginFactory( "networkmanagement_novellvpnui", "libknetworkmanager" ) )
+
+NovellVpnUiPlugin::NovellVpnUiPlugin(QObject * parent, const QVariantList &) : VpnUiPlugin(parent)
+{
+}
+
+NovellVpnUiPlugin::~NovellVpnUiPlugin()
+{
+
+}
+
+SettingWidget * NovellVpnUiPlugin::widget(Knm::Connection * connection, QWidget * parent)
+{
+    NovellVpnSettingWidget * wid = new NovellVpnSettingWidget(connection, parent);
+    return wid;
+}
+
+// vim: sw=4 sts=4 et tw=100
Index: vpnplugins/novellvpn/novellvpnadvancedprop.ui
===================================================================
--- vpnplugins/novellvpn/novellvpnadvancedprop.ui	(revision 0)
+++ vpnplugins/novellvpn/novellvpnadvancedprop.ui	(revision 0)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>NovellVpnAdvancedWidget</class>
+ <widget class="QWidget" name="NovellVpnAdvancedWidget">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>156</width>
+    <height>244</height>
+   </rect>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>&amp;DH Group</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <widget class="QRadioButton" name="rbDh1">
+        <property name="text">
+         <string>768 bits (DH&amp;1)</string>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="rbDh2">
+        <property name="text">
+         <string>1024 bits (DH&amp;2)</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="title">
+      <string>&amp;PFS Group</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_3">
+      <item>
+       <widget class="QRadioButton" name="rbPfOff">
+        <property name="text">
+         <string>&amp;Off</string>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="rbPf1">
+        <property name="text">
+         <string>&amp;768 bits (PF1)</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="rbPf2">
+        <property name="text">
+         <string>102&amp;4 bits (PF2)</string>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QCheckBox" name="cbDisableSplit">
+     <property name="text">
+      <string>Disable &amp;split tunnel</string>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: vpnplugins/novellvpn/novellvpnwidget.cpp
===================================================================
--- vpnplugins/novellvpn/novellvpnwidget.cpp	(revision 0)
+++ vpnplugins/novellvpn/novellvpnwidget.cpp	(revision 0)
@@ -0,0 +1,214 @@
+/*
+Copyright 2009 Will Stephenson <wstephenson@kde.org>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "novellvpnwidget.h"
+#include "nm-novellvpn-service.h"
+
+#include "settingwidget_p.h"
+
+#include <KDebug>
+#include <KLocale>
+
+#include <nm-setting-vpn.h>
+#include "settings/vpn.h"
+#include "connection.h"
+
+#include "ui_novellvpnprop.h"
+#include "ui_novellvpnadvancedprop.h"
+
+class NovellVpnSettingWidget::Private
+{
+public:
+    Ui_NovellVpnWidget ui;
+    Knm::VpnSetting * setting;
+    Ui_NovellVpnAdvancedWidget advUi;
+    KDialog * advancedDialog;
+};
+
+
+NovellVpnSettingWidget::NovellVpnSettingWidget(Knm::Connection * connection, QWidget * parent)
+: SettingWidget(connection, parent), d(new Private)
+{
+    //setValid(false);
+    d->ui.setupUi(this);
+    d->ui.x509Cert->setMode(KFile::LocalOnly);
+    d->setting = static_cast<Knm::VpnSetting *>(connection->setting(Knm::Setting::Vpn));
+
+    connect(d->ui.leGateway, SIGNAL(textChanged(const QString&)), this, SLOT(validate()));
+    connect(d->ui.cbShowPasswords, SIGNAL(toggled(bool)), this, SLOT(showPasswordsChanged(bool)));
+
+    connect(d->ui.cmbGwType, SIGNAL(currentIndexChanged(int)), this, SLOT(gatewayTypeChanged(int)));
+
+    connect(d->ui.btnAdvanced, SIGNAL(clicked()), this, SLOT(advancedClicked()));
+
+    d->advancedDialog = new KDialog(this);
+    d->advancedDialog->setButtons(KDialog::Ok);
+    d->advancedDialog->setCaption(i18nc("@window:title NovellVPN advanced connection options", "NovellVPN advanced options"));
+    QWidget * advWid = new QWidget(d->advancedDialog);
+    d->advUi.setupUi(advWid);
+    d->advancedDialog->setMainWidget(advWid);
+}
+
+NovellVpnSettingWidget::~NovellVpnSettingWidget()
+{
+    delete d;
+}
+
+void NovellVpnSettingWidget::advancedClicked()
+{
+    d->advancedDialog->exec();
+}
+
+void NovellVpnSettingWidget::gatewayTypeChanged(int gatewayType)
+{
+    if ( gatewayType == 1) {
+        d->ui.cmbAuthType->setCurrentIndex(1);
+    }
+    d->ui.cmbAuthType->setEnabled(gatewayType != 1);
+}
+
+void NovellVpnSettingWidget::showPasswordsChanged(bool show)
+{
+    d->ui.x509CertPass->setPasswordMode(!show);
+    d->ui.leUserPass->setPasswordMode(!show);
+    d->ui.leGroupPass->setPasswordMode(!show);
+}
+
+void NovellVpnSettingWidget::readConfig()
+{
+    kDebug();
+
+    // General settings
+    QStringMap dataMap = d->setting->data();
+
+    d->ui.leGateway->setText( dataMap[NM_NOVELLVPN_KEY_GATEWAY] );
+
+    QString gwType = dataMap[NM_NOVELLVPN_KEY_GWTYPE];
+
+    if (gwType == QLatin1String(NM_NOVELLVPN_GWTYPE_NORTEL_STRING)) {
+        d->ui.cmbGwType->setCurrentIndex(0);
+        QString authType = dataMap[NM_NOVELLVPN_KEY_AUTHTYPE];
+        if (authType == QLatin1String(NM_NOVELLVPN_CONTYPE_GROUPAUTH_STRING)) {
+            d->ui.leUserName->setText(dataMap[NM_NOVELLVPN_KEY_USER_NAME]);
+            d->ui.leGroupName->setText(dataMap[NM_NOVELLVPN_KEY_GROUP_NAME]);
+        } else if (authType == QLatin1String(NM_NOVELLVPN_CONTYPE_X509_STRING)) {
+            readX509Auth(dataMap);
+        }
+    } else if (gwType == QLatin1String(NM_NOVELLVPN_GWTYPE_STDGW_STRING)) {
+            readX509Auth(dataMap);
+    }
+
+    // advanced
+    QString dhGroup = dataMap[QLatin1String(NM_NOVELLVPN_KEY_DHGROUP)];
+    if (dhGroup.toUInt() == 1) {
+        d->advUi.rbDh2->setChecked(true);
+    }
+
+    QString pfsGroup = dataMap[QLatin1String(NM_NOVELLVPN_KEY_PFSGROUP)];
+    if (pfsGroup.toUInt() == PFSGROUP_PFS1) {
+        d->advUi.rbPf1->setChecked(true);
+    } else if (pfsGroup.toUInt() == PFSGROUP_PFS2) {
+        d->advUi.rbPf2->setChecked(true);
+    }
+
+    if (dataMap[QLatin1String(NM_NOVELLVPN_KEY_NOSPLITTUNNEL)] == QLatin1String("yes")) {
+        d->advUi.cbDisableSplit->setChecked(true);
+    }
+}
+
+void NovellVpnSettingWidget::readX509Auth(const QStringMap & dataMap)
+{
+    d->ui.cmbGwType->setCurrentIndex(1);
+    d->ui.x509Cert->setUrl(KUrl(dataMap[NM_NOVELLVPN_KEY_CERTIFICATE]));
+}
+
+void NovellVpnSettingWidget::writeConfig()
+{
+    kDebug();
+
+    d->setting->setServiceType(QLatin1String(NM_DBUS_SERVICE_NOVELLVPN));
+
+    QStringMap data;
+    QVariantMap secretData;
+
+    // required settings
+    data.insert(NM_NOVELLVPN_KEY_GATEWAY, d->ui.leGateway->text());
+
+    if (d->ui.cmbGwType->currentIndex() == 0) {
+        data.insert(QLatin1String(NM_NOVELLVPN_KEY_GWTYPE), QLatin1String(NM_NOVELLVPN_GWTYPE_NORTEL_STRING));
+
+        if (d->ui.cmbAuthType->currentIndex() == 0) {
+            data.insert(QLatin1String(NM_NOVELLVPN_KEY_AUTHTYPE), QLatin1String(NM_NOVELLVPN_CONTYPE_GROUPAUTH_STRING));
+
+            data.insert(QLatin1String(NM_NOVELLVPN_KEY_USER_NAME), d->ui.leUserName->text());
+            data.insert(QLatin1String(NM_NOVELLVPN_KEY_GROUP_NAME), d->ui.leGroupName->text());
+            secretData.insert(QLatin1String(NM_NOVELLVPN_KEY_USER_PWD), d->ui.leUserPass->text());
+            secretData.insert(QLatin1String(NM_NOVELLVPN_KEY_GRP_PWD), d->ui.leGroupPass->text());
+        } else {
+            writeX509Auth(data, secretData);
+        }
+    } else {
+        data.insert(QLatin1String(NM_NOVELLVPN_KEY_GWTYPE), QLatin1String(NM_NOVELLVPN_GWTYPE_STDGW_STRING));
+        writeX509Auth(data, secretData);
+    }
+
+    // advanced dialog
+    data.insert(QLatin1String(NM_NOVELLVPN_KEY_DHGROUP),
+            (d->advUi.rbDh1->isChecked()
+             ? QString::number(DHGROUP_DH1)
+             : QString::number(DHGROUP_DH2)));
+
+    if (d->advUi.rbPfOff->isChecked()) {
+        data.insert(QLatin1String(NM_NOVELLVPN_KEY_PFSGROUP), QString::number(PFSGROUP_OFF));
+    } else if (d->advUi.rbPf1->isChecked()) {
+        data.insert(QLatin1String(NM_NOVELLVPN_KEY_PFSGROUP), QString::number(PFSGROUP_PFS1));
+    } else {
+        data.insert(QLatin1String(NM_NOVELLVPN_KEY_PFSGROUP), QString::number(PFSGROUP_PFS2));
+    }
+
+    data.insert(QLatin1String(NM_NOVELLVPN_KEY_NOSPLITTUNNEL), d->advUi.cbDisableSplit->isChecked() ? QLatin1String("yes") : QLatin1String("no"));
+
+    d->setting->setData(data);
+    d->setting->setVpnSecrets(secretData);
+}
+
+void NovellVpnSettingWidget::writeX509Auth(QStringMap & data, QVariantMap & secretData)
+{
+    data.insert(QLatin1String(NM_NOVELLVPN_KEY_AUTHTYPE), QLatin1String(NM_NOVELLVPN_CONTYPE_X509_STRING));
+    data.insert(NM_NOVELLVPN_KEY_CERTIFICATE, d->ui.x509Cert->url().path().toUtf8());
+    secretData.insert(QLatin1String(NM_NOVELLVPN_KEY_CERT_PWD), d->ui.x509CertPass->text());
+}
+
+void NovellVpnSettingWidget::readSecrets()
+{
+    QVariantMap secrets = d->setting->vpnSecrets();
+    kDebug() << "Value of" << NM_NOVELLVPN_KEY_CERT_PWD << secrets.value(QLatin1String(NM_NOVELLVPN_KEY_CERT_PWD)).toString();
+    d->ui.x509CertPass->setText(secrets.value(QLatin1String(NM_NOVELLVPN_KEY_CERT_PWD)).toString());
+    d->ui.leUserPass->setText(secrets.value(QLatin1String(NM_NOVELLVPN_KEY_USER_PWD)).toString());
+    d->ui.leGroupPass->setText(secrets.value(QLatin1String(NM_NOVELLVPN_KEY_GRP_PWD)).toString());
+}
+
+void NovellVpnSettingWidget::validate()
+{
+//    setValid(!d->ui.leGateway->text().isEmpty());
+//    emit valid(isValid());
+}
+
+// vim: sw=4 sts=4 et tw=100
Index: vpnplugins/novellvpn/novellvpn.h
===================================================================
--- vpnplugins/novellvpn/novellvpn.h	(revision 0)
+++ vpnplugins/novellvpn/novellvpn.h	(revision 0)
@@ -0,0 +1,42 @@
+/*
+Copyright 2009 Will Stephenson <wstephenson@kde.org>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef KNM4_NOVELLVPN_H
+#define KNM4_NOVELLVPN_H
+
+#include "vpnuiplugin.h"
+
+#include <QVariant>
+
+namespace Knm
+{
+    class Connection;
+} // namespace Knm
+
+class NovellVpnUiPlugin : public VpnUiPlugin
+{
+Q_OBJECT
+public:
+    NovellVpnUiPlugin(QObject * parent = 0, const QVariantList& = QVariantList());
+    virtual ~NovellVpnUiPlugin();
+    SettingWidget * widget(Knm::Connection *, QWidget * parent = 0);
+};
+
+#endif //  KNM4_NOVELLVPN_H
Index: vpnplugins/novellvpn/CMakeLists.txt
===================================================================
--- vpnplugins/novellvpn/CMakeLists.txt	(revision 0)
+++ vpnplugins/novellvpn/CMakeLists.txt	(revision 0)
@@ -0,0 +1,19 @@
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/ui)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../libs)
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../libs/internals)
+
+set(novellvpn_SRCS
+   novellvpn.cpp
+   novellvpnwidget.cpp
+   )
+
+kde4_add_ui_files(novellvpn_SRCS novellvpnprop.ui novellvpnadvancedprop.ui)
+
+kde4_add_plugin(networkmanagement_novellvpnui ${novellvpn_SRCS})
+
+target_link_libraries(networkmanagement_novellvpnui ${KDE4_KIO_LIBS} knmui knminternals )
+
+install(TARGETS networkmanagement_novellvpnui  DESTINATION ${PLUGIN_INSTALL_DIR})
+
+install( FILES networkmanagement_novellvpnui.desktop  DESTINATION ${SERVICES_INSTALL_DIR})
+
Index: vpnplugins/novellvpn/novellvpnwidget.h
===================================================================
--- vpnplugins/novellvpn/novellvpnwidget.h	(revision 0)
+++ vpnplugins/novellvpn/novellvpnwidget.h	(revision 0)
@@ -0,0 +1,56 @@
+/*
+Copyright 2009 Will Stephenson <wstephenson@kde.org>
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License as
+published by the Free Software Foundation; either version 2 of
+the License or (at your option) version 3 or any later version
+accepted by the membership of KDE e.V. (or its successor approved
+by the membership of KDE e.V.), which shall act as a proxy
+defined in Section 14 of version 3 of the license.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef NOVELLVPNWIDGET_H
+#define NOVELLVPNWIDGET_H
+
+#include "settingwidget.h"
+
+#include <types.h>
+
+namespace Knm
+{
+    class Connection;
+} // namespace Knm
+
+class NovellVpnSettingWidget : public SettingWidget
+{
+Q_OBJECT
+public:
+    NovellVpnSettingWidget(Knm::Connection *,  QWidget * parent = 0);
+    ~NovellVpnSettingWidget();
+    void readConfig();
+    void writeConfig();
+    void readSecrets();
+protected Q_SLOTS:
+    void validate();
+
+    void advancedClicked();
+
+    void gatewayTypeChanged(int);
+    void showPasswordsChanged(bool);
+private:
+    void readX509Auth(const QStringMap &);
+    void writeX509Auth(QStringMap & data, QVariantMap & secretData);
+    class Private;
+    Private * d;
+};
+
+#endif // NOVELLVPNWIDGET_H
Index: vpnplugins/CMakeLists.txt
===================================================================
--- vpnplugins/CMakeLists.txt	(revision 1043876)
+++ vpnplugins/CMakeLists.txt	(working copy)
@@ -1,3 +1,4 @@
 add_subdirectory(openvpn)
+add_subdirectory(novellvpn)
 add_subdirectory(pptp)
 add_subdirectory(vpnc)
openSUSE Build Service is sponsored by