add more spacing
[personal-kdebase.git] / workspace / solid / networkmanager-0.6 / NetworkManager-wirednetwork.cpp
blob6dec06f07d9b28816fa4a81768a0b598d34dd1df
1 /* This file is part of the KDE project
2 Copyright (C) 2008 Pino Toscano <pino@kde.org>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
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 "NetworkManager-wirednetwork.h"
23 #include "NetworkManager-networkinterface_p.h"
25 #include <kdebug.h>
27 #include <QtDBus/QDBusReply>
29 class NMWiredNetworkPrivate : public NMNetworkInterfacePrivate
31 public:
32 NMWiredNetworkPrivate(const QString & netPath);
33 Q_DECLARE_PUBLIC(NMWiredNetwork)
34 /* reimp */ void applyProperties(const NMDBusDeviceProperties & props);
35 QString hwAddr;
36 int rate;
37 bool carrier;
40 NMWiredNetworkPrivate::NMWiredNetworkPrivate(const QString & netPath)
41 : NMNetworkInterfacePrivate(netPath)
42 , rate(0)
43 , carrier(false)
47 void NMWiredNetworkPrivate::applyProperties(const NMDBusDeviceProperties & props)
49 NMNetworkInterfacePrivate::applyProperties(props);
51 hwAddr = props.hardwareAddress;
52 carrier = props.linkActive;
56 NMWiredNetwork::NMWiredNetwork(const QString & networkPath)
57 : NMNetworkInterface(*new NMWiredNetworkPrivate(networkPath))
61 NMWiredNetwork::~NMWiredNetwork()
65 QString NMWiredNetwork::hardwareAddress() const
67 Q_D(const NMWiredNetwork);
68 return d->hwAddr;
71 int NMWiredNetwork::bitRate() const
73 Q_D(const NMWiredNetwork);
74 return d->rate;
77 bool NMWiredNetwork::carrier() const
79 Q_D(const NMWiredNetwork);
80 return d->carrier;
83 void NMWiredNetwork::setBitrate(int rate)
85 Q_D(NMWiredNetwork);
86 if (d->rate == rate)
87 return;
89 d->rate = rate;
90 emit bitRateChanged(rate);
93 void NMWiredNetwork::setCarrier(bool carrier)
95 Q_D(NMWiredNetwork);
96 if (d->carrier == carrier)
97 return;
99 d->carrier = carrier;
100 emit carrierChanged(d->carrier);
103 bool NMWiredNetwork::activateConnection(const QString & connectionUni, const QVariantMap & connectionParameters)
105 Q_D(NMWiredNetwork);
106 Q_UNUSED(connectionUni)
107 Q_UNUSED(connectionParameters)
108 if (d->manager)
110 const QDBusReply<void> reply = d->manager->call(QDBus::NoBlock, "setActiveDevice", uni());
111 Q_UNUSED(reply)
112 return true;
114 return false;
117 bool NMWiredNetwork::deactivateConnection()
119 return false;
122 #include "NetworkManager-wirednetwork.moc"