From 1e0dd58661c9097fb41218ee7e3515f2d8ba8dac Mon Sep 17 00:00:00 2001 From: tpearson Date: Mon, 17 Oct 2011 17:38:53 +0000 Subject: Add dead-ended knetworkmanager 0.8 source Add copy of same for knetworkmanager 0.9 starting point git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/knetworkmanager8@1259314 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- .../vpn-plugins/pptp/src/Makefile.am | 12 + .../vpn-plugins/pptp/src/Makefile.am.automake | 34 +++ .../vpn-plugins/pptp/src/knetworkmanager-pptp.cpp | 231 +++++++++++++++++++ .../vpn-plugins/pptp/src/knetworkmanager-pptp.h | 84 +++++++ .../vpn-plugins/pptp/src/pptpauth.ui | 95 ++++++++ .../vpn-plugins/pptp/src/pptpprop.ui | 244 +++++++++++++++++++++ 6 files changed, 700 insertions(+) create mode 100644 knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am create mode 100644 knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am.automake create mode 100644 knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp create mode 100644 knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.h create mode 100644 knetworkmanager-0.8/vpn-plugins/pptp/src/pptpauth.ui create mode 100644 knetworkmanager-0.8/vpn-plugins/pptp/src/pptpprop.ui (limited to 'knetworkmanager-0.8/vpn-plugins/pptp/src') diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am b/knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am new file mode 100644 index 0000000..d5d943c --- /dev/null +++ b/knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am @@ -0,0 +1,12 @@ +INCLUDES = $(KNETWORKMANAGER_CFLAGS) $(PACKAGE_CFLAGS) $(all_includes) + +METASOURCES = AUTO + +kde_module_LTLIBRARIES = knetworkmanager_pptp.la +knetworkmanager_pptp_la_SOURCES = knetworkmanager-pptp.cpp \ + pptpprop.ui \ + pptpauth.ui +noinst_HEADERS = knetworkmanager-pptp.h +knetworkmanager_pptp_la_LDFLAGS = -module $(all_libraries) +knetworkmanager_pptp_la_LIBADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) + diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am.automake b/knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am.automake new file mode 100644 index 0000000..2c8f5b0 --- /dev/null +++ b/knetworkmanager-0.8/vpn-plugins/pptp/src/Makefile.am.automake @@ -0,0 +1,34 @@ +INCLUDES = $(PACKAGE_CFLAGS) $(all_includes) + +# rule for creating tqmoc files +%.tqmoc.cpp: %.h + $(TQMOC) -o $@ $< + +# rules for creating .h and .cpp from .ui +%.cpp: %.ui %.h + $(UIC) -tr tr2i18n -pch klocale.h -o $@ -impl $*.h $< + +%.h: %.ui + $(UIC) -o $@ $< + +all_TQMOC = knetworkmanager-vpnc.tqmoc.cpp \ + vpncauth.tqmoc.cpp \ + vpncprop.tqmoc.cpp + +all_METASOURCES = vpncauth.cpp \ + vpncprop.cpp + +all_IMPLEMENTATIONS = knetworkmanager-vpnc.cpp + +kde_module_LTLIBRARIES = knetworkmanager_vpnc.la +knetworkmanager_vpnc_la_SOURCES = $(all_METASOURCES) $(all_TQMOC) $(all_IMPLEMENTATIONS) +noinst_HEADERS = knetworkmanager-vpnc.h +knetworkmanager_vpnc_la_LDFLAGS = -module $(all_libraries) $(KDE_PLUGIN) +knetworkmanager_vpnc_la_LIBADD = $(LIB_KDEUI) $(LIB_KDECORE) $(LIB_QT) + +service_DATA = knetworkmanager_vpnc.desktop +servicedir = $(kde_servicesdir) + +CLEANFILES = $(all_TQMOC) $(all_METASOURCES) + + diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp b/knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp new file mode 100644 index 0000000..091b400 --- /dev/null +++ b/knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.cpp @@ -0,0 +1,231 @@ +/*************************************************************************** + * + * knetworkmanager-pptp.cpp - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 + * + **************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "knetworkmanager-pptp.h" + +typedef KGenericFactory PPTPPluginFactory; +K_EXPORT_COMPONENT_FACTORY( knetworkmanager_pptp, PPTPPluginFactory("knetworkmanager_pptp")); + + +PPTPPlugin::PPTPPlugin(TQObject* parent, const char* name, const TQStringList& args) + : VPNPlugin(parent, name, args) +{ + KLocale* loc = KGlobal::locale(); + loc->insertCatalogue("NetworkManager-pptp"); +} + +PPTPPlugin::~PPTPPlugin() +{ + +} + +VPNConfigWidget* PPTPPlugin::CreateConfigWidget(TQWidget* parent) +{ + return new PPTPConfig(parent); +} + +VPNAuthenticationWidget* PPTPPlugin::CreateAuthenticationWidget(TQWidget* parent) +{ + return new PPTPAuthentication(parent); +} + + +PPTPConfig::PPTPConfig(TQWidget* parent) + : VPNConfigWidget(parent) +{ + TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1); + _pptpWidget = new PPTPConfigWidget(this); + tqlayout->addWidget(_pptpWidget); + + connect(_pptpWidget->chkIPAdresses, TQT_SIGNAL(toggled(bool)), _pptpWidget->routes, TQT_SLOT(setEnabled(bool))); + + this->languageChange(); +} + +PPTPConfig::~PPTPConfig() +{ + +} + +void PPTPConfig::languageChange() +{ + +} + +void PPTPConfig::setVPNData(const TQStringList& routes, const TQMap& properties) +{ + // fill up our inputfields (only textfields atm) + for(TQMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) + { + TQString entry = it.key(); + TQString value = it.data(); + + if (entry == "gateway") + { + _pptpWidget->gateway->setText(value); + } + else if (entry == "refuse-eap") + { + _pptpWidget->chk_refuseeap->setChecked(value == "yes" || value == "true"); + } + else if (entry == "refuse-pap") + { + _pptpWidget->chk_refusepap->setChecked(value == "yes" || value == "true"); + } + else if (entry == "refuse-chap") + { + _pptpWidget->chk_refusechap->setChecked(value == "yes" || value == "true"); + } + else if (entry == "refuse-mschap") + { + _pptpWidget->chk_refusemschap->setChecked(value == "yes" || value == "true"); + } + else if (entry == "refuse-mschapv2") + { + _pptpWidget->chk_refusemschapv2->setChecked(value == "yes" || value == "true"); + } + else if (entry == "require-mppe") + { + _pptpWidget->chk_requiremppe->setChecked(value == "yes" || value == "true"); + } + else if (entry == "require-mppe-40") + { + _pptpWidget->chk_requiremppe40->setChecked(value == "yes" || value == "true"); + } + else if (entry == "require-mppe-128") + { + _pptpWidget->chk_requiremppe128->setChecked(value == "yes" || value == "true"); + } + else if (entry == "mppe-stateful") + { + _pptpWidget->chk_mppestateful->setChecked(value == "yes" || value == "true"); + } + else if (entry == "nodeflate") + { + _pptpWidget->chk_nodeflate->setChecked(value == "yes" || value == "true"); + } + } + + // set routes + if (!routes.empty()) + { + _pptpWidget->chkIPAdresses->setChecked(true); + _pptpWidget->routes->setText(routes.join(" ")); + } +} + +TQMap PPTPConfig::getVPNProperties() +{ + // build a StingList of properties + TQMap strlist; + strlist.insert("gateway", TQString(_pptpWidget->gateway->text())); + strlist.insert("refuse-eap", TQString(_pptpWidget->chk_refuseeap->isChecked() ? "yes" : "no")); + strlist.insert("refuse-pap", TQString(_pptpWidget->chk_refusepap->isChecked() ? "yes" : "no")); + strlist.insert("refuse-chap", TQString(_pptpWidget->chk_refusechap->isChecked() ? "yes" : "no")); + strlist.insert("refuse-mschap", TQString(_pptpWidget->chk_refusemschap->isChecked() ? "yes" : "no")); + strlist.insert("refuse-mschapv2", TQString(_pptpWidget->chk_refusemschapv2->isChecked() ? "yes" : "no")); + strlist.insert("require-mppe", TQString(_pptpWidget->chk_requiremppe->isChecked() ? "yes" : "no")); + strlist.insert("require-mppe-40", TQString(_pptpWidget->chk_requiremppe40->isChecked() ? "yes" : "no")); + strlist.insert("require-mppe-128", TQString(_pptpWidget->chk_requiremppe128->isChecked() ? "yes" : "no")); + strlist.insert("mppe-stateful", TQString(_pptpWidget->chk_mppestateful->isChecked() ? "yes" : "no")); + strlist.insert("nodeflate", TQString(_pptpWidget->chk_nodeflate->isChecked() ? "yes" : "no")); + + // Current network-manager-pptp plugin supports bluetooth-gprs,dialup and pptp. + // We want a pptp connection. + //strlist.insert("ppp-connection-type", "pptp"); + + return strlist; +} + +TQStringList PPTPConfig::getVPNRoutes() +{ + TQStringList strlist; + if(_pptpWidget->chkIPAdresses->isChecked()) + { + strlist = TQStringList::split(" ", _pptpWidget->routes->text()); + } + return strlist; + +} + +bool PPTPConfig::hasChanged() +{ + return true; +} + +bool PPTPConfig::isValid(TQStringList& err_msg) +{ + bool retval = true; + if(_pptpWidget->gateway->text() == "") + { + err_msg.append(i18n("At least the gateway has to be supplied.")); + retval = false; + } + return retval; +} + +PPTPAuthentication::PPTPAuthentication(TQWidget* parent, char* name) + : VPNAuthenticationWidget(parent, name) +{ + TQVBoxLayout* tqlayout = new TQVBoxLayout(this, 1, 1); + _pptpAuth = new PPTPAuthenticationWidget(this); + tqlayout->addWidget(_pptpAuth); +} + +PPTPAuthentication::~PPTPAuthentication() +{ + +} + +TQMap PPTPAuthentication::getPasswords() +{ + // network-manager-pptp will fail hard if "CHAP" is not the + // first element in the username&password list. + TQMap pwds; + //pwds.insert("CHAP", "CHAP"); + pwds.insert("user", TQString(_pptpAuth->username->text())); + pwds.insert("password", TQString(_pptpAuth->password->password())); + pwds.insert("domain", TQString(_pptpAuth->domain->text())); + return pwds; +} + +void PPTPAuthentication::setPasswords(TQString name, TQString value) { + if (name == TQString("password")) { + _pptpAuth->password->erase(); + _pptpAuth->password->insert(value); + } +} \ No newline at end of file diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.h b/knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.h new file mode 100644 index 0000000..d703743 --- /dev/null +++ b/knetworkmanager-0.8/vpn-plugins/pptp/src/knetworkmanager-pptp.h @@ -0,0 +1,84 @@ +/*************************************************************************** + * + * knetworkmanager-vpnc.h - A NetworkManager frontend for KDE + * + * Copyright (C) 2006 Novell, Inc. + * + * Author: Helmut Schaa , + * + * 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 KNETWORKMANAGER_PPTP_H +#define KNETWORKMANAGER_PPTP_H + +#include +#include +#include +#include + +#include "knetworkmanager-vpnplugin.h" +#include "pptpprop.h" +#include "pptpauth.h" + +class PPTPPlugin : public VPNPlugin +{ + Q_OBJECT + TQ_OBJECT + public: + PPTPPlugin(TQObject*, const char*, const TQStringList&); + ~PPTPPlugin(); + + VPNConfigWidget* CreateConfigWidget(TQWidget* parent=0); + VPNAuthenticationWidget* CreateAuthenticationWidget(TQWidget* parent=0); +}; + +class PPTPConfig : public VPNConfigWidget +{ + Q_OBJECT + TQ_OBJECT + public: + void setVPNData(const TQStringList& routes, const TQMap& properties); + TQMap getVPNProperties(); + TQStringList getVPNRoutes(); + bool hasChanged(); + bool isValid(TQStringList& ); + + PPTPConfig(TQWidget* parent); + ~PPTPConfig(); + + private: + PPTPConfigWidget* _pptpWidget; + + protected slots: + void languageChange(); +}; + +class PPTPAuthentication : public VPNAuthenticationWidget +{ + Q_OBJECT + TQ_OBJECT + public: + PPTPAuthentication(TQWidget* parent = NULL, char* name = NULL); + ~PPTPAuthentication(); + TQMap getPasswords(); + void setPasswords(TQString name, TQString value); + + private: + PPTPAuthenticationWidget* _pptpAuth; +}; + +#endif /* KNETWORKMANAGER_PPTP_H */ diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/src/pptpauth.ui b/knetworkmanager-0.8/vpn-plugins/pptp/src/pptpauth.ui new file mode 100644 index 0000000..5388561 --- /dev/null +++ b/knetworkmanager-0.8/vpn-plugins/pptp/src/pptpauth.ui @@ -0,0 +1,95 @@ + +PPTPAuthenticationWidget + + + PPTPAuthenticationWidget + + + + 0 + 0 + 277 + 111 + + + + PPTPAuthentication + + + + unnamed + + + 0 + + + + spacer1 + + + Vertical + + + Expanding + + + + 20 + 20 + + + + + + textLabel1 + + + Domain + + + + + textLabel1 + + + Password + + + + + textLabel1_2 + + + Username + + + + + domain + + + + + password + + + + + username + + + + + + username + password + domain + + + + + + + + + diff --git a/knetworkmanager-0.8/vpn-plugins/pptp/src/pptpprop.ui b/knetworkmanager-0.8/vpn-plugins/pptp/src/pptpprop.ui new file mode 100644 index 0000000..b57e065 --- /dev/null +++ b/knetworkmanager-0.8/vpn-plugins/pptp/src/pptpprop.ui @@ -0,0 +1,244 @@ + +PPTPConfigWidget + + + PPTPConfigWidget + + + + 0 + 0 + 535 + 303 + + + + + unnamed + + + 0 + + + + kTabWidget1 + + + + TabPage + + + Required Information + + + + unnamed + + + + textLabel3 + + + Gateway: + + + IPSec_gateway + + + + + gateway + + + + + spacer9 + + + Vertical + + + Expanding + + + + 20 + 30 + + + + + + + + TabPage + + + Optional Information + + + + unnamed + + + + chkIPAdresses + + + Only use VPN Connection for these Adresses +(for example: 172.16.0.0/16 10.11.12.0/24) + + + + + spacer10 + + + Vertical + + + Expanding + + + + 20 + 40 + + + + + + routes + + + false + + + + + spacer4 + + + Horizontal + + + Expanding + + + + 220 + 20 + + + + + + spacer3 + + + Horizontal + + + Expanding + + + + 230 + 20 + + + + + + chk_refuseeap + + + Refuse EAP + + + + + chk_refusepap + + + Refuse PAP + + + + + chk_refusechap + + + Refuse CHAP + + + + + chk_refusemschap + + + Refuse MSCHAP + + + + + chk_refusemschapv2 + + + Refuse MSCHAP v2 + + + + + chk_requiremppe + + + Require MPPE Encryption + + + + + chk_requiremppe40 + + + Require MPPE 40-bit Encryption + + + + + chk_requiremppe128 + + + Require MPPE 128-bit Encryption + + + + + chk_mppestateful + + + Use MPPE Stateful Encryption + + + + + chk_nodeflate + + + No Deflation + + + + + + + + + + + + + + + + -- cgit v1.2.1