From 21e3469c8b7a0675e673083aa729ff737120ce13 Mon Sep 17 00:00:00 2001 From: weinig Date: Mon, 4 Sep 2006 17:11:44 +0000 Subject: [PATCH] git-svn-id: https://svn.webkit.org/repository/webkit/trunk@16214 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- CMakeLists.txt | 5 +- WebKitQt/ChangeLog | 43 ++++++++ WebKitQt/WebKitPart/CMakeLists.txt | 35 ++++++ WebKitQt/WebKitPart/WebKitFactory.cpp | 114 ++++++++++++++++++++ WebKitQt/WebKitPart/WebKitFactory.h | 66 ++++++++++++ WebKitQt/WebKitPart/WebKitPart.cpp | 111 +++++++++++++++++++ WebKitQt/WebKitPart/WebKitPart.desktop | 12 +++ WebKitQt/WebKitPart/WebKitPart.h | 105 ++++++++++++++++++ WebKitQt/WebKitPart/WebKitPart.rc | 16 +++ WebKitQt/WebKitPart/WebKitPartBrowser.rc | 46 ++++++++ WebKitQt/WebKitPart/WebKitPartClient.cpp | 44 ++++++++ WebKitQt/WebKitPart/WebKitPartClient.h | 42 ++++++++ WebKitQt/WebKitPart/WebKitPartInterface.cpp | 55 ++++++++++ WebKitQt/WebKitPart/WebKitPartInterface.h | 53 +++++++++ WebKitQt/WebKitPart/org.kde.WebKitPart.xml | 10 ++ 15 files changed, 756 insertions(+), 1 deletion(-) create mode 100644 WebKitQt/ChangeLog create mode 100644 WebKitQt/WebKitPart/CMakeLists.txt create mode 100644 WebKitQt/WebKitPart/WebKitFactory.cpp create mode 100644 WebKitQt/WebKitPart/WebKitFactory.h create mode 100644 WebKitQt/WebKitPart/WebKitPart.cpp create mode 100644 WebKitQt/WebKitPart/WebKitPart.desktop create mode 100644 WebKitQt/WebKitPart/WebKitPart.h create mode 100644 WebKitQt/WebKitPart/WebKitPart.rc create mode 100644 WebKitQt/WebKitPart/WebKitPartBrowser.rc create mode 100644 WebKitQt/WebKitPart/WebKitPartClient.cpp create mode 100644 WebKitQt/WebKitPart/WebKitPartClient.h create mode 100644 WebKitQt/WebKitPart/WebKitPartInterface.cpp create mode 100644 WebKitQt/WebKitPart/WebKitPartInterface.h create mode 100644 WebKitQt/WebKitPart/org.kde.WebKitPart.xml diff --git a/CMakeLists.txt b/CMakeLists.txt index 544c80453ca5..c7db16bdb0e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,10 @@ add_definitions (-DUSE_SYSTEM_MALLOC=1) add_subdirectory (JavaScriptCore) add_subdirectory (WebCore) -add_subdirectory (WebKitTools/QtLauncher) add_subdirectory (WebKitTools/DumpRenderTree/DumpRenderTree.qtproj) +IF (WEBKIT_USE_KDE_SUPPORT) + add_subdirectory (WebKitQt/WebKitPart) +ENDIF (WEBKIT_USE_KDE_SUPPORT) + include_directories (BEFORE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/WebKitQt/ChangeLog b/WebKitQt/ChangeLog new file mode 100644 index 000000000000..6c74583f2e56 --- /dev/null +++ b/WebKitQt/ChangeLog @@ -0,0 +1,43 @@ +2006-09-04 Nikolas Zimmermann + + Reviewed by Darin. Final polish by Sam. + + Fixes parts of: http://bugzilla.opendarwin.org/show_bug.cgi?id=10644 + Add WebKitPart, an embeddable KPart for the KDE platform. + + * WebKitPart/CMakeLists.txt: Added. + * WebKitPart/WebKitFactory.cpp: Added. + (WebKitFactory::WebKitFactory): + (WebKitFactory::~WebKitFactory): + (WebKitFactory::createPartObject): + (WebKitFactory::instance): + (WebKitFactory::ref): + (WebKitFactory::deref): + (init_libWebKitPart): + * WebKitPart/WebKitFactory.h: Added. + * WebKitPart/WebKitPart.cpp: Added. + (WebKitPart::WebKitPart): + (WebKitPart::~WebKitPart): + (WebKitPart::openFile): + (WebKitPart::openUrl): + (WebKitPart::closeUrl): + (WebKitPart::parentPart): + (WebKitPart::frame): + (WebKitPart::initView): + * WebKitPart/WebKitPart.desktop: Added. + * WebKitPart/WebKitPart.h: Added. + (WebKitPart::): + * WebKitPart/WebKitPart.rc: Added. + * WebKitPart/WebKitPartBrowser.rc: Added. + * WebKitPart/WebKitPartClient.cpp: Added. + (WebKitPartClient::WebKitPartClient): + (WebKitPartClient::~WebKitPartClient): + * WebKitPart/WebKitPartClient.h: Added. + * WebKitPart/WebKitPartInterface.cpp: Added. + (WebKitPartInterface::WebKitPartInterface): + (WebKitPartInterface::~WebKitPartInterface): + (WebKitPartInterface::url): + (WebKitPartInterface::closeURL): + * WebKitPart/WebKitPartInterface.h: Added. + * WebKitPart/org.kde.WebKitPart.xml: Added. + diff --git a/WebKitQt/WebKitPart/CMakeLists.txt b/WebKitQt/WebKitPart/CMakeLists.txt new file mode 100644 index 000000000000..85bf594658bc --- /dev/null +++ b/WebKitQt/WebKitPart/CMakeLists.txt @@ -0,0 +1,35 @@ +include_directories ( + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../JavaScriptCore + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/bridge + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/page + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/loader + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/platform + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/platform/qt + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/ksvg2 + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/ksvg2/css + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/ksvg2/svg + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/rendering + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/editing + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/html + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/css + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/dom + BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/../../WebCore/xml + BEFORE ${CMAKE_SOURCE_DIR}/kdecore +) + +add_definitions (-Wno-undef -Wno-unused-parameter) + +set (WebKitPart_SRCS WebKitFactory.cpp WebKitPart.cpp WebKitPartInterface.cpp WebKitPartClient.cpp) + +qt4_add_dbus_adaptor (WebKitPart_SRCS org.kde.WebKitPart.xml WebKitPartInterface.h WebKitPartInterface) + +kde4_automoc (${WebKitPart_SRCS}) +kde4_add_plugin (WebKitPart WITH_PREFIX ${WebKitPart_SRCS}) +target_link_libraries (WebKitPart ${KDE4_KDECORE_LIBS} kparts WebCore-unity) + +kde4_install_libtool_file (${PLUGIN_INSTALL_DIR}/ WebKitPart) +install (TARGETS WebKitPart DESTINATION ${PLUGIN_INSTALL_DIR}) + +install (FILES WebKitPart.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +install (FILES WebKitPart.rc WebKitPartBrowser.rc DESTINATION ${DATA_INSTALL_DIR}/WebKitPart) diff --git a/WebKitQt/WebKitPart/WebKitFactory.cpp b/WebKitQt/WebKitPart/WebKitFactory.cpp new file mode 100644 index 000000000000..ac43f86822b9 --- /dev/null +++ b/WebKitQt/WebKitPart/WebKitFactory.cpp @@ -0,0 +1,114 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann + * + * 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 +#include +#include + +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/WebKitQt/WebKitPart/WebKitFactory.h b/WebKitQt/WebKitPart/WebKitFactory.h new file mode 100644 index 000000000000..ff834373f0b6 --- /dev/null +++ b/WebKitQt/WebKitPart/WebKitFactory.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann + * + * 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 + +#include + +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/WebKitQt/WebKitPart/WebKitPart.cpp b/WebKitQt/WebKitPart/WebKitPart.cpp new file mode 100644 index 000000000000..54b184d30a7d --- /dev/null +++ b/WebKitQt/WebKitPart/WebKitPart.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann + * + * 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 "Page.h" +#include "FrameQt.h" +#include "WebKitFactory.h" +#include "WebKitPartClient.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); +} + +WebKitPart::~WebKitPart() +{ + if (m_frame) + delete m_frame->page(); + + delete m_client; +} + +bool WebKitPart::openFile() +{ + return true; +} + +bool WebKitPart::openUrl(const KUrl& url) +{ + return m_frame->openURL(KURL(url.toEncoded())); +} + +bool WebKitPart::closeUrl() +{ + return m_frame->closeURL(); +} + +WebKitPart* WebKitPart::parentPart() +{ + return qobject_cast(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(); + + // Initialize WebCore in Qt platform mode... + Page* page = new Page(); + 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); + + // Initialize KParts widget... + setWidget(m_frame->view()->qwidget()); +} + +#include "WebKitPart.moc" diff --git a/WebKitQt/WebKitPart/WebKitPart.desktop b/WebKitQt/WebKitPart/WebKitPart.desktop new file mode 100644 index 000000000000..a9421391f1e3 --- /dev/null +++ b/WebKitQt/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/WebKitQt/WebKitPart/WebKitPart.h b/WebKitQt/WebKitPart/WebKitPart.h new file mode 100644 index 000000000000..b010d8b8d36e --- /dev/null +++ b/WebKitQt/WebKitPart/WebKitPart.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann + * + * 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 + +#include +#include + +namespace WebCore { + class Frame; + class FrameView; +} + +class WebKitPartClient; + +class WebKitPart : public KParts::ReadOnlyPart +{ +Q_OBJECT +Q_PROPERTY(QString url READ url) + +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 m_frame; + WTF::RefPtr m_frameView; + + WebKitPartClient* m_client; +}; + +#endif diff --git a/WebKitQt/WebKitPart/WebKitPart.rc b/WebKitQt/WebKitPart/WebKitPart.rc new file mode 100644 index 000000000000..886af21fe597 --- /dev/null +++ b/WebKitQt/WebKitPart/WebKitPart.rc @@ -0,0 +1,16 @@ + + + + &Edit + + + + + + + + + + + + diff --git a/WebKitQt/WebKitPart/WebKitPartBrowser.rc b/WebKitQt/WebKitPart/WebKitPartBrowser.rc new file mode 100644 index 000000000000..7fcc84424a6c --- /dev/null +++ b/WebKitQt/WebKitPart/WebKitPartBrowser.rc @@ -0,0 +1,46 @@ + + + + &File + + + + + + + &Edit + + + + + + + + + &View + + + + + + + + + + +Main Toolbar + + + + + + + + + + diff --git a/WebKitQt/WebKitPart/WebKitPartClient.cpp b/WebKitQt/WebKitPart/WebKitPartClient.cpp new file mode 100644 index 000000000000..795b40321a79 --- /dev/null +++ b/WebKitQt/WebKitPart/WebKitPartClient.cpp @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann + * + * 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() + : FrameQtClientDefault() +{ +} + +WebKitPartClient::~WebKitPartClient() +{ +} + +// vim: ts=4 sw=4 et diff --git a/WebKitQt/WebKitPart/WebKitPartClient.h b/WebKitQt/WebKitPart/WebKitPartClient.h new file mode 100644 index 000000000000..c46ad2d7963d --- /dev/null +++ b/WebKitQt/WebKitPart/WebKitPartClient.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann + * + * 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 WebKitPartClient : public WebCore::FrameQtClientDefault +{ +public: + WebKitPartClient(); + virtual ~WebKitPartClient(); +}; + +#endif + +// vim: ts=4 sw=4 et diff --git a/WebKitQt/WebKitPart/WebKitPartInterface.cpp b/WebKitQt/WebKitPart/WebKitPartInterface.cpp new file mode 100644 index 000000000000..ae49b96dfd92 --- /dev/null +++ b/WebKitQt/WebKitPart/WebKitPartInterface.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann + * + * 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/WebKitQt/WebKitPart/WebKitPartInterface.h b/WebKitQt/WebKitPart/WebKitPartInterface.h new file mode 100644 index 000000000000..cac18980bbc3 --- /dev/null +++ b/WebKitQt/WebKitPart/WebKitPartInterface.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2006 Nikolas Zimmermann + * + * 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 + +class KUrl; +class WebKitPart; + +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/WebKitQt/WebKitPart/org.kde.WebKitPart.xml b/WebKitQt/WebKitPart/org.kde.WebKitPart.xml new file mode 100644 index 000000000000..84cacd1020fd --- /dev/null +++ b/WebKitQt/WebKitPart/org.kde.WebKitPart.xml @@ -0,0 +1,10 @@ + + + + + + + + + -- 2.36.0