Logo Search packages:      
Sourcecode: qcake version File versions  Download package

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::aboutTrolltech()
    {
        openUrl("http://www.trolltech.com");
    }

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

See also:
transferComplete() uploadData() uploadFile()

Definition at line 1476 of file qtbrowserplugin.cpp.

{
    if (!pi)
        return -1;
    QString wnd = window;
    if (wnd.isEmpty())
        wnd = "_blank";

    qint32 id = pi->getNotificationSeqNum();
    NPError err = NPN_GetURLNotify(pi->npp, url.toLocal8Bit().constData(), wnd.toLocal8Bit().constData(), reinterpret_cast<void*>(id));
    if (err != NPERR_NO_ERROR)
        id = -1;

    if (err == NPERR_INCOMPATIBLE_VERSION_ERROR) {
        err = NPN_GetURL(pi->npp, url.toLocal8Bit().constData(), wnd.toLocal8Bit().constData());
        if (NPERR_NO_ERROR == err)
            id = 0;
        else
            id = -1;
    }
    return id;
}


Generated by  Doxygen 1.6.0   Back to index