not quite so much needs to be delayed to the init() function
[personal-kdebase.git] / workspace / libs / solid / control / authentication.cpp
blobc1c0d517a4b1cf900bf88414fe301c4af42246a9
1 /* This file is part of the KDE project
2 Copyright (C) 2006 Kevin Ottens <ervin@kde.org>
3 Copyright (C) 2006,2007 Will Stephenson <wstephenson@kde.org>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License version 2 as published by the Free Software Foundation.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
21 #include "soliddefs_p.h"
22 #include "authentication.h"
23 #include "networkmanager_p.h"
24 #include <solid/control/networkmanager.h>
25 #include <solid/control/ifaces/networkmanager.h>
26 #include <solid/control/ifaces/authentication.h>
28 namespace Solid
30 namespace Control
32 class AuthenticationValidator::Private
34 public:
35 QObject *backendObject;
38 class Authentication::Private
40 public:
41 SecretMap secrets;
44 class AuthenticationWep::Private
46 public:
47 WepMethod method;
48 WepType type;
49 int keyLength;
52 class AuthenticationWpa::Private
54 public:
55 WpaProtocol protocol;
56 WpaVersion version;
57 WpaKeyManagement mgmt;
60 class AuthenticationWpaEnterprise::Private
62 public:
63 QString identity;
64 QString anonIdentity;
65 QString certClient;
66 QString certCA;
67 QString certPrivate;
68 EapMethod method;
69 QString idPasswordKey;
70 QString certPrivatePasswordKey;
76 /******************************************************************************/
78 Solid::Control::Authentication::Authentication()
79 : d(new Private)
84 Solid::Control::Authentication::~Authentication()
86 delete d;
89 void Solid::Control::Authentication::setSecrets(const SecretMap &secrets)
91 d->secrets = secrets;
94 Solid::Control::Authentication::SecretMap Solid::Control::Authentication::secrets() const
96 return d->secrets;
101 /******************************************************************************/
103 Solid::Control::AuthenticationNone::AuthenticationNone()
104 : d(0)
109 Solid::Control::AuthenticationNone::~AuthenticationNone()
116 /******************************************************************************/
118 Solid::Control::AuthenticationWep::AuthenticationWep()
119 : d(new Private)
124 Solid::Control::AuthenticationWep::~AuthenticationWep()
126 delete d;
129 void Solid::Control::AuthenticationWep::setMethod(WepMethod method)
131 d->method = method;
134 Solid::Control::AuthenticationWep::WepMethod Solid::Control::AuthenticationWep::method() const
136 return d->method;
139 void Solid::Control::AuthenticationWep::setType(WepType type)
141 d->type = type;
144 Solid::Control::AuthenticationWep::WepType Solid::Control::AuthenticationWep::type() const
146 return d->type;
149 void Solid::Control::AuthenticationWep::setKeyLength(int length)
151 d->keyLength = length;
154 int Solid::Control::AuthenticationWep::keyLength() const
156 return d->keyLength;
159 /******************************************************************************/
161 Solid::Control::AuthenticationWpa::AuthenticationWpa()
162 : d(new Private)
167 Solid::Control::AuthenticationWpa::~AuthenticationWpa()
169 delete d;
172 void Solid::Control::AuthenticationWpa::setProtocol(WpaProtocol protocol)
174 d->protocol = protocol;
177 Solid::Control::AuthenticationWpa::WpaProtocol Solid::Control::AuthenticationWpa::protocol() const
179 return d->protocol;
182 void Solid::Control::AuthenticationWpa::setVersion(WpaVersion version)
184 d->version = version;
187 Solid::Control::AuthenticationWpa::WpaVersion Solid::Control::AuthenticationWpa::version() const
189 return d->version;
192 void Solid::Control::AuthenticationWpa::setKeyManagement(WpaKeyManagement mgmt)
194 d->mgmt = mgmt;
197 Solid::Control::AuthenticationWpa::WpaKeyManagement Solid::Control::AuthenticationWpa::keyManagement() const
199 return d->mgmt;
202 /******************************************************************************/
204 Solid::Control::AuthenticationWpaPersonal::AuthenticationWpaPersonal()
205 : d(0)
210 Solid::Control::AuthenticationWpaPersonal::~AuthenticationWpaPersonal()
217 /******************************************************************************/
219 Solid::Control::AuthenticationWpaEnterprise::AuthenticationWpaEnterprise()
220 : d(new Private)
225 Solid::Control::AuthenticationWpaEnterprise::~AuthenticationWpaEnterprise()
227 delete d;
230 void Solid::Control::AuthenticationWpaEnterprise::setIdentity(const QString &identity)
232 d->identity = identity;
235 QString Solid::Control::AuthenticationWpaEnterprise::identity() const
237 return d->identity;
240 void Solid::Control::AuthenticationWpaEnterprise::setAnonIdentity(const QString &anonIdentity)
242 d->anonIdentity = anonIdentity;
245 QString Solid::Control::AuthenticationWpaEnterprise::anonIdentity() const
247 return d->anonIdentity;
250 void Solid::Control::AuthenticationWpaEnterprise::setCertClient(const QString &certClient)
252 d->certClient = certClient;
255 QString Solid::Control::AuthenticationWpaEnterprise::certClient() const
257 return d->certClient;
260 void Solid::Control::AuthenticationWpaEnterprise::setCertCA(const QString &certCA)
262 d->certCA = certCA;
265 QString Solid::Control::AuthenticationWpaEnterprise::certCA() const
267 return d->certCA;
270 void Solid::Control::AuthenticationWpaEnterprise::setCertPrivate(const QString &certPrivate)
272 d->certPrivate = certPrivate;
275 QString Solid::Control::AuthenticationWpaEnterprise::certPrivate() const
277 return d->certPrivate;
281 void Solid::Control::AuthenticationWpaEnterprise::setMethod(EapMethod method)
283 d->method = method;
286 Solid::Control::AuthenticationWpaEnterprise::EapMethod Solid::Control::AuthenticationWpaEnterprise::method() const
288 return d->method;
291 void Solid::Control::AuthenticationWpaEnterprise::setIdPasswordKey(const QString &idPasswordKey)
293 d->idPasswordKey = idPasswordKey;
296 QString Solid::Control::AuthenticationWpaEnterprise::idPasswordKey() const
298 return d->idPasswordKey;
301 void Solid::Control::AuthenticationWpaEnterprise::setCertPrivatePasswordKey(const QString &certPrivatePasswordKey)
303 d->certPrivatePasswordKey = certPrivatePasswordKey;
306 QString Solid::Control::AuthenticationWpaEnterprise::certPrivatePasswordKey() const
308 return d->certPrivatePasswordKey;
313 Solid::Control::AuthenticationValidator::AuthenticationValidator()
314 : d(new Private)
316 #if 0
317 Ifaces::NetworkManager *backend = qobject_cast<Ifaces::NetworkManager *>(NetworkManager::self().d->managerBackend());
319 if (backend)
321 d->backendObject = backend->createAuthenticationValidator();
323 #endif
326 Solid::Control::AuthenticationValidator::~AuthenticationValidator()
328 delete d->backendObject;
329 delete d;
332 bool Solid::Control::AuthenticationValidator::validate(const Solid::Control::Authentication *authentication)
334 return_SOLID_CALL(Ifaces::AuthenticationValidator *, d->backendObject, false, validate(authentication));