1
/***************************************************************************
3
* knetworkmanager-vpn.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"
27
#define GCONF_PRE "/.gconf"
28
#define VPN_PATH "/system/networking/vpn_connections"
39
#include <kplugininfo.h>
41
#include "knetworkmanager-vpn.h"
42
#include "knetworkmanager-vpn_dbus.h"
43
#include "knetworkmanager-storage.h"
44
#include "knetworkmanager-vpnplugin.h"
45
#include "knetworkmanager-vpnconnectionsdialog.h"
46
#include "knetworkmanager-vpnauthenticationdialog.h"
53
VPNConnection::setConfigGroup(const QString& cfgGrp)
55
_cfgGrp = new KConfigGroup(KGlobal::config(), cfgGrp);
60
VPNConnection::getName () const
66
VPNConnection::setName (const QString & name)
72
VPNConnection::getVPNService() const
78
VPNConnection::getService () const
81
return _vpnService->getService();
87
VPNConnection::getServiceName () const
90
return _vpnService->getName();
96
VPNConnection::setServiceName(const QString& service)
98
_vpnService = _vpn->getVPNService(service);
102
VPNConnection::getUser () const
108
VPNConnection::setUser (const QString & user)
114
VPNConnection::getRoutes () const
120
VPNConnection::addRoute (const QString & route)
122
_routes.append (route);
126
VPNConnection::setRoutes(const QStringList& routes)
132
VPNConnection::getData () const
138
VPNConnection::addData (const QString & data)
144
VPNConnection::setData(const QStringList & data)
146
// overwrite all data
151
VPNConnection::getPasswords () const
157
VPNConnection::addPasswords (const QStringList & passwords, bool storePasswordsPermanent, bool storePasswordsSession)
159
_passwords = passwords;
160
if (_storePasswordsPermanent = storePasswordsPermanent)
162
// store passwords in KWallet
163
KNetworkManagerStorage* storage = KNetworkManagerStorage::getInstance();
164
QMap<QString, QString> map;
165
map.insert("passwords", _passwords.join(" "));
166
storage->storeCredentials(_name, map);
168
// should the pwd stored for this session?
169
_storePasswordsSession = storePasswordsSession;
173
VPNConnection::getActivationStage () const
175
return _activationStage;
179
VPNConnection::setActivationStage (NMVPNActStage activationStage)
181
_activationStage = activationStage;
182
emit activationStateChanged ();
186
VPNConnection::setVPNConnectionFailure(QString& member, QString& err_msg)
188
emit connectionFailure(member, err_msg);
192
VPNConnection::getAuthHelper () const
194
return _vpnService->getAuthHelper();
198
VPNConnection::setAuthHelper (const QString & authHelper)
200
_authHelper = authHelper;
204
VPNConnection::isValid ()
208
/* _routes is allowed to be empty for some VPN service */
209
if (_name == QString::null || _user == QString::null || _data.empty () || _vpnService == NULL)
216
VPNConnection::isReadonly()
222
VPNConnection::isConfirmedByNM()
224
return _confirmedByNM;
228
VPNConnection::setConfirmedByNM(bool confirmed)
230
_confirmedByNM = confirmed;
233
VPNConnection::VPNConnection (VPN* parent, const char * name ) : QObject( parent, name )
236
_name = QString::null;
237
_user = getenv ("USER");
238
_authHelper = QString::null;
239
_activationStage = NM_VPN_ACT_STAGE_UNKNOWN;
243
_storePasswordsPermanent = false;
244
_storePasswordsSession = false;
247
_confirmedByNM = false;
250
VPNConnection::VPNConnection (const QString& cfgGrp, VPN* parent, const char * name ) : QObject( parent, name )
253
_name = QString::null;
254
_user = getenv ("USER");
255
_authHelper = QString::null;
256
_activationStage = NM_VPN_ACT_STAGE_UNKNOWN;
260
_storePasswordsPermanent = false;
261
_storePasswordsSession = false;
263
_confirmedByNM = false;
266
_cfgGrp = new KConfigGroup(KGlobal::config(), cfgGrp);
268
// read attribs from config
269
_name = _cfgGrp->readEntry("name");
270
_vpnService = _vpn->getVPNService(_cfgGrp->readEntry("service_name"));
271
_routes = _cfgGrp->readPropertyEntry("routes", QVariant::StringList).toStringList();
272
_data = _cfgGrp->readPropertyEntry("vpn_data", QVariant::StringList).toStringList();
276
VPNConnection::~VPNConnection ()
283
bool VPNConnection::save()
288
if (_dirty && this->isValid())
290
// write attribs to configfile
291
_cfgGrp->writeEntry("name", _name);
293
_cfgGrp->writeEntry("service_name", _vpnService->getName());
294
_cfgGrp->writeEntry("routes", _routes);
295
_cfgGrp->writeEntry("vpn_data", _data);
300
_cfgGrp->deleteGroup();
306
void VPNConnection::remove()
311
bool VPNConnection::hasPasswordsStored()
313
// do we have some passwords in kwallet?
314
KNetworkManagerStorage* storage = KNetworkManagerStorage::getInstance();
315
_storePasswordsPermanent = storage->hasCredentialsStored(_name);
317
// check if we have the passwords already
318
return _storePasswordsPermanent || _storePasswordsSession;
322
VPNConnection::slotCredentialsLoaded (QString /*id*/, QMap<QString, QString> map, bool canceled)
324
// credentials got loaded
325
if ( !map.isEmpty() )
327
_passwords = QStringList::split(" ", map["passwords"], TRUE);
328
_storePasswordsPermanent = true;
330
emit passwordsRestored(canceled, _passwords, _storePasswordsPermanent, _storePasswordsSession);
334
VPNConnection::restorePasswords()
336
if (_storePasswordsSession && !_passwords.empty())
338
// we have the passwords here -> reply
339
emit passwordsRestored(false, _passwords, _storePasswordsPermanent, _storePasswordsSession);
343
// no passwords here -> ask the wallet and wait for answer
344
CredentialsRequest* req = KNetworkManagerStorage::getInstance()->credentialsAsync(_name);
345
connect(req, SIGNAL(credentialsLoaded(QString, QMap<QString, QString>, bool)), this, SLOT(slotCredentialsLoaded (QString, QMap<QString, QString>, bool)));
346
req->loadCredentials();
350
VPNConnection::VPNConnection (const VPNConnection & vpnConnection) : QObject( vpnConnection.parent(), vpnConnection.name())
352
_name = vpnConnection.getName ();
353
_user = vpnConnection.getUser();
354
_routes = vpnConnection.getRoutes ();
355
_data = vpnConnection.getData ();
356
_passwords = vpnConnection.getPasswords ();
357
_activationStage = vpnConnection.getActivationStage ();
358
_authHelper = vpnConnection.getAuthHelper ();
362
VPNConnection::receiveAuthenticationData (KProcess* /* authHelper */, char* buffer, int len)
364
QStringList passwords = QStringList::split (QString ("\n"), QString::fromLatin1 (buffer, len), false);
365
this->addPasswords (passwords);
369
VPNConnection::authHelperExited (KProcess* authHelper)
371
if (authHelper->exitStatus() != 0)
372
this->setActivationStage(NM_VPN_ACT_STAGE_CANCELED);
374
VPNDBus::activateVPNConnection (this);
378
VPNConnection::authHelperExited (bool cancel, QStringList& passwords)
380
this->authHelperExited(cancel, passwords, false, false);
384
VPNConnection::authHelperExited (bool cancel, QStringList& passwords, bool storePasswordsPermanent, bool storePasswordsSession)
387
// lets fake a CANCELD Message, so the Statuswindow gets closed
388
this->setActivationStage(NM_VPN_ACT_STAGE_CANCELED);
391
this->addPasswords(passwords, storePasswordsPermanent, storePasswordsSession);
392
VPNDBus::activateVPNConnection ( this );
401
VPNService::VPNService(const QString& serviceName, const QString& service, VPN* parent, const char* name)
402
: QObject(parent, name)
408
_useInternalAuthentication = false;
410
// query if a plugin for this vpn service is available
411
PluginManager* plugMan = _vpn->getCtx()->getPluginManager();
414
QStringList list = plugMan->getPluginList("KNetworkManager/VPNPlugin", "X-NetworkManager-Services", serviceName);
417
// get the first VPN Plugin handling our VPNService
418
VPNPlugin* vpnPlugin = dynamic_cast<VPNPlugin*>( plugMan->getPlugin(list.first()) );
421
kdDebug() << k_funcinfo << i18n("Using VPN plugin '%1' for service '%2'").arg(list.first()).arg(serviceName) << endl;
422
_vpnPlugin = vpnPlugin;
423
_useInternalAuthentication = true;
428
// do we have a authentication dialog for this service?
429
if (!_useInternalAuthentication)
431
// we do not have an own auth dialog -> try to get the gnome dialog
432
_extAuthDialog = readAuthHelper();
433
kdDebug() << i18n("VPN: service %1 uses external authentication dialog (%2)").arg(serviceName).arg(_extAuthDialog) << endl;
437
VPNService::~VPNService()
442
QString VPNService::getIcon()
444
if (!_vpnPlugin.isNull())
446
PluginManager* plugMan = _vpn->getCtx()->getPluginManager();
449
const KPluginInfo* info = plugMan->getPluginInfo(_vpnPlugin);
452
QString icon = info->icon();
461
VPNPlugin* VPNService::getVPNPlugin()
466
QString VPNService::getService() const
471
QString VPNService::getDisplayName() const
473
const KPluginInfo* info = NULL;
474
PluginManager* plugMan = _vpn->getCtx()->getPluginManager();
475
if (_vpnPlugin && plugMan)
476
if ( (info = plugMan->getPluginInfo(_vpnPlugin)) )
477
if (!info->name().isEmpty())
482
QString VPNService::getName() const
487
bool VPNService::hasInternalAuthentication()
489
return _useInternalAuthentication;
492
QString VPNService::getAuthHelper()
494
return _extAuthDialog;
497
QString VPNService::readAuthHelper()
499
// get the auth helper
500
QDir serviceDir(SERVICE_DIR, QString::null, QDir::Name|QDir::IgnoreCase, QDir::Files);
501
QStringList services = serviceDir.entryList ().grep (".name", true);
502
QString retVal = QString::null;
504
for (QStringList::Iterator i = services.begin (); i != services.end (); ++i) {
505
QString service = SERVICE_DIR + QString ("/") + *i;
506
KConfig kconfig (service, true, true, "config");
507
kconfig.setGroup ("VPN Connection");
508
if (kconfig.readEntry ("service", QString::null) == _service) {
509
kconfig.setGroup ("GNOME");
510
QString authDialog = kconfig.readEntry ("auth-dialog", QString::null);
511
if ( !authDialog.isEmpty() ) {
515
printf ("Warning: No authentication helper for service \"%s\" found.\n", service.ascii ());
528
VPN::hasGnomeVPNConfig()
530
return !_gnomeVPNApplet.isEmpty();
534
VPN::startGnomeVPNConfig()
536
if (!_gnomeVPNApplet.isEmpty())
538
KProcess* configureVPNHelper = new KProcess ();
540
*configureVPNHelper << _gnomeVPNApplet;
542
// trigger the vpn module to reread the available connections
543
connect (configureVPNHelper, SIGNAL (processExited (KProcess*)),
544
this, SLOT (updateVPNConnections(KProcess*)));
546
configureVPNHelper->start (KProcess::NotifyOnExit);
551
VPN::vpnActivationStateChanged()
553
// look if at least one VPN Connection is active
554
for (VPNList::ConstIterator it = _vpnList->begin(); it != _vpnList->end(); ++it)
556
if ((*it)->getActivationStage() == NM_VPN_ACT_STAGE_ACTIVATED)
558
emit vpnConnectionStateChanged(true);
563
emit vpnConnectionStateChanged(false);
567
VPN::activateVPNConnection (VPNConnection* vpnConnection)
569
if (!vpnConnection) return;
571
if (vpnConnection->getVPNService()->hasInternalAuthentication())
573
// lets ask the plugin whether we have to show the widget or not
574
bool waitForPwds = true;
575
VPNPlugin* plugin = vpnConnection->getVPNService()->getVPNPlugin();
578
VPNAuthenticationWidget* auth = plugin->CreateAuthenticationWidget();
581
auth->setVPNData(vpnConnection->getRoutes(), vpnConnection->getData());
582
waitForPwds = auth->needsUserInteraction();
585
QStringList helper = auth->getPasswords();
586
vpnConnection->authHelperExited(false, helper, false, false);
594
// does the connection has its passwords stored (in session or permanent)
595
if (vpnConnection->hasPasswordsStored())
597
// disconnect every slot from the signal to avoid multiple calls of authHelperExited
598
disconnect(vpnConnection, SIGNAL(passwordsRestored(bool, QStringList&, bool, bool)), 0, 0);
599
connect(vpnConnection, SIGNAL(passwordsRestored(bool, QStringList&, bool, bool)), vpnConnection, SLOT(authHelperExited(bool, QStringList&, bool, bool)));
600
vpnConnection->restorePasswords();
604
// ok, we have to show the auth dialog so the user can type in his pwds
605
VPNAuthenticationDialog* dlg = new VPNAuthenticationDialog(vpnConnection);
606
connect(dlg, SIGNAL(done(bool, QStringList&, bool, bool)), vpnConnection, SLOT(authHelperExited(bool, QStringList&, bool, bool)));
613
// no internal authentication dialog -> use the external one
614
printf("External AuthHelper: %s\n", vpnConnection->getAuthHelper().ascii());
615
KProcess* authHelper = new KProcess ();
617
*authHelper << vpnConnection->getAuthHelper () \
618
<< "-n" << vpnConnection->getName () \
619
<< "-s" << vpnConnection->getService () \
622
connect (authHelper, SIGNAL (receivedStdout (KProcess*, char*, int)),
623
vpnConnection, SLOT (receiveAuthenticationData (KProcess*, char*, int)));
625
connect (authHelper, SIGNAL (processExited (KProcess*)),
626
vpnConnection, SLOT (authHelperExited (KProcess*)));
628
authHelper->start (KProcess::NotifyOnExit, KProcess::Stdout);
633
VPN::updateVPNConnections ()
635
// notify NM about the changed connections
636
for (VPNList::iterator i = _vpnList->begin (); i != _vpnList->end (); ++i) {
637
VPNDBus::updateVPNConnection (*i);
642
VPN::updateVPNConnections (KProcess* /* p */)
644
for (VPNList::iterator i = _vpnList->begin (); i != _vpnList->end (); ++i) {
651
this->updateVPNConnections();
655
VPN::disconnectVPNConnection (void)
657
VPNDBus::disconnectVPNConnection ();
661
VPN::isAvailable (void)
667
VPN::getAuthHelper(const QString & serviceName)
669
// get the auth helper
670
QDir* serviceDir = new QDir (SERVICE_DIR, QString::null, QDir::Name|QDir::IgnoreCase, QDir::Files);
671
QStringList services = serviceDir->entryList ().grep (".name", true);
673
for (QStringList::Iterator i = services.begin (); i != services.end (); ++i) {
674
QString service = SERVICE_DIR + QString ("/") + *i;
675
KConfig* kconfig = new KConfig (service, true, true, "config");
676
kconfig->setGroup ("VPN Connection");
677
if (kconfig->readEntry ("service", QString::null) == serviceName) {
678
kconfig->setGroup ("GNOME");
679
QString authDialog = kconfig->readEntry ("auth-dialog", QString::null);
680
if ( !authDialog.isEmpty() ) {
683
printf ("Warning: No authentication helper for service \"%s\" found.\n", service.ascii ());
692
VPN::addConnection (const QString & cfgGrp)
694
VPNConnection* vpnConnection = new VPNConnection ( cfgGrp, this, "vpnconnection");
696
if (!vpnConnection->getName () || !vpnConnection->getServiceName ())
699
if (vpnConnection->isValid ())
701
_vpnList->append (vpnConnection);
702
connect(vpnConnection, SIGNAL(activationStateChanged()), this, SLOT(vpnActivationStateChanged()));
705
delete vpnConnection;
709
VPN::appendVPNConnection(VPNConnection* vpnConnection)
711
if (vpnConnection->isValid())
713
_vpnList->append(vpnConnection);
714
connect(vpnConnection, SIGNAL(activationStateChanged()), this, SLOT(vpnActivationStateChanged()));
721
VPN::getGConfConnection (const QString & connection)
723
VPNConnection* vpnConnection = new VPNConnection ( this, "vpnconnection" );
729
QDomDocument doc ("vpnconnection");
730
QFile file (_confPath + "/" + connection + "/%gconf.xml");
731
if (file.open (IO_ReadOnly) == false)
733
if (doc.setContent (&file) == false) {
739
QDomElement docElem = doc.documentElement ();
740
QDomNode n = docElem.firstChild ();
741
while (n.isNull () == false) {
742
QDomElement e = n.toElement ();
743
if (e.isNull () == false) {
744
if (e.hasAttribute ("name")) {
745
QString nameValue = e.attribute ("name", QString::null);
746
if (nameValue == "name") {
747
vpnConnection->setName (e.text () );
748
} else if (nameValue == "service_name") {
749
vpnConnection->setServiceName (e.text ());
750
} else if (nameValue == "routes") {
751
QDomNode m = n.firstChild ();
752
while (m.isNull () == false) {
753
QDomElement f = m.toElement ();
754
if (f.isNull () == false)
755
vpnConnection->addRoute (f.text ());
756
m = m.nextSibling ();
758
} else if (nameValue == "vpn_data") {
759
QDomNode m = n.firstChild ();
760
while (m.isNull () == false) {
761
QDomElement f = m.toElement ();
762
if (f.isNull () == false)
763
vpnConnection->addData (f.text ());
764
m = m.nextSibling ();
769
n = n.nextSibling ();
772
if (!vpnConnection->getName () || !vpnConnection->getServiceName () || vpnConnection->getService()==NULL)
774
delete vpnConnection;
778
// we want this conection only if we have none with the same name
779
if (this->getVPNConnection(vpnConnection->getName()) != NULL)
781
delete vpnConnection;
785
QDir* serviceDir = new QDir (SERVICE_DIR, QString::null, QDir::Name|QDir::IgnoreCase, QDir::Files);
786
QStringList services = serviceDir->entryList ().grep (".name", true);
788
for (QStringList::Iterator i = services.begin (); i != services.end (); ++i) {
789
QString service = SERVICE_DIR + QString ("/") + *i;
790
KConfig* kconfig = new KConfig (service, true, true, "config");
791
kconfig->setGroup ("VPN Connection");
792
if (kconfig->readEntry ("service", QString::null) == vpnConnection->getServiceName ()) {
793
kconfig->setGroup ("GNOME");
794
QString helper = kconfig->readEntry ("auth-dialog", QString::null);
795
if ( !helper.isEmpty() ) {
796
vpnConnection->setAuthHelper (helper);
798
printf ("Warning: No authentication helper for service \"%s\" found.\n", vpnConnection->getServiceName ().ascii ());
804
if (vpnConnection->isValid ())
806
_vpnList->append (vpnConnection);
807
connect(vpnConnection, SIGNAL(activationStateChanged()), this, SLOT(vpnActivationStateChanged()));
810
delete vpnConnection;
814
VPN::listGConfConnections()
816
QStringList connections;
817
QDir confDir(_confPath);
818
confDir.setFilter (QDir::Dirs);
820
QStringList entryList = confDir.entryList ();
821
for (QStringList::Iterator it = entryList.begin (); it != entryList.end (); ++it) {
822
if ((*it) != "." && (*it) != "..")
823
if (getVPNConnection(*it) == NULL)
824
connections.append (*it);
830
VPN::newVPNConnection ()
832
KNetworkManagerStorage* storage = KNetworkManagerStorage::getInstance();
833
QString group = storage->vpnConnectionNewGroup();
834
return new VPNConnection(group, this, "vpnconnection");
838
VPN::importVPNConnection(const QString& conn_name)
840
VPNConnection* conn = getVPNConnection(conn_name);
843
KNetworkManagerStorage* storage = KNetworkManagerStorage::getInstance();
844
QString group = storage->vpnConnectionNewGroup();
845
conn->setConfigGroup(group);
853
VPN::getConnections (void)
855
KNetworkManagerStorage* storage = KNetworkManagerStorage::getInstance();
856
QStringList connections = storage->vpnConnectionGroups();
857
for(QStringList::Iterator it = connections.begin(); it != connections.end(); ++it)
862
// import all gconf connections for which we do not have an plugin
863
QDir confDir(_confPath);
864
confDir.setFilter (QDir::Dirs);
866
QStringList entryList = confDir.entryList ();
867
for (QStringList::Iterator it = entryList.begin (); it != entryList.end (); ++it) {
868
if ((*it) != "." && (*it) != "..")
869
getGConfConnection(*it);
872
emit vpnConnectionsUpdated();
876
VPN::receiveKeyringData (KProcess* /* keyringDaemon */, char* buffer, int len)
878
QStringList env = QStringList::split (QString ("\n"), QString::fromLatin1 (buffer, len), false);
880
for (QStringList::Iterator it = env.begin (); it != env.end (); ++it) {
881
QString* item = &(*it);
882
if (item->startsWith ("GNOME_KEYRING_SOCKET")) {
883
setenv ("GNOME_KEYRING_SOCKET", item->section ('=', 1, 1).ascii(), 1);
892
QString keyringSocket = getenv ("GNOME_KEYRING_SOCKET");
894
if (!keyringSocket) {
895
KProcess* keyringDaemon = new KProcess ();
896
*keyringDaemon << "gnome-keyring-daemon";
898
connect (keyringDaemon, SIGNAL (receivedStdout (KProcess*, char*, int)),
899
this, SLOT (receiveKeyringData (KProcess*, char*, int)));
901
keyringDaemon->start (KProcess::NotifyOnExit, KProcess::Stdout);
910
QDir serviceDir(SERVICE_DIR, QString::null, QDir::Name|QDir::IgnoreCase, QDir::Files);
911
QStringList services = serviceDir.entryList ().grep (".name", true);
913
if (services.count () > 0)
916
// read in all available Services
917
_vpnServiceList = new VPNServiceList();
918
for (QStringList::Iterator i = services.begin (); i != services.end (); ++i) {
919
QString service = SERVICE_DIR + QString ("/") + *i;
920
KConfig* kconfig = new KConfig (service, true, true, "config");
921
kconfig->setGroup ("VPN Connection");
922
// create new VPNService Object
923
_vpnServiceList->push_back(new VPNService(kconfig->readEntry ("name", QString::null), kconfig->readEntry ("service", QString::null), this));
932
VPN::getVPNService(const QString & name)
934
for (VPNServiceList::Iterator i = _vpnServiceList->begin (); i != _vpnServiceList->end (); ++i) {
935
if ((*i)->getName() == name || (*i)->getService() == name)
942
VPN::getVPNServices ()
945
for (VPNServiceList::Iterator i = _vpnServiceList->begin (); i != _vpnServiceList->end (); ++i) {
946
retval.push_back((*i)->getName());
952
VPN::deleteVPNConnection (const QString & name)
954
VPNConnection* vpnConnection = NULL;
955
for (VPNList::iterator i = _vpnList->begin (); i != _vpnList->end (); ++i) {
956
if ((*i)->getName () == name) {
957
// remove the configuration
959
vpnConnection->remove();
960
// remove our reference
962
delete vpnConnection;
963
vpnConnection = NULL;
971
VPN::getVPNConnection (const QString & name)
973
VPNConnection* vpnConnection = NULL;
974
for (VPNList::iterator i = _vpnList->begin (); i != _vpnList->end (); ++i) {
975
if ((*i)->getName () == name) {
981
return vpnConnection;
989
for (VPNList::iterator i = _vpnList->begin (); i != _vpnList->end (); ++i) {
990
if ((*i)->getActivationStage () == NM_VPN_ACT_STAGE_ACTIVATED) {
1001
VPN::getVPNList (void)
1007
VPN::push (KNetworkManager* ctx)
1010
VPNDBus::push (ctx);
1013
KNetworkManager* VPN::getCtx()
1018
VPN::VPN ( KNetworkManager* parent, const char * name )
1019
: QObject( parent, name ), _vpnServiceList(NULL), _vpnList(NULL)
1022
VPNDBus::push(_ctx);
1023
_confPath = QDir::homeDirPath() + GCONF_PRE + VPN_PATH;
1024
_available = getServices();
1026
if (_available == true) {
1028
_vpnList = new VPNList ();
1031
// find the gnome vpn configuration applet
1032
_gnomeVPNApplet = KStandardDirs::findExe("nm-vpn-properties");
1037
// delete connectionslist
1039
for (VPNList::iterator i = _vpnList->begin (); i != _vpnList->end (); ++i) {
1047
if (_vpnServiceList) {
1048
for (VPNServiceList::iterator i = _vpnServiceList->begin (); i != _vpnServiceList->end (); ++i) {
1051
_vpnServiceList->clear ();
1052
delete _vpnServiceList;
1053
_vpnServiceList = NULL;
1057
#include "knetworkmanager-vpn.moc"