• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.8.3 API Reference
  • KDE Home
  • Contact Us
 

KParts

htmlextension.h
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 #ifndef KPARTS_HTMLEXTENSION_H
00021 #define KPARTS_HTMLEXTENSION_H
00022 
00023 #include <QtCore/QSharedDataPointer>
00024 #include <QtCore/QObject>
00025 
00026 #include <kparts/kparts_export.h>
00027 
00028 class KUrl;
00029 
00030 namespace KParts
00031 {
00032 
00033 class ReadOnlyPart;
00034 class HtmlExtensionPrivate;
00035 class SelectorInterfacePrivate;
00036 
00045 class KPARTS_EXPORT HtmlExtension : public QObject
00046 {
00047     Q_OBJECT
00048 public:
00049     HtmlExtension(KParts::ReadOnlyPart* parent);
00050     ~HtmlExtension();
00051 
00056     static HtmlExtension *childObject( QObject *obj );
00057 
00064     virtual KUrl baseUrl() const = 0;
00065 
00072     virtual bool hasSelection() const;
00073 
00074 private:
00075     // for future extensions
00076     HtmlExtensionPrivate* const d;
00077 };
00078 
00089 class KPARTS_EXPORT SelectorInterface
00090 {
00091 public:
00092     class ElementPrivate;
00093     class Element;
00094 
00098     enum QueryMethod {
00099         None = 0x00,                   
00100         EntireContent = 0x01,          
00101         SelectedContent = 0x02         
00102     };
00103     Q_DECLARE_FLAGS(QueryMethods, QueryMethod)
00104 
00105     
00108     virtual ~SelectorInterface() {}
00109 
00117     virtual QueryMethods supportedQueryMethods() const;
00118 
00132     virtual Element querySelector(const QString& query, QueryMethod method) const = 0;
00133 
00147     virtual QList<Element> querySelectorAll(const QString& query, QueryMethod method) const = 0;
00148 
00149     class KPARTS_EXPORT Element {
00150     public:
00154         Element();
00155 
00159         Element(const Element& other);
00160 
00164         ~Element();
00165 
00169         bool isNull() const;
00170 
00174         void setTagName(const QString& tag);
00175 
00179         QString tagName() const;
00180 
00185         void setAttribute(const QString& name, const QString& value);
00186 
00190         QStringList attributeNames() const;
00191 
00195         QString attribute(const QString& name, const QString& defaultValue = QString()) const;
00196 
00200         bool hasAttribute(const QString& name) const;
00201 
00202         // No namespace support yet, could be added with attributeNS, setAttributeNS
00203 
00207         void swap( Element& other ) {
00208             d.swap( other.d );
00209         }
00210 
00214         Element& operator=(const Element& other) {
00215             if ( this != &other ) {
00216                 Element copy( other );
00217                 swap( copy );
00218             }
00219             return *this;
00220         }
00221 
00222     private:
00223         QSharedDataPointer<ElementPrivate> d;
00224     };
00225 };
00226 
00245 class KPARTS_EXPORT HtmlSettingsInterface
00246 {
00247 public:
00251     enum HtmlSettingsType {
00252         AutoLoadImages,
00253         DnsPrefetchEnabled,
00254         JavaEnabled,
00255         JavascriptEnabled,
00256         MetaRefreshEnabled,
00257         PluginsEnabled,
00258         PrivateBrowsingEnabled,
00259         OfflineStorageDatabaseEnabled,
00260         OfflineWebApplicationCacheEnabled,
00261         LocalStorageEnabled,
00262         UserDefinedStyleSheetURL
00263     };
00264 
00270     enum JavaScriptAdvice {
00271         JavaScriptDunno=0,
00272         JavaScriptAccept,
00273         JavaScriptReject
00274     };
00275 
00281     enum JSWindowOpenPolicy {
00282         JSWindowOpenAllow=0,
00283         JSWindowOpenAsk,
00284         JSWindowOpenDeny,
00285         JSWindowOpenSmart
00286     };
00287 
00293     enum JSWindowStatusPolicy {
00294         JSWindowStatusAllow=0,
00295         JSWindowStatusIgnore
00296     };
00297 
00303     enum JSWindowMovePolicy {
00304         JSWindowMoveAllow=0,
00305         JSWindowMoveIgnore
00306     };
00307 
00313     enum JSWindowResizePolicy {
00314         JSWindowResizeAllow=0,
00315         JSWindowResizeIgnore
00316     };
00317 
00323     enum JSWindowFocusPolicy {
00324         JSWindowFocusAllow=0,
00325         JSWindowFocusIgnore
00326     };
00327 
00331     virtual ~HtmlSettingsInterface() {}
00332 
00336     virtual QVariant htmlSettingsProperty(HtmlSettingsType type) const = 0;
00337 
00341     virtual bool setHtmlSettingsProperty(HtmlSettingsType type, const QVariant& value) = 0;
00342 
00351     static JavaScriptAdvice textToJavascriptAdvice(const QString& text);
00352 
00361     static const char* javascriptAdviceToText(JavaScriptAdvice advice);
00362 
00373     static void splitDomainAdvice(const QString& text,
00374                                   QString& domain,
00375                                   JavaScriptAdvice& javaAdvice,
00376                                   JavaScriptAdvice& javaScriptAdvice);
00377 };
00378 
00379 } // namespace KParts
00380 
00381 inline void qSwap( KParts::SelectorInterface::Element & lhs, KParts::SelectorInterface::Element & rhs )
00382 {
00383     lhs.swap( rhs );
00384 }
00385 
00386 Q_DECLARE_OPERATORS_FOR_FLAGS(KParts::SelectorInterface::QueryMethods)
00387 
00388 Q_DECLARE_TYPEINFO(KParts::SelectorInterface::Element, Q_MOVABLE_TYPE);
00389 
00390 Q_DECLARE_INTERFACE(KParts::SelectorInterface,
00391                     "org.kde.KParts.SelectorInterface")
00392 Q_DECLARE_INTERFACE(KParts::HtmlSettingsInterface,
00393                     "org.kde.KParts.HtmlSettingsInterface")
00394 
00395 
00396 #endif /* KPARTS_HTMLEXTENSION_H */
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Thu May 10 2012 20:57:02 by doxygen 1.8.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KParts

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

kdelibs-4.8.3 API Reference

Skip menu "kdelibs-4.8.3 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal