• Skip to content
  • Skip to link menu
KDE 4.1 API Reference
  • KDE API Reference
  • kdelibs
  • 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 <kparts/part.h>
00027 #include <kparts/event.h>
00028 
00029 #include <QtCore/QSharedDataPointer>
00030 
00031 template <class T1, class T2> struct QPair;
00032 template<typename T> class Q3PtrList;
00033 template <class Key, class T> class QMap;
00034 template<typename T> class QList;
00035 
00036 class KFileItem;
00037 class KFileItemList;
00038 class QDataStream;
00039 class QPoint;
00040 class QString;
00041 class QStringList;
00042 
00043 namespace KParts {
00044 
00045 class BrowserInterface;
00046 
00047 struct BrowserArgumentsPrivate;
00048 
00064 struct KPARTS_EXPORT BrowserArguments
00065 {
00066   BrowserArguments();
00067   BrowserArguments( const BrowserArguments &args );
00068   BrowserArguments &operator=( const BrowserArguments &args);
00069 
00070   virtual ~BrowserArguments();
00071 
00072   // KDE4: a struct has the problem that the stuff added after BC-freeze uses methods
00073   // so it looks inconsistent with the member vars. -> better use methods for everything,
00074   // even if they are inline.
00075 
00076 
00081   QStringList docState;
00082 
00089   bool softReload;
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 
00133   QString frameName;
00134 
00140   bool trustedSource;
00141 
00146   bool redirectedRequest () const;
00147 
00154   void setRedirectedRequest(bool redirected);
00155 
00159   void setForcesNewWindow( bool forcesNewWindow );
00160 
00164   bool forcesNewWindow() const;
00165 
00166 private:
00167   BrowserArgumentsPrivate *d;
00168 };
00169 
00170 class WindowArgsPrivate;
00171 
00177 class KPARTS_EXPORT WindowArgs
00178 {
00179 public:
00180     WindowArgs();
00181     ~WindowArgs();
00182     WindowArgs( const WindowArgs &args );
00183     WindowArgs &operator=( const WindowArgs &args );
00184     WindowArgs( const QRect &_geometry, bool _fullscreen, bool _menuBarVisible,
00185                 bool _toolBarsVisible, bool _statusBarVisible, bool _resizable );
00186     WindowArgs( int _x, int _y, int _width, int _height, bool _fullscreen,
00187                 bool _menuBarVisible, bool _toolBarsVisible,
00188                 bool _statusBarVisible, bool _resizable );
00189 
00190     void setX(int x);
00191     int x() const;
00192 
00193     void setY(int y);
00194     int y() const;
00195 
00196     void setWidth(int w);
00197     int width() const;
00198 
00199     void setHeight(int h);
00200     int height() const;
00201 
00202     void setFullScreen(bool fs);
00203     bool isFullScreen() const;
00204 
00205     void setMenuBarVisible(bool visible);
00206     bool isMenuBarVisible() const;
00207 
00208     void setToolBarsVisible(bool visible);
00209     bool toolBarsVisible() const;
00210 
00211     void setStatusBarVisible(bool visible);
00212     bool isStatusBarVisible() const;
00213 
00214     void setResizable(bool resizable);
00215     bool isResizable() const;
00216 
00217     void setLowerWindow(bool lower);
00218     bool lowerWindow() const;
00219 
00220     void setScrollBarsVisible(bool visible);
00221     bool scrollBarsVisible() const;
00222 
00223 private:
00224     QSharedDataPointer<WindowArgsPrivate> d;
00225 };
00226 
00234 class KPARTS_EXPORT OpenUrlEvent : public Event
00235 {
00236 public:
00237   OpenUrlEvent( ReadOnlyPart *part, const KUrl &url,
00238                 const OpenUrlArguments& args = OpenUrlArguments(),
00239                 const BrowserArguments& browserArgs = BrowserArguments() );
00240   virtual ~OpenUrlEvent();
00241 
00242   ReadOnlyPart *part() const;
00243   KUrl url() const;
00244   OpenUrlArguments arguments() const;
00245   BrowserArguments browserArguments() const;
00246 
00247   static bool test( const QEvent *event );
00248 
00249 private:
00250   class OpenUrlEventPrivate;
00251   OpenUrlEventPrivate * const d;
00252 };
00253 
00309 class KPARTS_EXPORT BrowserExtension : public QObject
00310 {
00311   Q_OBJECT
00312   Q_PROPERTY( bool urlDropHandling READ isURLDropHandlingEnabled WRITE setURLDropHandlingEnabled )
00313 public:
00319   explicit BrowserExtension( KParts::ReadOnlyPart *parent );
00320 
00321 
00322   virtual ~BrowserExtension();
00323 
00327   enum PopupFlag {
00328       DefaultPopupItems=0x0000, 
00329       ShowNavigationItems=0x0001, 
00330       ShowUp=0x0002, 
00331       ShowReload=0x0004, 
00332       ShowBookmark=0x0008, 
00333       ShowCreateDirectory=0x0010, 
00335       ShowTextSelectionItems=0x0020, 
00336       NoDeletion=0x0040, 
00338       IsLink=0x0080, 
00339       ShowUrlOperations=0x0100, 
00340       ShowProperties=0x200     
00341   };
00342 
00343   Q_DECLARE_FLAGS( PopupFlags, PopupFlag )
00344 
00345   
00350   virtual void setBrowserArguments( const BrowserArguments &args );
00351 
00357   BrowserArguments browserArguments() const;
00358 
00364   virtual int xOffset();
00370   virtual int yOffset();
00371 
00379   virtual void saveState( QDataStream &stream );
00380 
00388   virtual void restoreState( QDataStream &stream );
00389 
00395   bool isURLDropHandlingEnabled() const;
00396 
00407   void setURLDropHandlingEnabled( bool enable );
00408 
00409   void setBrowserInterface( BrowserInterface *impl );
00410   BrowserInterface *browserInterface() const;
00411 
00418   bool isActionEnabled( const char * name ) const;
00419 
00426   QString actionText( const char * name ) const;
00427 
00428   typedef QMap<QByteArray,QByteArray> ActionSlotMap;
00457   static ActionSlotMap actionSlotMap();
00458 
00463   static ActionSlotMap * actionSlotMapPtr();
00464 
00469   static BrowserExtension *childObject( QObject *obj );
00470 
00474   void pasteRequest();
00475 
00482     typedef QMap<QString, QList<QAction *> > ActionGroupMap;
00483 
00484 Q_SIGNALS:
00485 #ifndef Q_MOC_RUN
00486 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00487 public:  // yes, those signals are public; don't tell moc or doxygen :)
00488 #endif
00489 #endif
00490 
00495   void enableAction( const char * name, bool enabled );
00496 
00503   void setActionText( const char * name, const QString& text );
00504 
00511   void openUrlRequest( const KUrl &url,
00512                        const KParts::OpenUrlArguments& arguments = KParts::OpenUrlArguments(),
00513                        const KParts::BrowserArguments &browserArguments = KParts::BrowserArguments() );
00514 
00521   void openUrlRequestDelayed( const KUrl &url,
00522                               const KParts::OpenUrlArguments& arguments,
00523                               const KParts::BrowserArguments &browserArguments );
00524 
00540   void openUrlNotify();
00541 
00545   void setLocationBarUrl( const QString &url );
00546 
00550   void setIconUrl( const KUrl &url );
00551 
00566     void createNewWindow( const KUrl &url,
00567                           const KParts::OpenUrlArguments& arguments = KParts::OpenUrlArguments(),
00568                           const KParts::BrowserArguments &browserArguments = KParts::BrowserArguments(),
00569                           const KParts::WindowArgs &windowArgs = KParts::WindowArgs(),
00570                           KParts::ReadOnlyPart** part = 0 ); // TODO consider moving to BrowserHostExtension?
00571 
00580   void loadingProgress( int percent );
00584   void speedProgress( int bytesPerSecond );
00585 
00586   void infoMessage( const QString & );
00587 
00598   void popupMenu( const QPoint &global, const KFileItemList &items,
00599                   const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
00600                   const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments(),
00601                   KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::DefaultPopupItems,
00602                   const KParts::BrowserExtension::ActionGroupMap& actionGroups = ActionGroupMap() );
00603 
00618   void popupMenu( const QPoint &global, const KUrl &url,
00619                   mode_t mode = (mode_t)-1,
00620                   const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
00621                   const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments(),
00622                   KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::DefaultPopupItems,
00623                   const KParts::BrowserExtension::ActionGroupMap& actionGroups = ActionGroupMap() );
00624 
00630   void selectionInfo( const KFileItemList& items );
00635   void selectionInfo( const QString &text );
00640   void selectionInfo( const KUrl::List &urls );
00641 
00646   void mouseOverInfo( const KFileItem& item );
00647 
00652   void addWebSideBar(const KUrl &url, const QString& name);
00653 
00657   void moveTopLevelWidget( int x, int y );
00658 
00662   void resizeTopLevelWidget( int w, int h );
00663 
00667   void requestFocus(KParts::ReadOnlyPart *part);
00668 
00673   void setPageSecurity( int );
00674 
00678   void itemsRemoved( const KFileItemList &items );
00679 
00680 private Q_SLOTS:
00681   void slotCompleted();
00682   void slotOpenUrlRequest( const KUrl &url,
00683                            const KParts::OpenUrlArguments& arguments = KParts::OpenUrlArguments(),
00684                            const KParts::BrowserArguments &browserArguments = KParts::BrowserArguments() );
00685 
00686   void slotEmitOpenUrlRequestDelayed();
00687   void slotEnableAction( const char *, bool );
00688   void slotSetActionText( const char*, const QString& );
00689 
00690 public:
00691   typedef QMap<QByteArray,int> ActionNumberMap;
00692 
00693 private:
00694   class BrowserExtensionPrivate;
00695   BrowserExtensionPrivate * const d;
00696 };
00697 
00703 class KPARTS_EXPORT BrowserHostExtension : public QObject
00704 {
00705   Q_OBJECT
00706 public:
00707   BrowserHostExtension( KParts::ReadOnlyPart *parent );
00708 
00709   virtual ~BrowserHostExtension();
00710 
00716   virtual QStringList frameNames() const;
00717 
00723   virtual const QList<KParts::ReadOnlyPart*> frames() const;
00724 
00729   virtual BrowserHostExtension *findFrameParent(KParts::ReadOnlyPart *callingPart, const QString &frame);
00730 
00735   virtual bool openUrlInFrame( const KUrl &url,
00736                                const KParts::OpenUrlArguments& arguments,
00737                                const KParts::BrowserArguments &browserArguments );
00738 
00743   static BrowserHostExtension *childObject( QObject *obj );
00744 
00745 private:
00746   class BrowserHostExtensionPrivate;
00747   BrowserHostExtensionPrivate * const d;
00748 };
00749 
00756 class KPARTS_EXPORT LiveConnectExtension : public QObject
00757 {
00758   Q_OBJECT
00759 public:
00760   enum Type {
00761       TypeVoid=0, TypeBool, TypeFunction, TypeNumber, TypeObject, TypeString
00762   };
00763   typedef QList<QPair<Type, QString> > ArgList;
00764 
00765   LiveConnectExtension( KParts::ReadOnlyPart *parent );
00766 
00767   virtual ~LiveConnectExtension();
00771   virtual bool get( const unsigned long objid, const QString & field, Type & type, unsigned long & retobjid, QString & value );
00775   virtual bool put( const unsigned long objid, const QString & field, const QString & value );
00779   virtual bool call( const unsigned long objid, const QString & func, const QStringList & args, Type & type, unsigned long & retobjid, QString & value );
00783   virtual void unregister( const unsigned long objid );
00784 
00785   static LiveConnectExtension *childObject( QObject *obj );
00786 Q_SIGNALS:
00787 #ifndef Q_MOC_RUN
00788 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00789 public:  // yes, those signals are public; don't tell moc or doxygen :)
00790 #endif
00791 #endif
00792 
00795   void partEvent( const unsigned long objid, const QString & event, const KParts::LiveConnectExtension::ArgList & args );
00796 
00797 private:
00798   class LiveConnectExtensionPrivate;
00799   LiveConnectExtensionPrivate * const d;
00800 };
00801 
00802 }
00803 
00804 Q_DECLARE_OPERATORS_FOR_FLAGS( KParts::BrowserExtension::PopupFlags )
00805 
00806 #endif
00807 

KParts

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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