Prefer to autogenerate adaptor

(It allows me to fix some port problem)
I will try to test it now

svn path=/trunk/KDE/kdebase/nsplugins/; revision=615476
This commit is contained in:
Laurent Montel 2006-12-21 17:36:25 +00:00
parent acfdcc98f9
commit a5dfb6f6fc
12 changed files with 54 additions and 453 deletions

View file

@ -12,9 +12,9 @@ if (X11_Xt_LIB)
set(kcminit_nsplugin_PART_SRCS
plugin_part.cpp
nspluginloader.cpp
callbackadaptor.cpp
viewer_proxy.cpp
)
qt4_add_dbus_adaptor( kcminit_nsplugin_PART_SRCS org.kde.nsplugins.CallBack.xml plugin_part.h PluginPart )
kde4_automoc(${kcminit_nsplugin_PART_SRCS})

View file

@ -1,62 +0,0 @@
/*
* This file was generated by dbusidl2cpp version 0.6
* Command line was: dbusidl2cpp -m -a callbackadaptor -c NsPluginsCallBackAdaptor -i plugin_part.h -l PluginPart -- org.kde.nsplugins.CallBack.xml
*
* dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#include "callbackadaptor.h"
#include <QtCore/QMetaObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
/*
* Implementation of adaptor class NsPluginsCallBackAdaptor
*/
NsPluginsCallBackAdaptor::NsPluginsCallBackAdaptor(PluginPart *parent)
: QDBusAbstractAdaptor(parent)
{
// constructor
setAutoRelaySignals(true);
}
NsPluginsCallBackAdaptor::~NsPluginsCallBackAdaptor()
{
// destructor
}
void NsPluginsCallBackAdaptor::evalJavaScript(int id, const QString &script)
{
// handle method call org.kde.nsplugins.CallBack.evalJavaScript
parent()->evalJavaScript(id, script);
}
void NsPluginsCallBackAdaptor::postURL(const QString &url, const QString &target, const QByteArray &data, const QString &mime)
{
// handle method call org.kde.nsplugins.CallBack.postURL
parent()->postURL(url, target, data, mime);
}
void NsPluginsCallBackAdaptor::requestURL(const QString &url, const QString &target)
{
// handle method call org.kde.nsplugins.CallBack.requestURL
parent()->requestURL(url, target);
}
void NsPluginsCallBackAdaptor::statusMessage(const QString &msg)
{
// handle method call org.kde.nsplugins.CallBack.statusMessage
parent()->statusMessage(msg);
}
#include "callbackadaptor.moc"

View file

@ -1,73 +0,0 @@
/*
* This file was generated by dbusidl2cpp version 0.6
* Command line was: dbusidl2cpp -m -a callbackadaptor -c NsPluginsCallBackAdaptor -i plugin_part.h -l PluginPart -- org.kde.nsplugins.CallBack.xml
*
* dbusidl2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#ifndef CALLBACKADAPTOR_H_226561151514943
#define CALLBACKADAPTOR_H_226561151514943
#include <QtCore/QObject>
#include <QtDBus/QtDBus>
#include "plugin_part.h"
class QByteArray;
template<class T> class QList;
template<class Key, class Value> class QMap;
class QString;
class QStringList;
class QVariant;
/*
* Adaptor class for interface org.kde.nsplugins.CallBack
*/
class NsPluginsCallBackAdaptor: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.nsplugins.CallBack")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"org.kde.nsplugins.CallBack\" >\n"
" <method name=\"requestURL\" >\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\" />\n"
" <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
" <arg direction=\"in\" type=\"s\" name=\"target\" />\n"
" </method>\n"
" <method name=\"postURL\" >\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\" />\n"
" <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
" <arg direction=\"in\" type=\"s\" name=\"target\" />\n"
" <arg direction=\"in\" type=\"ay\" name=\"data\" />\n"
" <arg direction=\"in\" type=\"s\" name=\"mime\" />\n"
" </method>\n"
" <method name=\"statusMessage\" >\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\" />\n"
" <arg direction=\"in\" type=\"s\" name=\"msg\" />\n"
" </method>\n"
" <method name=\"evalJavaScript\" >\n"
" <annotation value=\"true\" name=\"org.freedesktop.DBus.Method.NoReply\" />\n"
" <arg direction=\"in\" type=\"i\" name=\"id\" />\n"
" <arg direction=\"in\" type=\"s\" name=\"script\" />\n"
" </method>\n"
" </interface>\n"
"")
public:
NsPluginsCallBackAdaptor(PluginPart *parent);
virtual ~NsPluginsCallBackAdaptor();
inline PluginPart *parent() const
{ return static_cast<PluginPart *>(QObject::parent()); }
public: // PROPERTIES
public Q_SLOTS: // METHODS
Q_NOREPLY void evalJavaScript(int id, const QString &script);
Q_NOREPLY void postURL(const QString &url, const QString &target, const QByteArray &data, const QString &mime);
Q_NOREPLY void requestURL(const QString &url, const QString &target);
Q_NOREPLY void statusMessage(const QString &msg);
Q_SIGNALS: // SIGNALS
};
#endif

View file

@ -175,7 +175,7 @@ PluginPart::PluginPart(QWidget *parentWidget, QObject *parent, const QStringList
: KParts::ReadOnlyPart(parent), _widget(0), _args(args),
_destructed(0L)
{
(void) new NsPluginsCallBackAdaptor( this );
(void) new CallBackAdaptor( this );
QDBusConnection::sessionBus().registerObject( s_callBackObjectPath, this );
setInstance(PluginFactory::instance());

View file

@ -3,7 +3,13 @@ include_directories( ${CMAKE_SOURCE_DIR}/nsplugins )
########### next target ###############
set(nspluginviewer_SRCS nsplugin.cpp viewer.cpp dbusadaptors.cpp callback_proxy.cpp)
set(nspluginviewer_SRCS nsplugin.cpp viewer.cpp callback_proxy.cpp)
qt4_add_dbus_adaptor( nspluginviewer_SRCS org.kde.nsplugins.class.xml nsplugin.h NSPluginClass )
qt4_add_dbus_adaptor( nspluginviewer_SRCS org.kde.nsplugins.instance.xml nsplugin.h NSPluginInstance )
qt4_add_dbus_adaptor( nspluginviewer_SRCS org.kde.nsplugins.viewer.xml nsplugin.h NSPluginViewer )
kde4_automoc(${nspluginviewer_SRCS})

View file

@ -1,136 +0,0 @@
/*
* This file was generated by dbusxml2cpp version 0.6
* Command line was: dbusxml2cpp -m -a dbusadaptors -c ViewerAdaptor -i nsplugin.h -l NSPluginViewer -- org.kde.nsplugins.xml
*
* dbusxml2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#include "dbusadaptors.h"
#include <QtCore/QMetaObject>
#include <QtCore/QByteArray>
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QVariant>
/*
* Implementation of adaptor class ClassAdaptor
*/
ClassAdaptor::ClassAdaptor(NSPluginClass *parent)
: QDBusAbstractAdaptor(parent)
{
// constructor
setAutoRelaySignals(true);
}
ClassAdaptor::~ClassAdaptor()
{
// destructor
}
QString ClassAdaptor::getMIMEDescription()
{
// handle method call org.kde.nsplugins.Class.getMIMEDescription
return parent()->getMIMEDescription();
}
QDBusObjectPath ClassAdaptor::newInstance(const QString &url, const QString &mimeType, bool embed, const QStringList &argn, const QStringList &argv, const QString &appId, const QString &callbackId, bool reload)
{
// handle method call org.kde.nsplugins.Class.newInstance
return QDBusObjectPath( parent()->newInstance(url, mimeType, embed, argn, argv, appId, callbackId, reload) );
}
/*
* Implementation of adaptor class InstanceAdaptor
*/
InstanceAdaptor::InstanceAdaptor(NSPluginInstance *parent)
: QDBusAbstractAdaptor(parent)
{
// constructor
setAutoRelaySignals(true);
}
InstanceAdaptor::~InstanceAdaptor()
{
// destructor
}
void InstanceAdaptor::displayPlugin()
{
// handle method call org.kde.nsplugins.Instance.displayPlugin
parent()->displayPlugin();
}
void InstanceAdaptor::javascriptResult(int id, const QString &result)
{
// handle method call org.kde.nsplugins.Instance.javascriptResult
parent()->javascriptResult(id, result);
}
void InstanceAdaptor::resizePlugin(int w, int h)
{
// handle method call org.kde.nsplugins.Instance.resizePlugin
parent()->resizePlugin(w, h);
}
int InstanceAdaptor::setWindow()
{
// handle method call org.kde.nsplugins.Instance.setWindow
return parent()->setWindow();
}
int InstanceAdaptor::setWindow(int remove)
{
// handle method call org.kde.nsplugins.Instance.setWindow
return parent()->setWindow(remove);
}
void InstanceAdaptor::shutdown()
{
// handle method call org.kde.nsplugins.Instance.shutdown
parent()->shutdown();
}
int InstanceAdaptor::winId()
{
// handle method call org.kde.nsplugins.Instance.winId
return parent()->winId();
}
/*
* Implementation of adaptor class ViewerAdaptor
*/
ViewerAdaptor::ViewerAdaptor(NSPluginViewer *parent)
: QDBusAbstractAdaptor(parent)
{
// constructor
setAutoRelaySignals(true);
}
ViewerAdaptor::~ViewerAdaptor()
{
// destructor
}
QDBusObjectPath ViewerAdaptor::newClass(const QString &plugin, const QDBusMessage& msg)
{
// handle method call org.kde.nsplugins.Viewer.newClass
return QDBusObjectPath( parent()->newClass(plugin, msg.service()) );
}
void ViewerAdaptor::shutdown()
{
// handle method call org.kde.nsplugins.Viewer.shutdown
parent()->shutdown();
}
#include "dbusadaptors.moc"

View file

@ -1,144 +0,0 @@
/*
* This file was generated by dbusxml2cpp version 0.6
* Command line was: dbusxml2cpp -m -a dbusadaptors -c ViewerAdaptor -i nsplugin.h -l NSPluginViewer -- org.kde.nsplugins.xml
*
* dbusxml2cpp is Copyright (C) 2006 Trolltech AS. All rights reserved.
*
* This is an auto-generated file.
* This file may have been hand-edited. Look for HAND-EDIT comments
* before re-generating it.
*/
#ifndef DBUSADAPTORS_H_326861151891350
#define DBUSADAPTORS_H_326861151891350
#include <QtCore/QObject>
#include <QtDBus/QtDBus>
#include "nsplugin.h"
class QByteArray;
template<class T> class QList;
template<class Key, class Value> class QMap;
class QString;
class QStringList;
class QVariant;
/*
* Adaptor class for interface org.kde.nsplugins.Class
*/
class Q_DECL_EXPORT ClassAdaptor: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.nsplugins.Class")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"org.kde.nsplugins.Class\" >\n"
" <method name=\"newInstance\" >\n"
" <arg direction=\"out\" type=\"o\" />\n"
" <arg direction=\"in\" type=\"s\" name=\"url\" />\n"
" <arg direction=\"in\" type=\"s\" name=\"mimeType\" />\n"
" <arg direction=\"in\" type=\"b\" name=\"embed\" />\n"
" <arg direction=\"in\" type=\"as\" name=\"argn\" />\n"
" <arg direction=\"in\" type=\"as\" name=\"argv\" />\n"
" <arg direction=\"in\" type=\"s\" name=\"appId\" />\n"
" <arg direction=\"in\" type=\"s\" name=\"callbackId\" />\n"
" <arg direction=\"in\" type=\"b\" name=\"reload\" />\n"
" </method>\n"
" <method name=\"getMIMEDescription\" >\n"
" <arg direction=\"out\" type=\"s\" />\n"
" </method>\n"
" </interface>\n"
"")
public:
ClassAdaptor(NSPluginClass *parent);
virtual ~ClassAdaptor();
inline NSPluginClass *parent() const
{ return static_cast<NSPluginClass *>(QObject::parent()); }
public: // PROPERTIES
public Q_SLOTS: // METHODS
QString getMIMEDescription();
QDBusObjectPath newInstance(const QString &url, const QString &mimeType, bool embed, const QStringList &argn, const QStringList &argv, const QString &appId, const QString &callbackId, bool reload);
Q_SIGNALS: // SIGNALS
};
/*
* Adaptor class for interface org.kde.nsplugins.Instance
*/
class Q_DECL_EXPORT InstanceAdaptor: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.nsplugins.Instance")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"org.kde.nsplugins.Instance\" >\n"
" <method name=\"shutdown\" />\n"
" <method name=\"winId\" >\n"
" <arg direction=\"out\" type=\"i\" />\n"
" </method>\n"
" <method name=\"setWindow\" >\n"
" <arg direction=\"out\" type=\"i\" />\n"
" <arg direction=\"in\" type=\"i\" name=\"remove\" />\n"
" </method>\n"
" <method name=\"setWindow\" >\n"
" <arg direction=\"out\" type=\"i\" />\n"
" </method>\n"
" <method name=\"resizePlugin\" >\n"
" <arg direction=\"in\" type=\"i\" name=\"w\" />\n"
" <arg direction=\"in\" type=\"i\" name=\"h\" />\n"
" </method>\n"
" <method name=\"javascriptResult\" >\n"
" <arg direction=\"in\" type=\"i\" name=\"id\" />\n"
" <arg direction=\"in\" type=\"s\" name=\"result\" />\n"
" </method>\n"
" <method name=\"displayPlugin\" />\n"
" </interface>\n"
"")
public:
InstanceAdaptor(NSPluginInstance *parent);
virtual ~InstanceAdaptor();
inline NSPluginInstance *parent() const
{ return static_cast<NSPluginInstance *>(QObject::parent()); }
public: // PROPERTIES
public Q_SLOTS: // METHODS
void displayPlugin();
void javascriptResult(int id, const QString &result);
void resizePlugin(int w, int h);
int setWindow();
int setWindow(int remove);
void shutdown();
int winId();
Q_SIGNALS: // SIGNALS
};
/*
* Adaptor class for interface org.kde.nsplugins.Viewer
*/
class Q_DECL_EXPORT ViewerAdaptor: public QDBusAbstractAdaptor
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "org.kde.nsplugins.Viewer")
Q_CLASSINFO("D-Bus Introspection", ""
" <interface name=\"org.kde.nsplugins.Viewer\" >\n"
" <method name=\"shutdown\" />\n"
" <method name=\"newClass\" >\n"
" <arg direction=\"out\" type=\"o\" />\n"
" <arg direction=\"in\" type=\"s\" name=\"plugin\" />\n"
" </method>\n"
" </interface>\n"
"")
public:
ViewerAdaptor(NSPluginViewer *parent);
virtual ~ViewerAdaptor();
inline NSPluginViewer *parent() const
{ return static_cast<NSPluginViewer *>(QObject::parent()); }
public: // PROPERTIES
public Q_SLOTS: // METHODS
QDBusObjectPath newClass(const QString &plugin, const QDBusMessage& msg);
void shutdown();
Q_SIGNALS: // SIGNALS
};
#endif

View file

@ -25,7 +25,10 @@
#include "nsplugin.h"
#include "resolve.h"
#include "dbusadaptors.h"
#include "classadaptor.h"
#include "instanceadaptor.h"
#include "vieweradaptor.h"
#include "callback_proxy.h"
#include <stdlib.h>
@ -1249,7 +1252,7 @@ void NSPluginViewer::shutdown()
}
QString NSPluginViewer::newClass( const QString& plugin, const QString& senderId )
QDBusObjectPath NSPluginViewer::newClass( const QString& plugin, const QString& senderId )
{
kDebug(1431) << "NSPluginViewer::NewClass( " << plugin << ")" << endl;
@ -1262,13 +1265,13 @@ QString NSPluginViewer::newClass( const QString& plugin, const QString& senderId
if ( cls->error() ) {
kError(1431) << "Can't create plugin class" << endl;
delete cls;
return QString();
return QDBusObjectPath();
}
_classes.insert( plugin, cls );
}
return cls->objectName();
return QDBusObjectPath(cls->objectName());
}
@ -1408,14 +1411,14 @@ void NSPluginClass::shutdown()
}
QString NSPluginClass::newInstance( const QString &url, const QString &mimeType, bool embed,
QDBusObjectPath NSPluginClass::newInstance( const QString &url, const QString &mimeType, bool embed,
const QStringList &argn, const QStringList &argv,
const QString &appId, const QString &callbackId, bool reload )
{
kDebug(1431) << "-> NSPluginClass::NewInstance" << endl;
if ( !_constructed )
return QString();
return QDBusObjectPath();
// copy parameters over
unsigned int argc = argn.count();
@ -1474,7 +1477,7 @@ QString NSPluginClass::newInstance( const QString &url, const QString &mimeType,
delete inst;
//delete npp; double delete!
kDebug(1431) << "<- PluginClass::NewInstance = 0" << endl;
return QString();
return QDBusObjectPath();
}
// create source stream
@ -1482,7 +1485,7 @@ QString NSPluginClass::newInstance( const QString &url, const QString &mimeType,
inst->requestURL( src, mimeType, QString(), 0, false, reload );
_instances.append( inst );
return inst->objectName();
return QDBusObjectPath(inst->objectName());
}

View file

@ -38,7 +38,7 @@
#include <kparts/browserextension.h> // for URLArgs
#include <kio/job.h>
#include <QDBusObjectPath>
#define XP_UNIX
#include "sdk/npupp.h"
@ -272,7 +272,7 @@ public:
~NSPluginClass();
QString getMIMEDescription();
QString newInstance(const QString &url, const QString &mimeType, bool embed,
QDBusObjectPath newInstance(const QString &url, const QString &mimeType, bool embed,
const QStringList &argn, const QStringList &argv,
const QString &appId, const QString &callbackId, bool reload);
void destroyInstance( NSPluginInstance* inst );
@ -316,7 +316,7 @@ public:
virtual ~NSPluginViewer();
void shutdown();
QString newClass( const QString& plugin, const QString& senderId );
QDBusObjectPath newClass( const QString& plugin, const QString& senderId );
private Q_SLOTS:
void appUnregistered(const QString& id);

View file

@ -0,0 +1,19 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.nsplugins.Class">
<method name="newInstance">
<arg type="o" direction="out"/>
<arg name="url" type="s" direction="in"/>
<arg name="mimeType" type="s" direction="in"/>
<arg name="embed" type="b" direction="in"/>
<arg name="argn" type="as" direction="in"/>
<arg name="argv" type="as" direction="in"/>
<arg name="appId" type="s" direction="in"/>
<arg name="callbackId" type="s" direction="in"/>
<arg name="reload" type="b" direction="in"/>
</method>
<method name="getMIMEDescription">
<arg type="s" direction="out"/>
</method>
</interface>
</node>

View file

@ -1,29 +1,5 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.nsplugins.Viewer">
<method name="shutdown">
</method>
<method name="newClass">
<arg type="o" direction="out"/>
<arg name="plugin" type="s" direction="in"/>
</method>
</interface>
<interface name="org.kde.nsplugins.Class">
<method name="newInstance">
<arg type="o" direction="out"/>
<arg name="url" type="s" direction="in"/>
<arg name="mimeType" type="s" direction="in"/>
<arg name="embed" type="b" direction="in"/>
<arg name="argn" type="as" direction="in"/>
<arg name="argv" type="as" direction="in"/>
<arg name="appId" type="s" direction="in"/>
<arg name="callbackId" type="s" direction="in"/>
<arg name="reload" type="b" direction="in"/>
</method>
<method name="getMIMEDescription">
<arg type="s" direction="out"/>
</method>
</interface>
<interface name="org.kde.nsplugins.Instance">
<method name="shutdown">
</method>

View file

@ -0,0 +1,12 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.kde.nsplugins.Viewer">
<method name="shutdown">
</method>
<method name="newClass">
<arg type="o" direction="out"/>
<arg name="plugin" type="s" direction="in"/>
<arg name="senderId" type="s" direction="in"/>
</method>
</interface>
</node>