Home

QtNPBindable Class Reference

The QtNPBindable class provides an interface between a widget and the web browser. More...

 #include <QtNPBindable>

Public Types

Public Functions

Protected Functions


Detailed Description

The QtNPBindable class provides an interface between a widget and the web browser.

Inherit your plugin widget class from both QWidget (or QObject) and QtNPBindable to be able to call the functions of this class, and to reimplement the virtual functions. The meta-object compiler requires you to inherit from the QObject subclass first.

 class PluginWidget : public QWidget, public QtNPBindable
 {
     Q_OBJECT
 public:
     PluginWidget(QWidget *parent = 0)
     {
     }

     //...
 };

Member Type Documentation

enum QtNPBindable::DisplayMode

This enum specifies the different display modes of a plugin

ConstantValueDescription
QtNPBindable::Embedded1The plugin widget is embedded in a web page, usually with the <EMBED> or the <OBJECT> tag.
QtNPBindable::Fullpage2The plugin widget is the primary content of the web browser, which is usually the case when the web browser displays a file the plugin supports.

enum QtNPBindable::Reason

This enum specifies how an URL operation was completed

ConstantValue
QtNPBindable::ReasonDone0
QtNPBindable::ReasonBreak1
QtNPBindable::ReasonError2
QtNPBindable::ReasonUnknown-1


Member Function Documentation

QtNPBindable::QtNPBindable ()   [protected]

Constructs a QtNPBindable object.

This can only happen when the plugin object is created.

QtNPBindable::~QtNPBindable ()   [virtual protected]

Destroys the object.

This can only happen when the plugin object is destroyed.

DisplayMode QtNPBindable::displayMode () const

Returns the display mode of the plugin.

void QtNPBindable::getBrowserVersion ( int * major, int * minor ) const

Extracts the version of the browser into major and minor.

See http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/ for an explanation of those values.

See also getNppVersion() and userAgent().

void QtNPBindable::getNppVersion ( int * major, int * minor ) const

Extracts the version of the plugin API used by this plugin into major and minor.

See http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/ for an explanation of those values.

See also getBrowserVersion() and userAgent().

NPP QtNPBindable::instance () const

Returns the browser's plugin instance associated with this plugin object. The instance is required to call functions in the Netscape Plugin API, i.e. NPN_GetJavaPeer().

The instance returned is only valid as long as this object is.

See http://devedge-temp.mozilla.org/library/manuals/2002/plugin/1.0/ for documentation of the NPP type.

QString QtNPBindable::mimeType () const

Returns the mime type this plugin has been instantiated for.

int QtNPBindable::openUrl ( const QString & url, const QString & window = QString() )

Requests that the url be retrieved and sent to the named window (or a new window if window is empty), and returns the ID of the request that is delivered to transferComplete() when the get-operation has finished. Returns 0 when the browser or the system doesn't support notification, or -1 when an error occured.

 void MyPlugin::aboutQtSoftware()
 {
     openUrl("http://qt.nokia.com");
 }

See Netscape's JavaScript documentation for an explanation of window names.

See also transferComplete(), uploadData(), and uploadFile().

QMap<QByteArray, QVariant> QtNPBindable::parameters () const

Returns the parameters passed to the plugin instance.

The framework sets the properties of the plugin to the corresponding parameters when the plugin object has been created, but you can use this function to process additional parameters.

Note that the SGML specification does not permit multiple arguments with the same name.

bool QtNPBindable::readData ( QIODevice * source, const QString & format )   [virtual]

Reimplement this function to read data from source provided with mime type format. The data is the one specified in the src or data attribute of the <EMBED> or <OBJECT> tag of in HTML page. This function is called once for every stream the browser creates for the plugin.

Return true to indicate successfull processing of the data, otherwise return false. The default implementation does nothing and returns false.

void QtNPBindable::transferComplete ( const QString & url, int id, Reason reason )   [virtual]

Called as a result of a call to openUrl, uploadData or uploadFile. url corresponds to the respective parameter, and id to value returned by the call. reason indicates how the transfer was completed.

int QtNPBindable::uploadData ( const QString & url, const QString & window, const QByteArray & data )

Posts data to url, and displays the result in window. Returns the ID of the request that is delivered to transferComplete() when the post-operation has finished. Returns 0 when the browser or the system doesn't support notification, or -1 when an error occured.

 void MyPlugin::sendMail()
 {
     uploadData("mailto:[email protected]", QString(), "There is a new file for you!");
 }

See Netscape's JavaScript documentation for an explanation of window names.

See also transferComplete(), openUrl(), and uploadFile().

int QtNPBindable::uploadFile ( const QString & url, const QString & window, const QString & filename )

Posts filename to url, and displays the result in window. Returns the ID of the request that is delivered to transferComplete() when the post-operation has finished. Returns 0 when the browser or the system doesn't support notification, or -1 when an error occured.

 void MyPlugin::uploadFile()
 {
     uploadFile("ftp://ftp.somewhere.com/incoming", "response", "c:\\temp\\file.txt");
 }

See Netscape's JavaScript documentation for an explanation of window names.

See also transferComplete(), uploadData(), and openUrl().

QString QtNPBindable::userAgent () const

Returns the user agent (browser name) containing this plugin.

This is a wrapper around NPN_UserAgent.

See also getBrowserVersion().


Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies) Trademarks
Qt Solutions