Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
QGeckoEmbed Class Reference

#include <qgeckoembed.h>

Collaboration diagram for QGeckoEmbed:
Collaboration graph
[legend]

List of all members.

Public Types

enum  ReloadFlags {
  Normal, BypassCache, BypassProxy, BypassProxyAndCache,
  CharsetChange
}

Public Slots

void loadURL (const QString &url)
void stopLoad ()
void goForward ()
void goBack ()
void renderData (const QCString &data, const QString &baseURI, const QString &mimeType)
int openStream (const QString &baseURI, const QString &mimeType)
int appendData (const QCString &data)
int closeStream ()
void reload (ReloadFlags flags=Normal)
void setChromeMask (int)

Signals

void linkMessage (const QString &message)
void jsStatusMessage (const QString &message)
void locationChanged (const QString &location)
void windowTitleChanged (const QString &title)
void progress (int current, int max)
void progressAll (const QString &url, int current, int max)
void netState (int state, int status)
void netStateAll (const QString &url, int state, int status)
void netStart ()
void netStop ()
void newWindow (QGeckoEmbed *newWindow, int chromeMask)
void visibilityChanged (bool visible)
void destroyBrowser ()
void openURI (const QString &url)
void sizeTo (int width, int height)
void securityChange (void *request, int status, void *message)
void statusChange (void *request, int status, void *message)
void showContextMenu (const QPoint &p, const QString &url)
void domKeyDown (nsIDOMKeyEvent *keyEvent)
 The dom signals are called only if the dom* methods are not reimplemented.
void domKeyPress (nsIDOMKeyEvent *keyEvent)
void domKeyUp (nsIDOMKeyEvent *keyEvent)
void domMouseDown (nsIDOMMouseEvent *mouseEvent)
void domMouseUp (nsIDOMMouseEvent *mouseEvent)
void domMouseClick (nsIDOMMouseEvent *mouseEvent)
void domMouseDblClick (nsIDOMMouseEvent *mouseEvent)
void domMouseOver (nsIDOMMouseEvent *mouseEvent)
void domMouseOut (nsIDOMMouseEvent *mouseEvent)
void domActivate (nsIDOMUIEvent *event)
void domFocusIn (nsIDOMUIEvent *event)
void domFocusOut (nsIDOMUIEvent *event)
void startURIOpen (const QString &url, bool &abort)

Public Member Functions

 QGeckoEmbed (QWidget *parent, const char *name)
 ~QGeckoEmbed ()
bool canGoBack () const
bool canGoForward () const
void setIsChrome (bool)
int chromeMask () const
nsIDOMDocumentdocument () const
QString url () const
QString resolvedUrl (const QString &relativepath) const

Static Public Member Functions

static void initialize (const char *aDir, const char *aName)

Protected Member Functions

virtual bool domKeyDownEvent (nsIDOMKeyEvent *keyEvent)
 return true if you want to stop the propagation of the event.
virtual bool domKeyPressEvent (nsIDOMKeyEvent *keyEvent)
virtual bool domKeyUpEvent (nsIDOMKeyEvent *keyEvent)
virtual bool domMouseDownEvent (nsIDOMMouseEvent *mouseEvent)
virtual bool domMouseUpEvent (nsIDOMMouseEvent *mouseEvent)
virtual bool domMouseClickEvent (nsIDOMMouseEvent *mouseEvent)
virtual bool domMouseDblClickEvent (nsIDOMMouseEvent *mouseEvent)
virtual bool domMouseOverEvent (nsIDOMMouseEvent *mouseEvent)
virtual bool domMouseOutEvent (nsIDOMMouseEvent *mouseEvent)
virtual bool domActivateEvent (nsIDOMUIEvent *event)
virtual bool domFocusInEvent (nsIDOMUIEvent *event)
virtual bool domFocusOutEvent (nsIDOMUIEvent *event)
void emitScriptStatus (const QString &str)
void emitLinkStatus (const QString &str)
void contentStateChanged ()
void contentFinishedLoading ()
bool isChrome () const
bool chromeLoaded () const
void resizeEvent (QResizeEvent *e)
void setupListener ()
void attachListeners ()
EmbedWindowwindow () const
int GetPIDOMWindow (nsPIDOMWindow **aPIWin)

Protected Attributes

QGeckoEmbedPrivated

Friends

class EmbedEventListener
class EmbedContentListener
class EmbedWindow
class EmbedWindowCreator
class EmbedProgress
class EmbedContextMenuListener
class EmbedStream
class QGeckoGlobals

Detailed Description

Definition at line 69 of file qgeckoembed.h.


Member Enumeration Documentation

Enumerator:
Normal 
BypassCache 
BypassProxy 
BypassProxyAndCache 
CharsetChange 

Definition at line 75 of file qgeckoembed.h.


Constructor & Destructor Documentation

QGeckoEmbed::QGeckoEmbed ( QWidget *  parent,
const char *  name 
)

Definition at line 258 of file qgeckoembed.cpp.

    : QWidget(parent, name)
{
    d = new QGeckoEmbedPrivate(this);
}

Definition at line 264 of file qgeckoembed.cpp.

{
    delete d;
}

Member Function Documentation

int QGeckoEmbed::appendData ( const QCString &  data) [slot]

Definition at line 349 of file qgeckoembed.cpp.

{
    if (!d->stream)
        return NS_ERROR_FAILURE;

    // Attach listeners to this document since in some cases we don't
    // get updates for content added this way.
    contentStateChanged();

    return d->stream->AppendToStream(data, data.length());
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 613 of file qgeckoembed.cpp.

{
    if (!d->eventReceiver || d->listenersAttached)
        return;

    nsIDOMEventListener *eventListener =
        NS_STATIC_CAST(nsIDOMEventListener *,
                       NS_STATIC_CAST(nsIDOMKeyListener *, d->eventListener));

    // add the key listener
    nsresult rv;
    rv = d->eventReceiver->AddEventListenerByIID(eventListener,
                                                 NS_GET_IID(nsIDOMKeyListener));
    if (NS_FAILED(rv)) {
        NS_WARNING("Failed to add key listener\n");
        return;
    }

    rv = d->eventReceiver->AddEventListenerByIID(eventListener,
                                                 NS_GET_IID(nsIDOMMouseListener));
    if (NS_FAILED(rv)) {
        NS_WARNING("Failed to add mouse listener\n");
        return;
    }

    rv = d->eventReceiver->AddEventListenerByIID(eventListener,
                                                NS_GET_IID(nsIDOMUIListener));
    if (NS_FAILED(rv)) {
        NS_WARNING("Failed to add UI listener\n");
        return;
    }

    // ok, all set.
    d->listenersAttached = PR_TRUE;
}

Here is the caller graph for this function:

Definition at line 271 of file qgeckoembed.cpp.

{
    PRBool retval = PR_FALSE;
    if (d->navigation)
        d->navigation->GetCanGoBack(&retval);
    return retval;
}

Definition at line 280 of file qgeckoembed.cpp.

{
    PRBool retval = PR_FALSE;
    if (d->navigation)
        d->navigation->GetCanGoForward(&retval);
    return retval;
}
bool QGeckoEmbed::chromeLoaded ( ) const [protected]

Definition at line 693 of file qgeckoembed.cpp.

{
    return d->chromeLoaded;
}

Definition at line 513 of file qgeckoembed.cpp.

{
    return d->chromeMask;
}

Definition at line 362 of file qgeckoembed.cpp.

{
    nsresult rv;

    if (!d->stream)
        return NS_ERROR_FAILURE;
    rv = d->stream->CloseStream();

    // release
    d->stream = 0;
    d->streamGuard = 0;

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 567 of file qgeckoembed.cpp.

{
    if (d->isChrome) {
        // We're done loading.
        d->chromeLoaded = PR_TRUE;

        // get the web browser
        nsCOMPtr<nsIWebBrowser> webBrowser;
        d->window->GetWebBrowser(getter_AddRefs(webBrowser));

        // get the content DOM window for that web browser
        nsCOMPtr<nsIDOMWindow> domWindow;
        webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
        if (!domWindow) {
            NS_WARNING("no dom window in content finished loading\n");
            return;
        }

        // resize the content
        domWindow->SizeToContent();

        // and since we're done loading show the window, assuming that the
        // visibility flag has been set.
        PRBool visibility;
        d->window->GetVisibility(&visibility);
        if (visibility)
            d->window->SetVisibility(PR_TRUE);
    }
}

Here is the call graph for this function:

Definition at line 552 of file qgeckoembed.cpp.

{
    // we don't attach listeners to chrome
    if (d->listenersAttached && !d->isChrome)
        return;

    setupListener();

    if (!d->eventReceiver)
        return;

    attachListeners();
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 534 of file qgeckoembed.cpp.

{
    nsIDOMDocument *doc = 0;

    nsCOMPtr<nsIDOMWindow> window;
    nsCOMPtr<nsIWebBrowser> webBrowser;

    d->window->GetWebBrowser(getter_AddRefs(webBrowser));

    webBrowser->GetContentDOMWindow(getter_AddRefs(window));
    if (window) {
        window->GetDocument(&doc);
    }

    return doc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool QGeckoEmbed::domActivateEvent ( nsIDOMUIEvent event) [protected, virtual]

Definition at line 480 of file qgeckoembed.cpp.

{
    emit domActivate(event);
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool QGeckoEmbed::domFocusInEvent ( nsIDOMUIEvent event) [protected, virtual]

Definition at line 487 of file qgeckoembed.cpp.

{
    emit domFocusIn(event);
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool QGeckoEmbed::domFocusOutEvent ( nsIDOMUIEvent event) [protected, virtual]

Definition at line 494 of file qgeckoembed.cpp.

{
    emit domFocusOut(event);
    return false;
}

Here is the call graph for this function:

void QGeckoEmbed::domKeyDown ( nsIDOMKeyEvent keyEvent) [signal]

The dom signals are called only if the dom* methods are not reimplemented.

Here is the caller graph for this function:

bool QGeckoEmbed::domKeyDownEvent ( nsIDOMKeyEvent keyEvent) [protected, virtual]

return true if you want to stop the propagation of the event.

By default the events are being propagated

Definition at line 417 of file qgeckoembed.cpp.

{
    emit domKeyDown(keyEvent);
    return false;
}

Here is the call graph for this function:

void QGeckoEmbed::domKeyPress ( nsIDOMKeyEvent keyEvent) [signal]

Here is the caller graph for this function:

bool QGeckoEmbed::domKeyPressEvent ( nsIDOMKeyEvent keyEvent) [protected, virtual]

Definition at line 424 of file qgeckoembed.cpp.

{
    emit domKeyPress(keyEvent);
    return false;
}

Here is the call graph for this function:

void QGeckoEmbed::domKeyUp ( nsIDOMKeyEvent keyEvent) [signal]

Here is the caller graph for this function:

bool QGeckoEmbed::domKeyUpEvent ( nsIDOMKeyEvent keyEvent) [protected, virtual]

Definition at line 431 of file qgeckoembed.cpp.

{
    emit domKeyUp(keyEvent);
    return false;
}

Here is the call graph for this function:

void QGeckoEmbed::domMouseClick ( nsIDOMMouseEvent mouseEvent) [signal]

Here is the caller graph for this function:

bool QGeckoEmbed::domMouseClickEvent ( nsIDOMMouseEvent mouseEvent) [protected, virtual]

Definition at line 452 of file qgeckoembed.cpp.

{
    emit domMouseClick(mouseEvent);
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool QGeckoEmbed::domMouseDblClickEvent ( nsIDOMMouseEvent mouseEvent) [protected, virtual]

Definition at line 459 of file qgeckoembed.cpp.

{
    emit domMouseDblClick(mouseEvent);
    return false;
}

Here is the call graph for this function:

void QGeckoEmbed::domMouseDown ( nsIDOMMouseEvent mouseEvent) [signal]

Here is the caller graph for this function:

bool QGeckoEmbed::domMouseDownEvent ( nsIDOMMouseEvent mouseEvent) [protected, virtual]

Definition at line 438 of file qgeckoembed.cpp.

{
    emit domMouseDown(mouseEvent);
    return false;
}

Here is the call graph for this function:

void QGeckoEmbed::domMouseOut ( nsIDOMMouseEvent mouseEvent) [signal]

Here is the caller graph for this function:

bool QGeckoEmbed::domMouseOutEvent ( nsIDOMMouseEvent mouseEvent) [protected, virtual]

Definition at line 473 of file qgeckoembed.cpp.

{
    emit domMouseOut(mouseEvent);
    return false;
}

Here is the call graph for this function:

void QGeckoEmbed::domMouseOver ( nsIDOMMouseEvent mouseEvent) [signal]

Here is the caller graph for this function:

bool QGeckoEmbed::domMouseOverEvent ( nsIDOMMouseEvent mouseEvent) [protected, virtual]

Definition at line 466 of file qgeckoembed.cpp.

{
    emit domMouseOver(mouseEvent);
    return false;
}

Here is the call graph for this function:

void QGeckoEmbed::domMouseUp ( nsIDOMMouseEvent mouseEvent) [signal]

Here is the caller graph for this function:

bool QGeckoEmbed::domMouseUpEvent ( nsIDOMMouseEvent mouseEvent) [protected, virtual]

Definition at line 445 of file qgeckoembed.cpp.

{
    emit domMouseUp(mouseEvent);
    return false;
}

Here is the call graph for this function:

void QGeckoEmbed::emitLinkStatus ( const QString &  str) [protected]

Definition at line 507 of file qgeckoembed.cpp.

{
    emit linkMessage(str);
}

Here is the call graph for this function:

void QGeckoEmbed::emitScriptStatus ( const QString &  str) [protected]

Definition at line 501 of file qgeckoembed.cpp.

{
    emit jsStatusMessage(str);
}

Here is the call graph for this function:

int QGeckoEmbed::GetPIDOMWindow ( nsPIDOMWindow **  aPIWin) [protected]

Definition at line 655 of file qgeckoembed.cpp.

{
    *aPIWin = nsnull;

    // get the web browser
    nsCOMPtr<nsIWebBrowser> webBrowser;
    d->window->GetWebBrowser(getter_AddRefs(webBrowser));

    // get the content DOM window for that web browser
    nsCOMPtr<nsIDOMWindow> domWindow;
    webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
    if (!domWindow)
        return NS_ERROR_FAILURE;

    // get the private DOM window
    nsCOMPtr<nsPIDOMWindow> domWindowPrivate = do_QueryInterface(domWindow);
    // and the root window for that DOM window
    *aPIWin = domWindowPrivate->GetPrivateRoot();

    if (*aPIWin) {
        NS_ADDREF(*aPIWin);
        return NS_OK;
    }

    return NS_ERROR_FAILURE;

}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 315 of file qgeckoembed.cpp.

{
    if (d->navigation)
        d->navigation->GoBack();
}

Here is the caller graph for this function:

Definition at line 308 of file qgeckoembed.cpp.

{
    if (d->navigation)
        d->navigation->GoForward();
}

Here is the caller graph for this function:

void QGeckoEmbed::initialize ( const char *  aDir,
const char *  aName 
) [static]

Definition at line 720 of file qgeckoembed.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

bool QGeckoEmbed::isChrome ( ) const [protected]

Definition at line 688 of file qgeckoembed.cpp.

{
    return d->isChrome;
}

Here is the caller graph for this function:

void QGeckoEmbed::jsStatusMessage ( const QString &  message) [signal]

Here is the caller graph for this function:

void QGeckoEmbed::linkMessage ( const QString &  message) [signal]

Here is the caller graph for this function:

void QGeckoEmbed::loadURL ( const QString &  url) [slot]

Definition at line 289 of file qgeckoembed.cpp.

{
    if (!url.isEmpty()) {
        d->navigation->LoadURI((const PRUnichar*)url.ucs2(),
                               nsIWebNavigation::LOAD_FLAGS_NONE, // Load flags
                               nsnull,                            // Referring URI
                               nsnull,                            // Post data
                               nsnull);
    }
}

Here is the caller graph for this function:

void QGeckoEmbed::locationChanged ( const QString &  location) [signal]
void QGeckoEmbed::netState ( int  state,
int  status 
) [signal]
void QGeckoEmbed::netStateAll ( const QString &  url,
int  state,
int  status 
) [signal]
void QGeckoEmbed::netStop ( ) [signal]
void QGeckoEmbed::newWindow ( QGeckoEmbed newWindow,
int  chromeMask 
) [signal]
int QGeckoEmbed::openStream ( const QString &  baseURI,
const QString &  mimeType 
) [slot]

Definition at line 331 of file qgeckoembed.cpp.

{
    nsresult rv;

    if (!d->stream) {
        d->stream = new EmbedStream();
        d->streamGuard = do_QueryInterface(d->stream);
        d->stream->InitOwner(this);
        rv = d->stream->Init();
        if (NS_FAILED(rv))
            return rv;
    }

    rv = d->stream->OpenStream(baseURI, mimeType);
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QGeckoEmbed::openURI ( const QString &  url) [signal]
void QGeckoEmbed::progress ( int  current,
int  max 
) [signal]
void QGeckoEmbed::progressAll ( const QString &  url,
int  current,
int  max 
) [signal]

Definition at line 378 of file qgeckoembed.cpp.

{
    int qeckoFlags = 0;
    switch(flags) {
    case Normal:
        qeckoFlags = 0;
        break;
    case BypassCache:
        qeckoFlags = nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE;
        break;
    case BypassProxy:
        qeckoFlags = nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY;
        break;
    case BypassProxyAndCache:
        qeckoFlags = nsIWebNavigation::LOAD_FLAGS_BYPASS_CACHE |
                     nsIWebNavigation::LOAD_FLAGS_BYPASS_PROXY;
        break;
    case CharsetChange:
        qeckoFlags = nsIWebNavigation::LOAD_FLAGS_CHARSET_CHANGE;
        break;
    default:
        qeckoFlags = 0;
        break;
    }


    nsCOMPtr<nsIWebNavigation> wn;

    if (d->sessionHistory) {
        wn = do_QueryInterface(d->sessionHistory);
    }
    if (!wn)
        wn = d->navigation;

    if (wn)
        wn->Reload(qeckoFlags);
}

Here is the call graph for this function:

void QGeckoEmbed::renderData ( const QCString &  data,
const QString &  baseURI,
const QString &  mimeType 
) [slot]

Definition at line 322 of file qgeckoembed.cpp.

Here is the call graph for this function:

void QGeckoEmbed::resizeEvent ( QResizeEvent *  e) [protected]

Definition at line 527 of file qgeckoembed.cpp.

{
    d->window->SetDimensions(nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER,
                              0, 0, e->size().width(), e->size().height());
}
QString QGeckoEmbed::resolvedUrl ( const QString &  relativepath) const

Definition at line 708 of file qgeckoembed.cpp.

{
    nsCOMPtr<nsIURI> uri;
    d->navigation->GetCurrentURI(getter_AddRefs(uri));
    nsCAutoString rel;
    rel.Assign(relativepath.utf8().data());
    nsCAutoString resolved;
    uri->Resolve(rel, resolved);

    return QString::fromUtf8(resolved.get());
}

Here is the call graph for this function:

void QGeckoEmbed::securityChange ( void request,
int  status,
void message 
) [signal]

Definition at line 519 of file qgeckoembed.cpp.

Here is the call graph for this function:

Definition at line 683 of file qgeckoembed.cpp.

Here is the call graph for this function:

Definition at line 598 of file qgeckoembed.cpp.

{
    if (d->eventReceiver)
        return;

    nsCOMPtr<nsPIDOMWindow> piWin;
    GetPIDOMWindow(getter_AddRefs(piWin));

    if (!piWin)
        return;

    d->eventReceiver = do_QueryInterface(piWin->GetChromeEventHandler());
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QGeckoEmbed::showContextMenu ( const QPoint &  p,
const QString &  url 
) [signal]
void QGeckoEmbed::sizeTo ( int  width,
int  height 
) [signal]
void QGeckoEmbed::startURIOpen ( const QString &  url,
bool abort 
) [signal]
void QGeckoEmbed::statusChange ( void request,
int  status,
void message 
) [signal]

Definition at line 301 of file qgeckoembed.cpp.

Here is the caller graph for this function:

QString QGeckoEmbed::url ( ) const

Definition at line 698 of file qgeckoembed.cpp.

{
    nsCOMPtr<nsIURI> uri;
    d->navigation->GetCurrentURI(getter_AddRefs(uri));
    nsCAutoString acstring;
    uri->GetSpec(acstring);

    return QString::fromUtf8(acstring.get());
}

Here is the call graph for this function:

void QGeckoEmbed::visibilityChanged ( bool  visible) [signal]
EmbedWindow * QGeckoEmbed::window ( ) const [protected]

Definition at line 649 of file qgeckoembed.cpp.

{
    return d->window;
}

Here is the caller graph for this function:

void QGeckoEmbed::windowTitleChanged ( const QString &  title) [signal]

Friends And Related Function Documentation

friend class EmbedContentListener [friend]

Definition at line 162 of file qgeckoembed.h.

friend class EmbedContextMenuListener [friend]

Definition at line 189 of file qgeckoembed.h.

friend class EmbedEventListener [friend]

Definition at line 161 of file qgeckoembed.h.

friend class EmbedProgress [friend]

Definition at line 188 of file qgeckoembed.h.

friend class EmbedStream [friend]

Definition at line 190 of file qgeckoembed.h.

friend class EmbedWindow [friend]

Definition at line 186 of file qgeckoembed.h.

friend class EmbedWindowCreator [friend]

Definition at line 187 of file qgeckoembed.h.

friend class QGeckoGlobals [friend]

Definition at line 191 of file qgeckoembed.h.


Member Data Documentation

Definition at line 210 of file qgeckoembed.h.


The documentation for this class was generated from the following files: