browserextension.h Source File (kparts Library)

| # kparts Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# browserextension.h

    00001 /* This file is part of the KDE project
    00002    Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
    00003                       David Faure <faure@kde.org>
    00004
    00005    This library is free software; you can redistribute it and/or
    00006    modify it under the terms of the GNU Library General Public
    00007    License as published by the Free Software Foundation; either
    00008    version 2 of the License, or (at your option) any later version.
    00009
    00010    This library is distributed in the hope that it will be useful,
    00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013    Library General Public License for more details.
    00014
    00015    You should have received a copy of the GNU Library General Public License
    00016    along with this library; see the file COPYING.LIB.  If not, write to
    00017    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00018    Boston, MA 02111-1307, USA.
    00019 */
    00020
    00021 #ifndef __kparts_browserextension_h__
    00022 #define __kparts_browserextension_h__
    00023
    00024 #include <sys/types.h>
    00025
    00026 #include <qpoint.h>
    00027 #include <qptrlist.h>
    00028 #include <qdatastream.h>
    00029 #include <qstringlist.h>
    00030
    00031 #include <kparts/part.h>
    00032 #include <kparts/event.h>
    00033
    00034 class KFileItem;
    00035 typedef QPtrList<KFileItem> KFileItemList;
    00036 class QString;
    00037
    00038 namespace KParts {
    00039
    00040 class BrowserInterface;
    00041
    00042 struct URLArgsPrivate;
    00043
    00056 struct URLArgs
    00057 {
    00058   URLArgs();
    00059   URLArgs( const URLArgs &args );
    00060   URLArgs &operator=( const URLArgs &args);
    00061
    00062   URLArgs( bool reload, int xOffset, int yOffset, const QString &serviceType = QString::null );
    00063   virtual ~URLArgs();
    00064
    00069   QStringList docState;
    00070
    00074   bool reload;
    00080   int xOffset;
    00084   int yOffset;
    00088   QString serviceType;
    00089
    00093   QByteArray postData;
    00097   void setContentType( const QString & contentType );
    00101   QString contentType() const;
    00106   void setDoPost( bool enable );
    00111   bool doPost() const;
    00112
    00118   void setLockHistory( bool lock );
    00119   bool lockHistory() const;
    00120
    00124   void setNewTab( bool newTab );
    00125   bool newTab() const;
    00126
    00131   QMap<QString, QString> &metaData();
    00132
    00136   QString frameName;
    00137
    00143   bool trustedSource;
    00144
    00148   bool redirectedRequest () const;
    00149
    00153   void setRedirectedRequest(bool redirected);
    00154
    00155   URLArgsPrivate *d;
    00156 };
    00157
    00158 struct WindowArgsPrivate;
    00159
    00165 struct WindowArgs
    00166 {
    00167     WindowArgs();
    00168     WindowArgs( const WindowArgs &args );
    00169     WindowArgs &operator=( const WindowArgs &args );
    00170     WindowArgs( const QRect &_geometry, bool _fullscreen, bool _menuBarVisible,
    00171                 bool _toolBarsVisible, bool _statusBarVisible, bool _resizable );
    00172     WindowArgs( int _x, int _y, int _width, int _height, bool _fullscreen,
    00173                 bool _menuBarVisible, bool _toolBarsVisible,
    00174                 bool _statusBarVisible, bool _resizable );
    00175
    00176     // Position
    00177     int x;
    00178     int y;
    00179     // Size
    00180     int width;
    00181     int height;
    00182     bool fullscreen; //defaults to false
    00183     bool menuBarVisible; //defaults to true
    00184     bool toolBarsVisible; //defaults to true
    00185     bool statusBarVisible; //defaults to true
    00186     bool resizable; //defaults to true
    00187
    00188     bool lowerWindow; //defaults to false
    00189
    00190     WindowArgsPrivate *d; // yes, I am paranoid :-)
    00191 };
    00192
    00193 class OpenURLEvent : public Event
    00194 {
    00195 public:
    00196   OpenURLEvent( ReadOnlyPart *part, const KURL &url, const URLArgs &args = URLArgs() );
    00197   virtual ~OpenURLEvent();
    00198
    00199   ReadOnlyPart *part() const { return m_part; }
    00200   KURL url() const { return m_url; }
    00201   URLArgs args() const { return m_args; }
    00202
    00203   static bool test( const QEvent *event ) { return Event::test( event, s_strOpenURLEvent ); }
    00204
    00205 private:
    00206   static const char *s_strOpenURLEvent;
    00207   ReadOnlyPart *m_part;
    00208   KURL m_url;
    00209   URLArgs m_args;
    00210
    00211   class OpenURLEventPrivate;
    00212   OpenURLEventPrivate *d;
    00213 };
    00214
    00215 class BrowserExtensionPrivate;
    00216
    00278 class BrowserExtension : public QObject
    00279 {
    00280   Q_OBJECT
    00281   Q_PROPERTY( bool urlDropHandling READ isURLDropHandlingEnabled WRITE setURLDropHandlingEnabled )
    00282 public:
    00289   BrowserExtension( KParts::ReadOnlyPart *parent,
    00290                     const char *name = 0L );
    00291
    00292
    00293   virtual ~BrowserExtension();
    00294
    00300   virtual void setURLArgs( const URLArgs &args );
    00301
    00307   URLArgs urlArgs() const;
    00308
    00314   virtual int xOffset();
    00320   virtual int yOffset();
    00321
    00329   virtual void saveState( QDataStream &stream );
    00330
    00338   virtual void restoreState( QDataStream &stream );
    00339
    00345   bool isURLDropHandlingEnabled() const;
    00346
    00357   void setURLDropHandlingEnabled( bool enable );
    00358
    00359   void setBrowserInterface( BrowserInterface *impl );
    00360   BrowserInterface *browserInterface() const;
    00361
    00368   bool isActionEnabled( const char * name ) const;
    00369
    00370   typedef QMap<QCString,QCString> ActionSlotMap;
    00399   static ActionSlotMap actionSlotMap();
    00400
    00405   static ActionSlotMap * actionSlotMapPtr();
    00406
    00411   static BrowserExtension *childObject( QObject *obj );
    00412
    00413 // KDE invents support for public signals...
    00414 #undef signals
    00415 #define signals public
    00416 signals:
    00417 #undef signals
    00418 #define signals protected
    00419
    00424   void enableAction( const char * name, bool enabled );
    00425
    00432   void openURLRequest( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
    00433
    00440   void openURLRequestDelayed( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
    00441
    00457   void openURLNotify();
    00458
    00462   void setLocationBarURL( const QString &url );
    00463
    00467   void setIconURL( const KURL &url );
    00468
    00476   void createNewWindow( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
    00477
    00485   void createNewWindow( const KURL &url, const KParts::URLArgs &args,
    00486                         const KParts::WindowArgs &windowArgs, KParts::ReadOnlyPart *&part );
    00487
    00496   void loadingProgress( int percent );
    00500   void speedProgress( int bytesPerSecond );
    00501
    00502   void infoMessage( const QString & );
    00503
    00508   void popupMenu( const QPoint &global, const KFileItemList &items );
    00509
    00516   void popupMenu( KXMLGUIClient *client, const QPoint &global, const KFileItemList &items );
    00517
    00526   void popupMenu( const QPoint &global, const KURL &url,
    00527                   const QString &mimeType, mode_t mode = (mode_t)-1 );
    00528
    00538   void popupMenu( KXMLGUIClient *client,
    00539                   const QPoint &global, const KURL &url,
    00540                   const QString &mimeType, mode_t mode = (mode_t)-1 );
    00541
    00547   void selectionInfo( const KFileItemList &items );
    00552   void selectionInfo( const QString &text );
    00557   void selectionInfo( const KURL::List &urls );
    00558
    00563   void mouseOverInfo( const KFileItem* item );
    00564
    00565 private slots:
    00566   void slotCompleted();
    00567   void slotOpenURLRequest( const KURL &url, const KParts::URLArgs &args );
    00568   void slotEmitOpenURLRequestDelayed();
    00569   void slotEnableAction( const char *, bool );
    00570
    00571 private:
    00572   KParts::ReadOnlyPart *m_part;
    00573   URLArgs m_args;
    00574 public:
    00575   typedef QMap<QCString,int> ActionNumberMap;
    00576
    00577 private:
    00578   static ActionNumberMap * s_actionNumberMap;
    00579   static ActionSlotMap * s_actionSlotMap;
    00580   static void createActionSlotMap();
    00581 protected:
    00582   virtual void virtual_hook( int id, void* data );
    00583 private:
    00584   BrowserExtensionPrivate *d;
    00585 };
    00586
    00592 class BrowserHostExtension : public QObject
    00593 {
    00594   Q_OBJECT
    00595 public:
    00596   BrowserHostExtension( KParts::ReadOnlyPart *parent,
    00597                         const char *name = 0L );
    00598
    00599   virtual ~BrowserHostExtension();
    00600
    00606   virtual QStringList frameNames() const;
    00607
    00614   virtual const QPtrList<KParts::ReadOnlyPart> frames() const;
    00615
    00620   virtual bool openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs );
    00621
    00626   static BrowserHostExtension *childObject( QObject *obj );
    00627
    00628 protected:
    00629   virtual void virtual_hook( int id, void* data );
    00630 private:
    00631   class BrowserHostExtensionPrivate;
    00632   BrowserHostExtensionPrivate *d;
    00633 };
    00634
    00641 class LiveConnectExtension : public QObject
    00642 {
    00643   Q_OBJECT
    00644 public:
    00645   enum Type {
    00646       TypeVoid=0, TypeBool, TypeFunction, TypeNumber, TypeObject, TypeString
    00647   };
    00648   typedef QValueList<QPair<Type, QString> > ArgList;
    00649
    00650   LiveConnectExtension( KParts::ReadOnlyPart *parent, const char *name = 0L );
    00651
    00652   virtual ~LiveConnectExtension() {}
    00656   virtual bool get( const unsigned long objid, const QString & field, Type & type, unsigned long & retobjid, QString & value );
    00660   virtual bool put( const unsigned long objid, const QString & field, const QString & value );
    00664   virtual bool call( const unsigned long objid, const QString & func, const QStringList & args, Type & type, unsigned long & retobjid, QString & value );
    00668   virtual void unregister( const unsigned long objid );
    00669
    00670   static LiveConnectExtension *childObject( QObject *obj );
    00671 signals:
    00675   virtual void partEvent( const unsigned long objid, const QString & event, const ArgList & args );
    00676 };
    00677
    00678 }
    00679
    00680 #endif
    00681

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:26:50 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001