Solid
deviceinterface.cpp
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 2006-2007 Kevin Ottens <ervin@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 "deviceinterface.h" 00021 #include "deviceinterface_p.h" 00022 00023 #include <solid/ifaces/deviceinterface.h> 00024 00025 #include <QtCore/QMetaEnum> 00026 00027 00028 Solid::DeviceInterface::DeviceInterface(DeviceInterfacePrivate &dd, QObject *backendObject) 00029 : d_ptr(&dd) 00030 { 00031 Q_D(DeviceInterface); 00032 00033 d->setBackendObject(backendObject); 00034 } 00035 00036 00037 Solid::DeviceInterface::~DeviceInterface() 00038 { 00039 00040 } 00041 00042 bool Solid::DeviceInterface::isValid() const 00043 { 00044 Q_D(const DeviceInterface); 00045 return d->backendObject()!=0; 00046 } 00047 00048 QString Solid::DeviceInterface::typeToString(Type type) 00049 { 00050 int index = staticMetaObject.indexOfEnumerator("Type"); 00051 QMetaEnum metaEnum = staticMetaObject.enumerator(index); 00052 return QString(metaEnum.valueToKey((int)type)); 00053 } 00054 00055 Solid::DeviceInterface::Type Solid::DeviceInterface::stringToType(const QString &type) 00056 { 00057 int index = staticMetaObject.indexOfEnumerator("Type"); 00058 QMetaEnum metaEnum = staticMetaObject.enumerator(index); 00059 return (Type)metaEnum.keyToValue(type.toUtf8()); 00060 } 00061 00062 Solid::DeviceInterfacePrivate::DeviceInterfacePrivate() 00063 { 00064 00065 } 00066 00067 Solid::DeviceInterfacePrivate::~DeviceInterfacePrivate() 00068 { 00069 00070 } 00071 00072 QObject *Solid::DeviceInterfacePrivate::backendObject() const 00073 { 00074 return m_backendObject; 00075 } 00076 00077 void Solid::DeviceInterfacePrivate::setBackendObject(QObject *object) 00078 { 00079 m_backendObject = object; 00080 } 00081 00082 #include "deviceinterface.moc"
KDE 4.0 API Reference