KParts
htmlextension.cpp
Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 2010 David Faure <faure@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 as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #include "htmlextension.h" 00021 00022 #include "part.h" 00023 00024 #include <kglobal.h> 00025 00026 00027 using namespace KParts; 00028 00029 KParts::HtmlExtension::HtmlExtension(KParts::ReadOnlyPart* parent) 00030 : QObject(parent), d(0) 00031 { 00032 } 00033 00034 KParts::HtmlExtension::~HtmlExtension() 00035 { 00036 } 00037 00038 bool HtmlExtension::hasSelection() const 00039 { 00040 return false; 00041 } 00042 00043 HtmlExtension * KParts::HtmlExtension::childObject( QObject *obj ) 00044 { 00045 return KGlobal::findDirectChild<KParts::HtmlExtension *>(obj); 00046 } 00047 00048 SelectorInterface::QueryMethods SelectorInterface::supportedQueryMethods() const 00049 { 00050 return KParts::SelectorInterface::None; 00051 } 00052 00053 class SelectorInterface::ElementPrivate : public QSharedData 00054 { 00055 public: 00056 QString tag; 00057 QHash<QString, QString> attributes; 00058 }; 00059 00060 SelectorInterface::Element::Element() 00061 : d(new ElementPrivate) 00062 { 00063 } 00064 00065 SelectorInterface::Element::Element(const SelectorInterface::Element& other) 00066 : d(other.d) 00067 { 00068 } 00069 00070 SelectorInterface::Element::~Element() 00071 { 00072 } 00073 00074 bool SelectorInterface::Element::isNull() const 00075 { 00076 return d->tag.isNull(); 00077 } 00078 00079 void SelectorInterface::Element::setTagName(const QString& tag) 00080 { 00081 d->tag = tag; 00082 } 00083 00084 QString SelectorInterface::Element::tagName() const 00085 { 00086 return d->tag; 00087 } 00088 00089 void SelectorInterface::Element::setAttribute(const QString& name, const QString& value) 00090 { 00091 d->attributes[name] = value; // insert or replace 00092 } 00093 00094 QStringList SelectorInterface::Element::attributeNames() const 00095 { 00096 return d->attributes.keys(); 00097 } 00098 00099 QString SelectorInterface::Element::attribute(const QString& name, const QString& defaultValue) const 00100 { 00101 return d->attributes.value(name, defaultValue); 00102 } 00103 00104 bool SelectorInterface::Element::hasAttribute(const QString& name) const 00105 { 00106 return d->attributes.contains(name); 00107 }
KDE 4.6 API Reference