summaryrefslogtreecommitdiffstats
path: root/xparts/mozilla
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit90825e2392b2d70e43c7a25b8a3752299a933894 (patch)
treee33aa27f02b74604afbfd0ea4f1cfca8833d882a /xparts/mozilla
downloadtdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.tar.gz
tdebindings-90825e2392b2d70e43c7a25b8a3752299a933894.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'xparts/mozilla')
-rw-r--r--xparts/mozilla/Makefile.am25
-rw-r--r--xparts/mozilla/README2
-rw-r--r--xparts/mozilla/configure.in.in31
-rw-r--r--xparts/mozilla/kmozilla.c193
-rw-r--r--xparts/mozilla/kmozilla.desktop9
-rw-r--r--xparts/mozilla/kmozilla.h34
-rw-r--r--xparts/mozilla/kmozilla.rc11
-rw-r--r--xparts/mozilla/kmozilla_ext.c125
-rw-r--r--xparts/mozilla/kmozilla_ext.h41
-rw-r--r--xparts/mozilla/kmozillapart.cpp51
-rw-r--r--xparts/mozilla/kmozillapart.h27
-rw-r--r--xparts/mozilla/kshell.cpp76
-rw-r--r--xparts/mozilla/main.c69
-rw-r--r--xparts/mozilla/parthost.rc14
14 files changed, 708 insertions, 0 deletions
diff --git a/xparts/mozilla/Makefile.am b/xparts/mozilla/Makefile.am
new file mode 100644
index 00000000..1e499a2a
--- /dev/null
+++ b/xparts/mozilla/Makefile.am
@@ -0,0 +1,25 @@
+INCLUDES = -I$(srcdir)/../src/kde -I$(srcdir)/../src/interfaces -I$(srcdir)/../src/gtk -I$(prefix)/include -I$(top_srcdir) $(MOZILLA_INCLUDES) $(all_includes)
+
+AM_CFLAGS = $(GLIB_CFLAGS) $(GTK_CFLAGS)
+
+lib_LTLIBRARIES = libkmozillapart.la
+
+libkmozillapart_la_SOURCES = kmozillapart.cpp
+libkmozillapart_la_LDFLAGS = -module $(all_libraries)
+libkmozillapart_la_LIBADD = ../src/kde/libkdexparts.la
+
+servicedir = $(kde_servicesdir)
+service_DATA = kmozilla.desktop
+
+bin_PROGRAMS = kmozilla #kshell
+
+kmozilla_SOURCES = kmozilla.c kmozilla_ext.c main.c
+kmozilla_LDADD = ../src/gtk/libgtkxparts.la $(GTK_LIBS) $(GLIB_LIBS)
+kmozilla_LDFLAGS = $(GLIB_LDFLAGS) $(GTK_LDFLAGS) -L$(libdir) -L/usr/lib/mozilla -Wl,--rpath=/usr/lib/mozilla -lgtkembedmoz -lxpcom $(all_libraries)
+
+#kshell_SOURCES = kshell.cpp
+#kshell_LDADD = $(top_builddir)/xkparts/kde/libkdexparts.la
+#kshell_LDFLAGS = $(all_libraries)
+
+METASOURCES = AUTO
+
diff --git a/xparts/mozilla/README b/xparts/mozilla/README
new file mode 100644
index 00000000..48b99103
--- /dev/null
+++ b/xparts/mozilla/README
@@ -0,0 +1,2 @@
+You will need to set some environment variables for this to work. Have a look
+at env for some sample settings.
diff --git a/xparts/mozilla/configure.in.in b/xparts/mozilla/configure.in.in
new file mode 100644
index 00000000..7dc0165c
--- /dev/null
+++ b/xparts/mozilla/configure.in.in
@@ -0,0 +1,31 @@
+AC_DEFUN([AC_PATH_MOZILLA],
+[
+
+AC_MSG_CHECKING([for Mozilla development headers])
+
+mozilla_incldirs="/usr/include /usr/include/mozilla /usr/local/include /usr/X11R6/include/mozilla /opt/include /opt/mozilla/include"
+AC_FIND_FILE(gtkmozembed.h, $mozilla_incldirs, mozilla_incdir)
+
+if test "$mozilla_incdir" = NO; then
+ AC_FIND_FILE(gtkembedmoz/gtkmozembed.h, $mozilla_incldirs, mozilla_incdir)
+
+ if test "$mozilla_incdir" != NO; then
+ mozilla_incdir="$mozilla_incdir/gtkembedmoz"
+ fi
+fi
+
+if test "$mozilla_incdir" = NO; then
+ AC_MSG_RESULT(no);
+else
+ have_mozilla=yes;
+ MOZILLA_INCLUDES="-I$mozilla_incdir"
+ AC_SUBST(MOZILLA_INCLUDES)
+ AC_MSG_RESULT([found in $mozilla_incdir]);
+fi
+
+AM_CONDITIONAL(include_MOZILLA_support, [test "$mozilla_incdir" != NO])
+
+])
+
+
+AC_PATH_MOZILLA
diff --git a/xparts/mozilla/kmozilla.c b/xparts/mozilla/kmozilla.c
new file mode 100644
index 00000000..f405ef36
--- /dev/null
+++ b/xparts/mozilla/kmozilla.c
@@ -0,0 +1,193 @@
+#include "kmozilla.h"
+#include "kmozilla_ext.h"
+#include <gtkmozembed.h>
+#include <gtkbrowserextension.h>
+#include <assert.h>
+
+typedef struct _GtkKmozillaPrivate GtkKmozillaPrivate;
+
+struct _GtkKmozillaPrivate {
+ GtkMozEmbed *mozilla;
+ GtkKmozillaExtension *ext;
+};
+
+#define P ((GtkKmozillaPrivate *)(((GtkKmozilla *)part)->data))
+#define CLASS(obj) GTK_KMOZILLA_CLASS(GTK_OBJECT(obj)->klass)
+
+
+/* class and instance initialization */
+
+static void
+gtk_kmozilla_class_init(GtkKmozillaClass *klass);
+
+static void
+gtk_kmozilla_init(GtkKmozilla *part);
+
+static void
+gtk_kmozilla_destroy( GtkObject *obj );
+
+static GtkXPartClass *parent_class = 0;
+static gboolean openUrlRequested = FALSE;
+static GtkKmozilla *mozilla = 0;
+
+/* virtual functions */
+static gboolean open_url( GtkXPart *part, const char * url );
+static gboolean close_url ( GtkXPart *part );
+static char * query_extension ( GtkXPart *part, const char *name );
+
+
+/* signals */
+static void handle_reload(GtkObject *obj, gpointer user_data);
+
+/* signal handlers for gtkmozembed signals */
+static gboolean open_url_request(GtkObject *obj, const char *url);
+
+/* --------------------------- implementations --------------------------------------- */
+
+/* type information */
+GtkType
+gtk_kmozilla_get_type(void)
+{
+ static GtkType part_type = 0;
+ if (!part_type)
+ {
+ static const GtkTypeInfo part_info =
+ {
+ "GtkKmozilla",
+ sizeof(GtkKmozilla),
+ sizeof(GtkKmozillaClass),
+ (GtkClassInitFunc)gtk_kmozilla_class_init,
+ (GtkObjectInitFunc)gtk_kmozilla_init,
+ 0,
+ 0,
+ 0
+ };
+ part_type = gtk_type_unique(GTK_TYPE_XPART, &part_info);
+ }
+ return part_type;
+}
+
+/* class and instance initialization */
+static void
+gtk_kmozilla_class_init(GtkKmozillaClass *klass)
+{
+ GtkObjectClass *object_class = (GtkObjectClass *)klass;
+ GtkXPartClass *xpart_class = GTK_XPART_CLASS(klass);
+
+ parent_class = (GtkXPartClass *)gtk_type_class(gtk_xpart_get_type());
+
+ object_class->destroy = gtk_kmozilla_destroy;
+
+ xpart_class->open_url = open_url;
+ xpart_class->close_url = close_url;
+ xpart_class->query_extension = query_extension;
+
+ g_message( "gtk_kmozilla_class_init\n" );
+}
+
+static void
+gtk_kmozilla_init(GtkKmozilla *part)
+{
+ GtkWidget *w;
+ GtkWidget *moz;
+ GtkKmozillaExtension *ext;
+
+ GtkKmozillaPrivate *d;
+ d = g_new( GtkKmozillaPrivate, 1 );
+ part->data = d;
+
+ ext = gtk_kmozilla_extension_new();
+ g_message( "gtk_kmozilla_init\n" );
+ kmozilla_extension_set_mozilla( ext, part );
+ d->ext = ext;
+
+ dcop_object_set_id( DCOP_OBJECT(part), "KmozillaClient" );
+
+ w = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ moz = gtk_moz_embed_new();
+ d->mozilla = GTK_MOZ_EMBED( moz );
+ gtk_container_add( GTK_CONTAINER( w ), moz );
+ gtk_widget_realize( w );
+
+ /* g_warning( "winid %x\n", GDK_WINDOW_XWINDOW( w->window ) );*/
+
+ gtk_xpart_set_widget( (GtkXPart *)part, w );
+
+ gtk_signal_connect(GTK_OBJECT(part), "reload",
+ GTK_SIGNAL_FUNC(handle_reload), NULL);
+ gtk_signal_connect(GTK_OBJECT(moz), "open_uri",
+ GTK_SIGNAL_FUNC(open_url_request), NULL);
+
+ mozilla = part;
+ g_message( "gtk_kmozilla_init\n" );
+}
+
+GtkKmozilla *gtk_kmozilla_new (void)
+{
+ return (GtkKmozilla *) gtk_type_new(gtk_kmozilla_get_type());
+}
+
+void gtk_kmozilla_destroy( GtkObject *obj )
+{
+ GtkKmozilla *part = GTK_KMOZILLA(obj);
+ GtkKmozillaPrivate *d = (GtkKmozillaPrivate *) part->data;
+
+ gtk_object_destroy( GTK_OBJECT( d->mozilla ) );
+
+ GTK_OBJECT_CLASS(parent_class)->destroy(obj);
+}
+
+void gtk_kmozilla_set_dcop_client( GtkKmozilla *part, DcopClient *client )
+{
+ gtk_xpart_set_dcop_client(part, client);
+ gtk_xbrowserextension_set_dcop_client(P->ext, client);
+}
+
+/* ----------------------------------------------------------------------- */
+
+static gboolean open_url( GtkXPart *part, const char * url )
+{
+ g_message( "open_url %s", url );
+ openUrlRequested = FALSE;
+ gtk_moz_embed_load_url( P->mozilla, url );
+ return TRUE;
+}
+
+static gboolean close_url( GtkXPart *part )
+{
+ g_message( "close_url" );
+ gtk_moz_embed_stop_load( P->mozilla );
+ return TRUE;
+}
+
+static char * query_extension ( GtkXPart *part, const char *name )
+{
+ g_warning("KMozilla::query_extension");
+ if( !strcmp(name, "browserextension") )
+ return dcop_object_get_id((DcopObject *)P->ext);
+ return NULL;
+}
+
+static void
+handle_reload(GtkObject *obj, gpointer user_data)
+{
+ GtkKmozilla *part = GTK_KMOZILLA(obj);
+ g_message( "reload called" );
+ gtk_moz_embed_reload(P->mozilla, 0);
+}
+
+/* ----------------- signal handlers for gtkmozembed ------------------ */
+
+/* return true if we don't want mozilla to load it, false if mozilla should load the page. */
+static gboolean open_url_request(GtkObject *obj, const char * url)
+{
+ gboolean req;
+ g_message("==================>>>>>>> kmozilla::openUrlRequest %s", url);
+ req = openUrlRequested;
+ if( req == TRUE ) {
+ gtk_browserextension_open_url_request( ((GtkKmozillaPrivate *)mozilla->data)->ext, url );
+ }
+ openUrlRequested = TRUE;
+ return req;
+}
+
diff --git a/xparts/mozilla/kmozilla.desktop b/xparts/mozilla/kmozilla.desktop
new file mode 100644
index 00000000..de54312f
--- /dev/null
+++ b/xparts/mozilla/kmozilla.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Type=Service
+Exec=foobar
+Comment=Embeddable HTML viewing component
+MimeType=text/html;text/xml;
+Icon=konqueror
+Name=KMOZILLA
+ServiceTypes=KParts/ReadOnlyPart,Browser/View
+X-KDE-Library=libkmozillapart
diff --git a/xparts/mozilla/kmozilla.h b/xparts/mozilla/kmozilla.h
new file mode 100644
index 00000000..c9054399
--- /dev/null
+++ b/xparts/mozilla/kmozilla.h
@@ -0,0 +1,34 @@
+#ifndef _gtk_kmozilla_h_
+#define _gtk_kmozilla_h_
+
+#include "gtkpart.h"
+
+#define GTK_TYPE_KMOZILLA (gtk_kmozilla_get_type())
+#define GTK_KMOZILLA(obj) GTK_CHECK_CAST((obj), GTK_TYPE_KMOZILLA, GtkKmozilla)
+#define GTK_KMOZILLA_CLASS(klass) GTK_CHECK_CLASS_CAST((klass), GTK_TYPE_KMOZILLA, GtkKmozillaClass)
+#define GTK_IS_KMOZILLA(obj) GTK_CHECK_TYPE((obj), GTK_TYPE_KMOZILLA)
+#define GTK_IS_KMOZILLA_CLASS(klass) GTK_CHECK_CLASS_TYPE((klass), GTK_TYPE_KMOZILLA)
+
+#define GTK_KMOZILLA_WIDGET(part) (gtk_kmozilla_get_widget(part))
+#define GTK_KMOZILLA_DCOP(part) (gtk_kmozilla_get_dcop(part))
+
+typedef struct _GtkKmozilla GtkKmozilla;
+typedef struct _GtkKmozillaClass GtkKmozillaClass;
+
+struct _GtkKmozilla
+{
+ GtkXPart part;
+ void *data;
+};
+
+struct _GtkKmozillaClass
+{
+ GtkXPartClass parent_class;
+};
+
+extern GtkType gtk_kmozilla_get_type (void);
+extern GtkKmozilla *gtk_kmozilla_new (void);
+
+void gtk_kmozilla_set_dcop_client( GtkKmozilla *part, DcopClient *client );
+
+#endif
diff --git a/xparts/mozilla/kmozilla.rc b/xparts/mozilla/kmozilla.rc
new file mode 100644
index 00000000..9c80e6c3
--- /dev/null
+++ b/xparts/mozilla/kmozilla.rc
@@ -0,0 +1,11 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="khtmlpart" version="1">
+<MenuBar>
+ <Menu name="edit">
+ <Action name="stop" />
+ <Action name="reload" />
+ <Separator />
+ <Action name="nonexistant" />
+ </Menu>
+</MenuBar>
+</kpartgui>
diff --git a/xparts/mozilla/kmozilla_ext.c b/xparts/mozilla/kmozilla_ext.c
new file mode 100644
index 00000000..15195136
--- /dev/null
+++ b/xparts/mozilla/kmozilla_ext.c
@@ -0,0 +1,125 @@
+#include "kmozilla_ext.h"
+
+#include <gdk/gdkx.h>
+
+#include <dcopc/util.h>
+#include <dcopc/marshal.h>
+#include <dcopc/dcopc.h>
+
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include <stdlib.h>
+
+typedef struct _GtkKmozillaExtensionPrivate GtkKmozillaExtensionPrivate;
+
+struct _GtkKmozillaExtensionPrivate {
+ GtkKmozilla *moz;
+};
+
+#define P ((GtkKmozillaExtensionPrivate *)(ext->data))
+#define CLASS(obj) GTK_KMOZILLAEXTENSION_CLASS(GTK_OBJECT(obj)->klass)
+
+
+/* class and instance initialization */
+
+static void
+gtk_kmozilla_extension_class_init(GtkKmozillaExtensionClass *klass);
+
+static void
+gtk_kmozilla_extension_init(GtkKmozillaExtension *part);
+
+static void
+gtk_kmozilla_extension_destroy( GtkObject *obj );
+
+/* virtual functions */
+static const char * save_state( GtkXBrowserExtension *ext );
+static void restore_state ( GtkXBrowserExtension *ext, const char *state, unsigned int size );
+
+static GtkXBrowserExtensionClass *parent_class = 0;
+
+/* --------------------------- implementations --------------------------------------- */
+
+/* type information */
+GtkType
+gtk_kmozilla_extension_get_type(void)
+{
+ static GtkType part_type = 0;
+ if (!part_type)
+ {
+ static const GtkTypeInfo part_info =
+ {
+ "GtkKmozillaExtension",
+ sizeof(GtkKmozillaExtension),
+ sizeof(GtkKmozillaExtensionClass),
+ (GtkClassInitFunc)gtk_kmozilla_extension_class_init,
+ (GtkObjectInitFunc)gtk_kmozilla_extension_init,
+ 0,
+ 0,
+ 0
+ };
+ part_type = gtk_type_unique(GTK_TYPE_XBROWSEREXTENSION, &part_info);
+ }
+ return part_type;
+}
+
+/* class and instance initialization */
+static void
+gtk_kmozilla_extension_class_init(GtkKmozillaExtensionClass *klass)
+{
+ GtkObjectClass *object_class = (GtkObjectClass *)klass;
+ DcopObjectClass *dcop_class = DCOP_OBJECT_CLASS(klass);
+ GtkXBrowserExtensionClass *be_class = GTK_XBROWSEREXTENSION_CLASS(klass);
+
+ parent_class = (GtkXBrowserExtensionClass *)gtk_type_class(gtk_xbrowserextension_get_type());
+
+ object_class->destroy = gtk_kmozilla_extension_destroy;
+
+ be_class->save_state = save_state;
+ be_class->restore_state = restore_state;
+
+ g_message( "gtk_kmozillaextension_class_init\n" );
+}
+
+static void
+gtk_kmozilla_extension_init(GtkKmozillaExtension *part)
+{
+ GtkKmozillaExtensionPrivate *d;
+ d = g_new( GtkKmozillaExtensionPrivate, 1 );
+ part->data = d;
+
+ dcop_object_set_id( DCOP_OBJECT(part), "KmozillaExtensionClient" );
+
+ g_message( "gtk_kmozillaextension_init\n" );
+}
+
+GtkKmozillaExtension *gtk_kmozilla_extension_new (void)
+{
+ return (GtkKmozillaExtension *) gtk_type_new(gtk_kmozilla_extension_get_type());
+}
+
+
+void gtk_kmozilla_extension_destroy( GtkObject *obj )
+{
+ GtkKmozillaExtension *part = GTK_KMOZILLA_EXTENSION(obj);
+ GtkKmozillaExtensionPrivate *d = (GtkKmozillaExtensionPrivate *) part->data;
+ g_free( d );
+
+ GTK_OBJECT_CLASS(parent_class)->destroy(obj);
+}
+
+void kmozilla_extension_set_mozilla( GtkKmozillaExtension *ext, GtkKmozilla *moz )
+{
+ P->moz = moz;
+}
+
+static const char * save_state( GtkXBrowserExtension *ext )
+{
+ g_warning("Extension::save_state!");
+ return 0;
+}
+
+static void restore_state ( GtkXBrowserExtension *ext, const char *state, unsigned int size )
+{
+ g_warning("Extension::restore_state!");
+}
diff --git a/xparts/mozilla/kmozilla_ext.h b/xparts/mozilla/kmozilla_ext.h
new file mode 100644
index 00000000..419bbc85
--- /dev/null
+++ b/xparts/mozilla/kmozilla_ext.h
@@ -0,0 +1,41 @@
+#ifndef _kmozillaextension_h__
+#define _kmozillaextension_h__
+
+#include "gtkbrowserextension.h"
+#include "kmozilla.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#define GTK_TYPE_KMOZILLA_EXTENSION (gtk_kmozilla_extension_get_type())
+#define GTK_KMOZILLA_EXTENSION(obj) GTK_CHECK_CAST((obj), GTK_TYPE_KMOZILLA_EXTENSION, GtkKmozillaExtension)
+#define GTK_KMOZILLAEXTENSION_CLASS(klass) GTK_CHECK_CLASS_CAST((klass), GTK_TYPE_KMOZILLA_EXTENSION, GtkKmozillaExtensionClass)
+#define GTK_IS_KMOZILLA_EXTENSION(obj) GTK_CHECK_TYPE((obj), GTK_TYPE_KMOZILLA_EXTENSION)
+#define GTK_IS_KMOZILLA_EXTENSION_CLASS(klass) GTK_CHECK_CLASS_TYPE((klass), GTK_TYPE_KMOZILLA_EXTENSION)
+
+typedef struct _GtkKmozillaExtension GtkKmozillaExtension;
+typedef struct _GtkKmozillaExtensionClass GtkKmozillaExtensionClass;
+
+struct _GtkKmozillaExtension
+{
+ GtkXBrowserExtension obj;
+ void *data;
+};
+
+struct _GtkKmozillaExtensionClass
+{
+ GtkXBrowserExtensionClass parent_class;
+};
+
+extern GtkType gtk_kmozilla_extension_get_type (void);
+extern GtkKmozillaExtension *gtk_kmozilla_extension_new (void);
+
+extern void kmozilla_extension_set_mozilla( GtkKmozillaExtension *ext, GtkKmozilla *moz );
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/xparts/mozilla/kmozillapart.cpp b/xparts/mozilla/kmozillapart.cpp
new file mode 100644
index 00000000..d5f73050
--- /dev/null
+++ b/xparts/mozilla/kmozillapart.cpp
@@ -0,0 +1,51 @@
+#include "kmozillapart.h"
+
+#include <dcopclient.h>
+#include <dcopobject.h>
+#include <kapplication.h>
+#include <kstdaction.h>
+#include <kaction.h>
+#include <kmainwindow.h>
+#include <kprocess.h>
+#include <kparts/mainwindow.h>
+#include <kdebug.h>
+#include <kaboutdata.h>
+#include <kparts/genericfactory.h>
+
+typedef KParts::GenericFactory<KMozillaPart> KMozillaPartFactory;
+K_EXPORT_COMPONENT_FACTORY( libkmozillapart, KMozillaPartFactory );
+
+KMozillaPart::KMozillaPart(QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name, const QStringList &)
+ : XPartHost_KPart(parentWidget, widgetName, parent, name)
+{
+ setInstance( KMozillaPartFactory::instance() );
+
+ m_partProcess = new KProcess;
+ *m_partProcess << "kmozilla"
+ << kapp->dcopClient()->appId() << objId();
+ m_partProcess->start();
+
+ qDebug("---->>>>>> enter loop");
+ kapp->enter_loop();
+ qDebug("----<<<<<< left loop");
+}
+
+KMozillaPart::~KMozillaPart()
+{
+ delete m_partProcess;
+}
+
+void KMozillaPart::createActions( const QCString &xmlActions )
+{
+ XPartHost_KPart::createActions( xmlActions );
+ qDebug("----<<<<<< exit loop");
+ kapp->exit_loop();
+}
+
+KAboutData *KMozillaPart::createAboutData()
+{
+ return new KAboutData( "kmozilla", "kmozilla", "0.1" );
+}
+
+#include "kmozillapart.moc"
diff --git a/xparts/mozilla/kmozillapart.h b/xparts/mozilla/kmozillapart.h
new file mode 100644
index 00000000..d7cef4b9
--- /dev/null
+++ b/xparts/mozilla/kmozillapart.h
@@ -0,0 +1,27 @@
+#ifndef _kmozillapart_h_
+#define _kmozillapart_h_
+
+#include "xparthost_kpart.h"
+
+class KAboutData;
+class KProcess;
+
+class KMozillaPart : public XPartHost_KPart
+{
+ Q_OBJECT
+
+public:
+ KMozillaPart(QWidget *parentWidget, const char *widgetName,
+ QObject *parent, const char *name, const QStringList &);
+ virtual ~KMozillaPart();
+
+ virtual void createActions( const QCString &xmlActions );
+
+ static KAboutData *createAboutData();
+
+private:
+ KProcess *m_partProcess;
+};
+
+#endif
+
diff --git a/xparts/mozilla/kshell.cpp b/xparts/mozilla/kshell.cpp
new file mode 100644
index 00000000..4f012dbb
--- /dev/null
+++ b/xparts/mozilla/kshell.cpp
@@ -0,0 +1,76 @@
+
+#include "xparthost_kpart.h"
+
+#include <dcopclient.h>
+#include <dcopobject.h>
+#include <kapplication.h>
+#include <kstdaction.h>
+#include <kaction.h>
+#include <kmainwindow.h>
+#include <kprocess.h>
+#include <kparts/mainwindow.h>
+#include <kdebug.h>
+
+class ShellWindow : public KParts::MainWindow
+{
+ Q_OBJECT
+
+public:
+ ShellWindow()
+ {
+ m_host = new XPartHost_KPart( this, "parthost" );
+
+ setCentralWidget( m_host->widget() );
+
+ connect(m_host, SIGNAL( actionsInitialized() ), this, SLOT( mergeGUI() ) );
+
+#if 1
+ m_partProcess = new KProcess;
+ *m_partProcess << "./kmozilla"
+ << kapp->dcopClient()->appId() << m_host->objId();
+ m_partProcess->start();
+#endif
+
+ KStdAction::quit( this, SLOT( close() ), actionCollection() );
+ KSelectAction *s = new KSelectAction( "http://www.kde.org" , 0,
+ actionCollection(), "location" );
+ connect( s, SIGNAL(activated( const QString& ) ), this, SLOT( slotOpenUrl( const QString & ) ) );
+ s->setEditable(true);
+ }
+ virtual ~ShellWindow()
+ {
+ delete m_partProcess;
+ }
+public slots:
+ void slotOpenUrl( const QString &url )
+ {
+ kdDebug() << "this=" << this;
+ kdDebug() << "url=" << url << endl;
+ m_host->openURL(url.latin1());
+ }
+ void mergeGUI()
+ {
+ qDebug("initGUI");
+ setXMLFile("/home/lars/kmozilla/kmozilla/parthost.rc");
+ createGUI( m_host );
+ }
+
+private:
+ XPartHost_KPart *m_host;
+ KProcess *m_partProcess;
+};
+
+int main( int argc, char **argv )
+{
+ KApplication app( argc, argv, "xkpartsshell" );
+
+ app.dcopClient()->registerAs("kshell");
+
+ ShellWindow *w = new ShellWindow;
+ w->resize(500, 500);
+ w->show();
+
+ return app.exec();
+}
+
+#include "kshell.moc"
diff --git a/xparts/mozilla/main.c b/xparts/mozilla/main.c
new file mode 100644
index 00000000..c4b8e3ca
--- /dev/null
+++ b/xparts/mozilla/main.c
@@ -0,0 +1,69 @@
+#include "kmozilla.h"
+#include <dcopc/dcopc.h>
+#include "gtkpart.h"
+
+#include <stdio.h>
+
+gboolean dcop_socket_notify( GIOChannel *chan, GIOCondition condition, gpointer data )
+{
+ DcopClient *client = (DcopClient *)data;
+ g_warning( "dcop_socket_notify\n" );
+ dcop_client_process_socket_data( client );
+ return TRUE;
+}
+
+void gtktest_exit()
+{
+ g_warning( "EXIT!\n" );
+ gtk_main_quit();
+}
+
+
+int main( int argc, char **argv )
+{
+ GtkKmozilla *moz;
+ GtkXPart *part;
+ DcopClient *client;
+ GIOChannel *socket_chan;
+
+ gtk_init( &argc, &argv );
+
+ moz = gtk_kmozilla_new( );
+ part = (GtkXPart *)moz;
+ client = dcop_client_new();
+/* dcop_client_attach( client );*/
+ /* for debugging*/
+ dcop_client_register_as( client, "kmozilla", TRUE );
+
+ socket_chan = g_io_channel_unix_new( dcop_client_socket( client ) );
+ g_io_channel_ref( socket_chan );
+ g_io_add_watch( socket_chan, G_IO_IN, dcop_socket_notify, client );
+
+ fprintf(stderr, "client initialized!\n");
+
+ gtk_kmozilla_set_dcop_client(part, client);
+ if(!gtk_xpart_register(part, argv[1], argv[2]))
+ fprintf(stderr, "could not register part\n");
+
+ {
+ /* initialize actions */
+ const char * actions = "<!DOCTYPE actionList SYSTEM \"actionlist.dtd\">\n"
+ "<Actionlist>\n"
+ " <Action name=\"stop\" />\n"
+ " <Action name=\"reload\" />\n"
+ " <Action name=\"nonexistant\" />\n"
+ " <XMLFile location=\"./kmozilla.rc\" />\n"
+ "</Actionlist>\n";
+ gtk_xpart_initialize_actions( part, actions );
+ fprintf(stderr, "hopfully initialized actions\n");
+ }
+ fprintf(stderr, "done!\n");
+
+ gtk_main();
+
+ g_io_channel_unref( socket_chan );
+
+ gtk_object_destroy( GTK_OBJECT(client) );
+
+ return 0;
+}
diff --git a/xparts/mozilla/parthost.rc b/xparts/mozilla/parthost.rc
new file mode 100644
index 00000000..6d451d8d
--- /dev/null
+++ b/xparts/mozilla/parthost.rc
@@ -0,0 +1,14 @@
+<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
+<kpartgui name="part" version="1">
+<MenuBar>
+ <Menu name="edit">
+ <Action name="stop" />
+ <Action name="reload" />
+ <Separator />
+ <Action name="nonexistant" />
+ </Menu>
+</MenuBar>
+<ToolBar fullWidth="true" name="locationToolBar" newline="true">
+ <Action name="location" />
+</ToolBar>
+</kpartgui>