• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KParts

  • sources
  • kde-4.12
  • kdelibs
  • kparts
browserextension.h
Go to the documentation of this file.
1 /* This file is part of the KDE project
2  Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
3  David Faure <faure@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Library General Public
7  License as published by the Free Software Foundation; either
8  version 2 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Library General Public License for more details.
14 
15  You should have received a copy of the GNU Library General Public License
16  along with this library; see the file COPYING.LIB. If not, write to
17  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  Boston, MA 02110-1301, USA.
19 */
20 
21 #ifndef __kparts_browserextension_h__
22 #define __kparts_browserextension_h__
23 
24 #include <sys/types.h>
25 
26 #include <kparts/part.h>
27 #include <kparts/event.h>
28 
29 #include <QtCore/QSharedDataPointer>
30 
31 template <class T1, class T2> struct QPair;
32 template<typename T> class Q3PtrList;
33 template <class Key, class T> class QMap;
34 template<typename T> class QList;
35 
36 class KFileItem;
37 class KFileItemList;
38 class QDataStream;
39 class QPoint;
40 class QString;
41 class QStringList;
42 
43 namespace KParts {
44 
45 class BrowserInterface;
46 
47 struct BrowserArgumentsPrivate;
48 
64 struct KPARTS_EXPORT BrowserArguments
65 {
66  BrowserArguments();
67  BrowserArguments( const BrowserArguments &args );
68  BrowserArguments &operator=( const BrowserArguments &args);
69 
70  virtual ~BrowserArguments();
71 
72  // KDE4: a struct has the problem that the stuff added after BC-freeze uses methods
73  // so it looks inconsistent with the member vars. -> better use methods for everything,
74  // even if they are inline.
75 
76 
81  QStringList docState;
82 
89  bool softReload;
90 
94  QByteArray postData;
95 
99  void setContentType( const QString & contentType );
103  QString contentType() const;
108  void setDoPost( bool enable );
109 
114  bool doPost() const;
115 
121  void setLockHistory( bool lock );
122  bool lockHistory() const;
123 
127  void setNewTab( bool newTab );
128  bool newTab() const;
129 
133  QString frameName;
134 
140  bool trustedSource;
141 
146  bool redirectedRequest () const;
147 
154  void setRedirectedRequest(bool redirected);
155 
174  void setForcesNewWindow( bool forcesNewWindow );
175 
179  bool forcesNewWindow() const;
180 
181 private:
182  BrowserArgumentsPrivate *d;
183 };
184 
185 class WindowArgsPrivate;
186 
192 class KPARTS_EXPORT WindowArgs
193 {
194 public:
195  WindowArgs();
196  ~WindowArgs();
197  WindowArgs( const WindowArgs &args );
198  WindowArgs &operator=( const WindowArgs &args );
199  WindowArgs( const QRect &_geometry, bool _fullscreen, bool _menuBarVisible,
200  bool _toolBarsVisible, bool _statusBarVisible, bool _resizable );
201  WindowArgs( int _x, int _y, int _width, int _height, bool _fullscreen,
202  bool _menuBarVisible, bool _toolBarsVisible,
203  bool _statusBarVisible, bool _resizable );
204 
205  void setX(int x);
206  int x() const;
207 
208  void setY(int y);
209  int y() const;
210 
211  void setWidth(int w);
212  int width() const;
213 
214  void setHeight(int h);
215  int height() const;
216 
217  void setFullScreen(bool fs);
218  bool isFullScreen() const;
219 
220  void setMenuBarVisible(bool visible);
221  bool isMenuBarVisible() const;
222 
223  void setToolBarsVisible(bool visible);
224  bool toolBarsVisible() const;
225 
226  void setStatusBarVisible(bool visible);
227  bool isStatusBarVisible() const;
228 
229  void setResizable(bool resizable);
230  bool isResizable() const;
231 
232  void setLowerWindow(bool lower);
233  bool lowerWindow() const;
234 
235  void setScrollBarsVisible(bool visible);
236  bool scrollBarsVisible() const;
237 
238 private:
239  QSharedDataPointer<WindowArgsPrivate> d;
240 };
241 
249 class KPARTS_EXPORT OpenUrlEvent : public Event
250 {
251 public:
252  OpenUrlEvent( ReadOnlyPart *part, const KUrl &url,
253  const OpenUrlArguments& args = OpenUrlArguments(),
254  const BrowserArguments& browserArgs = BrowserArguments() );
255  virtual ~OpenUrlEvent();
256 
257  ReadOnlyPart *part() const;
258  KUrl url() const;
259  OpenUrlArguments arguments() const;
260  BrowserArguments browserArguments() const;
261 
262  static bool test( const QEvent *event );
263 
264 private:
265  class OpenUrlEventPrivate;
266  OpenUrlEventPrivate * const d;
267 };
268 
320 class KPARTS_EXPORT BrowserExtension : public QObject
321 {
322  Q_OBJECT
323  Q_PROPERTY( bool urlDropHandling READ isURLDropHandlingEnabled WRITE setURLDropHandlingEnabled )
324 public:
330  explicit BrowserExtension( KParts::ReadOnlyPart *parent );
331 
332 
333  virtual ~BrowserExtension();
334 
338  enum PopupFlag {
339  DefaultPopupItems=0x0000,
340  ShowNavigationItems=0x0001,
341  ShowUp=0x0002,
342  ShowReload=0x0004,
343  ShowBookmark=0x0008,
344  ShowCreateDirectory=0x0010,
346  ShowTextSelectionItems=0x0020,
347  NoDeletion=0x0040,
349  IsLink=0x0080,
350  ShowUrlOperations=0x0100,
351  ShowProperties=0x200
352  };
353 
354  Q_DECLARE_FLAGS( PopupFlags, PopupFlag )
355 
356 
361  virtual void setBrowserArguments( const BrowserArguments &args );
362 
368  BrowserArguments browserArguments() const;
369 
375  virtual int xOffset();
381  virtual int yOffset();
382 
390  virtual void saveState( QDataStream &stream );
391 
399  virtual void restoreState( QDataStream &stream );
400 
406  bool isURLDropHandlingEnabled() const;
407 
418  void setURLDropHandlingEnabled( bool enable );
419 
420  void setBrowserInterface( BrowserInterface *impl );
421  BrowserInterface *browserInterface() const;
422 
429  bool isActionEnabled( const char * name ) const;
430 
437  QString actionText( const char * name ) const;
438 
439  typedef QMap<QByteArray,QByteArray> ActionSlotMap;
468  static ActionSlotMap actionSlotMap();
469 
474  static ActionSlotMap * actionSlotMapPtr();
475 
480  static BrowserExtension *childObject( QObject *obj );
481 
485  void pasteRequest();
486 
493  typedef QMap<QString, QList<QAction *> > ActionGroupMap;
494 
495 Q_SIGNALS:
496 #if !defined(Q_MOC_RUN) && !defined(DOXYGEN_SHOULD_SKIP_THIS) && !defined(IN_IDE_PARSER)
497 public: // yes, those signals are public; don't tell moc, doxygen or kdevelop :)
498 #endif
499 
504  void enableAction( const char * name, bool enabled );
505 
512  void setActionText( const char * name, const QString& text );
513 
520  void openUrlRequest( const KUrl &url,
521  const KParts::OpenUrlArguments& arguments = KParts::OpenUrlArguments(),
522  const KParts::BrowserArguments &browserArguments = KParts::BrowserArguments() );
523 
530  void openUrlRequestDelayed( const KUrl &url,
531  const KParts::OpenUrlArguments& arguments,
532  const KParts::BrowserArguments &browserArguments );
533 
549  void openUrlNotify();
550 
554  void setLocationBarUrl( const QString &url );
555 
559  void setIconUrl( const KUrl &url );
560 
575  void createNewWindow( const KUrl &url,
576  const KParts::OpenUrlArguments& arguments = KParts::OpenUrlArguments(),
577  const KParts::BrowserArguments &browserArguments = KParts::BrowserArguments(),
578  const KParts::WindowArgs &windowArgs = KParts::WindowArgs(),
579  KParts::ReadOnlyPart** part = 0 ); // TODO consider moving to BrowserHostExtension?
580 
589  void loadingProgress( int percent );
593  void speedProgress( int bytesPerSecond );
594 
595  void infoMessage( const QString & );
596 
607  void popupMenu( const QPoint &global, const KFileItemList &items,
608  const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
609  const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments(),
610  KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::DefaultPopupItems,
611  const KParts::BrowserExtension::ActionGroupMap& actionGroups = ActionGroupMap() );
612 
627  void popupMenu( const QPoint &global, const KUrl &url,
628  mode_t mode = static_cast<mode_t>(-1),
629  const KParts::OpenUrlArguments &args = KParts::OpenUrlArguments(),
630  const KParts::BrowserArguments &browserArgs = KParts::BrowserArguments(),
631  KParts::BrowserExtension::PopupFlags flags = KParts::BrowserExtension::DefaultPopupItems,
632  const KParts::BrowserExtension::ActionGroupMap& actionGroups = ActionGroupMap() );
633 
639  void selectionInfo( const KFileItemList& items );
644  void selectionInfo( const QString &text );
649  void selectionInfo( const KUrl::List &urls );
650 
655  void mouseOverInfo( const KFileItem& item );
656 
661  void addWebSideBar(const KUrl &url, const QString& name);
662 
666  void moveTopLevelWidget( int x, int y );
667 
671  void resizeTopLevelWidget( int w, int h );
672 
676  void requestFocus(KParts::ReadOnlyPart *part);
677 
682  void setPageSecurity( int );
683 
687  void itemsRemoved( const KFileItemList &items );
688 
689 private Q_SLOTS:
690  void slotCompleted();
691  void slotOpenUrlRequest( const KUrl &url,
692  const KParts::OpenUrlArguments& arguments = KParts::OpenUrlArguments(),
693  const KParts::BrowserArguments &browserArguments = KParts::BrowserArguments() );
694 
695  void slotEmitOpenUrlRequestDelayed();
696  void slotEnableAction( const char *, bool );
697  void slotSetActionText( const char*, const QString& );
698 
699 public:
700  typedef QMap<QByteArray,int> ActionNumberMap;
701 
702 private:
703  class BrowserExtensionPrivate;
704  BrowserExtensionPrivate * const d;
705 };
706 
712 class KPARTS_EXPORT BrowserHostExtension : public QObject
713 {
714  Q_OBJECT
715 public:
716  BrowserHostExtension( KParts::ReadOnlyPart *parent );
717 
718  virtual ~BrowserHostExtension();
719 
725  virtual QStringList frameNames() const;
726 
732  virtual const QList<KParts::ReadOnlyPart*> frames() const;
733 
738  virtual BrowserHostExtension *findFrameParent(KParts::ReadOnlyPart *callingPart, const QString &frame);
739 
744  virtual bool openUrlInFrame( const KUrl &url,
745  const KParts::OpenUrlArguments& arguments,
746  const KParts::BrowserArguments &browserArguments );
747 
752  static BrowserHostExtension *childObject( QObject *obj );
753 
754 private:
755  class BrowserHostExtensionPrivate;
756  BrowserHostExtensionPrivate * const d;
757 };
758 
765 class KPARTS_EXPORT LiveConnectExtension : public QObject
766 {
767  Q_OBJECT
768 public:
769  enum Type {
770  TypeVoid=0, TypeBool, TypeFunction, TypeNumber, TypeObject, TypeString
771  };
772  typedef QList<QPair<Type, QString> > ArgList;
773 
774  LiveConnectExtension( KParts::ReadOnlyPart *parent );
775 
776  virtual ~LiveConnectExtension();
780  virtual bool get( const unsigned long objid, const QString & field, Type & type, unsigned long & retobjid, QString & value );
784  virtual bool put( const unsigned long objid, const QString & field, const QString & value );
788  virtual bool call( const unsigned long objid, const QString & func, const QStringList & args, Type & type, unsigned long & retobjid, QString & value );
792  virtual void unregister( const unsigned long objid );
793 
794  static LiveConnectExtension *childObject( QObject *obj );
795 Q_SIGNALS:
796 #if !defined(Q_MOC_RUN) && !defined(DOXYGEN_SHOULD_SKIP_THIS) && !defined(IN_IDE_PARSER)
797 public: // yes, those signals are public; don't tell moc, doxygen or kdevelop :)
798 #endif
799 
802  void partEvent( const unsigned long objid, const QString & event, const KParts::LiveConnectExtension::ArgList & args );
803 
804 private:
805  class LiveConnectExtensionPrivate;
806  LiveConnectExtensionPrivate * const d;
807 };
808 
809 }
810 
811 Q_DECLARE_OPERATORS_FOR_FLAGS( KParts::BrowserExtension::PopupFlags )
812 
813 #endif
814 
KParts::BrowserExtension
The Browser Extension is an extension (yes, no kidding) to KParts::ReadOnlyPart, which allows a bette...
Definition: browserextension.h:320
put
TransferJob * put(const KUrl &url, int permissions, JobFlags flags=DefaultFlags)
KParts::LiveConnectExtension::Type
Type
Definition: browserextension.h:769
KParts::BrowserInterface
The purpose of this interface is to allow a direct communication between a KPart and the hosting brow...
Definition: browserinterface.h:53
KParts::BrowserArguments
BrowserArguments is a set of web-browsing-specific arguments, which allow specifying how a URL should...
Definition: browserextension.h:64
KParts::BrowserExtension::DefaultPopupItems
default value, no additional menu item
Definition: browserextension.h:339
QString
QObject
KUrl
KParts::BrowserArguments::trustedSource
bool trustedSource
If true, the part who asks for a URL to be opened can be 'trusted' to execute applications.
Definition: browserextension.h:140
KParts::BrowserArguments::docState
QStringList docState
This buffer can be used by the part to save and restore its contents.
Definition: browserextension.h:81
test
KGuiItem test()
KParts::LiveConnectExtension
An extension class for LiveConnect, i.e.
Definition: browserextension.h:765
KParts::BrowserExtension::PopupFlag
PopupFlag
Set of flags passed via the popupMenu signal, to ask for some items in the popup menu.
Definition: browserextension.h:338
QStringList
KFileItemList
KParts::OpenUrlEvent
The KParts::OpenUrlEvent event informs that a given part has opened a given URL.
Definition: browserextension.h:249
KParts::BrowserHostExtension
An extension class for container parts, i.e.
Definition: browserextension.h:712
KParts::BrowserArguments::softReload
bool softReload
softReload is set when user just hits reload button.
Definition: browserextension.h:89
KParts::BrowserArguments::frameName
QString frameName
The frame in which to open the URL.
Definition: browserextension.h:133
KUrl::List
QPoint
event.h
KParts::Event
Base class for all KParts events.
Definition: event.h:37
Q3PtrList
Definition: browserextension.h:32
QRect
QPair
Definition: browserextension.h:31
KParts::BrowserExtension::ActionNumberMap
QMap< QByteArray, int > ActionNumberMap
Definition: browserextension.h:700
QEvent
KParts::LiveConnectExtension::ArgList
QList< QPair< Type, QString > > ArgList
Definition: browserextension.h:772
QAction
KParts::BrowserArguments::postData
QByteArray postData
KHTML-specific field, contents of the HTTP POST data.
Definition: browserextension.h:94
KParts::WindowArgs
The WindowArgs are used to specify arguments to the "create new window" call (see the createNewWindow...
Definition: browserextension.h:192
QMap
Definition: browserextension.h:33
KFileItem
part.h
KParts::OpenUrlArguments
OpenUrlArguments is the set of arguments that specify how a URL should be opened by KParts::ReadOnlyP...
Definition: part.h:404
QList
Definition: browserextension.h:34
KParts::ReadOnlyPart
Base class for any "viewer" part.
Definition: part.h:488
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:42 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KParts

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal