diff options
Diffstat (limited to 'WebKit/qt/WebKitPart')
-rw-r--r-- | WebKit/qt/WebKitPart/WebKitFactory.cpp | 114 | ||||
-rw-r--r-- | WebKit/qt/WebKitPart/WebKitFactory.h | 66 | ||||
-rw-r--r-- | WebKit/qt/WebKitPart/WebKitPart.cpp | 133 | ||||
-rw-r--r-- | WebKit/qt/WebKitPart/WebKitPart.desktop | 12 | ||||
-rw-r--r-- | WebKit/qt/WebKitPart/WebKitPart.h | 106 | ||||
-rw-r--r-- | WebKit/qt/WebKitPart/WebKitPart.rc | 16 | ||||
-rw-r--r-- | WebKit/qt/WebKitPart/WebKitPartBrowser.rc | 46 | ||||
-rw-r--r-- | WebKit/qt/WebKitPart/WebKitPartBrowserExtension.cpp | 40 | ||||
-rw-r--r-- | WebKit/qt/WebKitPart/WebKitPartBrowserExtension.h | 84 | ||||
-rw-r--r-- | WebKit/qt/WebKitPart/WebKitPartClient.cpp | 50 | ||||
-rw-r--r-- | WebKit/qt/WebKitPart/WebKitPartClient.h | 48 | ||||
-rw-r--r-- | WebKit/qt/WebKitPart/WebKitPartInterface.cpp | 55 | ||||
-rw-r--r-- | WebKit/qt/WebKitPart/WebKitPartInterface.h | 54 | ||||
-rw-r--r-- | WebKit/qt/WebKitPart/org.kde.WebKitPart.xml | 10 |
14 files changed, 834 insertions, 0 deletions
diff --git a/WebKit/qt/WebKitPart/WebKitFactory.cpp b/WebKit/qt/WebKitPart/WebKitFactory.cpp new file mode 100644 index 0000000..ac43f86 --- /dev/null +++ b/WebKit/qt/WebKitPart/WebKitFactory.cpp @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebKitFactory.h" + +#include "WebKitPart.h" + +#include <klocale.h> +#include <kinstance.h> +#include <kaboutdata.h> + +WebKitFactory* WebKitFactory::s_self = 0; +unsigned long int WebKitFactory::s_refCount = 0; +KInstance* WebKitFactory::s_instance = 0; +KAboutData* WebKitFactory::s_about = 0; + +WebKitFactory::WebKitFactory(bool clone) +{ + if (clone) + ref(); +} + +WebKitFactory::~WebKitFactory() +{ + if (s_self == this) { + Q_ASSERT(!s_refCount); + + delete s_instance; + delete s_about; + + s_instance = 0; + s_about = 0; + } + else + deref(); +} + +KParts::Part* WebKitFactory::createPartObject(QWidget* parentWidget, + QObject* parentObject, + const char* className, + const QStringList& args) +{ + WebKitPart::GUIProfile prof = WebKitPart::DefaultGUI; + + if (strcmp(className, "Browser/View") == 0) + prof = WebKitPart::BrowserViewGUI; + + return new WebKitPart(parentWidget, parentObject, prof); +} + +KInstance* WebKitFactory::instance() +{ + Q_ASSERT(s_self != 0); + + if (!s_instance) { + s_about = new KAboutData("WebKitPart", I18N_NOOP("WebKit"), "0.1", + I18N_NOOP("Embeddable HTML/SVG component"), + KAboutData::License_LGPL); + + // FIXME: Add copyright information in the KAboutData! + s_instance = new KInstance(s_about); + } + + return s_instance; +} + +void WebKitFactory::ref() +{ + if (!s_refCount && !s_self) + s_self = new WebKitFactory(); + + s_refCount++; +} + +void WebKitFactory::deref() +{ + if(!--s_refCount && s_self) { + delete s_self; + s_self = 0; + } +} + +// Factory entry point +extern "C" void* init_libWebKitPart() +{ + return new WebKitFactory(true); +} + +#include "WebKitFactory.moc" diff --git a/WebKit/qt/WebKitPart/WebKitFactory.h b/WebKit/qt/WebKitPart/WebKitFactory.h new file mode 100644 index 0000000..ff83437 --- /dev/null +++ b/WebKit/qt/WebKitPart/WebKitFactory.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebKitFactory_H +#define WebKitFactory_H + +#include <QObject> + +#include <kparts/factory.h> + +class KInstance; +class KAboutData; + +class WebKitFactory : public KParts::Factory +{ +Q_OBJECT + +public: + WebKitFactory(bool clone = false); + virtual ~WebKitFactory(); + + virtual KParts::Part* createPartObject(QWidget* parentWidget, + QObject* parentObject, + const char* className, + const QStringList& args); + + static KInstance* instance(); + + +protected: + static void ref(); + static void deref(); + +private: + static unsigned long s_refCount; + + static WebKitFactory* s_self; + static KInstance* s_instance; + static KAboutData* s_about; +}; + +#endif diff --git a/WebKit/qt/WebKitPart/WebKitPart.cpp b/WebKit/qt/WebKitPart/WebKitPart.cpp new file mode 100644 index 0000000..26c2668 --- /dev/null +++ b/WebKit/qt/WebKitPart/WebKitPart.cpp @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * Copyright (C) 2006 Zack Rusin <zack@kde.org> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebKitPart.h" + +#include "FrameLoader.h" +#include "FrameView.h" +#include "ChromeClientQt.h" +#include "ContextMenuClientQt.h" +#include "DragClientQt.h" +#include "EditorClientQt.h" +#include "InspectorClientQt.h" +#include "KURL.h" + +#include <QDebug> + +#include "Page.h" +#include "FrameQt.h" +#include "WebKitFactory.h" +#include "WebKitPartClient.h" +#include "WebKitPartBrowserExtension.h" + +using namespace WebCore; + +WebKitPart::WebKitPart(QWidget* parentWidget, QObject* parentObject, GUIProfile prof) + : KParts::ReadOnlyPart(parentObject) + , m_frame(0) + , m_frameView(0) + , m_client(0) +{ + setInstance(WebKitFactory::instance(), prof == BrowserViewGUI && !parentPart()); + initView(parentWidget, prof); + + m_extension = new WebKitPartBrowserExtension(this); +} + +WebKitPart::~WebKitPart() +{ + if (m_frame) + delete m_frame->page(); + + delete m_client; + delete m_extension; +} + +bool WebKitPart::openFile() +{ + return true; +} + +bool WebKitPart::openUrl(const KUrl& url) +{ + if (!m_client) + return false; + + emit started(0); + m_client->openURL(KURL(url.toEncoded())); + return true; +} + +bool WebKitPart::closeUrl() +{ + return m_frame->loader()->closeURL(); +} + +WebKitPart* WebKitPart::parentPart() +{ + return qobject_cast<WebKitPart*>(parent()); +} + +Frame* WebKitPart::frame() +{ + return m_frame.get(); +} + +void WebKitPart::initView(QWidget* parentWidget, GUIProfile prof) +{ + if (prof == DefaultGUI) + setXMLFile("WebKitPart.rc"); + else if (prof == BrowserViewGUI) + setXMLFile("WebKitPartBrowser.rc"); + + m_client = new WebKitPartClient(this); + + // Initialize WebCore in Qt platform mode... + Page* page = new Page(new ChromeClientQt(), new ContextMenuClientQt(), new EditorClientQt(), new DragClientQt(), new InspectorClientQt()); + Frame* frame = new FrameQt(page, 0, m_client); + + m_frame = frame; + frame->deref(); // Frames are created with a refcount of 1. Release this ref, since we've assigned it to a RefPtr + + page->setMainFrame(frame); + + FrameView* frameView = new FrameView(frame); + m_frameView = frameView; + frameView->deref(); // FrameViews are created with a refcount of 1. Release this ref, since we've assigned it to a RefPtr + + m_frame->setView(frameView); + m_frameView->setParentWidget(parentWidget); + + m_frame->init(); + + // Initialize KParts widget... + setWidget(m_frame->view()->qwidget()); +} + +#include "WebKitPart.moc" diff --git a/WebKit/qt/WebKitPart/WebKitPart.desktop b/WebKit/qt/WebKitPart/WebKitPart.desktop new file mode 100644 index 0000000..a942139 --- /dev/null +++ b/WebKit/qt/WebKitPart/WebKitPart.desktop @@ -0,0 +1,12 @@ +[Desktop Entry] +Encoding=UTF-8 +Type=Service +Comment=Embeddable HTML/SVG viewing component +Comment[x-test]=xxEmbeddable HTML/SVg viewing componentxx +MimeType=text/html;text/xml;application/xhtml+xml;image/svg+xml;image/svg-xml +Icon=konqueror +Name=WebKit +Name[x-test]=xxWebKitLxx +ServiceTypes=KParts/ReadOnlyPart,Browser/View +X-KDE-Library=libWebKitPart +InitialPreference=10 diff --git a/WebKit/qt/WebKitPart/WebKitPart.h b/WebKit/qt/WebKitPart/WebKitPart.h new file mode 100644 index 0000000..6472d44 --- /dev/null +++ b/WebKit/qt/WebKitPart/WebKitPart.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebKitPart_H +#define WebKitPart_H + +#include <QObject> + +#include <wtf/RefPtr.h> +#include <kparts/part.h> + +namespace WebCore { + class Frame; + class FrameView; +} + +class WebKitPartClient; +class WebKitPartBrowserExtension; + +class WebKitPart : public KParts::ReadOnlyPart +{ +Q_OBJECT + +public: + enum GUIProfile { + DefaultGUI, + BrowserViewGUI + }; + + WebKitPart(QWidget* parentWidget = 0, + QObject* parentObject = 0, + GUIProfile prof = DefaultGUI); + + virtual ~WebKitPart(); + + /** + * Opens the specified URL @p url. + * + * Reimplemented from KParts::ReadOnlyPart::openURL . + */ + virtual bool openUrl(const KUrl&); + + /** + * Stops loading the document and kills all data requests (for images, etc.) + */ + virtual bool closeUrl(); + + /** + * Returns a pointer to the parent WebKitPart + * if the part is a frame in an HTML frameset. + * + * Returns 0 otherwise. + */ + WebKitPart* parentPart(); + +private: + friend class WebKitPartClient; + + /** + * Returns pointer the current frame. + */ + WebCore::Frame* frame(); + + /** + * Internal empty reimplementation of KParts::ReadOnlyPart::openFile . + */ + virtual bool openFile(); + + /** + * Internal helper method + */ + void initView(QWidget*, GUIProfile); + +private: + WTF::RefPtr<WebCore::Frame> m_frame; + WTF::RefPtr<WebCore::FrameView> m_frameView; + + WebKitPartClient* m_client; + WebKitPartBrowserExtension* m_extension; +}; + +#endif diff --git a/WebKit/qt/WebKitPart/WebKitPart.rc b/WebKit/qt/WebKitPart/WebKitPart.rc new file mode 100644 index 0000000..886af21 --- /dev/null +++ b/WebKit/qt/WebKitPart/WebKitPart.rc @@ -0,0 +1,16 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="WebKitPart" version="1"> +<MenuBar> + <Menu name="edit"><text>&Edit</text> + <Action name="selectAll" /> + <Separator /> + <Action name="find" /> + <Action name="findNext" /> + <Action name="findPrevious" /> + <Action name="findAheadText" /> + <Action name="findAheadLink" /> + </Menu> +</MenuBar> +<ActionProperties> +</ActionProperties> +</kpartgui> diff --git a/WebKit/qt/WebKitPart/WebKitPartBrowser.rc b/WebKit/qt/WebKitPart/WebKitPartBrowser.rc new file mode 100644 index 0000000..7fcc844 --- /dev/null +++ b/WebKit/qt/WebKitPart/WebKitPartBrowser.rc @@ -0,0 +1,46 @@ +<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd"> +<kpartgui name="WebKitPart" version="1"> +<MenuBar> + <Menu name="file"><text>&File</text> + <Action name="saveBackground" /> + <Action name="saveDocument" /> + <Action name="saveFrame" /> + <Separator /> + <Action name="printFrame" group="print" /> + </Menu> + <Menu name="edit"><text>&Edit</text> + <Action name="selectAll" /> + <Separator /> + <Action name="find" /> + <Action name="findNext" /> + <Action name="findPrevious" /> + <Action name="findAheadText" /> + <Action name="findAheadLink" /> + </Menu> + <Menu name="view"><text>&View</text> + <Action name="incFontSizes" /> + <Action name="decFontSizes" /> + <Action name="viewDocumentSource" /> + <Action name="viewPageInfo" /> + <Action name="setEncoding" /> + <Action name="useStylesheet" /> + <ActionList name="debugScriptList" /> +<!-- +<!-- + <Separator /> + <Action name="debugRenderTree" /> + <Action name="debugDOMTree" /> +--> + </Menu> +</MenuBar> +<ToolBar name="mainToolBar"><text>Main Toolbar</text> + <Action name="find" /> + <Separator /> + <Action name="incFontSizes" /> + <Action name="decFontSizes" /> + <ActionList name="loadImages" /> +</ToolBar> +<ActionProperties> + <Action shortcut="F7" name="caretMode" /> +</ActionProperties> +</kpartgui> diff --git a/WebKit/qt/WebKitPart/WebKitPartBrowserExtension.cpp b/WebKit/qt/WebKitPart/WebKitPartBrowserExtension.cpp new file mode 100644 index 0000000..66bf854 --- /dev/null +++ b/WebKit/qt/WebKitPart/WebKitPartBrowserExtension.cpp @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebKitPartBrowserExtension.h" + +WebKitPartBrowserExtension::WebKitPartBrowserExtension(KParts::ReadOnlyPart* part) + : KParts::BrowserExtension(part) +{ +} + +WebKitPartBrowserExtension::~WebKitPartBrowserExtension() +{ +} + +// vim: ts=4 sw=4 et diff --git a/WebKit/qt/WebKitPart/WebKitPartBrowserExtension.h b/WebKit/qt/WebKitPart/WebKitPartBrowserExtension.h new file mode 100644 index 0000000..5ef4c0a --- /dev/null +++ b/WebKit/qt/WebKitPart/WebKitPartBrowserExtension.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebKitPartBrowserExtension_H +#define WebKitPartBrowserExtension_H + +#include <kparts/browserextension.h> + +class WebKitPartBrowserExtension : public KParts::BrowserExtension +{ +public: + WebKitPartBrowserExtension(KParts::ReadOnlyPart*); + virtual ~WebKitPartBrowserExtension(); +}; + +#endif + +// vim: ts=4 sw=4 et +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebKitPartBrowserExtension_H +#define WebKitPartBrowserExtension_H + +#include <kparts/browserextension.h> + +class WebKitPartBrowserExtension : public KParts::BrowserExtension +{ +public: + WebKitPartBrowserExtension(KParts::ReadOnlyPart*); + virtual ~WebKitPartBrowserExtension(); +}; + +#endif + +// vim: ts=4 sw=4 et diff --git a/WebKit/qt/WebKitPart/WebKitPartClient.cpp b/WebKit/qt/WebKitPart/WebKitPartClient.cpp new file mode 100644 index 0000000..2c89e7e --- /dev/null +++ b/WebKit/qt/WebKitPart/WebKitPartClient.cpp @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebKitPartClient.h" + +#include "WebKitPart.h" + +using namespace WebCore; + +WebKitPartClient::WebKitPartClient(WebKitPart* part) + : FrameQtClientDefault() + , m_part(part) +{ +} + +WebKitPartClient::~WebKitPartClient() +{ +} + +void WebKitPartClient::loadFinished() const +{ + emit m_part->completed(); +} + +// vim: ts=4 sw=4 et diff --git a/WebKit/qt/WebKitPart/WebKitPartClient.h b/WebKit/qt/WebKitPart/WebKitPartClient.h new file mode 100644 index 0000000..8874334 --- /dev/null +++ b/WebKit/qt/WebKitPart/WebKitPartClient.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebKitPartClient_H +#define WebKitPartClient_H + +#include "FrameQt.h" + +class WebKitPart; +class WebKitPartClient : public WebCore::FrameQtClientDefault +{ +public: + WebKitPartClient(WebKitPart*); + virtual ~WebKitPartClient(); + + virtual void loadFinished() const; + +private: + WebKitPart* m_part; +}; + +#endif + +// vim: ts=4 sw=4 et diff --git a/WebKit/qt/WebKitPart/WebKitPartInterface.cpp b/WebKit/qt/WebKitPart/WebKitPartInterface.cpp new file mode 100644 index 0000000..ae49b96 --- /dev/null +++ b/WebKit/qt/WebKitPart/WebKitPartInterface.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebKitPartInterface.h" + +#include "WebKitPart.h" + +WebKitPartInterface::WebKitPartInterface(WebKitPart* part) + : QObject(part) + , m_part(part) +{ + Q_ASSERT(m_part != 0); +} + +WebKitPartInterface::~WebKitPartInterface() +{ +} + + +KUrl WebKitPartInterface::url() const +{ + return m_part->url(); +} + +bool WebKitPartInterface::closeURL() +{ + return m_part->closeUrl(); +} + +#include "WebKitPartInterface.moc" diff --git a/WebKit/qt/WebKitPart/WebKitPartInterface.h b/WebKit/qt/WebKitPart/WebKitPartInterface.h new file mode 100644 index 0000000..a011370 --- /dev/null +++ b/WebKit/qt/WebKitPart/WebKitPartInterface.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org> + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebKitPartInterface_H +#define WebKitPartInterface_H + +#include <QObject> + +class KUrl; +class WebKitPart; + +// Exposed to DBUS. +class WebKitPartInterface : public QObject +{ +Q_OBJECT + +public: + WebKitPartInterface(WebKitPart*); + virtual ~WebKitPartInterface(); + +public Q_SLOTS: + KUrl url() const; + + bool closeURL(); + +private: + WebKitPart* m_part; +}; + +#endif diff --git a/WebKit/qt/WebKitPart/org.kde.WebKitPart.xml b/WebKit/qt/WebKitPart/org.kde.WebKitPart.xml new file mode 100644 index 0000000..84cacd1 --- /dev/null +++ b/WebKit/qt/WebKitPart/org.kde.WebKitPart.xml @@ -0,0 +1,10 @@ +<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" +"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> +<node> + <interface name="org.kde.WebKitPart"> + <property name="url" type="s" access="read"/> + <method name="closeURL"> + <arg type="b" direction="out"/> + </method> + </interface> +</node> |