1
/***************************************************************************
3
* knetworkmanager-vpnmanager.cpp - A NetworkManager frontend for KDE
5
* Copyright (C) 2006 Novell, Inc.
7
* Author: Timo Hoenig <thoenig@suse.de>, <thoenig@nouse.net>
8
* Helmut Schaa <hschaa@suse.de>, <helmut.schaa@gmx.de>
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
**************************************************************************/
26
#define SERVICE_DIR "/etc/NetworkManager/VPN"
33
#include "knetworkmanager-vpnmanager.h"
34
#include "knetworkmanager-vpnservice.h"
35
#include "knetworkmanager-vpnplugin.h"
42
VPNManager::getVPNServices ()
47
QDir serviceDir(SERVICE_DIR, QString::null, QDir::Name|QDir::IgnoreCase, QDir::Files);
48
QStringList services = serviceDir.entryList ().grep (".name", true);
50
if (services.count () > 0)
53
// read in all available Services
54
for (QStringList::Iterator i = services.begin (); i != services.end (); ++i) {
55
QString service = SERVICE_DIR + QString ("/") + *i;
56
KConfig* kconfig = new KConfig (service, true, true, "config");
57
kconfig->setGroup ("VPN Connection");
59
printf("VPN Service %s\n", kconfig->readEntry ("name", QString::null).ascii());
61
// create new VPNService Object
62
VPNService* vpnservice = new VPNService(kconfig->readEntry ("name", QString::null), kconfig->readEntry ("service", QString::null), KNetworkManager::getInstance());
63
if (!vpnservice->getVPNPlugin())
66
list.push_back(vpnservice);
75
VPNManager::getVPNService(QString service_type)
80
QDir serviceDir(SERVICE_DIR, QString::null, QDir::Name|QDir::IgnoreCase, QDir::Files);
81
QStringList services = serviceDir.entryList ().grep (".name", true);
83
if (services.count () > 0)
86
// read in all available Services
87
for (QStringList::Iterator i = services.begin (); i != services.end (); ++i) {
88
QString service = SERVICE_DIR + QString ("/") + *i;
89
KConfig* kconfig = new KConfig (service, true, true, "config");
90
kconfig->setGroup ("VPN Connection");
92
if (kconfig->readEntry ("service", QString::null) == service_type)
94
// create new VPNService Object
95
VPNService* vpnservice = new VPNService(kconfig->readEntry ("name", QString::null), kconfig->readEntry ("service", QString::null), KNetworkManager::getInstance());
96
if (!vpnservice->getVPNPlugin())
107
#include "knetworkmanager-vpnmanager.moc"