browserextension.h
/* This file is part of the KDE project
Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef __kparts_browserextension_h__
#define __kparts_browserextension_h__
#include <sys/types.h>
#include <qpoint.h>
#include <qptrlist.h>
#include <qdatastream.h>
#include <qstringlist.h>
#include <qpair.h>
#include <kparts/part.h>
#include <kparts/event.h>
class KFileItem;
typedef QPtrList<KFileItem> KFileItemList;
class QString;
namespace KParts {
class BrowserInterface;
struct URLArgsPrivate;
struct KPARTS_EXPORT URLArgs
{
URLArgs();
URLArgs( const URLArgs &args );
URLArgs &operator=( const URLArgs &args);
URLArgs( bool reload, int xOffset, int yOffset, const QString &serviceType = QString::null );
virtual ~URLArgs();
QStringList docState;
bool reload;
int xOffset;
int yOffset;
QString serviceType;
QByteArray postData;
void setContentType( const QString & contentType );
QString contentType() const;
void setDoPost( bool enable );
bool doPost() const;
void setLockHistory( bool lock );
bool lockHistory() const;
void setNewTab( bool newTab );
bool newTab() const;
QMap<QString, QString> &metaData();
QString frameName;
bool trustedSource;
bool redirectedRequest () const;
void setRedirectedRequest(bool redirected);
void setForcesNewWindow( bool forcesNewWindow );
bool forcesNewWindow() const;
URLArgsPrivate *d;
};
struct WindowArgsPrivate;
struct KPARTS_EXPORT WindowArgs
{
WindowArgs();
~WindowArgs();
WindowArgs( const WindowArgs &args );
WindowArgs &operator=( const WindowArgs &args );
WindowArgs( const QRect &_geometry, bool _fullscreen, bool _menuBarVisible,
bool _toolBarsVisible, bool _statusBarVisible, bool _resizable );
WindowArgs( int _x, int _y, int _width, int _height, bool _fullscreen,
bool _menuBarVisible, bool _toolBarsVisible,
bool _statusBarVisible, bool _resizable );
// Position
int x;
int y;
// Size
int width;
int height;
bool fullscreen; //defaults to false
bool menuBarVisible; //defaults to true
bool toolBarsVisible; //defaults to true
bool statusBarVisible; //defaults to true
bool resizable; //defaults to true
bool lowerWindow; //defaults to false
bool scrollBarsVisible; //defaults to true
WindowArgsPrivate *d; // don't use before KDE4, many KDE-3.x didn't have an explicit destructor
};
class KPARTS_EXPORT OpenURLEvent : public Event
{
public:
OpenURLEvent( ReadOnlyPart *part, const KURL &url, const URLArgs &args = URLArgs() );
virtual ~OpenURLEvent();
ReadOnlyPart *part() const { return m_part; }
KURL url() const { return m_url; }
URLArgs args() const { return m_args; }
static bool test( const QEvent *event ) { return Event::test( event, s_strOpenURLEvent ); }
private:
static const char *s_strOpenURLEvent;
ReadOnlyPart *m_part;
KURL m_url;
URLArgs m_args;
class OpenURLEventPrivate;
OpenURLEventPrivate *d;
};
class BrowserExtensionPrivate;
class KPARTS_EXPORT BrowserExtension : public QObject
{
Q_OBJECT
Q_PROPERTY( bool urlDropHandling READ isURLDropHandlingEnabled WRITE setURLDropHandlingEnabled )
public:
BrowserExtension( KParts::ReadOnlyPart *parent,
const char *name = 0L );
virtual ~BrowserExtension();
typedef uint PopupFlags;
enum { DefaultPopupItems=0x0000, ShowNavigationItems=0x0001,
ShowUp=0x0002, ShowReload=0x0004, ShowBookmark=0x0008,
ShowCreateDirectory=0x0010, ShowTextSelectionItems=0x0020,
NoDeletion=0x0040
};
virtual void setURLArgs( const URLArgs &args );
URLArgs urlArgs() const;
virtual int xOffset();
virtual int yOffset();
virtual void saveState( QDataStream &stream );
virtual void restoreState( QDataStream &stream );
bool isURLDropHandlingEnabled() const;
void setURLDropHandlingEnabled( bool enable );
void setBrowserInterface( BrowserInterface *impl );
BrowserInterface *browserInterface() const;
bool isActionEnabled( const char * name ) const;
QString actionText( const char * name ) const;
typedef QMap<QCString,QCString> ActionSlotMap;
static ActionSlotMap actionSlotMap();
static ActionSlotMap * actionSlotMapPtr();
static BrowserExtension *childObject( QObject *obj );
void pasteRequest();
// KDE invents support for public signals...
#undef signals
#define signals public
signals:
#undef signals
#define signals protected
void enableAction( const char * name, bool enabled );
void setActionText( const char * name, const QString& text );
void openURLRequest( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
void openURLRequestDelayed( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
void openURLNotify();
void setLocationBarURL( const QString &url );
void setIconURL( const KURL &url );
void createNewWindow( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
void createNewWindow( const KURL &url, const KParts::URLArgs &args,
const KParts::WindowArgs &windowArgs, KParts::ReadOnlyPart *&part );
void loadingProgress( int percent );
void speedProgress( int bytesPerSecond );
void infoMessage( const QString & );
void popupMenu( const QPoint &global, const KFileItemList &items );
void popupMenu( KXMLGUIClient *client, const QPoint &global, const KFileItemList &items );
void popupMenu( KXMLGUIClient *client, const QPoint &global, const KFileItemList &items, const KParts::URLArgs &args, KParts::BrowserExtension::PopupFlags i );
void popupMenu( const QPoint &global, const KURL &url,
const QString &mimeType, mode_t mode = (mode_t)-1 );
void popupMenu( KXMLGUIClient *client,
const QPoint &global, const KURL &url,
const QString &mimeType, mode_t mode = (mode_t)-1 );
void popupMenu( KXMLGUIClient *client,
const QPoint &global, const KURL &url,
const KParts::URLArgs &args, KParts::BrowserExtension::PopupFlags i, mode_t mode = (mode_t)-1 );
void selectionInfo( const KFileItemList &items );
void selectionInfo( const QString &text );
void selectionInfo( const KURL::List &urls );
void mouseOverInfo( const KFileItem* item );
void addWebSideBar(const KURL &url, const QString& name);
void moveTopLevelWidget( int x, int y );
void resizeTopLevelWidget( int w, int h );
void requestFocus(KParts::ReadOnlyPart *part);
void setPageSecurity( int );
#define KPARTS_BROWSEREXTENSION_HAS_ITEMS_REMOVED
void itemsRemoved( const KFileItemList &items );
private slots:
void slotCompleted();
void slotOpenURLRequest( const KURL &url, const KParts::URLArgs &args );
void slotEmitOpenURLRequestDelayed();
void slotEnableAction( const char *, bool );
void slotSetActionText( const char*, const QString& );
private:
KParts::ReadOnlyPart *m_part;
URLArgs m_args;
public:
typedef QMap<QCString,int> ActionNumberMap;
private:
static ActionNumberMap * s_actionNumberMap;
static ActionSlotMap * s_actionSlotMap;
static void createActionSlotMap();
protected:
virtual void virtual_hook( int id, void* data );
private:
BrowserExtensionPrivate *d;
};
class KPARTS_EXPORT BrowserHostExtension : public QObject
{
Q_OBJECT
public:
BrowserHostExtension( KParts::ReadOnlyPart *parent,
const char *name = 0L );
virtual ~BrowserHostExtension();
virtual QStringList frameNames() const;
virtual const QPtrList<KParts::ReadOnlyPart> frames() const;
BrowserHostExtension *findFrameParent(KParts::ReadOnlyPart *callingPart, const QString &frame);
virtual bool openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs );
static BrowserHostExtension *childObject( QObject *obj );
protected:
enum { VIRTUAL_FIND_FRAME_PARENT = 0x10 };
struct FindFrameParentParams
{
BrowserHostExtension *parent;
KParts::ReadOnlyPart *callingPart;
QString frame;
};
virtual void virtual_hook( int id, void* data );
private:
class BrowserHostExtensionPrivate;
BrowserHostExtensionPrivate *d;
};
class KPARTS_EXPORT LiveConnectExtension : public QObject
{
Q_OBJECT
public:
enum Type {
TypeVoid=0, TypeBool, TypeFunction, TypeNumber, TypeObject, TypeString
};
typedef QValueList<QPair<Type, QString> > ArgList;
LiveConnectExtension( KParts::ReadOnlyPart *parent, const char *name = 0L );
virtual ~LiveConnectExtension() {}
virtual bool get( const unsigned long objid, const QString & field, Type & type, unsigned long & retobjid, QString & value );
virtual bool put( const unsigned long objid, const QString & field, const QString & value );
virtual bool call( const unsigned long objid, const QString & func, const QStringList & args, Type & type, unsigned long & retobjid, QString & value );
virtual void unregister( const unsigned long objid );
static LiveConnectExtension *childObject( QObject *obj );
signals:
virtual void partEvent( const unsigned long objid, const QString & event, const ArgList & args );
};
}
#endif
KParts::BrowserExtension
The Browser Extension is an extension (yes, no kidding) to KParts::ReadOnlyPart, which allows a bette...
Definition: browserextension.h:308
KURL
KParts::URLArgs::frameName
QString frameName
The frame in which to open the URL.
Definition: browserextension.h:139
KParts::WindowArgs
The WindowArgs are used to specify arguments to the "create new window" call (see the createNewWindow...
Definition: browserextension.h:184
KXMLGUIClient
KParts::BrowserInterface
The purpose of this interface is to allow a direct communication between a KPart and the hosting brow...
Definition: browserinterface.h:38
KParts::LiveConnectExtension
An extension class for LiveConnect, i.e.
Definition: browserextension.h:792
KParts::URLArgs::reload
bool reload
reload is set when the cache shouldn't be used (forced reload).
Definition: browserextension.h:75
KParts::OpenURLEvent
The KParts::OpenURLEvent event informs that a given part has opened a given URL.
Definition: browserextension.h:221
KParts::BrowserHostExtension
An extension class for container parts, i.e.
Definition: browserextension.h:724
KParts::URLArgs
URLArgs is a set of arguments bundled into a structure, to allow specifying how a URL should be opene...
Definition: browserextension.h:57
KParts::URLArgs::serviceType
QString serviceType
The servicetype (usually mimetype) to use when opening the next URL.
Definition: browserextension.h:89
KParts::URLArgs::docState
QStringList docState
This buffer can be used by the part to save and restore its contents.
Definition: browserextension.h:70
KParts::URLArgs::xOffset
int xOffset
xOffset is the horizontal scrolling of the part's widget (in case it's a scrollview).
Definition: browserextension.h:81
KParts::Event
Base class for all KParts events.
Definition: event.h:36
KParts::URLArgs::postData
QByteArray postData
KHTML-specific field, contents of the HTTP POST data.
Definition: browserextension.h:94
KParts::URLArgs::yOffset
int yOffset
yOffset vertical scrolling position, xOffset.
Definition: browserextension.h:85
KURL::List
KParts::URLArgs::trustedSource
bool trustedSource
If true, the part who asks for a URL to be opened can be 'trusted' to execute applications.
Definition: browserextension.h:146
KParts::ReadOnlyPart
Base class for any "viewer" part.
Definition: part.h:338

KDE Home | KDE Accessibility Home | Description of Access Keys