--- gnash/configure.ac.kde4~	2008-10-07 13:30:16.000000000 +0200
+++ gnash/configure.ac	2008-10-08 13:50:44.651325784 +0200
@@ -478,10 +478,12 @@ esac], sdkinstall=no)
 
 AM_CONDITIONAL(SDKINSTALL, test x$sdkinstall = xyes)
 
+has_kde4=no
 has_kde=no
 has_gtk2=no
 build_fb=no
 build_fltk=no
+build_kde4=no
 build_kde=no
 build_gtk=no
 build_sdl=no
@@ -514,9 +516,12 @@ dnl        AC_DEFINE(USE_ALP, [1], [Use 
 dnl        AC_DEFINE(USE_GTK, [1], [Use the GTK GUI])
         build_gtk=yes
         ;;
-      kde|KDE)
+      kde|KDE|kde3|KDE3)
         build_kde=yes
         ;;
+      kde4|KDE4)
+        build_kde4=yes
+        ;;
       qtopia|QTOPIA)
         build_qtopia=yes
         build_qt=yes
@@ -547,6 +552,7 @@ dnl        AC_DEFINE(USE_GTK, [1], [Use 
         build_fb=yes
         build_fltk=yes
         build_kde=yes
+        build_kde4=yes
         build_gtk=yes
         build_sdl=yes
 dnl        build_qtopia=yes
@@ -554,7 +560,7 @@ dnl        build_hildon=yes
 dnl        build_alp=yes
 dnl        build_riscos=yes
         ;;
-      *) AC_MSG_ERROR([invalid gui ${enableval} given (accept: gtk|kde|fltk|sdl|riscos|aqua|fb|hildon|alp|qtopia|dump)])
+      *) AC_MSG_ERROR([invalid gui ${enableval} given (accept: gtk|kde|kde4|fltk|sdl|riscos|aqua|fb|hildon|alp|qtopia|dump)])
          ;;
       esac]
     enableval=`echo ${enableval} | cut -d ' ' -f 2-6`
@@ -1236,9 +1242,21 @@ AC_ARG_ENABLE(kparts,
 [case "${enableval}" in
   yes) kparts=yes ;;
   no)  kparts=no ;;
-  *)   AC_MSG_ERROR([bad value ${enableval} for --disable-kpart option]) ;;
+  *)   AC_MSG_ERROR([bad value ${enableval} for --disable-kparts option]) ;;
 esac],kparts=$build_kde)
 
+dnl --------------------------------------------------------
+dnl Add KPARTS 4.x support, if specified or KDE gui is built
+dnl --------------------------------------------------------
+
+AC_ARG_ENABLE(kparts4,
+  AC_HELP_STRING([--disable-kparts4], [Disble support for Konqueror 4.x plugin (default: enabled if kde4 gui is)]),
+[case "${enableval}" in
+  yes) kparts4=yes ;;
+  no)  kparts4=no ;;
+  *)   AC_MSG_ERROR([bad value ${enableval} for --disable-kparts4 option]) ;;
+esac],kparts4=$build_kde4)
+
 dnl ----------------------------------------------------
 dnl Add NPAPI support, if specified or GTK gui is built
 dnl ----------------------------------------------------
@@ -1269,6 +1287,7 @@ AC_ARG_ENABLE(plugins,
 if test x$plugins = xno; then
   npapi=no
   kparts=no
+  kparts4=no
 fi
 
 dnl
@@ -1618,6 +1637,10 @@ dnl # Check KDE if kde gui or kparts wer
 if test x$build_kde = xyes -o x$kparts = xyes; then
   GNASH_PATH_KDE
 fi
+if test x$build_kde4 = xyes -o x$kparts4 = xyes; then
+  GNASH_QT4_GUI
+  GNASH_PATH_KDE4
+fi
 if test x$build_qt = xyes -o x$build_qtopia = xyes -o x$build_kde = xyes; then
   GNASH_PATH_QT
   if test x$build_qtopia = xyes; then
@@ -1626,6 +1649,7 @@ if test x$build_qt = xyes -o x$build_qto
 fi
 AM_CONDITIONAL(HAVE_QTOPIA, [test x$has_qtopia = xyes])
 AM_CONDITIONAL(HAVE_KDE, [test x$has_kde = xyes])
+AM_CONDITIONAL(HAVE_KDE4, [test x$has_kde4 = xyes])
 AM_CONDITIONAL(HAVE_QT, [test x$has_qt = xyes])
 
 AM_CONDITIONAL(HAVE_QTOPIA_2, [test x"$gnash_qtopia_version" = x2])
@@ -1667,6 +1691,15 @@ fi
 if test x$build_kde = xno -a x$kparts = xyes; then
   AC_MSG_WARN(["Enabled KPARTS plugin, but you aren't building a KDE based GUI!"])
 fi
+if test x$has_kde4 = xno -a x$kparts4 = xyes; then
+  kparts4=no
+dnl  build_kde4=no
+  AC_MSG_WARN(["Disabling KPARTS 4.x plugin, no KDE 4.x development found"])
+fi
+
+if test x$build_kde4 = xno -a x$kparts4 = xyes; then
+  AC_MSG_WARN(["Enabled KPARTS 4.x plugin, but you aren't building a KDE 4.x based GUI!"])
+fi
 
 AM_CONDITIONAL(BUILD_QTOPIA_GUI, [ test x$build_qtopia = xyes ])
 AM_CONDITIONAL(BUILD_ALP_GUI, [ test x$build_alp = xyes ])
@@ -1674,6 +1707,7 @@ AM_CONDITIONAL(BUILD_QT_GUI, [ test x$bu
 AM_CONDITIONAL(BUILD_HILDON_GUI, [ test x$build_hildon = xyes ])
 AM_CONDITIONAL(BUILD_GTK_GUI, [ test x$build_gtk = xyes ])
 AM_CONDITIONAL(BUILD_KDE_GUI, [ test x$build_kde = xyes ])
+AM_CONDITIONAL(BUILD_KDE4_GUI, [ test x$build_kde4 = xyes ])
 AM_CONDITIONAL(BUILD_FLTK_GUI, [ test x$build_fltk = xyes ])
 AM_CONDITIONAL(BUILD_SDL_GUI, [ test x$build_sdl = xyes ])
 AM_CONDITIONAL(BUILD_FB_GUI, [ test x$build_fb = xyes ])
@@ -1684,6 +1718,7 @@ AM_CONDITIONAL(BUILD_DUMP_GUI, [ test x$
 # plugin building flags
 AM_CONDITIONAL(NPAPI, [test x$npapi = xyes])
 AM_CONDITIONAL(KPARTS, [test x$kparts = xyes])
+AM_CONDITIONAL(KPARTS4, [test x$kparts4 = xyes])
 
 AC_SUBST(KDE_CFLAGS)
 AC_SUBST(KDE_LIBS)
@@ -2088,6 +2123,9 @@ fi
 if test x$build_kde = xyes; then
   SUPPORTED_GUIS="${SUPPORTED_GUIS},kde"
 fi
+if test x$build_kde4 = xyes; then
+  SUPPORTED_GUIS="${SUPPORTED_GUIS},kde4"
+fi
 if test x$build_gtk = xyes; then
   SUPPORTED_GUIS="${SUPPORTED_GUIS},gtk"
 fi
@@ -2212,13 +2250,23 @@ else
 fi
 
 if test x"$kparts" = x"yes"; then
-  echo "        KPARTS plugin enabled (default). Use --disable-kparts to disable"
-  echo "            KPARTS plugin will be installed in ${KDE_PLUGINDIR}"
-  echo "            KPARTS service will be installed in ${KDE_SERVICESDIR}"
-  echo "            KPARTS config dir will be in ${KDE_CONFIGDIR}"
-  echo "            KPARTS appsdata will be installed in ${KDE_APPSDATADIR}"
+  echo "        KPARTS 3.x plugin enabled (default). Use --disable-kparts to disable"
+  echo "            KPARTS 3.x plugin will be installed in ${KDE_PLUGINDIR}"
+  echo "            KPARTS 3.x service will be installed in ${KDE_SERVICESDIR}"
+  echo "            KPARTS 3.x config dir will be in ${KDE_CONFIGDIR}"
+  echo "            KPARTS 3.x appsdata will be installed in ${KDE_APPSDATADIR}"
+else
+  echo "        KPARTS 3.x plugin disabled."
+fi
+
+if test x"$kparts4" = x"yes"; then
+  echo "        KPARTS 4.x plugin enabled (default). Use --disable-kparts4 to disable"
+  echo "            KPARTS 4.x plugin will be installed in ${KDE4_PLUGINDIR}"
+  echo "            KPARTS 4.x service will be installed in ${KDE4_SERVICESDIR}"
+  echo "            KPARTS 4.x config dir will be in ${KDE4_CONFIGDIR}"
+  echo "            KPARTS 4.x appsdata will be installed in ${KDE4_APPSDATADIR}"
 else
-  echo "        KPARTS plugin disabled."
+  echo "        KPARTS 4.x plugin disabled."
 fi
 
 dnl -- if test x"${dynamic_gui}" = x"yes"; then
@@ -2311,17 +2359,17 @@ fi
 
 if test x$build_kde = xyes -o x$kparts = xyes; then
   if test x"$has_kde" = xyes; then
-    echo "        KDE flags are: $KDE_CFLAGS"
-    echo "        KDE libs are: $KDE_LIBS"
+    echo "        KDE 3.x flags are: $KDE_CFLAGS"
+    echo "        KDE 3.x libs are: $KDE_LIBS"
   else
-      echo "        ERROR: No KDE development package installed!" >&3
-      echo "               To disable the KDE gui," >&3
+      echo "        ERROR: No KDE 3.x development package installed!" >&3
+      echo "               To disable the KDE 3.x gui," >&3
       echo "               reconfigure using --enable-gui=<list-of-guis>" >&3
       echo "               and omit "kde" from the list." >&3
       echo "               When the option --enable-gui=... is omitted," >&3
       echo "               the default is the same of --enable-gui=kde,gtk" >&3
-      echo "               To be able to build the kde gui," >&3
-      echo "               install the KDE development environment from http://kde.org" >&3
+      echo "               To be able to build the kde 3.x gui," >&3
+      echo "               install version 3.x of the KDE development environment from http://kde.org" >&3
       echo "               or .deb users: apt-get install kdelibs-dev" >&3
       echo "               or .rpm users: yum install <something-else>." >&3
   fi
--- gnash/gui/am-frag/kde4.am.kde4~	2008-10-08 13:50:45.242075753 +0200
+++ gnash/gui/am-frag/kde4.am	2008-10-08 13:50:45.242075753 +0200
@@ -0,0 +1,38 @@
+# 
+#   Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+# 
+
+#
+# Build the KDE gui
+# 
+if BUILD_KDE4_GUI
+bin_PROGRAMS += kde4-gnash
+kde4_gnash_CPPFLAGS = -DGUI_KDE4 -DGUI_CONFIG=\"KDE4\" \
+	 $(AM_CPPFLAGS) $(KDE4_CFLAGS) $(QT4_CFLAGS)
+kde4_gnash_SOURCES = $(GUI_SRCS) GuiKde4.cpp
+kde4_gnash_LDFLAGS = $(LIBLTDL) -export-dynamic 
+kde4_gnash_LDADD = \
+	$(MYSQL_LIBS) \
+	$(GNASH_LIBS) \
+	$(AM_LDFLAGS) @QTCORE@ @QTGUI@ @KDECORE@ @KDEUI@
+if BUILD_AGG_RENDERER
+kde4_gnash_CPPFLAGS += $(AGG_CFLAGS)
+kde4_gnash_LDADD += $(top_builddir)/backend/libgnashagg.la \
+	$(KDE4_LIBS) $(QT4_LIBS) $(AGG_LIBS)
+kde4_gnash_SOURCES += Kde4GlueAgg.cpp Kde4GlueAgg.h \
+	 	Kde4Gui.cpp Kde4Gui.h KdeGlue.h
+endif
+endif
--- gnash/gui/GuiKde4.cpp.kde4~	2008-10-08 13:50:45.243075564 +0200
+++ gnash/gui/GuiKde4.cpp	2008-10-08 13:50:45.243075564 +0200
@@ -0,0 +1,46 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "gui.h"
+#include "GnashException.h"
+
+#ifdef GUI_KDE4
+#include "Kde4Gui.h"
+#endif
+
+namespace gnash {
+
+#ifdef GUI_KDE4
+std::auto_ptr<Gui> createKDE4Gui(unsigned long windowid, float scale, bool do_loop, unsigned int bit_depth)
+{
+	return std::auto_ptr<Gui>(new Kde4Gui(windowid, scale, do_loop, bit_depth));
+}
+#else // ! GUI_KDE4
+std::auto_ptr<Gui> createKDE4Gui(unsigned long , float , bool , unsigned int )
+{
+	throw GnashException("Support for KDE4 gui was not compiled in");
+}
+#endif // ! GUI_KDE4
+
+} // namespace gnash
+
--- gnash/gui/Kde4GlueAgg.cpp.kde4~	2008-10-08 13:50:45.243075564 +0200
+++ gnash/gui/Kde4GlueAgg.cpp	2008-10-08 13:50:45.243075564 +0200
@@ -0,0 +1,130 @@
+//
+//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "Kde4GlueAgg.h"
+#include "render_handler.h"
+#include "render_handler_agg.h"
+#include <QImage>
+#include <QRect>
+
+namespace gnash
+{
+
+Kde4AggGlue::Kde4AggGlue()
+:
+  _width(0),
+  _height(0),
+   _renderer(0)
+{
+}
+
+Kde4AggGlue::~Kde4AggGlue()
+{
+}
+
+bool
+Kde4AggGlue::init(int /* argc */, char *** /* argv */)
+{
+    return true;
+}
+
+
+void
+Kde4AggGlue::prepDrawingArea(QWidget *drawing_area)
+{
+    _drawing_area = drawing_area;
+}
+
+
+void
+Kde4AggGlue::initBuffer(int width, int height)
+{
+    if (!_renderer) return;
+
+    _width = width;
+    _height = height;
+
+    int _bpp = 32;
+    int depth_bytes = _bpp / 8;
+
+    assert(_bpp % 8 == 0);
+
+#define CHUNK_SIZE (100 * 100 * depth_bytes)
+
+    int bufsize = (width * height * depth_bytes / CHUNK_SIZE + 1) * CHUNK_SIZE;
+
+    _offscreenbuf.reset(new unsigned char[bufsize]);
+
+    render_handler_agg_base * renderer =
+      static_cast<render_handler_agg_base *>(_renderer);
+
+    renderer->init_buffer(_offscreenbuf.get(), bufsize, _width, _height,
+      width*((_bpp+7)/8));
+    
+    _image.reset(new QImage(_offscreenbuf.get(), _width, _height, QImage::Format_RGB32));
+}
+
+
+void
+Kde4AggGlue::render()
+{
+    QRect r(0, 0, _width, _height);
+    render(r);
+}
+
+
+void
+Kde4AggGlue::render(const QRect& updateRect)
+{
+
+// log_debug("Render region: %d, %d, %d, %d", updateRect.topLeft().x(),
+//updateRect.topLeft().y(), updateRect.bottomRight().x(),
+//updateRect.bottomRight().y());
+
+    QPainter p(_drawing_area);
+   
+    p.drawImage(updateRect, *_image, updateRect);
+    p.end();
+
+}
+
+
+render_handler*
+Kde4AggGlue::createRenderHandler()
+{
+    _renderer = create_render_handler_agg("BGRA32");
+
+    if ( ! _renderer )
+    {
+        throw GnashException("Could not create AGG renderer with pixelformat ABGR32");
+    }
+    return _renderer;
+}
+
+void
+Kde4AggGlue::resize(int width, int height)
+{
+    initBuffer(width, height);
+}
+
+// end of namespace gnash
+}
--- gnash/gui/Kde4GlueAgg.h.kde4~	2008-10-08 13:50:45.243075564 +0200
+++ gnash/gui/Kde4GlueAgg.h	2008-10-08 13:50:45.243075564 +0200
@@ -0,0 +1,60 @@
+//
+//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "Kde4Glue.h"
+
+#include <QImage>
+#include <boost/scoped_array.hpp>
+#include <QPainter>
+#include "snappingrange.h"
+
+class QRect;
+
+namespace gnash
+{
+
+class Kde4AggGlue : public Kde4Glue
+{
+  public:
+    Kde4AggGlue();
+    ~Kde4AggGlue();
+    
+    bool init(int argc, char **argv[]);
+    void prepDrawingArea(QWidget *drawing_area);
+    render_handler* createRenderHandler();
+    void initBuffer(int width, int height);
+    void resize(int width, int height);
+    void render();
+    void render(const QRect& updateRect);
+
+  private:
+    int _width;
+    int _height;
+    boost::scoped_array<unsigned char> _offscreenbuf;
+    render_handler* _renderer; // We don't own this pointer.
+    std::auto_ptr<QImage> _image;
+    std::auto_ptr<QPainter> _painter;
+};
+
+
+
+
+}
--- gnash/gui/Kde4Glue.h.kde4~	2008-10-08 13:50:45.244075405 +0200
+++ gnash/gui/Kde4Glue.h	2008-10-08 13:50:45.243075564 +0200
@@ -0,0 +1,47 @@
+//
+//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "gnash.h"
+#include <QWidget>
+#include "snappingrange.h"
+
+
+namespace gnash
+{
+
+class Kde4Glue
+{
+  public:
+    Kde4Glue() : _drawing_area(NULL) {}
+    virtual ~Kde4Glue() { }
+    virtual bool init(int argc, char **argv[]) = 0;
+
+    virtual void prepDrawingArea(QWidget *drawing_area) = 0;
+    virtual render_handler* createRenderHandler() = 0;
+    virtual void render() = 0;
+    virtual void setInvalidatedRegions(const InvalidatedRanges& /* ranges */) {}
+    virtual void resize(int, int) {}
+    virtual void initBuffer(int, int) {}
+  protected:
+    QWidget     *_drawing_area;
+};
+
+} // namespace gnash
--- gnash/gui/Kde4Gui.cpp.kde4~	2008-10-08 13:50:45.256076033 +0200
+++ gnash/gui/Kde4Gui.cpp	2008-10-08 13:50:45.256076033 +0200
@@ -0,0 +1,530 @@
+// kde.cpp:  K Development Environment top level window, for Gnash.
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+
+#include <map>
+#include <boost/assign/list_inserter.hpp>
+
+#include <QMainWindow>
+#include <QMenu>
+#include <QMenuBar>
+#include <QWidget>
+#include <QCursor>
+#include <QApplication>
+#include <QPainter>
+#include <QMouseEvent>
+#include <QResizeEvent>
+#include <QTimer>
+#include <QEvent>
+
+#include "Range2d.h"
+
+#include "gnash.h"
+#include "movie_definition.h" 
+#include "log.h"
+
+#include "gui.h"
+#include "Kde4Gui.h"
+#include "Kde4.moc"
+#include "render_handler.h"
+#include "utility.h" // for PIXELS_TO_TWIPS 
+
+
+namespace gnash 
+{
+
+Kde4Gui::Kde4Gui(unsigned long xid, float scale, bool loop, unsigned int depth)
+ : Gui(xid, scale, loop, depth)
+{
+}
+
+
+Kde4Gui::~Kde4Gui()
+{
+}
+
+
+bool
+Kde4Gui::init(int argc, char **argv[])
+{
+
+    char** r = NULL;
+    int* i = new int(0);
+
+    _application.reset(new QApplication(*i, r));
+    _window.reset(new QMainWindow());
+    _drawingWidget = new DrawingWidget(*this);
+
+    _glue.init (argc, argv);
+
+    setupActions();
+    setupMenus();
+
+    if (!_xid) {
+        createMainMenu();
+    }
+
+    // Make sure key events are ready to be passed
+    // before the widget can receive them.
+    setupKeyMap();
+    
+    return true;
+}
+
+
+bool
+Kde4Gui::run()
+{
+    return _application->exec();
+}
+
+
+bool
+Kde4Gui::createWindow(const char* windowtitle, int width, int height)
+{
+
+    _width = width;
+    _height = height;
+
+    _drawingWidget->setMinimumSize(_width, _height);
+
+    // Enable receiving of mouse events.
+    _drawingWidget->setMouseTracking(true);
+    _drawingWidget->setFocusPolicy(Qt::StrongFocus);
+    _window->setWindowTitle(windowtitle);
+    
+    // The QMainWindow takes ownership of the DrawingWidget.
+    _window->setCentralWidget(_drawingWidget);
+    _window->show();
+
+    _glue.prepDrawingArea(_drawingWidget);
+
+    _renderer = _glue.createRenderHandler();
+
+    if ( ! _renderer ) {
+        return false;
+    }
+
+    _validbounds.setTo(0, 0, _width, _height);
+    _glue.initBuffer(width, height);
+    
+    set_render_handler(_renderer);
+   
+    return true;
+}
+
+
+void
+Kde4Gui::popupMenu(const QPoint& point)
+{
+    QMenu popupMenu(_drawingWidget);
+    popupMenu.addMenu(fileMenu);
+    popupMenu.addMenu(movieControlMenu);
+    popupMenu.addMenu(viewMenu);
+    popupMenu.exec(point);
+}
+
+
+void
+Kde4Gui::renderBuffer()
+{
+    
+    for (DrawBounds::const_iterator i = _drawbounds.begin(),
+                        e = _drawbounds.end(); i != e; ++i) {
+        
+        // it may happen that a particular range is out of the screen, which 
+        // will lead to bounds==null. 
+        if (i->isNull()) continue;
+        
+        assert(i->isFinite()); 
+
+        _drawingWidget->update(i->getMinX(), i->getMinY(),
+                               i->width(), i->height());
+
+    }
+}
+
+
+void
+Kde4Gui::renderWidget(const QRect& updateRect)
+{
+    // This call renders onto the widget using a QPainter,
+    // which *must only happen inside a paint event*.
+    _glue.render(updateRect);
+}
+
+
+void
+Kde4Gui::setInvalidatedRegions(const InvalidatedRanges& ranges)
+{
+    _renderer->set_invalidated_regions(ranges);
+
+    _drawbounds.clear();
+
+    for (size_t i = 0, e = ranges.size(); i != e; ++i) {
+
+        geometry::Range2d<int> bounds = Intersection(
+        _renderer->world_to_pixel(ranges.getRange(i)),
+        _validbounds);
+
+        // it may happen that a particular range is out of the screen, which 
+        // will lead to bounds==null. 
+        if (bounds.isNull()) continue;
+
+
+        assert(bounds.isFinite());
+
+        _drawbounds.push_back(bounds);
+
+    }
+}
+
+
+void
+Kde4Gui::setTimeout(unsigned int timeout)
+{
+    QTimer::singleShot(timeout, _application.get(), SLOT(quit()));
+}
+
+
+void
+Kde4Gui::setInterval(unsigned int interval)
+{
+      _drawingWidget->startTimer(interval);
+}
+
+
+void
+Kde4Gui::setCursor(gnash_cursor_type newcursor)
+{
+    switch(newcursor) {
+        case CURSOR_HAND:
+            _drawingWidget->setCursor(Qt::PointingHandCursor);
+            break;
+        case CURSOR_INPUT:
+            _drawingWidget->setCursor(Qt::IBeamCursor); 
+            break;
+        default:
+            _drawingWidget->unsetCursor(); 
+    }
+}
+
+
+gnash::key::code
+Kde4Gui::qtToGnashKey(QKeyEvent *event)
+{
+
+    // This should be initialized by now.
+    assert (!_keyMap.empty());
+
+    // Gnash uses its own keycodes to map key events
+    // to the three sometimes weird and confusing values that flash movies
+    // can refer to. See gnash.h for the keycodes and map.
+    //
+    // Gnash's keycodes are gnash::key::code. They are mainly in ascii order.
+    // Standard ascii characters (32-127) have the same value. Extended ascii
+    // characters (160-254) are in ascii order but correspond to gnash::key::code
+    // 169-263. Non-character values must normally be mapped separately.
+
+    const int key = event->key();
+
+    if (key >= Qt::Key_0 && key <= Qt::Key_9) {
+          return static_cast<gnash::key::code>(
+                key - Qt::Key_0 + gnash::key::_0);
+    }
+
+    // All other characters between ascii 32 and 126 are simple.
+    // From space (32) to slash (47):
+    else if (key >= Qt::Key_Space && key <= Qt::Key_AsciiTilde) {
+        return static_cast<gnash::key::code>(
+                key - Qt::Key_Space + gnash::key::SPACE);
+    }
+
+    // Function keys:
+    else if (key >= Qt::Key_F1 && key <= Qt::Key_F15) {
+        return static_cast<gnash::key::code>(
+                key - Qt::Key_F1 + gnash::key::F1);
+    }
+
+    // Extended ascii from non-breaking (160) space to ÿ (264) is in the same
+    // order.
+    else if (key >= Qt::Key_nobreakspace && key <= Qt::Key_ydiaeresis) {
+        return static_cast<gnash::key::code>(
+                key - Qt::Key_nobreakspace + gnash::key::NOBREAKSPACE);
+    }
+
+    const KeyMap::const_iterator it = _keyMap.find(key);
+    
+    if (it == _keyMap.end()) return gnash::key::INVALID;
+    
+    return it->second;
+
+}
+
+
+void
+Kde4Gui::handleKeyEvent(QKeyEvent *event, bool down)
+{
+    gnash::key::code c = qtToGnashKey(event);
+//    int mod = qtToGnashModifier(event->state());
+    notify_key_event(c, 0, down);
+}
+
+
+void
+Kde4Gui::resize(int width, int height)
+{
+    _glue.resize(width, height);
+    resize_view(width, height);
+}
+
+
+void
+Kde4Gui::quit()
+{
+    _application->quit();
+}
+
+
+void
+Kde4Gui::setupActions()
+{
+
+    // File Menu actions
+    quitAction = new QAction(_("Quit Gnash"), _window.get());
+    // This is connected directly to the QApplication's quit() slot
+    _drawingWidget->connect(quitAction, SIGNAL(triggered()),
+                     _application.get(), SLOT(quit()));
+
+    // Movie Control Menu actions
+    playAction = new QAction(_("Play"), _window.get());
+    _drawingWidget->connect(playAction, SIGNAL(triggered()),
+                     _drawingWidget, SLOT(play()));
+
+    pauseAction = new QAction(_("Pause"), _window.get());
+    _drawingWidget->connect(pauseAction, SIGNAL(triggered()),
+                     _drawingWidget, SLOT(pause()));
+
+    stopAction = new QAction(_("Stop"), _window.get());
+    _drawingWidget->connect(stopAction, SIGNAL(triggered()),
+                     _drawingWidget, SLOT(stop()));
+
+    restartAction = new QAction(_("Restart"), _window.get());
+    _drawingWidget->connect(restartAction, SIGNAL(triggered()),
+                     _drawingWidget, SLOT(restart()));
+
+    // View Menu actions
+    refreshAction = new QAction(_("Refresh"), _window.get());
+    _drawingWidget->connect(refreshAction, SIGNAL(triggered()),
+                     _drawingWidget, SLOT(refresh()));
+
+}
+
+
+void
+Kde4Gui::setupMenus()
+{
+    /// The menus are children of the QMainWindow so that
+    /// they are destroyed on exit. The QMainWindow already has
+    /// ownership of the main QMenuBar.
+
+    // Set up the File menu.
+    fileMenu = new QMenu(_("File"), _window.get());
+    fileMenu->addAction(quitAction);
+
+    // Set up the Movie Control menu
+    movieControlMenu = new QMenu(_("Movie Control"), _window.get());
+    movieControlMenu->addAction(playAction);
+    movieControlMenu->addAction(pauseAction);
+    movieControlMenu->addAction(stopAction);
+    movieControlMenu->addAction(restartAction);
+
+    // Set up the View menu
+    viewMenu = new QMenu(_("View"), _window.get());
+    viewMenu->addAction(refreshAction);
+}
+
+
+void
+Kde4Gui::createMainMenu()
+{
+    std::auto_ptr<QMenuBar> mainMenu(new QMenuBar);
+
+    // Set up the menu bar.
+    mainMenu->addMenu(fileMenu);
+    mainMenu->addMenu(movieControlMenu);
+    mainMenu->addMenu(viewMenu);
+
+    // The QMainWindow::setMenuBar transfers ownership
+    // of the QMenuBar.
+    _window->setMenuBar(mainMenu.release());
+
+}
+
+void
+Kde4Gui::setupKeyMap()
+{
+    // We only want to do this once, although it would not
+    // be harmful to do it more.
+    assert (_keyMap.empty());
+    
+    boost::assign::insert(_keyMap)
+    (Qt::Key_Backspace, gnash::key::BACKSPACE)
+    (Qt::Key_Tab, gnash::key::TAB)
+    (Qt::Key_Clear, gnash::key::CLEAR)
+    (Qt::Key_Return, gnash::key::ENTER)
+    (Qt::Key_Enter, gnash::key::ENTER)
+    (Qt::Key_Shift, gnash::key::SHIFT)
+    (Qt::Key_Control, gnash::key::CONTROL)
+    (Qt::Key_Alt, gnash::key::ALT)
+    (Qt::Key_CapsLock, gnash::key::CAPSLOCK)
+    (Qt::Key_Escape, gnash::key::ESCAPE)
+    (Qt::Key_Space, gnash::key::SPACE)
+    (Qt::Key_PageDown, gnash::key::PGDN)
+    (Qt::Key_PageUp, gnash::key::PGUP)
+    (Qt::Key_Home, gnash::key::HOME)
+    (Qt::Key_End, gnash::key::END)
+    (Qt::Key_Left, gnash::key::LEFT)
+    (Qt::Key_Up, gnash::key::UP)
+    (Qt::Key_Right, gnash::key::RIGHT)
+    (Qt::Key_Down, gnash::key::DOWN)
+    (Qt::Key_Insert, gnash::key::INSERT)
+    (Qt::Key_Delete, gnash::key::DELETEKEY)
+    (Qt::Key_Help, gnash::key::HELP)
+    (Qt::Key_NumLock, gnash::key::NUM_LOCK)
+    (Qt::Key_Semicolon, gnash::key::SEMICOLON)
+    (Qt::Key_Equal, gnash::key::EQUALS)
+    (Qt::Key_Minus, gnash::key::MINUS)
+    (Qt::Key_Slash, gnash::key::SLASH)
+    (Qt::Key_BracketLeft, gnash::key::LEFT_BRACKET)
+    (Qt::Key_Backslash, gnash::key::BACKSLASH)
+    (Qt::Key_BracketRight, gnash::key::RIGHT_BRACKET)
+    (Qt::Key_QuoteDbl, gnash::key::DOUBLE_QUOTE);
+}
+
+
+/// DrawingWidget implementation
+
+void 
+DrawingWidget::paintEvent(QPaintEvent *event)
+{
+    _gui.renderWidget(event->rect());
+}
+
+
+void
+DrawingWidget::timerEvent(QTimerEvent*)
+{
+    Gui::advance_movie(&_gui);
+}
+
+
+void
+DrawingWidget::mouseMoveEvent(QMouseEvent *event)
+{
+    QPoint position = event->pos();
+    _gui.notify_mouse_moved(position.x(), position.y());
+}
+
+
+void
+DrawingWidget::contextMenuEvent(QContextMenuEvent* event)
+{
+    _gui.popupMenu(event->globalPos());
+}
+
+
+void
+DrawingWidget::mousePressEvent(QMouseEvent* /* event */)
+{
+    _gui.notify_mouse_clicked(true, 1);
+}
+
+
+void
+DrawingWidget::mouseReleaseEvent(QMouseEvent* /* event */)
+{
+    _gui.notify_mouse_clicked(false, 1);
+}
+
+
+void
+DrawingWidget::keyPressEvent(QKeyEvent *event)
+{
+    _gui.handleKeyEvent(event, true);
+}
+
+
+void
+DrawingWidget::keyReleaseEvent(QKeyEvent *event)
+{
+    _gui.handleKeyEvent(event, false);
+}
+
+
+void
+DrawingWidget::resizeEvent(QResizeEvent *event)
+{
+    _gui.resize(event->size().width(), event->size().height());
+    update();
+}
+
+
+void
+DrawingWidget::play()
+{
+    _gui.play();
+}
+
+
+void
+DrawingWidget::pause()
+{
+    _gui.pause();
+}
+
+
+void
+DrawingWidget::restart()
+{
+    _gui.restart();
+}
+
+
+void
+DrawingWidget::stop()
+{
+    _gui.stop();
+}
+
+
+void
+DrawingWidget::refresh()
+{
+    _gui.refreshView();
+}
+
+
+
+}
+
--- gnash/gui/Kde4Gui.h.kde4~	2008-10-08 13:50:45.257076031 +0200
+++ gnash/gui/Kde4Gui.h	2008-10-08 13:50:45.257076031 +0200
@@ -0,0 +1,170 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#ifndef GNASH_KDE4GUI_H
+#define GNASH_KDE4GUI_H
+
+#ifdef HAVE_CONFIG_H
+#include "gnashconfig.h"
+#endif
+
+#include "gui.h"
+
+#include <QObject>
+#include <QWidget>
+
+#ifdef RENDERER_OPENGL
+# error "OGL not supported yet for KDE4!"
+#elif defined(RENDERER_CAIRO)
+# error "Cairo not supported yet for KDE4!"
+#elif defined(RENDERER_AGG)
+# include "Kde4GlueAgg.h"
+#endif
+
+
+class QMainWindow;
+class QMenuBar;
+class QMenu;
+class QRect;
+
+namespace gnash {
+    class Kde4Gui;
+}
+
+namespace gnash
+{
+
+class DrawingWidget : public QWidget
+{
+    Q_OBJECT;
+
+public:
+    DrawingWidget(Kde4Gui& gui) : _gui(gui) {}
+    ~DrawingWidget() {}
+
+public slots:
+
+    void play();
+    void pause();
+    void stop();
+    void restart();
+    void refresh();
+
+protected:
+    void paintEvent(QPaintEvent*);
+    void timerEvent(QTimerEvent*);
+    void resizeEvent(QResizeEvent *event);
+    void mouseReleaseEvent(QMouseEvent *event);
+    void mousePressEvent(QMouseEvent *event);
+    void mouseMoveEvent(QMouseEvent *event);
+    void keyPressEvent(QKeyEvent *event);
+    void keyReleaseEvent(QKeyEvent *event);
+    void contextMenuEvent(QContextMenuEvent *event);
+
+private:
+
+    Kde4Gui& _gui;
+
+};
+
+
+class DSOEXPORT Kde4Gui :  public Gui
+{
+
+public:
+    Kde4Gui(unsigned long xid, float scale, bool loop, unsigned int depth);
+    virtual ~Kde4Gui();
+    virtual bool init(int argc, char **argv[]);
+    virtual bool createWindow(const char* windowtitle, int width, int height);
+    virtual bool run();
+    virtual void renderBuffer();
+    virtual void setInterval(unsigned int interval);
+    virtual void setTimeout(unsigned int timeout);
+    virtual void handleKeyEvent(QKeyEvent *event, bool down);
+    virtual void setCursor(gnash_cursor_type newcursor);
+    void setInvalidatedRegions(const InvalidatedRanges& ranges);
+    void resize(int width, int height);
+    void quit();
+
+    bool want_multiple_regions() { return true; }
+
+    void renderWidget(const QRect& updateRect);
+
+    void popupMenu(const QPoint& point);
+
+private:
+
+    typedef std::vector<geometry::Range2d<int> > DrawBounds; 
+    typedef std::map<int, gnash::key::code> KeyMap;
+
+    void setupActions();
+    void setupMenus();
+    void createMainMenu();
+
+    /// Set up the map of Qt to Gnash keys.
+    void setupKeyMap();
+
+    DrawBounds::value_type _validbounds;
+    DrawBounds _drawbounds;
+ 
+    /// The main application, which should destroy everything
+    /// left on closing.
+    std::auto_ptr<QApplication>  _application;
+    
+    /// The widget for rendering and handling user events.
+    //
+    /// Ownership is transferred to the main window, which
+    /// takes care of deletion.
+    DrawingWidget* _drawingWidget;
+    
+    /// Takes care of painting onto the widget.
+    Kde4AggGlue _glue;
+    
+    /// The main application window.
+    std::auto_ptr<QMainWindow> _window;
+
+    /// A map for Qt::Key values that don't easily
+    /// map onto Gnash ones.
+    KeyMap _keyMap;
+
+    gnash::key::code qtToGnashKey(QKeyEvent *event);
+
+    /// QActions and QMenus should be attached to the
+    /// QMainWindow so that they are destroyed with it.
+    /// Actions may be shared between menus and/or
+    /// other uses.
+
+    // File Menu
+    QMenu* fileMenu;
+    QAction* quitAction;
+    
+    // Movie Control Menu;
+    QMenu* movieControlMenu;
+    QAction* playAction;
+    QAction* pauseAction;
+    QAction* stopAction;
+    QAction* restartAction;
+    
+    // View Menu
+    QMenu* viewMenu;
+    QAction* refreshAction;
+
+};
+
+}
+
+#endif
--- gnash/gui/Makefile.am.kde4~	2008-10-07 13:30:16.000000000 +0200
+++ gnash/gui/Makefile.am	2008-10-08 13:50:45.257076031 +0200
@@ -188,6 +188,15 @@ BUILT_SOURCES += klash.moc 
 include $(srcdir)/am-frag/kde.am
 endif
 
+# Build the KDE4 gui
+if BUILD_KDE4_GUI
+BUILT_SOURCES += Kde4.moc
+include $(srcdir)/am-frag/kde4.am
+
+Kde4.moc: $(srcdir)/Kde4Gui.h
+	@MOC4@ -o $@ $<
+endif
+
 # Build the SDL gui
 if BUILD_SDL_GUI
 include $(srcdir)/am-frag/sdl.am
--- gnash/macros/kde4.m4.kde4~	2008-10-08 13:50:45.258075677 +0200
+++ gnash/macros/kde4.m4	2008-10-08 13:50:45.258075677 +0200
@@ -0,0 +1,337 @@
+AC_DEFUN([GNASH_PATH_QT4], [
+	AC_ARG_WITH(qt4, AS_HELP_STRING([--with-qt4=DIR], [Location of Qt 4.x]))
+	if test "$with_qt4" = "yes" -o "$with_qt4" = "no"; then
+		with_qt4=""
+	fi
+	AC_MSG_CHECKING([for Qt 4.x])
+	LibDir="lib"
+	if uname -m |grep -q 64 && test -d /usr/lib64; then
+		LibDir="lib64"
+	fi
+	gnash_cv_lib_qt_dir=no
+	for dir in $with_qt4 $QTDIR /usr/$LibDir/qt4 /usr/local/$LibDir/qt4 /usr/local/$LibDir/qt /opt/qt /opt/qt4 /usr/$LibDir/qt /usr/local/$LibDir/qt /opt/qt $libdir; do
+		if test -e $dir/lib/libQtCore.so; then
+			gnash_cv_lib_qt_dir="$dir"
+			break
+		fi
+	done
+	if test "$gnash_cv_lib_qt_dir" = "no"; then
+		dnl We might be on OSX...
+		if test -d /Library/Frameworks/QtCore.framework; then
+			gnash_cv_lib_qt_dir=/Library/Frameworks
+			LDFLAGS="-L/Library/Frameworks -F/Library/Frameworks"
+		fi
+	fi
+	if test -x "$gnash_cv_lib_qt_dir/bin/moc"; then
+		MOC4="$gnash_cv_lib_qt_dir/bin/moc"
+		UIC4="$gnash_cv_lib_qt_dir/bin/uic"
+		RCC4="$gnash_cv_lib_qt_dir/bin/rcc"
+	else
+		MOC4="moc"
+		UIC4="uic"
+		RCC4="rcc"
+	fi
+	if test "$gnash_cv_lib_qt_dir" = "no"; then
+		AC_MSG_RESULT([not found])
+	else
+		AC_MSG_RESULT([$gnash_cv_lib_qt_dir])
+		QT="$gnash_cv_lib_qt_dir"
+		AC_SUBST([QT])
+		AC_SUBST([MOC4])
+		AC_SUBST([UIC4])
+		AC_SUBST([RCC4])
+	fi
+])
+
+AC_DEFUN([GNASH_QT4_CORE], [
+	AC_REQUIRE([GNASH_PATH_QT4])
+	if test "$gnash_cv_lib_qt_dir" = "/Library/Frameworks"; then
+		CPPFLAGS="$CPPFLAGS -D_REENTRANT -DQT_SHARED -I$gnash_cv_lib_qt_dir/QtCore.framework/Headers"
+		QTCORE="-framework QtCore"
+	else
+		CPPFLAGS="$CPPFLAGS -D_REENTRANT -DQT_SHARED -I$gnash_cv_lib_qt_dir/include -I$gnash_cv_lib_qt_dir/include/QtCore"
+		LDFLAGS="$LDFLAGS -L$gnash_cv_lib_qt_dir/lib"
+		QTCORE="-lQtCore"
+	fi
+	if test "$enable_qt_debug" = "no"; then
+		CPPFLAGS="$CPPFLAGS -DQT_NO_DEBUG"
+	fi
+	AC_SUBST(QTCORE)
+])
+
+AC_DEFUN([GNASH_QT4_GUI], [
+	AC_REQUIRE([GNASH_QT4_CORE])
+	if test "$gnash_cv_lib_qt_dir" = "/Library/Frameworks"; then
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/QtGui.framework/Headers"
+		QTGUI="-framework QtGui"
+	else
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/include/QtGui"
+		QTGUI="-lQtGui"
+	fi
+	AC_SUBST(QTGUI)
+])
+
+AC_DEFUN([GNASH_QT4_XML], [
+	AC_REQUIRE([GNASH_QT4_CORE])
+	if test "$gnash_cv_lib_qt_dir" = "/Library/Frameworks"; then
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/QtXml.framework/Headers"
+		QTXML="-framework QtXml"
+	else
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/include/QtXml"
+		QTXML="-lQtXml"
+	fi
+	AC_SUBST(QTXML)
+])
+
+AC_DEFUN([GNASH_QT4_DBUS], [
+	AC_REQUIRE([GNASH_QT4_XML])
+	CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/include/QtDBus"
+	QTDBUS="-lQtDBus"
+	AC_SUBST(QTDBUS)
+])
+
+AC_DEFUN([GNASH_QT4_NETWORK], [
+	AC_REQUIRE([GNASH_QT4_CORE])
+	if test "$gnash_cv_lib_qt_dir" = "/Library/Frameworks"; then
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/QtNetwork.framework/Headers"
+		QTNETWORK="-framework QtNetwork"
+	else
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/include/QtNetwork"
+		QTNETWORK="-lQtNetwork"
+	fi
+	AC_SUBST(QTNETWORK)
+])
+
+AC_DEFUN([GNASH_QT4_OPENGL], [
+	AC_REQUIRE([GNASH_QT4_GUI])
+	if test "$gnash_cv_lib_qt_dir" = "/Library/Frameworks"; then
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/QtOpenGL.framework/Headers"
+		QTOPENGL="-framework QtOpenGL"
+	else
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/include/QtOpenGL"
+		QTOPENGL="-lQtOpenGL"
+	fi
+	AC_SUBST(QTOPENGL)
+])
+
+AC_DEFUN([GNASH_QT4_SCRIPT], [
+	AC_REQUIRE([GNASH_QT4_CORE])
+	if test "$gnash_cv_lib_qt_dir" = "/Library/Frameworks"; then
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/QtScript.framework/Headers"
+		QTSCRIPT="-framework QtScript"
+	else
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/include/QtScript"
+		QTSCRIPT="-lQtScript"
+	fi
+	AC_SUBST(QTSCRIPT)
+])
+
+AC_DEFUN([GNASH_QT4_SQL], [
+	AC_REQUIRE([GNASH_QT4_CORE])
+	if test "$gnash_cv_lib_qt_dir" = "/Library/Frameworks"; then
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/QtSql.framework/Headers"
+		QTSQL="-framework QtSql"
+	else
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/include/QtSql"
+		QTSQL="-lQtSql"
+	fi
+	AC_SUBST(QTSQL)
+])
+
+AC_DEFUN([GNASH_QT4_SVG], [
+	AC_REQUIRE([GNASH_QT4_GUI])
+	AC_REQUIRE([GNASH_QT4_XML])
+	if test "$gnash_cv_lib_qt_dir" = "/Library/Frameworks"; then
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/QtSvg.framework/Headers"
+		QTSVG="-framework QtSvg"
+	else
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/include/QtSvg"
+		QTSVG="-lQtSvg"
+	fi
+])
+
+AC_DEFUN([GNASH_QT4_TEST], [
+	AC_REQUIRE([GNASH_QT4_CORE])
+	if test "$gnash_cv_lib_qt_dir" = "/Library/Frameworks"; then
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/QtTest.framework/Headers"
+		QTTEST="-framework QtTest"
+	else
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/include/QtTest"
+		QTTEST="-lQtTest"
+	fi
+	AC_SUBST(QTTEST)
+])
+
+AC_DEFUN([GNASH_QT4_COMPAT], [
+	AC_REQUIRE([GNASH_QT4_CORE])
+	AC_REQUIRE([GNASH_QT4_GUI])
+	AC_REQUIRE([GNASH_QT4_NETWORK])
+	AC_REQUIRE([GNASH_QT4_SQL])
+	AC_REQUIRE([GNASH_QT4_XML])
+	if test "$gnash_cv_lib_qt_dir" = "/Library/Frameworks"; then
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/Qt3Support.framework/Headers"
+		QT3SUPPORT="-framework Qt3Support"
+	else
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/include/Qt3Support"
+		QT3SUPPORT="-lQt3Support"
+	fi
+	AC_SUBST(QT3SUPPORT)
+])
+
+AC_DEFUN([GNASH_QT4_DESIGNER], [
+	AC_REQUIRE([GNASH_QT4_CORE])
+	AC_REQUIRE([GNASH_QT4_GUI])
+	AC_REQUIRE([GNASH_QT4_NETWORK])
+	AC_REQUIRE([GNASH_QT4_XML])
+	if test "$gnash_cv_lib_qt_dir" = "/Library/Frameworks"; then
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/QtDesigner.framework/Headers"
+		QTDESIGNER="-framework QtDesigner"
+	else
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/include/QtDesigner"
+		QTDESIGNER="-lQtDesigner"
+	fi
+	AC_SUBST(QTDESIGNER)
+])
+
+AC_DEFUN([GNASH_QT_WEBKIT], [
+	AC_REQUIRE([GNASH_QT4_GUI])
+	AC_MSG_CHECKING([for WebKit])
+	SAVE_CPPFLAGS="$CPPFLAGS"
+	SAVE_LDFLAGS="$LDFLAGS"
+	if test "$gnash_cv_lib_qt_dir" = "/Library/Frameworks"; then
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/QtWebKit.framework/Headers"
+		QTWEBKIT="-framework QtWebKit"
+	else
+		CPPFLAGS="$CPPFLAGS -I$gnash_cv_lib_qt_dir/include/QtWebKit"
+		QTWEBKIT="-lQtWebKit"
+	fi
+	AC_LANG_PUSH([C++])
+	AC_COMPILE_IFELSE([
+		#include <qwebpage.h>
+	], [found=yes], [found=no])
+	AC_MSG_RESULT([$found])
+	AC_LANG_POP
+	if test "$found" = "yes"; then
+		AC_DEFINE([HAVE_WEBKIT], [1], [Define if you have WebKit])
+		AC_SUBST(QTWEBKIT)
+	else
+		CPPFLAGS="$SAVE_CPPFLAGS"
+		LDFLAGS="$SAVE_LDFLAGS"
+	fi
+])
+
+AC_DEFUN([GNASH_QT4], [
+	AC_REQUIRE([GNASH_QT4_CORE])
+	AC_REQUIRE([GNASH_QT4_GUI])
+	AC_REQUIRE([GNASH_QT4_XML])
+	AC_REQUIRE([GNASH_QT4_NETWORK])
+	AC_REQUIRE([GNASH_QT4_OPENGL])
+	AC_REQUIRE([GNASH_QT4_DBUS])
+	AC_REQUIRE([GNASH_QT4_SCRIPT])
+	AC_REQUIRE([GNASH_QT4_SQL])
+	AC_REQUIRE([GNASH_QT4_SVG])
+	AC_REQUIRE([GNASH_QT4_TEST])
+])
+
+AC_DEFUN([GNASH_PATH_KDE4], [
+	AC_ARG_WITH(kde4, AS_HELP_STRING([--with-kde4=DIR], [Location of KDE 4.x]))
+	if test "$with_kde4" = "yes"; then
+		with_kde4=""
+	fi
+	AC_MSG_CHECKING([for KDE 4.x])
+	if test "$with_kde4" = "no"; then
+		AC_MSG_RESULT([disabled by user])
+	else
+		gnash_cv_lib_kde_dir=no
+		if uname -m |grep -q 64 && test -d /usr/lib64; then
+			LibDir="lib64"
+		fi
+		for dir in $with_kde4 $prefix /opt/kde4 /opt/kde /usr /usr/local; do
+			if test -e $dir/$LibDir/libkhtml.so.5; then
+				gnash_cv_lib_kde_dir="$dir"
+				break
+			fi
+		done
+		if test "$gnash_cv_lib_kde_dir" = "no"; then
+			with_kde4=no
+			AC_MSG_RESULT([not found])
+		else
+			AC_DEFINE_UNQUOTED([WITH_KDE4], [1], [Define to use KDE])
+			AC_MSG_RESULT([$gnash_cv_lib_kde_dir])
+			KDE="$gnash_cv_lib_kde_dir"
+			if test "$KDE" != "/usr"; then
+				KDE4_INCLUDES="-I$KDE/include"
+				KDECORE="-L$KDE/$LibDir -Wl,--rpath -Wl,$KDE/$LibDir -lkdecore"
+			else
+				KDECORE="-lkdecore"
+			fi
+			AC_SUBST([KDE4])
+			AC_SUBST([KDE4_INCLUDES])
+			KDEUI="$KDECORE -lkdeui"
+			KHTML="$KDECORE -lkhtml"
+			AC_SUBST([KDECORE])
+			AC_SUBST([KHTML])
+			AC_SUBST([KDEUI])
+
+			KDE4_PLUGINDIR="$gnash_cv_lib_kde_dir/$LibDir/kde4"
+			KDE4_SERVICESDIR="$gnash_cv_lib_kde_dir/share/kde4/services"
+			KDE4_APPSDATADIR="$gnash_cv_lib_kde_dir/share/apps/klash4"
+			KDE4_CONFIGDIR="$gnash_cv_lib_kde_dir/share/config/"
+			AC_SUBST([KDE4_PLUGINDIR])
+			AC_SUBST([KDE4_SERVICESDIR])
+			AC_SUBST([KDE4_APPSDATADIR])
+			AC_SUBST([KDE4_CONFIGDIR])
+		fi
+	fi
+	AM_CONDITIONAL(WITH_KDE4, test "$with_kde4" != "no")
+])
+
+AC_DEFUN([GNASH_QT_PLATFORM], [
+	AC_REQUIRE([GNASH_QT4_CORE])
+	AC_MSG_CHECKING([Qt platform])
+	platform=unknown
+	AC_COMPILE_IFELSE([
+		#include <qglobal.h>
+		#ifndef Q_WS_X11
+		#error Not X11
+		#endif
+	], [platform=X11], [])
+	if test "$platform" = "unknown"; then
+		AC_COMPILE_IFELSE([
+			#include <qglobal.h>
+			#ifndef Q_WS_QWS
+			#error Not Qtopia
+			#endif
+		], [platform=Qtopia], [])
+	fi
+	if test "$platform" = "unknown"; then
+		AC_COMPILE_IFELSE([
+			#include <qglobal.h>
+			#ifndef Q_WS_MACX
+			#error Not OSX
+			#endif
+		], [platform=OSX], [])
+	fi
+	if test "$platform" = "unknown"; then
+		AC_COMPILE_IFELSE([
+			#include <qglobal.h>
+			#ifndef Q_WS_MAC9
+			#error Not OS9
+			#endif
+		], [platform=OS9], [])
+	fi
+	if test "$platform" = "unknown"; then
+		AC_COMPILE_IFELSE([
+			#include <qglobal.h>
+			#ifndef Q_WS_WIN32
+			#error No dirty Nazi junk
+			#endif
+		], [platform=Win32], [])
+	fi
+	AM_CONDITIONAL([QT_X11], [test "$platform" = "X11"])
+	AM_CONDITIONAL([QTOPIA], [test "$platform" = "Qtopia"])
+	AM_CONDITIONAL([QT_OSX], [test "$platform" = "OSX"])
+	AM_CONDITIONAL([QT_OS9], [test "$platform" = "OS9"])
+	AM_CONDITIONAL([QT_WIN32], [test "$platform" = "Win32"])
+	AC_MSG_RESULT([$platform])
+])
--- gnash/plugin/klash4/klash.desktop.kde4~	2008-10-08 13:50:45.259075627 +0200
+++ gnash/plugin/klash4/klash.desktop	2008-10-08 13:50:45.259075627 +0200
@@ -0,0 +1,80 @@
+# KDE Config File
+[Desktop Entry]
+Encoding=UTF-8
+Type=Application
+Exec=kmplayer -caption "%c" %i %m %U
+Icon=kmplayer.png
+DocPath=kmplayer/index.html
+Comment=KDE interface for Gnash
+Comment[ar]=واجهة كيدي لـ Gnash
+Comment[bg]=KDE интерфейс за Gnash
+Comment[br]=Etrefas Gnash evit KDE
+Comment[bs]=KDE interfejs za Gnash
+Comment[ca]=Interfície KDE per a Gnash
+Comment[cs]=KDE rozhraní pro Gnash
+Comment[da]=KDE-grænseflade for Gnash
+Comment[de]=KDE-Oberfläche für Gnash
+Comment[el]=Περιβάλλον χρήσης του Gnash για το KDE
+Comment[es]=Interfaz KDE para Gnash
+Comment[et]=KDE Gnashi liides
+Comment[fi]=KDE-käyttöliittymä Gnashille
+Comment[fr]=Une interface de Gnash pour KDE
+Comment[he]=ממשק KDE של Gnash
+Comment[hi]=एमप्लेयर हेतु केडीई इंटरफेस
+Comment[hu]=KDE-alapú felület az Gnashhez
+Comment[it]=Interfaccia KDE per Gnash
+Comment[nb]=KDE-grensesnitt for Gnash
+Comment[nl]=KDE-interface voor Gnash
+Comment[pa]=Gnash ਲਈ KDE ਇੰਟਰਫੇਸ
+Comment[pt]=Interface KDE para o Gnash
+Comment[pt_BR]=Interface do KDE para o Gnash
+Comment[ru]=Интерфейс KDE для Gnash
+Comment[sr]=KDE-ов интерфејс за Gnash
+Comment[sr@Latn]=KDE-ov interfejs za Gnash
+Comment[sv]=KDE-gränssnitt för Mplayer
+Comment[ta]=எம் இயக்கிக்கான கேடீஇ இடைமுகம்
+Comment[tr]=Gnash için KDE arayüzü
+Comment[xx]=xxKDE interface for Gnashxx
+Comment[zh_CN]=Gnash 的 KDE 界面
+Terminal=false
+Name=KGnash
+Name[hi]=केएमप्लेयर
+Name[hu]=KMPLayer
+Name[sv]=Kmplayer
+Name[ta]=கேஎம்இயக்கி
+Name[xx]=xxKGnashxx
+MimeType=application/x-shockwave-flash;
+InitialPreference=7
+Categories=Qt;KDE;AudioVideo;
+GenericName=Media Player
+GenericName[bg]=Медия плеър
+GenericName[br]=Soner liesvedia
+GenericName[ca]=Reproductor de medis
+GenericName[cs]=Přehrávač médií
+GenericName[cy]=Chwaraeydd Cyfryngau
+GenericName[da]=Medieafspiller
+GenericName[el]=Αναπαραγωγή πολυμέσων
+GenericName[es]=Reproductor multimedia
+GenericName[et]=Meediamängija
+GenericName[fr]=Lecteur multimédia
+GenericName[ga]=Seinnteoir Meán
+GenericName[he]=נגן מדיה
+GenericName[hi]=मीडिया प्लेयर
+GenericName[hu]=Médialejátszó
+GenericName[it]=Lettore multimediale
+GenericName[lt]=Media grotuvas
+GenericName[mk]=Изведувач на мултимедиа
+GenericName[nb]=Mediaspiller
+GenericName[nl]=Mediaspeler
+GenericName[pa]=ਮੀਡਿਆ ਪਲੇਅਰ
+GenericName[pt]=Leitor Multimédia
+GenericName[pt_BR]=Reprodutor de Mídia
+GenericName[ru]=Медиаплеер
+GenericName[sr]=Медија плејер
+GenericName[sr@Latn]=Medija plejer
+GenericName[sv]=Mediaspelare
+GenericName[tr]=Medya Oynatıcı
+GenericName[xh]=Umdlali we Midia
+GenericName[xx]=xxMedia Playerxx
+GenericName[zh_CN]=媒体播放器
+GenericName[zu]=Umdlali Wezezindaba
--- gnash/plugin/klash4/klash_part.cpp.kde4~	2008-10-08 13:50:45.259075627 +0200
+++ gnash/plugin/klash4/klash_part.cpp	2008-10-08 13:50:45.259075627 +0200
@@ -0,0 +1,588 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// Written by Koos Vriezen <koos ! vriezen ? xs4all ! nl>
+
+#ifdef KDE_USE_FINAL
+#undef Always
+#endif
+
+#include "gnashconfig.h"
+#include <cassert>
+#include <QByteArray>
+#include <QMenu>
+#include <QTimer>
+
+#include <klibloader.h>
+#include <kdebug.h>
+#include <kauthorized.h>
+#include <kconfig.h>
+#include <ksimpleconfig.h>
+#include <kaction.h>
+#include <kapplication.h>
+#include <klocale.h>
+#include <kcomponentdata.h>
+#include <kactioncollection.h>
+#include <kparts/factory.h>
+
+#include "klash_part.h"
+
+#include <signal.h>
+
+//-----------------------------------------------------------------------------
+
+class KlashFactory : public KParts::Factory {
+public:
+    KDE_NO_CDTOR_EXPORT KlashFactory ();
+    KDE_NO_CDTOR_EXPORT virtual ~KlashFactory ();
+    KDE_NO_CDTOR_EXPORT virtual KParts::Part *createPartObject
+        (QWidget *wparent,
+         QObject *parent,
+         const char *className, const QStringList &args);
+    static KComponentData * instance () { return s_instance; }
+private:
+    static KComponentData * s_instance;
+};
+
+K_EXPORT_COMPONENT_FACTORY (libklashpart, KlashFactory)
+
+KComponentData *KlashFactory::s_instance = 0;
+
+KlashFactory::KlashFactory () {
+    s_instance = new KComponentData ("klash");
+}
+
+KlashFactory::~KlashFactory () {
+    delete s_instance;
+}
+
+KParts::Part *KlashFactory::createPartObject
+  (QWidget *wparent,
+   QObject *parent,
+   const char * cls, const QStringList & args) {
+      //kdDebug() << "KlashFactory::createPartObject " << cls << endl;
+      return new KlashPart (wparent, parent, args);
+}
+
+//-----------------------------------------------------------------------------
+
+static bool getBoolValue (const QString & value) {
+    return (value.toLower() != QString::fromLatin1("false") &&
+            value.toLower() != QString::fromLatin1("off") &&
+            value.toLower() != QString::fromLatin1("0"));
+}
+
+KDE_NO_CDTOR_EXPORT KlashPart::KlashPart (QWidget * wparent,
+                    QObject * parent, const QStringList &args)
+ : KParts::ReadOnlyPart (parent),
+   //new KSimpleConfig ("klashrc")),
+   m_browserextension (new KlashBrowserExtension (this)),
+   m_liveconnectextension (new KlashLiveConnectExtension (this)),
+   m_process (0L),
+   m_width (0),
+   m_height (0),
+   m_autostart (false),
+   m_fullscreen (false),
+   m_started_emited (false) {
+    //kdDebug () << "KlashPart(" << this << ")::KlashPart ()" << endl;
+    bool show_fullscreen = false;
+    // FIXME what is the right replacement for this? setInstance (KlashFactory::instance (), true);
+    KAction *playact = new KAction(this);
+    playact->setText(i18n("P&lay"));
+    connect(playact, SIGNAL(triggered()), this, SLOT(play()));
+    actionCollection()->addAction("play", playact);
+    KAction *pauseact = new KAction(this);
+    pauseact->setText(i18n("&Pause"));
+    connect(pauseact, SIGNAL(triggered()), this, SLOT(pause()));
+    actionCollection()->addAction("pause", pauseact);
+    KAction *stopact = new KAction(this);
+    stopact->setText(i18n("&Stop"));
+    connect(stopact, SIGNAL(triggered()), this, SLOT(stop()));
+    actionCollection()->addAction("stop", stopact);
+    //new KAction (i18n ("Increase Volume"), QString ("player_volume"), KShortcut (), this, SLOT (increaseVolume ()), actionCollection (), "edit_volume_up");
+    //new KAction (i18n ("Decrease Volume"), QString ("player_volume"), KShortcut (), this, SLOT (decreaseVolume ()), actionCollection (), "edit_volume_down");
+    QStringList::const_iterator end = args.end ();
+    for (QStringList::const_iterator it = args.begin () ; it != end; ++it) {
+        int equalPos = (*it).indexOf("=");
+        if (equalPos > 0) {
+            QString name = (*it).left (equalPos).toLower ();
+            QString value = (*it).right ((*it).length () - equalPos - 1);
+            if (value.at(0)=='\"')
+                value = value.right (value.length () - 1);
+            if (value.at (value.length () - 1) == '\"')
+                value.truncate (value.length () - 1);
+            //kdDebug () << "name=" << name << " value=" << value << endl;
+            if (name == QString::fromLatin1("width")) {
+                m_width = value.toInt ();
+            } else if (name == QString::fromLatin1("height")) {
+                m_height = value.toInt ();
+            //} else if (name == QString::fromLatin1("type")) {
+            } else if (name == QString::fromLatin1("__khtml__pluginbaseurl")) {
+                m_docbase = KUrl (value);
+            } else if (name == QString::fromLatin1("src")) {
+                m_src_url = value;
+            } else if (name == QString::fromLatin1 ("fullscreenmode")) {
+                show_fullscreen = getBoolValue (value);
+            } else if (name == QString::fromLatin1 ("autostart")) {
+                bool ok;
+                m_autostart = value.toInt (&ok);
+                if (!ok)
+                    m_autostart = (value.toLower () == "false");
+            }
+            m_args.push_back(name + QChar('=') + value);
+        }
+    }
+    KParts::Part::setWidget (new KlashView (wparent));
+    setXMLFile("klashpartui.rc");
+    setProgressInfoEnabled (false);
+
+    if (m_fullscreen)
+        fullScreen ();
+}
+
+KDE_NO_CDTOR_EXPORT KlashPart::~KlashPart () {
+    kdDebug() << "KlashPart::~KlashPart" << endl;
+    stop ();
+    //delete m_config;
+    //m_config = 0L;
+}
+
+KDE_NO_EXPORT bool KlashPart::allowRedir (const KUrl & url) const {
+    return KAuthorized::authorizeUrlAction ("redirect", m_docbase, url);
+}
+
+KDE_NO_EXPORT void KlashPart::play ()
+{
+
+    QString procname;
+    char *gnash_env = getenv("KLASH_PLAYER");
+    if (!gnash_env) {
+      procname = GNASHBINDIR "/kde4-gnash";
+    } else {
+      procname = gnash_env;
+    }
+
+    stop ();
+    if (m_src_url.isEmpty ())
+        return;
+    m_process = new KProcess;
+    m_process->setEnv (QString::fromLatin1 ("SESSION_MANAGER"), QString::fromLatin1 (""));
+    *m_process << procname
+	       << "-x"
+	       << QString::number(static_cast<KlashView*>(widget())->embedId());
+
+    if (m_width > 0 && m_height > 0)
+        *m_process << "-j" << QString::number(m_width)
+                   << "-k" << QString::number(m_height);
+
+    QString url = this->url().url();
+    if (!url.isEmpty())
+        *m_process << "-u" << url;
+    url = m_docbase.url();
+    if (!url.isEmpty())
+        *m_process << "-U" << url;
+
+    for (QStringList::const_iterator it=m_args.begin(), end=m_args.end();it != end; ++it)
+        *m_process << "-P" << *it;
+
+    *m_process << m_src_url;
+
+    connect (m_process, SIGNAL (finished (int, QProcess::ExitStatus)),
+            this, SLOT (processStopped (int, QProcess::ExitStatus)));
+    m_process->start ();
+}
+
+KDE_NO_EXPORT void KlashPart::pause () {
+}
+
+KDE_NO_EXPORT void KlashPart::stop () {
+    if (m_process) {
+        if (m_process->state () == KProcess::Running) {
+            ; // IPC close
+            //m_process->wait(2);
+	    
+	    // Ignore SIGTERM, so we won't kill ourselves.
+            void (*oldhandler)(int) = signal(SIGTERM, SIG_IGN);
+
+	    int pid = -1 * ::getpid();
+	    assert(pid < -1);
+
+	    // Terminate every process in our process group.
+            ::kill (pid, SIGTERM);
+
+	    // Restore the old handler.
+            signal(SIGTERM, oldhandler);
+            m_process->waitForFinished(2000);
+        }
+        delete m_process;
+        m_process = 0L;
+    }
+}
+
+bool KlashPart::openFile() {
+    if (!localFilePath().isEmpty ())
+        m_src_url = localFilePath();
+    play ();
+    return true;
+}
+
+KDE_NO_EXPORT bool KlashPart::openUrl (const KUrl & url) {
+    kdDebug () << "KlashPart::openUrl " << url.url() << endl;
+    emit started (0);
+    return KParts::ReadOnlyPart::openUrl (url);
+}
+
+KDE_NO_EXPORT bool KlashPart::closeUrl () {
+    return KParts::ReadOnlyPart::closeUrl ();
+}
+
+KDE_NO_EXPORT void KlashPart::fullScreen () {
+}
+
+KDE_NO_EXPORT void KlashPart::setLoaded (int percentage) {
+    if (percentage < 100) {
+        m_browserextension->setLoadingProgress (percentage);
+        m_browserextension->infoMessage
+            (QString::number (percentage) + i18n ("% Cache fill"));
+    }
+}
+
+KDE_NO_EXPORT void KlashPart::playingStarted () {
+    //kdDebug () << "KlashPart::processStartedPlaying " << endl;
+    //if (m_settings->sizeratio && !m_noresize && m_source->width() > 0 && m_source->height() > 0)
+    //    m_liveconnectextension->setSize (m_source->width(), m_source->height());
+    m_browserextension->setLoadingProgress (100);
+    if (m_started_emited) {
+        emit completed ();
+        m_started_emited = false;
+    }
+    m_liveconnectextension->started ();
+    m_browserextension->infoMessage (i18n("Klash: Playing"));
+}
+
+KDE_NO_EXPORT void KlashPart::playingStopped () {
+    if (m_started_emited) {
+        m_started_emited = false;
+        m_browserextension->setLoadingProgress (100);
+        emit completed ();
+    }
+    m_liveconnectextension->finished ();
+    m_browserextension->infoMessage (i18n ("Klash: Stop Playing"));
+}
+
+KDE_NO_EXPORT void KlashPart::processStopped (int, QProcess::ExitStatus) {
+    QTimer::singleShot (0, this, SLOT (playingStopped ()));
+}
+
+//---------------------------------------------------------------------
+
+KDE_NO_CDTOR_EXPORT KlashBrowserExtension::KlashBrowserExtension (KlashPart * parent)
+  : KParts::BrowserExtension (parent) {
+}
+
+KDE_NO_EXPORT void KlashBrowserExtension::urlChanged (const QString & url) {
+    emit setLocationBarUrl (url);
+}
+
+KDE_NO_EXPORT void KlashBrowserExtension::setLoadingProgress (int percentage) {
+    emit loadingProgress (percentage);
+}
+
+KDE_NO_EXPORT void KlashBrowserExtension::saveState (QDataStream & stream) {
+    stream << static_cast <KlashPart *> (parent ())->source ();
+}
+
+KDE_NO_EXPORT void KlashBrowserExtension::restoreState (QDataStream & stream) {
+    QString url;
+    stream >> url;
+    static_cast <KlashPart *> (parent ())->openUrl (KUrl(url));
+}
+
+KDE_NO_EXPORT void KlashBrowserExtension::requestOpenUrl (const KUrl & url, const QString & target, const QString & service) {
+    KParts::OpenUrlArguments args;
+    //FIXME what replaces those?
+    //args.frameName = target;
+    //args.serviceType = service;
+    emit openUrlRequest (url, args);
+}
+
+//---------------------------------------------------------------------
+/*
+ * add
+ * .error.errorCount
+ * .error.item(count)
+ *   .errorDescription
+ *   .errorCode
+ * .controls.stop()
+ * .controls.play()
+ */
+
+enum JSCommand {
+    notsupported,
+    isfullscreen, isloop,
+    length, width, height, position, prop_source, source, setsource,
+    play, jsc_pause, start, stop,
+    prop_volume, volume, setvolume
+};
+
+struct KLASH_NO_EXPORT JSCommandEntry {
+    const char * name;
+    JSCommand command;
+    const char * defaultvalue;
+    const KParts::LiveConnectExtension::Type rettype;
+};
+
+// keep this list in alphabetic order
+// http://service.real.com/help/library/guides/realonescripting/browse/htmfiles/embedmet.htm
+static const JSCommandEntry JSCommandList [] = {
+    { "GetSource", source, 0L, KParts::LiveConnectExtension::TypeString },
+    { "GetTitle", notsupported, "title", KParts::LiveConnectExtension::TypeString },
+    { "GetVolume", volume, "100", KParts::LiveConnectExtension::TypeNumber },
+    { "Pause", jsc_pause, 0L, KParts::LiveConnectExtension::TypeBool },
+    { "Play", play, 0L, KParts::LiveConnectExtension::TypeBool },
+    { "SetSource", setsource, 0L, KParts::LiveConnectExtension::TypeBool },
+    { "SetVolume", setvolume, "true", KParts::LiveConnectExtension::TypeBool },
+    { "Start", start, 0L, KParts::LiveConnectExtension::TypeBool },
+    { "Stop", stop, 0L, KParts::LiveConnectExtension::TypeBool },
+    { "Volume", prop_volume, "100", KParts::LiveConnectExtension::TypeNumber },
+    { "pause", jsc_pause, 0L, KParts::LiveConnectExtension::TypeBool },
+    { "play", play, 0L, KParts::LiveConnectExtension::TypeBool },
+    { "stop", stop, 0L, KParts::LiveConnectExtension::TypeBool },
+    { "volume", volume, 0L, KParts::LiveConnectExtension::TypeBool },
+};
+
+static const JSCommandEntry * getJSCommandEntry (const char * name, int start = 0, int end = sizeof (JSCommandList)/sizeof (JSCommandEntry)) {
+    if (end - start < 2) {
+        if (start != end && !strcasecmp (JSCommandList[start].name, name))
+            return &JSCommandList[start];
+        return 0L;
+    }
+    int mid = (start + end) / 2;
+    int cmp = strcasecmp (JSCommandList[mid].name, name);
+    if (cmp < 0)
+        return getJSCommandEntry (name, mid + 1, end);
+    if (cmp > 0)
+        return getJSCommandEntry (name, start, mid);
+    return &JSCommandList[mid];
+}
+
+KDE_NO_CDTOR_EXPORT KlashLiveConnectExtension::KlashLiveConnectExtension (KlashPart * parent)
+  : KParts::LiveConnectExtension (parent), player (parent),
+    lastJSCommandEntry (0L),
+    m_started (false),
+    m_enablefinish (false) {
+      connect (parent, SIGNAL (started (KIO::Job *)), this, SLOT (started ()));
+}
+
+KDE_NO_CDTOR_EXPORT KlashLiveConnectExtension::~KlashLiveConnectExtension() {
+    //kdDebug () << "KlashLiveConnectExtension::~KlashLiveConnectExtension()" << endl;
+}
+
+KDE_NO_EXPORT void KlashLiveConnectExtension::started () {
+    m_started = true;
+}
+
+KDE_NO_EXPORT void KlashLiveConnectExtension::finished () {
+    if (m_started && m_enablefinish) {
+        KParts::LiveConnectExtension::ArgList args;
+        args.push_back (qMakePair (KParts::LiveConnectExtension::TypeString, QString("if (window.onFinished) onFinished();")));
+        emit partEvent (0, "eval", args);
+        m_started = true;
+        m_enablefinish = false;
+    }
+}
+
+KDE_NO_EXPORT bool KlashLiveConnectExtension::get
+  (const unsigned long id, const QString & name,
+   KParts::LiveConnectExtension::Type & type,
+   unsigned long & rid, QString & rval) {
+    const char * str = name.toAscii ();
+    kdDebug () << "[01;35mget[00m " << str << endl;
+    const JSCommandEntry * entry = getJSCommandEntry (str);
+    if (!entry)
+        return false;
+    rid = id;
+    type = entry->rettype;
+    switch (entry->command) {
+        case prop_source:
+            type = KParts::LiveConnectExtension::TypeString;
+            rval = player->source ();
+            break;
+        case prop_volume:
+            //if (player->view ())
+            //    rval = QString::number (??);
+            break;
+        default:
+            lastJSCommandEntry = entry;
+            type = KParts::LiveConnectExtension::TypeFunction;
+    }
+    return true;
+}
+
+KDE_NO_EXPORT bool KlashLiveConnectExtension::put
+  (const unsigned long, const QString & name, const QString & val) {
+    kdDebug () << "[01;35mput[00m " << name << "=" << val << endl;
+    const JSCommandEntry * entry = getJSCommandEntry (name.toAscii ());
+    if (!entry)
+        return false;
+    switch (entry->command) {
+        case prop_source: {
+            KUrl url (val);
+            if (player->allowRedir (url))
+                player->openUrl (url);
+            break;
+        }
+        case prop_volume:
+            //if (player->view ())
+            //    ?? (val.toInt ());
+            break;
+        default:
+            return false;
+    }
+    return true;
+}
+
+KDE_NO_EXPORT bool KlashLiveConnectExtension::call
+  (const unsigned long id, const QString & name,
+   const QStringList & args, KParts::LiveConnectExtension::Type & type,
+   unsigned long & rid, QString & rval) {
+    const JSCommandEntry * entry = lastJSCommandEntry;
+    const char * str = name.toAscii ();
+    if (!entry || strcmp (entry->name, str))
+        entry = getJSCommandEntry (str);
+    if (!entry)
+        return false;
+    kdDebug () << "[01;35mentry[00m " << entry->name << endl;
+    for (unsigned int i = 0; i < args.size (); ++i)
+        kdDebug () << "      " << args[i] << endl;
+    //Klash::View * view = static_cast <Klash::View*> (player->widget ());
+    //if (!view)
+    //    return false;
+    rid = id;
+    type = entry->rettype;
+    switch (entry->command) {
+        case notsupported:
+            if (entry->rettype != KParts::LiveConnectExtension::TypeVoid)
+                rval = entry->defaultvalue;
+            break;
+        case play:
+            if (args.size ()) {
+                KUrl url (args.first ());
+                if (player->allowRedir (url))
+                    ;//player->openNewUrl (url);
+            } else
+                player->play ();
+            rval = "true";
+            break;
+        case start:
+            player->play ();
+            rval = "true";
+            break;
+        case stop:
+            player->stop ();
+            rval = "true";
+            break;
+        case jsc_pause:
+            player->pause ();
+            rval = "true";
+            break;
+        case length:
+            rval.setNum (0 /*player->source ()->length ()*/);
+            break;
+        case width:
+            rval.setNum (player->width ());
+            break;
+        case height:
+            rval.setNum (player->height ());
+            break;
+        case setsource:
+            rval ="false";
+            if (args.size ()) {
+                KUrl url (args.first ());
+                if (player->allowRedir (url) && player->openUrl (url))
+                    rval = "true";
+            }
+            break;
+        case setvolume:
+            if (!args.size ())
+                return false;
+            //?? (args.first ().toInt ());
+            rval = "true";
+            break;
+        case source:
+            rval = player->url ().url ();
+            break;
+        case volume:
+            if (player->widget ())
+                rval = QString::number (0);
+            break;
+        default:
+            return false;
+    }
+    return true;
+}
+
+KDE_NO_EXPORT void KlashLiveConnectExtension::unregister (const unsigned long) {
+}
+
+KDE_NO_EXPORT void KlashLiveConnectExtension::setSize (int w, int h) {
+    QByteArray jscode;
+    //jscode.sprintf("this.width=%d;this.height=%d;klash", w, h);
+    KParts::LiveConnectExtension::ArgList args;
+    args.push_back (qMakePair (KParts::LiveConnectExtension::TypeString, QString("width")));
+    args.push_back (qMakePair (KParts::LiveConnectExtension::TypeNumber, QString::number (w)));
+    emit partEvent (0, "this.setAttribute", args);
+    args.clear();
+    args.push_back (qMakePair (KParts::LiveConnectExtension::TypeString, QString("height")));
+    args.push_back (qMakePair (KParts::LiveConnectExtension::TypeNumber, QString::number (h)));
+    emit partEvent (0, "this.setAttribute", args);
+}
+
+//-----------------------------------------------------------------------------
+
+#include <X11/Xlib.h>
+#include <X11/keysym.h>
+#include <X11/Intrinsic.h>
+#include <X11/StringDefs.h>
+static const int XKeyPress = KeyPress;
+#undef KeyPress
+#undef Always
+#undef Never
+#undef Status
+#undef Unsorted
+#undef Bool
+
+KlashEmbed::KlashEmbed (KlashView * view) : QX11EmbedWidget (view), m_view (view) {}
+
+KlashEmbed::~KlashEmbed () {}
+
+//-----------------------------------------------------------------------------
+
+KlashView::KlashView (QWidget * parent)
+    : QWidget (parent), m_embed (new KlashEmbed (this)) {}
+
+KlashView::~KlashView () {}
+
+void KlashView::resizeEvent (QResizeEvent *) {
+    m_embed->setGeometry (0, 0, width (), height ());
+}
+
+WId KlashView::embedId () {
+    return m_embed->winId ();
+}
+
+#include "klash_part.moc"
--- gnash/plugin/klash4/klash_part.desktop.kde4~	2008-10-08 13:50:45.259075627 +0200
+++ gnash/plugin/klash4/klash_part.desktop	2008-10-08 13:50:45.259075627 +0200
@@ -0,0 +1,12 @@
+[Desktop Entry]
+Encoding=UTF-8
+Name=Klash, embedded Gnash player for KDE
+Comment=SWF player plugin
+X-KDE-Library=libklashpart
+# Keep in sync with the audio types in kmplayer.desktop
+MimeType=application/x-shockwave-flash;application/futuresplash;
+Type=Service
+Icon=www
+ServiceTypes=KParts/ReadOnlyPart,Browser/View
+X-KDE-BrowserView-PluginsInfo=klash/pluginsinfo
+InitialPreference=1
--- gnash/plugin/klash4/klash_part.h.kde4~	2008-10-08 13:50:45.260075539 +0200
+++ gnash/plugin/klash4/klash_part.h	2008-10-08 13:50:45.260075539 +0200
@@ -0,0 +1,162 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+// Written by Koos Vriezen <koos ! vriezen ? xs4all ! nl>
+
+#ifndef KLASH_PART_H
+#define KLASH_PART_H
+
+#include <QX11EmbedWidget>
+#include <kprocess.h>
+#include <kparts/browserextension.h>
+
+#if __GNUC__ - 0 > 3
+#define KLASH_NO_EXPORT __attribute__ ((visibility("hidden")))
+#else
+#define KLASH_NO_EXPORT
+#endif
+#define KDE_NO_CDTOR_EXPORT KLASH_NO_EXPORT
+#ifndef KDE_NO_EXPORT
+#define KDE_NO_EXPORT KLASH_NO_EXPORT
+#endif
+
+class KAboutData;
+class KlashPart;
+class KInstance;
+class KProcess;
+class JSCommandEntry;
+class KlashView;
+
+/*
+ * Part notifications to hosting application
+ */
+class KLASH_NO_EXPORT KlashBrowserExtension : public KParts::BrowserExtension {
+    Q_OBJECT
+public:
+    KlashBrowserExtension(KlashPart *parent);
+    KDE_NO_CDTOR_EXPORT ~KlashBrowserExtension () {}
+    void urlChanged (const QString & url);
+    void setLoadingProgress (int percentage);
+
+    void saveState (QDataStream & stream);
+    void restoreState (QDataStream & stream);
+    void requestOpenUrl (const KUrl & url, const QString & target, const QString & service);
+};
+
+/*
+ * Part javascript support
+ */
+class KLASH_NO_EXPORT KlashLiveConnectExtension : public KParts::LiveConnectExtension {
+    Q_OBJECT
+public:
+    KlashLiveConnectExtension (KlashPart * parent);
+    ~KlashLiveConnectExtension ();
+
+    // LiveConnect interface
+    bool get (const unsigned long, const QString &,
+            KParts::LiveConnectExtension::Type &, unsigned long &, QString &);
+    bool put (const unsigned long, const QString &, const QString &);
+    bool call (const unsigned long, const QString &,
+            const QStringList &, KParts::LiveConnectExtension::Type &, 
+            unsigned long &, QString &);
+    void unregister (const unsigned long);
+    void sendEvent(const unsigned long objid, const QString & event, const KParts::LiveConnectExtension::ArgList & args ) {
+        emit partEvent(objid, event, args);
+    }
+
+    void enableFinishEvent (bool b = true) { m_enablefinish = b; }
+signals:
+    void partEvent (const unsigned long, const QString &,
+                    const KParts::LiveConnectExtension::ArgList &);
+public slots:
+    void setSize (int w, int h);
+    void started ();
+    void finished ();
+private:
+    KlashPart * player;
+    const JSCommandEntry * lastJSCommandEntry;
+    bool m_started : 1;
+    bool m_enablefinish : 1;
+};
+
+class KLASH_NO_EXPORT KlashEmbed : public QX11EmbedWidget {
+    KlashView * m_view;
+public:
+    KlashEmbed (KlashView * parent);
+    ~KlashEmbed ();
+};
+
+class KLASH_NO_EXPORT KlashView : public QWidget {
+    KlashEmbed * m_embed;
+public:
+    KlashView (QWidget * parent);
+    ~KlashView ();
+    WId embedId ();
+protected:
+    void resizeEvent (QResizeEvent *);
+};
+
+/*
+ * Part that gets created when used a KPart
+ */
+class KLASH_NO_EXPORT KlashPart : public KParts::ReadOnlyPart {
+    Q_OBJECT
+    friend struct GroupPredicate;
+public:
+    KlashPart (QWidget * wparent, QObject * parent, const QStringList &args);
+    ~KlashPart ();
+
+    KDE_NO_EXPORT KlashBrowserExtension * browserextension() const
+        { return m_browserextension; }
+    KlashLiveConnectExtension * liveconnectextension () const
+        { return m_liveconnectextension; }
+    bool allowRedir (const KUrl & url) const;
+    void fullScreen ();
+    void setLoaded (int percentage);
+    const QString & source () const { return m_src_url; }
+public slots:
+    virtual bool openUrl (const KUrl & url);
+    virtual bool closeUrl ();
+    void play ();
+    void stop ();
+    void pause ();
+    int width () const {return m_width; }
+    int height () const {return m_height; }
+protected slots:
+    void playingStarted ();
+    void playingStopped ();
+    void processStopped (int, QProcess::ExitStatus);
+protected:
+    virtual bool openFile();
+private:
+    QStringList m_args;
+    KlashBrowserExtension * m_browserextension;
+    KlashLiveConnectExtension * m_liveconnectextension;
+    KProcess * m_process;
+    KUrl m_docbase;
+    QString m_src_url;
+    QString m_file_name;
+    int m_width;
+    int m_height;
+    //bool m_noresize : 1;
+    bool m_autostart : 1;
+    bool m_fullscreen : 1;
+    bool m_started_emited : 1;
+};
+
+
+#endif
--- gnash/plugin/klash4/klash_part.moc.in.kde4~	2008-10-08 13:50:45.260075539 +0200
+++ gnash/plugin/klash4/klash_part.moc.in	2008-10-08 13:50:45.260075539 +0200
@@ -0,0 +1,340 @@
+/****************************************************************************
+** KlashBrowserExtension meta object code from reading C++ file 'klash_part.h'
+**
+** Created: Sat Oct 21 10:23:39 2006
+**
+** WARNING! All changes made in this file will be lost!
+*****************************************************************************/
+
+#undef QT_NO_COMPAT
+#include "../../../../gnash/plugin/klash/klash_part.h"
+#include <qmetaobject.h>
+#include <qapplication.h>
+
+#include <private/qucomextra_p.h>
+#if !defined(Q_MOC_OUTPUT_REVISION) || (Q_MOC_OUTPUT_REVISION != 26)
+#error "This file was generated using the moc from 3.3.6. It"
+#error "cannot be used with the include files from this version of Qt."
+#error "(The moc has changed too much.)"
+#endif
+
+const char *KlashBrowserExtension::className() const
+{
+    return "KlashBrowserExtension";
+}
+
+QMetaObject *KlashBrowserExtension::metaObj = 0;
+static QMetaObjectCleanUp cleanUp_KlashBrowserExtension( "KlashBrowserExtension", &KlashBrowserExtension::staticMetaObject );
+
+#ifndef QT_NO_TRANSLATION
+QString KlashBrowserExtension::tr( const char *s, const char *c )
+{
+    if ( qApp )
+	return qApp->translate( "KlashBrowserExtension", s, c, QApplication::DefaultCodec );
+    else
+	return QString::fromLatin1( s );
+}
+#ifndef QT_NO_TRANSLATION_UTF8
+QString KlashBrowserExtension::trUtf8( const char *s, const char *c )
+{
+    if ( qApp )
+	return qApp->translate( "KlashBrowserExtension", s, c, QApplication::UnicodeUTF8 );
+    else
+	return QString::fromUtf8( s );
+}
+#endif // QT_NO_TRANSLATION_UTF8
+
+#endif // QT_NO_TRANSLATION
+
+QMetaObject* KlashBrowserExtension::staticMetaObject()
+{
+    if ( metaObj )
+	return metaObj;
+    QMetaObject* parentObject = KParts::BrowserExtension::staticMetaObject();
+    metaObj = QMetaObject::new_metaobject(
+	"KlashBrowserExtension", parentObject,
+	0, 0,
+	0, 0,
+#ifndef QT_NO_PROPERTIES
+	0, 0,
+	0, 0,
+#endif // QT_NO_PROPERTIES
+	0, 0 );
+    cleanUp_KlashBrowserExtension.setMetaObject( metaObj );
+    return metaObj;
+}
+
+void* KlashBrowserExtension::qt_cast( const char* clname )
+{
+    if ( !qstrcmp( clname, "KlashBrowserExtension" ) )
+	return this;
+    return BrowserExtension::qt_cast( clname );
+}
+
+bool KlashBrowserExtension::qt_invoke( int _id, QUObject* _o )
+{
+    return BrowserExtension::qt_invoke(_id,_o);
+}
+
+bool KlashBrowserExtension::qt_emit( int _id, QUObject* _o )
+{
+    return BrowserExtension::qt_emit(_id,_o);
+}
+#ifndef QT_NO_PROPERTIES
+
+bool KlashBrowserExtension::qt_property( int id, int f, QVariant* v)
+{
+    return BrowserExtension::qt_property( id, f, v);
+}
+
+bool KlashBrowserExtension::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; }
+#endif // QT_NO_PROPERTIES
+
+
+const char *KlashLiveConnectExtension::className() const
+{
+    return "KlashLiveConnectExtension";
+}
+
+QMetaObject *KlashLiveConnectExtension::metaObj = 0;
+static QMetaObjectCleanUp cleanUp_KlashLiveConnectExtension( "KlashLiveConnectExtension", &KlashLiveConnectExtension::staticMetaObject );
+
+#ifndef QT_NO_TRANSLATION
+QString KlashLiveConnectExtension::tr( const char *s, const char *c )
+{
+    if ( qApp )
+	return qApp->translate( "KlashLiveConnectExtension", s, c, QApplication::DefaultCodec );
+    else
+	return QString::fromLatin1( s );
+}
+#ifndef QT_NO_TRANSLATION_UTF8
+QString KlashLiveConnectExtension::trUtf8( const char *s, const char *c )
+{
+    if ( qApp )
+	return qApp->translate( "KlashLiveConnectExtension", s, c, QApplication::UnicodeUTF8 );
+    else
+	return QString::fromUtf8( s );
+}
+#endif // QT_NO_TRANSLATION_UTF8
+
+#endif // QT_NO_TRANSLATION
+
+QMetaObject* KlashLiveConnectExtension::staticMetaObject()
+{
+    if ( metaObj )
+	return metaObj;
+    QMetaObject* parentObject = KParts::LiveConnectExtension::staticMetaObject();
+    static const QUParameter param_slot_0[] = {
+	{ "w", &static_QUType_int, 0, QUParameter::In },
+	{ "h", &static_QUType_int, 0, QUParameter::In }
+    };
+    static const QUMethod slot_0 = {"setSize", 2, param_slot_0 };
+    static const QUMethod slot_1 = {"started", 0, 0 };
+    static const QUMethod slot_2 = {"finished", 0, 0 };
+    static const QMetaData slot_tbl[] = {
+	{ "setSize(int,int)", &slot_0, QMetaData::Public },
+	{ "started()", &slot_1, QMetaData::Public },
+	{ "finished()", &slot_2, QMetaData::Public }
+    };
+    static const QUParameter param_signal_0[] = {
+	{ 0, &static_QUType_ptr, "unsigned long", QUParameter::In },
+	{ 0, &static_QUType_QString, 0, QUParameter::In },
+	{ 0, &static_QUType_ptr, "KParts::LiveConnectExtension::ArgList", QUParameter::In }
+    };
+    static const QUMethod signal_0 = {"partEvent", 3, param_signal_0 };
+    static const QMetaData signal_tbl[] = {
+	{ "partEvent(const unsigned long,const QString&,const KParts::LiveConnectExtension::ArgList&)", &signal_0, QMetaData::Public }
+    };
+    metaObj = QMetaObject::new_metaobject(
+	"KlashLiveConnectExtension", parentObject,
+	slot_tbl, 3,
+	signal_tbl, 1,
+#ifndef QT_NO_PROPERTIES
+	0, 0,
+	0, 0,
+#endif // QT_NO_PROPERTIES
+	0, 0 );
+    cleanUp_KlashLiveConnectExtension.setMetaObject( metaObj );
+    return metaObj;
+}
+
+void* KlashLiveConnectExtension::qt_cast( const char* clname )
+{
+    if ( !qstrcmp( clname, "KlashLiveConnectExtension" ) )
+	return this;
+    return LiveConnectExtension::qt_cast( clname );
+}
+
+#include <qobjectdefs.h>
+#include <qsignalslotimp.h>
+
+// SIGNAL partEvent
+void KlashLiveConnectExtension::partEvent( const unsigned long t0, const QString& t1, const KParts::LiveConnectExtension::ArgList& t2 )
+{
+    if ( signalsBlocked() )
+	return;
+    QConnectionList *clist = receivers( staticMetaObject()->signalOffset() + 0 );
+    if ( !clist )
+	return;
+    QUObject o[4];
+    static_QUType_ptr.set(o+1,&t0);
+    static_QUType_QString.set(o+2,t1);
+    static_QUType_ptr.set(o+3,&t2);
+    activate_signal( clist, o );
+}
+
+bool KlashLiveConnectExtension::qt_invoke( int _id, QUObject* _o )
+{
+    switch ( _id - staticMetaObject()->slotOffset() ) {
+    case 0: setSize((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
+    case 1: started(); break;
+    case 2: finished(); break;
+    default:
+	return LiveConnectExtension::qt_invoke( _id, _o );
+    }
+    return TRUE;
+}
+
+bool KlashLiveConnectExtension::qt_emit( int _id, QUObject* _o )
+{
+    switch ( _id - staticMetaObject()->signalOffset() ) {
+    case 0: partEvent((const unsigned long)(*((const unsigned long*)static_QUType_ptr.get(_o+1))),(const QString&)static_QUType_QString.get(_o+2),(const KParts::LiveConnectExtension::ArgList&)*((const KParts::LiveConnectExtension::ArgList*)static_QUType_ptr.get(_o+3))); break;
+    default:
+	return LiveConnectExtension::qt_emit(_id,_o);
+    }
+    return TRUE;
+}
+#ifndef QT_NO_PROPERTIES
+
+bool KlashLiveConnectExtension::qt_property( int id, int f, QVariant* v)
+{
+    return LiveConnectExtension::qt_property( id, f, v);
+}
+
+bool KlashLiveConnectExtension::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; }
+#endif // QT_NO_PROPERTIES
+
+
+const char *KlashPart::className() const
+{
+    return "KlashPart";
+}
+
+QMetaObject *KlashPart::metaObj = 0;
+static QMetaObjectCleanUp cleanUp_KlashPart( "KlashPart", &KlashPart::staticMetaObject );
+
+#ifndef QT_NO_TRANSLATION
+QString KlashPart::tr( const char *s, const char *c )
+{
+    if ( qApp )
+	return qApp->translate( "KlashPart", s, c, QApplication::DefaultCodec );
+    else
+	return QString::fromLatin1( s );
+}
+#ifndef QT_NO_TRANSLATION_UTF8
+QString KlashPart::trUtf8( const char *s, const char *c )
+{
+    if ( qApp )
+	return qApp->translate( "KlashPart", s, c, QApplication::UnicodeUTF8 );
+    else
+	return QString::fromUtf8( s );
+}
+#endif // QT_NO_TRANSLATION_UTF8
+
+#endif // QT_NO_TRANSLATION
+
+QMetaObject* KlashPart::staticMetaObject()
+{
+    if ( metaObj )
+	return metaObj;
+    QMetaObject* parentObject = KParts::ReadOnlyPart::staticMetaObject();
+    static const QUParameter param_slot_0[] = {
+	{ 0, &static_QUType_bool, 0, QUParameter::Out },
+	{ "url", &static_QUType_ptr, "KURL", QUParameter::In }
+    };
+    static const QUMethod slot_0 = {"openURL", 2, param_slot_0 };
+    static const QUParameter param_slot_1[] = {
+	{ 0, &static_QUType_bool, 0, QUParameter::Out }
+    };
+    static const QUMethod slot_1 = {"closeURL", 1, param_slot_1 };
+    static const QUMethod slot_2 = {"play", 0, 0 };
+    static const QUMethod slot_3 = {"stop", 0, 0 };
+    static const QUMethod slot_4 = {"pause", 0, 0 };
+    static const QUParameter param_slot_5[] = {
+	{ 0, &static_QUType_int, 0, QUParameter::Out }
+    };
+    static const QUMethod slot_5 = {"width", 1, param_slot_5 };
+    static const QUParameter param_slot_6[] = {
+	{ 0, &static_QUType_int, 0, QUParameter::Out }
+    };
+    static const QUMethod slot_6 = {"height", 1, param_slot_6 };
+    static const QUMethod slot_7 = {"playingStarted", 0, 0 };
+    static const QUMethod slot_8 = {"playingStopped", 0, 0 };
+    static const QUParameter param_slot_9[] = {
+	{ 0, &static_QUType_ptr, "KProcess", QUParameter::In }
+    };
+    static const QUMethod slot_9 = {"processStopped", 1, param_slot_9 };
+    static const QMetaData slot_tbl[] = {
+	{ "openURL(const KURL&)", &slot_0, QMetaData::Public },
+	{ "closeURL()", &slot_1, QMetaData::Public },
+	{ "play()", &slot_2, QMetaData::Public },
+	{ "stop()", &slot_3, QMetaData::Public },
+	{ "pause()", &slot_4, QMetaData::Public },
+	{ "width()", &slot_5, QMetaData::Public },
+	{ "height()", &slot_6, QMetaData::Public },
+	{ "playingStarted()", &slot_7, QMetaData::Protected },
+	{ "playingStopped()", &slot_8, QMetaData::Protected },
+	{ "processStopped(KProcess*)", &slot_9, QMetaData::Protected }
+    };
+    metaObj = QMetaObject::new_metaobject(
+	"KlashPart", parentObject,
+	slot_tbl, 10,
+	0, 0,
+#ifndef QT_NO_PROPERTIES
+	0, 0,
+	0, 0,
+#endif // QT_NO_PROPERTIES
+	0, 0 );
+    cleanUp_KlashPart.setMetaObject( metaObj );
+    return metaObj;
+}
+
+void* KlashPart::qt_cast( const char* clname )
+{
+    if ( !qstrcmp( clname, "KlashPart" ) )
+	return this;
+    return ReadOnlyPart::qt_cast( clname );
+}
+
+bool KlashPart::qt_invoke( int _id, QUObject* _o )
+{
+    switch ( _id - staticMetaObject()->slotOffset() ) {
+    case 0: static_QUType_bool.set(_o,openURL((const KURL&)*((const KURL*)static_QUType_ptr.get(_o+1)))); break;
+    case 1: static_QUType_bool.set(_o,closeURL()); break;
+    case 2: play(); break;
+    case 3: stop(); break;
+    case 4: pause(); break;
+    case 5: static_QUType_int.set(_o,width()); break;
+    case 6: static_QUType_int.set(_o,height()); break;
+    case 7: playingStarted(); break;
+    case 8: playingStopped(); break;
+    case 9: processStopped((KProcess*)static_QUType_ptr.get(_o+1)); break;
+    default:
+	return ReadOnlyPart::qt_invoke( _id, _o );
+    }
+    return TRUE;
+}
+
+bool KlashPart::qt_emit( int _id, QUObject* _o )
+{
+    return ReadOnlyPart::qt_emit(_id,_o);
+}
+#ifndef QT_NO_PROPERTIES
+
+bool KlashPart::qt_property( int id, int f, QVariant* v)
+{
+    return ReadOnlyPart::qt_property( id, f, v);
+}
+
+bool KlashPart::qt_static_property( QObject* , int , int , QVariant* ){ return FALSE; }
+#endif // QT_NO_PROPERTIES
--- gnash/plugin/klash4/klashpartui.rc.kde4~	2008-10-08 13:50:45.260075539 +0200
+++ gnash/plugin/klash4/klashpartui.rc	2008-10-08 13:50:45.260075539 +0200
@@ -0,0 +1,15 @@
+<!DOCTYPE kpartgui>
+<kpartgui name="klash" version="1">
+<MenuBar>
+  <Menu name="view"><text>&amp;View</text>
+    <Action name="play"/>
+    <Action name="pause"/>
+    <Action name="stop"/>
+  </Menu>
+</MenuBar>
+<Toolbar name="mainToolBar"><text></text>
+  <Action name="play"/>
+  <Action name="pause"/>
+  <Action name="stop"/>
+</Toolbar>
+</kpartgui>
--- gnash/plugin/klash4/klashplayer.lsm.kde4~	2008-10-08 13:50:45.261075508 +0200
+++ gnash/plugin/klash4/klashplayer.lsm	2008-10-08 13:50:45.261075508 +0200
@@ -0,0 +1,14 @@
+Begin3
+Title:          Klashplayer 
+Version:        0.0.1-pre1
+Entered-date:   
+Description:    
+Keywords:        
+Author:         Koos Vriezen <> 
+Maintained-by:  Koos Vriezen <> 
+Primary-site:   	        
+Home-page:      http://xx.kde.org
+Original-site:  
+Platforms:       Linux and other Unices
+Copying-policy: GNU Public License
+End
--- gnash/plugin/klash4/Makefile.am.kde4~	2008-10-08 13:50:45.261075508 +0200
+++ gnash/plugin/klash4/Makefile.am	2008-10-08 13:50:45.261075508 +0200
@@ -0,0 +1,110 @@
+## Process this file with automake to generate Makefile.in
+# 
+#   Copyright (C) 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+AUTOMAKE_OPTIONS = 
+
+if KPARTS
+AM_CPPFLAGS = \
+	$(KDE4_CFLAGS) \
+	$(QT4_CFLAGS) \
+	$(X11_CFLAGS) \
+	-DGNASHBINDIR=\"${bindir}\"
+
+plugindir   = $(KDE4_PLUGINDIR)
+kde_servicesdir = $(KDE4_SERVICESDIR)
+kde_rcdir       = $(KDE4_APPSDATADIR)
+#$(prefix)/share/apps/klash
+kde_appsdatadir = $(KDE4_APPSDATADIR)
+#$(prefix)/share/apps/klash
+kde_configdir   = $(KDE4_CONFIGDIR)
+#$(prefix)/share/config
+
+plugin_LTLIBRARIES= libklashpart.la
+
+libklashpart_la_SOURCES = klash_part.cpp klash_part.h
+libklashpart_la_DEPENDENCIES = klash_part.moc
+if PLUGIN_LINK_UNDEFINED
+libklashpart_la_LDFLAGS = -avoid-version -L$(plugindir) @QTCORE@ @QTGUI@ @KDECORE@ @KDEUI@
+else
+libklashpart_la_LDFLAGS = -module -avoid-version -L$(plugindir) @QTCORE@ @QTGUI@ @KDECORE@ @KDEUI@
+endif
+
+dist_kde_services_DATA = klash_part.desktop
+dist_kde_rc_DATA = klashpartui.rc
+dist_kde_appsdata_DATA = pluginsinfo
+#dist_kde_config_DATA = klashrc
+
+# DIST_COMMON = $(dist_kde_appsdata_DATA) $(dist_kde_services_DATA) $(dist_kde_rc_DATA)
+
+BUILT_SOURCES = klash_part.moc
+CLEANFILES = klash_part.moc
+
+klash_part.moc: $(srcdir)/klash_part.h
+	@if test x"$(MOC)" != x; then \
+	  echo "Generating MOC file..."; \
+	  $(MOC) $(srcdir)/klash_part.h -o klash_part.moc; \
+	else  \
+	  echo "WARNING: Install QT's moc tool! Linking to default MOC file"; \
+	  ln -s $(srcdir)/klash_part.moc.in klash_part.moc; \
+	fi
+
+install-data: $(dist_kde_services_DATA)
+	test -d $(DESTDIR)$(kde_servicesdir) || $(mkinstalldirs) $(DESTDIR)$(kde_servicesdir)
+	$(INSTALL) $(dist_kde_services_DATA) $(DESTDIR)$(kde_servicesdir)
+
+test_perms:
+	@if test ! -w $(DESTDIR)$(kde_appsdatadir) -o ! -w $(DESTDIR)$(kde_servicesdir); then \
+	  if test -d $(DESTDIR)$(kde_appsdatadir); then \
+	    echo "WARNING: Improper permissions for $(DESTDIR)$(kde_appsdatadir)!"; \
+	    echo "You probably need to be root"; \
+	    echo "Or configure with --with-kde-pluginprefix= set to a writable directory"; \
+	    exit 1; \
+          fi; \
+	  if test -d $(DESTDIR)$(kde_servicesdir); then \
+	    echo "WARNING: Improper permissions for $(DESTDIR)$(kde_appsdatadir) and $(DESTDIR)$(kde_servicesdir)!"; \
+	    echo "You probably need to be root"; \
+	    echo "Or configure with --with-kde-pluginprefix= set to a writable directory"; \
+	    exit 1; \
+	  fi; \
+	fi
+
+install-data-am: $(dist_kde_services_DATA) $(dist_kde_appsdata_DATA)
+	test -d $(DESTDIR)$(kde_servicesdir) || $(mkinstalldirs) $(DESTDIR)$(kde_servicesdir)
+	$(INSTALL) $(srcdir)/$(dist_kde_services_DATA) $(DESTDIR)$(kde_servicesdir)
+	test -d $(DESTDIR)$(kde_appsdatadir) || $(mkinstalldirs) $(DESTDIR)$(kde_appsdatadir)
+	$(INSTALL) $(srcdir)/$(dist_kde_appsdata_DATA) $(DESTDIR)$(kde_appsdatadir)
+
+install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+	@echo "Nothing to install here now."
+	@echo "Use \"make install-plugin\" to install the KDE plugin to $(DESTDIR)$(plugindir)."
+
+install-plugin install-plugins: test_perms $(plugin_LTLIBRARIES) $(dist_kde_services_DATA) \
+	install-dist_kde_appsdataDATA install-dist_kde_rcDATA \
+	install-dist_kde_servicesDATA
+	test -d $(DESTDIR)$(plugindir) || $(mkinstalldirs) $(DESTDIR)$(plugindir)
+	$(LIBTOOL) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $(plugin_LTLIBRARIES) $(DESTDIR)$(plugindir)
+
+uninstall-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+	$(RM) -f $(DESTDIR)$(plugindir)/libklashpart.so
+	$(RM) -f $(DESTDIR)$(plugindir)/libklashpart.la
+	$(RM) -f $(DESTDIR)$(plugindir)/libklashpart.a
+
+endif
+
+force:
+
+.PHONY : install-plugins install-plugin test_perms
--- gnash/plugin/klash4/pluginsinfo.kde4~	2008-10-08 13:50:45.261075508 +0200
+++ gnash/plugin/klash4/pluginsinfo	2008-10-08 13:50:45.261075508 +0200
@@ -0,0 +1,7 @@
+number=1
+
+[0]
+description=Shockwave Flash 7.0
+file=libklashpart.so
+mime=application/x-shockwave-flash:swf:Shockwave Flash;application/futuresplash:spl:FutureSplash Player
+name=Shockwave Flash
--- gnash/plugin/klash4/README.kde4~	2008-10-08 13:50:45.261075508 +0200
+++ gnash/plugin/klash4/README	2008-10-08 13:50:45.261075508 +0200
@@ -0,0 +1,5 @@
+Klash is a plugin for Konqueror, using the gnash binary from the Gnash
+project. As of this writing, you can only get it by checking it out their
+CVS repository. It should be newer than 2006-02-23, because that version
+has the -x option to embed in a window.
+You also need automake/autoconf and the SDL development.
--- gnash/plugin/Makefile.am.kde4~	2008-10-07 13:30:16.000000000 +0200
+++ gnash/plugin/Makefile.am	2008-10-08 13:52:00.976192165 +0200
@@ -24,6 +24,10 @@ if KPARTS
 SUBDIRS += klash
 endif
 
+if KPARTS4
+SUBDIRS += klash4
+endif
+
 if NPAPI
 SUBDIRS += mozilla-sdk
 
@@ -41,7 +45,7 @@ endif
 endif # NPAPI
 
 # make sure these files make it into the distribution tarball.
-DIST_SUBDIRS = klash mozilla-sdk xpcom win32
+DIST_SUBDIRS = klash klash4 mozilla-sdk xpcom win32
 
 # This is a hard coded path to where the plugin gets installed.
 GNASHBINDIR = $(bindir)
@@ -132,6 +136,7 @@ install-pluginLTLIBRARIES: $(plugin_LTLI
 	@echo "Use \"make install-plugin\" to install the Firefox plugin to $(DESTDIR)$(plugindir)."
 
 if !WIN32
+if NPAPI
 install-plugin: $(plugin_LTLIBRARIES)
 	@test -d "$(DESTDIR)$(plugindir)" || $(mkinstalldirs) "$(DESTDIR)$(plugindir)"
 	@echo "Installing plugin to $(DESTDIR)$(plugindir)"
@@ -140,6 +145,10 @@ install-plugin: $(plugin_LTLIBRARIES)
 	else \
 	  cp -f libgnashplugin.so* $(DESTDIR)$(plugindir)/libgnashplugin.so; \
 	fi
+else # NPAPI
+install-plugin:
+	: # do nothing
+endif
 else
 install-plugin: 
 	: # do nothing
@@ -147,6 +156,7 @@ endif # WIN32
 
 install-plugins: install-plugin
 	$(MAKE) -C klash install-plugins
+	$(MAKE) -C klash4 install-plugins
 	$(MAKE) -C win32 install-plugins
 
 uninstall-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
