• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

KParts

browserextension.h

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00018    Boston, MA 02110-1301, 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 #include <qpair.h>
00031 
00032 #include <kparts/part.h>
00033 #include <kparts/event.h>
00034 
00035 class KFileItem;
00036 typedef QPtrList<KFileItem> KFileItemList;
00037 class QString;
00038 
00039 namespace KParts {
00040 
00041 class BrowserInterface;
00042 
00043 struct URLArgsPrivate;
00044 
00057 struct KPARTS_EXPORT URLArgs
00058 {
00059   URLArgs();
00060   URLArgs( const URLArgs &args );
00061   URLArgs &operator=( const URLArgs &args);
00062 
00063   URLArgs( bool reload, int xOffset, int yOffset, const QString &serviceType = QString::null );
00064   virtual ~URLArgs();
00065 
00070   QStringList docState;
00071 
00075   bool reload;
00081   int xOffset;
00085   int yOffset;
00089   QString serviceType;
00090 
00094   QByteArray postData;
00095 
00099   void setContentType( const QString & contentType );
00103   QString contentType() const;
00108   void setDoPost( bool enable );
00109 
00114   bool doPost() const;
00115 
00121   void setLockHistory( bool lock );
00122   bool lockHistory() const;
00123 
00127   void setNewTab( bool newTab );
00128   bool newTab() const;
00129 
00134   QMap<QString, QString> &metaData();
00135 
00139   QString frameName;
00140 
00146   bool trustedSource;
00147 
00152   bool redirectedRequest () const;
00153 
00160   void setRedirectedRequest(bool redirected);
00161 
00166   void setForcesNewWindow( bool forcesNewWindow );
00167 
00172   bool forcesNewWindow() const;
00173 
00174   URLArgsPrivate *d;
00175 };
00176 
00177 struct WindowArgsPrivate;
00178 
00184 struct KPARTS_EXPORT WindowArgs
00185 {
00186     WindowArgs();
00187     ~WindowArgs();
00188     WindowArgs( const WindowArgs &args );
00189     WindowArgs &operator=( const WindowArgs &args );
00190     WindowArgs( const QRect &_geometry, bool _fullscreen, bool _menuBarVisible,
00191                 bool _toolBarsVisible, bool _statusBarVisible, bool _resizable );
00192     WindowArgs( int _x, int _y, int _width, int _height, bool _fullscreen,
00193                 bool _menuBarVisible, bool _toolBarsVisible,
00194                 bool _statusBarVisible, bool _resizable );
00195 
00196     // Position
00197     int x;
00198     int y;
00199     // Size
00200     int width;
00201     int height;
00202     bool fullscreen; //defaults to false
00203     bool menuBarVisible; //defaults to true
00204     bool toolBarsVisible; //defaults to true
00205     bool statusBarVisible; //defaults to true
00206     bool resizable; //defaults to true
00207 
00208     bool lowerWindow; //defaults to false
00209     bool scrollBarsVisible; //defaults to true
00210 
00211     WindowArgsPrivate *d; // don't use before KDE4, many KDE-3.x didn't have an explicit destructor
00212 };
00213 
00221 class KPARTS_EXPORT OpenURLEvent : public Event
00222 {
00223 public:
00224   OpenURLEvent( ReadOnlyPart *part, const KURL &url, const URLArgs &args = URLArgs() );
00225   virtual ~OpenURLEvent();
00226 
00227   ReadOnlyPart *part() const { return m_part; }
00228   KURL url() const { return m_url; }
00229   URLArgs args() const { return m_args; }
00230 
00231   static bool test( const QEvent *event ) { return Event::test( event, s_strOpenURLEvent ); }
00232 
00233 private:
00234   static const char *s_strOpenURLEvent;
00235   ReadOnlyPart *m_part;
00236   KURL m_url;
00237   URLArgs m_args;
00238 
00239   class OpenURLEventPrivate;
00240   OpenURLEventPrivate *d;
00241 };
00242 
00243 class BrowserExtensionPrivate;
00244 
00308 class KPARTS_EXPORT BrowserExtension : public QObject
00309 {
00310   Q_OBJECT
00311   Q_PROPERTY( bool urlDropHandling READ isURLDropHandlingEnabled WRITE setURLDropHandlingEnabled )
00312 public:
00319   BrowserExtension( KParts::ReadOnlyPart *parent,
00320                     const char *name = 0L );
00321 
00322 
00323   virtual ~BrowserExtension();
00324 
00325   typedef uint PopupFlags;
00326 
00344   enum { DefaultPopupItems=0x0000, ShowNavigationItems=0x0001,
00345          ShowUp=0x0002, ShowReload=0x0004, ShowBookmark=0x0008,
00346          ShowCreateDirectory=0x0010, ShowTextSelectionItems=0x0020,
00347          NoDeletion=0x0040 
00348        };
00349 
00350 
00356   virtual void setURLArgs( const URLArgs &args );
00357 
00363   URLArgs urlArgs() const;
00364 
00370   virtual int xOffset();
00376   virtual int yOffset();
00377 
00385   virtual void saveState( QDataStream &stream );
00386 
00394   virtual void restoreState( QDataStream &stream );
00395 
00401   bool isURLDropHandlingEnabled() const;
00402 
00413   void setURLDropHandlingEnabled( bool enable );
00414 
00415   void setBrowserInterface( BrowserInterface *impl );
00416   BrowserInterface *browserInterface() const;
00417 
00424   bool isActionEnabled( const char * name ) const;
00425 
00433   QString actionText( const char * name ) const;
00434 
00435   typedef QMap<QCString,QCString> ActionSlotMap;
00464   static ActionSlotMap actionSlotMap();
00465 
00470   static ActionSlotMap * actionSlotMapPtr();
00471 
00476   static BrowserExtension *childObject( QObject *obj );
00477 
00482   void pasteRequest();
00483 
00484 // KDE invents support for public signals...
00485 #undef signals
00486 #define signals public
00487 signals:
00488 #undef signals
00489 #define signals protected
00490 
00495   void enableAction( const char * name, bool enabled );
00496 
00504   void setActionText( const char * name, const QString& text );
00505 
00512   void openURLRequest( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
00513 
00520   void openURLRequestDelayed( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
00521 
00537   void openURLNotify();
00538 
00542   void setLocationBarURL( const QString &url );
00543 
00547   void setIconURL( const KURL &url );
00548 
00556   void createNewWindow( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
00557 
00565   void createNewWindow( const KURL &url, const KParts::URLArgs &args,
00566                         const KParts::WindowArgs &windowArgs, KParts::ReadOnlyPart *&part );
00567 
00576   void loadingProgress( int percent );
00580   void speedProgress( int bytesPerSecond );
00581 
00582   void infoMessage( const QString & );
00583 
00588   void popupMenu( const QPoint &global, const KFileItemList &items );
00589 
00596   void popupMenu( KXMLGUIClient *client, const QPoint &global, const KFileItemList &items );
00597 
00598   void popupMenu( KXMLGUIClient *client, const QPoint &global, const KFileItemList &items, const KParts::URLArgs &args, KParts::BrowserExtension::PopupFlags i );
00599 
00608   void popupMenu( const QPoint &global, const KURL &url,
00609                   const QString &mimeType, mode_t mode = (mode_t)-1 );
00610 
00620   void popupMenu( KXMLGUIClient *client,
00621                   const QPoint &global, const KURL &url,
00622                   const QString &mimeType, mode_t mode = (mode_t)-1 );
00623 
00633   void popupMenu( KXMLGUIClient *client,
00634                   const QPoint &global, const KURL &url,
00635                   const KParts::URLArgs &args, KParts::BrowserExtension::PopupFlags i, mode_t mode = (mode_t)-1 );
00636 
00642   void selectionInfo( const KFileItemList &items );
00647   void selectionInfo( const QString &text );
00652   void selectionInfo( const KURL::List &urls );
00653 
00658   void mouseOverInfo( const KFileItem* item );
00659 
00664   void addWebSideBar(const KURL &url, const QString& name);
00665 
00669   void moveTopLevelWidget( int x, int y );
00670 
00674   void resizeTopLevelWidget( int w, int h );
00675 
00680   void requestFocus(KParts::ReadOnlyPart *part);
00681 
00687   void setPageSecurity( int );
00688 
00689 #define KPARTS_BROWSEREXTENSION_HAS_ITEMS_REMOVED
00690 
00694   void itemsRemoved( const KFileItemList &items );
00695 
00696 private slots:
00697   void slotCompleted();
00698   void slotOpenURLRequest( const KURL &url, const KParts::URLArgs &args );
00699   void slotEmitOpenURLRequestDelayed();
00700   void slotEnableAction( const char *, bool );
00701   void slotSetActionText( const char*, const QString& );
00702 
00703 private:
00704   KParts::ReadOnlyPart *m_part;
00705   URLArgs m_args;
00706 public:
00707   typedef QMap<QCString,int> ActionNumberMap;
00708 
00709 private:
00710   static ActionNumberMap * s_actionNumberMap;
00711   static ActionSlotMap * s_actionSlotMap;
00712   static void createActionSlotMap();
00713 protected:
00714   virtual void virtual_hook( int id, void* data );
00715 private:
00716   BrowserExtensionPrivate *d;
00717 };
00718 
00724 class KPARTS_EXPORT BrowserHostExtension : public QObject
00725 {
00726   Q_OBJECT
00727 public:
00728   BrowserHostExtension( KParts::ReadOnlyPart *parent,
00729                         const char *name = 0L );
00730 
00731   virtual ~BrowserHostExtension();
00732 
00738   virtual QStringList frameNames() const;
00739 
00745   virtual const QPtrList<KParts::ReadOnlyPart> frames() const;
00746 
00752   BrowserHostExtension *findFrameParent(KParts::ReadOnlyPart *callingPart, const QString &frame);
00753 
00758   virtual bool openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs );
00759 
00764   static BrowserHostExtension *childObject( QObject *obj );
00765 
00766 protected:
00772   enum { VIRTUAL_FIND_FRAME_PARENT = 0x10 };
00773   struct FindFrameParentParams
00774   {
00775       BrowserHostExtension *parent;
00776       KParts::ReadOnlyPart *callingPart;
00777       QString frame;
00778   };
00779 
00780   virtual void virtual_hook( int id, void* data );
00781 private:
00782   class BrowserHostExtensionPrivate;
00783   BrowserHostExtensionPrivate *d;
00784 };
00785 
00792 class KPARTS_EXPORT LiveConnectExtension : public QObject
00793 {
00794   Q_OBJECT
00795 public:
00796   enum Type {
00797       TypeVoid=0, TypeBool, TypeFunction, TypeNumber, TypeObject, TypeString
00798   };
00799   typedef QValueList<QPair<Type, QString> > ArgList;
00800 
00801   LiveConnectExtension( KParts::ReadOnlyPart *parent, const char *name = 0L );
00802 
00803   virtual ~LiveConnectExtension() {}
00807   virtual bool get( const unsigned long objid, const QString & field, Type & type, unsigned long & retobjid, QString & value );
00811   virtual bool put( const unsigned long objid, const QString & field, const QString & value );
00815   virtual bool call( const unsigned long objid, const QString & func, const QStringList & args, Type & type, unsigned long & retobjid, QString & value );
00819   virtual void unregister( const unsigned long objid );
00820 
00821   static LiveConnectExtension *childObject( QObject *obj );
00822 signals:
00826   virtual void partEvent( const unsigned long objid, const QString & event, const ArgList & args );
00827 };
00828 
00829 }
00830 
00831 #endif
00832 

KParts

Skip menu "KParts"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal