• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

libsolidcontrol

fakenetworkinterface.cpp

Go to the documentation of this file.
00001 /*  This file is part of the KDE project
00002     Copyright (C) 2006,2008 Will Stephenson <wstephenson@kde.org>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License version 2 as published by the Free Software Foundation.
00007 
00008     This library is distributed in the hope that it will be useful,
00009     but WITHOUT ANY WARRANTY; without even the implied warranty of
00010     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011     Library General Public License for more details.
00012 
00013     You should have received a copy of the GNU Library General Public License
00014     along with this library; see the file COPYING.LIB.  If not, write to
00015     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016     Boston, MA 02110-1301, USA.
00017 
00018 */
00019 
00020 #include <QStringList>
00021 
00022 #include "fakenetworkinterface.h"
00023 
00024 #include <kdebug.h>
00025 
00026 FakeNetworkInterface::FakeNetworkInterface(const QMap<QString, QVariant>  & propertyMap, QObject * parent)
00027 : QObject(parent), mPropertyMap(propertyMap)
00028 {
00029 }
00030 
00031 FakeNetworkInterface::~FakeNetworkInterface()
00032 {
00033 }
00034 
00035 
00036 QString FakeNetworkInterface::uni() const
00037 {
00038     return mPropertyMap["uni"].toString();
00039 }
00040 
00041 
00042 QString FakeNetworkInterface::interfaceName() const
00043 {
00044     return mPropertyMap["interface"].toString();
00045 }
00046 
00047 QString FakeNetworkInterface::driver() const
00048 {
00049     return mPropertyMap["driver"].toString();
00050 }
00051 bool FakeNetworkInterface::isActive() const
00052 {
00053     return !mActiveConnection.isEmpty();
00054 }
00055 
00056 Solid::Control::NetworkInterface::ConnectionState FakeNetworkInterface::connectionState() const
00057 {
00058     QString stateString = mPropertyMap["state"].toString();
00059 
00060     if (stateString == "unmanaged")
00061         return Solid::Control::NetworkInterface::Unmanaged;
00062     else if (stateString == "unavailable")
00063         return Solid::Control::NetworkInterface::Unavailable;
00064     else if (stateString == "disconnected")
00065         return Solid::Control::NetworkInterface::Disconnected;
00066     else if (stateString == "preparing")
00067         return Solid::Control::NetworkInterface::Preparing;
00068     else if (stateString == "configuring")
00069         return Solid::Control::NetworkInterface::Configuring;
00070     else if (stateString == "needauth")
00071         return Solid::Control::NetworkInterface::NeedAuth;
00072     else if (stateString == "ipconfig")
00073         return Solid::Control::NetworkInterface::IPConfig;
00074     else if (stateString == "activated")
00075         return Solid::Control::NetworkInterface::Activated;
00076     else if (stateString == "failed")
00077         return Solid::Control::NetworkInterface::Failed;
00078     else
00079         return Solid::Control::NetworkInterface::UnknownState;
00080 }
00081 
00082 int FakeNetworkInterface::designSpeed() const
00083 {
00084     return mPropertyMap["speed"].toInt();
00085 }
00086 
00087 Solid::Control::NetworkInterface::Capabilities FakeNetworkInterface::capabilities() const
00088 {
00089     QStringList capStrings = mPropertyMap["capabilities"].toString().simplified().split(',');
00090 
00091     Solid::Control::NetworkInterface::Capabilities caps = 0;
00092     if (capStrings.contains("manageable"))
00093         caps |= Solid::Control::NetworkInterface::IsManageable;
00094     if (capStrings.contains("carrierdetect"))
00095         caps |= Solid::Control::NetworkInterface::SupportsCarrierDetect;
00096     return caps;
00097 }
00098 
00099 void FakeNetworkInterface::activate(const QString & connectionUni, const QString &)
00100 {
00101     mActiveConnection = connectionUni;
00102 }
00103 
00104 void FakeNetworkInterface::deactivate()
00105 {
00106     mActiveConnection = "";
00107 }
00108 
00109 
00110 Solid::Control::IPv4Config FakeNetworkInterface::ipV4Config() const
00111 {
00112     return Solid::Control::IPv4Config();
00113 }
00114 

libsolidcontrol

Skip menu "libsolidcontrol"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal