summaryrefslogtreecommitdiffstats
path: root/tdenetworkmanager/src/tdenetman-vpnservice.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-06 21:16:31 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-06 21:16:31 -0500
commit82102f3f7168b27e115f9f959bad75c99c1ae76a (patch)
tree100a1dc3ada92e5e969b68ac3f8b1d21aae10e27 /tdenetworkmanager/src/tdenetman-vpnservice.cpp
parentd45099229d40b4850c68eb4a64f67ff3ad0dcbc5 (diff)
downloadtdenetworkmanager-82102f3f7168b27e115f9f959bad75c99c1ae76a.tar.gz
tdenetworkmanager-82102f3f7168b27e115f9f959bad75c99c1ae76a.zip
Rename files to something more sensible
Diffstat (limited to 'tdenetworkmanager/src/tdenetman-vpnservice.cpp')
-rw-r--r--tdenetworkmanager/src/tdenetman-vpnservice.cpp123
1 files changed, 123 insertions, 0 deletions
diff --git a/tdenetworkmanager/src/tdenetman-vpnservice.cpp b/tdenetworkmanager/src/tdenetman-vpnservice.cpp
new file mode 100644
index 0000000..978a183
--- /dev/null
+++ b/tdenetworkmanager/src/tdenetman-vpnservice.cpp
@@ -0,0 +1,123 @@
+/***************************************************************************
+ *
+ * tdenetman-vpnservice.cpp - A NetworkManager frontend for KDE
+ *
+ * Copyright (C) 2006 Novell, Inc.
+ *
+ * Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
+ * Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.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
+ *
+ **************************************************************************/
+
+#define SERVICE_DIR "/etc/NetworkManager/VPN"
+
+#include <stdlib.h>
+#include <kconfig.h>
+#include <tqdom.h>
+#include <tqdir.h>
+#include <klocale.h>
+#include <kdebug.h>
+#include <kstddirs.h>
+#include <kprocess.h>
+#include <kconfig.h>
+#include <kplugininfo.h>
+
+#include "tdenetman-pluginmanager.h"
+#include "tdenetman-vpnservice.h"
+#include "tdenetman-vpnplugin.h"
+
+/*
+ * class VPNService
+ *
+ */
+
+VPNService::VPNService(const TQString& serviceName, const TQString& service, TQObject* parent, const char* name)
+ : TQObject(parent, name)
+{
+ _name = serviceName;
+ _service = service;
+ _vpnPlugin = NULL;
+
+ // query if a plugin for this vpn service is available
+ PluginManager* plugMan = PluginManager::getInstance();
+ if (plugMan)
+ {
+ TQStringList list = plugMan->getPluginList("KNetworkManager/VPNPlugin", "X-NetworkManager-Services", serviceName);
+ if (list.size() > 0)
+ {
+ // get the first VPN Plugin handling our VPNService
+ VPNPlugin* vpnPlugin = dynamic_cast<VPNPlugin*>( plugMan->getPlugin(list.first()) );
+ if (vpnPlugin)
+ {
+ kdDebug() << k_funcinfo << i18n("Using VPN plugin '%1' for service '%2'").arg(list.first()).arg(serviceName) << endl;
+ _vpnPlugin = vpnPlugin;
+ }
+ }
+ }
+}
+
+VPNService::~VPNService()
+{
+
+}
+
+TQString VPNService::getIcon()
+{
+ if (!_vpnPlugin.isNull())
+ {
+ PluginManager* plugMan = PluginManager::getInstance();
+ if (plugMan)
+ {
+ const KPluginInfo* info = plugMan->getPluginInfo(_vpnPlugin);
+ if (info)
+ {
+ TQString icon = info->icon();
+ if (!icon.isEmpty())
+ return icon;
+ }
+ }
+ }
+ return "encrypted";
+}
+
+VPNPlugin* VPNService::getVPNPlugin()
+{
+ return _vpnPlugin;
+}
+
+TQString VPNService::getService() const
+{
+ return _service;
+}
+
+TQString VPNService::getDisplayName() const
+{
+ const KPluginInfo* info = NULL;
+ PluginManager* plugMan = PluginManager::getInstance();
+ if (_vpnPlugin && plugMan)
+ if ( (info = plugMan->getPluginInfo(_vpnPlugin)) )
+ if (!info->name().isEmpty())
+ return info->name();
+ return _name;
+}
+
+TQString VPNService::getName() const
+{
+ return _name;
+}
+
+#include "tdenetman-vpnservice.moc"