• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeparts
 

tdeparts

  • tdeparts
browserextension.h
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 __tdeparts_browserextension_h__
22 #define __tdeparts_browserextension_h__
23 
24 #include <sys/types.h>
25 
26 #include <tqpoint.h>
27 #include <tqptrlist.h>
28 #include <tqdatastream.h>
29 #include <tqstringlist.h>
30 #include <tqpair.h>
31 
32 #include <tdeparts/part.h>
33 #include <tdeparts/event.h>
34 
35 class KFileItem;
36 typedef TQPtrList<KFileItem> KFileItemList;
37 class TQString;
38 
39 namespace KParts {
40 
41 class BrowserInterface;
42 
43 struct URLArgsPrivate;
44 
57 struct TDEPARTS_EXPORT URLArgs
58 {
59  URLArgs();
60  URLArgs( const URLArgs &args );
61  URLArgs &operator=( const URLArgs &args);
62 
63  URLArgs( bool reload, int xOffset, int yOffset, const TQString &serviceType = TQString::null );
64  virtual ~URLArgs();
65 
70  TQStringList docState;
71 
75  bool reload;
81  int xOffset;
85  int yOffset;
89  TQString serviceType;
90 
94  TQByteArray postData;
95 
99  void setContentType( const TQString & contentType );
103  TQString 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 
134  TQMap<TQString, TQString> &metaData();
135 
139  TQString frameName;
140 
146  bool trustedSource;
147 
152  bool redirectedRequest () const;
153 
160  void setRedirectedRequest(bool redirected);
161 
166  void setForcesNewWindow( bool forcesNewWindow );
167 
172  bool forcesNewWindow() const;
173 
174  URLArgsPrivate *d;
175 };
176 
177 struct WindowArgsPrivate;
178 
184 struct TDEPARTS_EXPORT WindowArgs
185 {
186  WindowArgs();
187  ~WindowArgs();
188  WindowArgs( const WindowArgs &args );
189  WindowArgs &operator=( const WindowArgs &args );
190  WindowArgs( const TQRect &_geometry, bool _fullscreen, bool _menuBarVisible,
191  bool _toolBarsVisible, bool _statusBarVisible, bool _resizable );
192  WindowArgs( int _x, int _y, int _width, int _height, bool _fullscreen,
193  bool _menuBarVisible, bool _toolBarsVisible,
194  bool _statusBarVisible, bool _resizable );
195 
196  // Position
197  int x;
198  int y;
199  // Size
200  int width;
201  int height;
202  bool fullscreen; //defaults to false
203  bool menuBarVisible; //defaults to true
204  bool toolBarsVisible; //defaults to true
205  bool statusBarVisible; //defaults to true
206  bool resizable; //defaults to true
207 
208  bool lowerWindow; //defaults to false
209  bool scrollBarsVisible; //defaults to true
210 
211  WindowArgsPrivate *d; // don't use before KDE4, many KDE-3.x didn't have an explicit destructor
212 };
213 
221 class TDEPARTS_EXPORT OpenURLEvent : public Event
222 {
223 public:
224  OpenURLEvent( ReadOnlyPart *part, const KURL &url, const URLArgs &args = URLArgs() );
225  virtual ~OpenURLEvent();
226 
227  ReadOnlyPart *part() const { return m_part; }
228  KURL url() const { return m_url; }
229  URLArgs args() const { return m_args; }
230 
231  static bool test( const TQEvent *event ) { return Event::test( event, s_strOpenURLEvent ); }
232 
233 private:
234  static const char *s_strOpenURLEvent;
235  ReadOnlyPart *m_part;
236  KURL m_url;
237  URLArgs m_args;
238 
239  class OpenURLEventPrivate;
240  OpenURLEventPrivate *d;
241 };
242 
243 class BrowserExtensionPrivate;
244 
308 class TDEPARTS_EXPORT BrowserExtension : public TQObject
309 {
310  Q_OBJECT
311  TQ_PROPERTY( bool urlDropHandling READ isURLDropHandlingEnabled WRITE setURLDropHandlingEnabled )
312 public:
319  BrowserExtension( KParts::ReadOnlyPart *parent,
320  const char *name = 0L );
321 
322 
323  virtual ~BrowserExtension();
324 
325  typedef uint PopupFlags;
326 
344  enum { DefaultPopupItems=0x0000, ShowNavigationItems=0x0001,
345  ShowUp=0x0002, ShowReload=0x0004, ShowBookmark=0x0008,
346  ShowCreateDirectory=0x0010, ShowTextSelectionItems=0x0020,
347  NoDeletion=0x0040
348  };
349 
350 
356  virtual void setURLArgs( const URLArgs &args );
357 
363  URLArgs urlArgs() const;
364 
370  virtual int xOffset();
376  virtual int yOffset();
377 
385  virtual void saveState( TQDataStream &stream );
386 
394  virtual void restoreState( TQDataStream &stream );
395 
401  bool isURLDropHandlingEnabled() const;
402 
413  void setURLDropHandlingEnabled( bool enable );
414 
415  void setBrowserInterface( BrowserInterface *impl );
416  BrowserInterface *browserInterface() const;
417 
424  bool isActionEnabled( const char * name ) const;
425 
433  TQString actionText( const char * name ) const;
434 
435  typedef TQMap<TQCString,TQCString> ActionSlotMap;
464  static ActionSlotMap actionSlotMap();
465 
470  static ActionSlotMap * actionSlotMapPtr();
471 
476  static BrowserExtension *childObject( TQObject *obj );
477 
482  void pasteRequest();
483 
484 // KDE invents support for public signals...
485 #undef signals
486 #define signals public
487 signals:
488 #undef signals
489 #define signals protected
490 
495  void enableAction( const char * name, bool enabled );
496 
504  void setActionText( const char * name, const TQString& text );
505 
512  void openURLRequest( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
513 
520  void openURLRequestDelayed( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
521 
537  void openURLNotify();
538 
542  void setLocationBarURL( const TQString &url );
543 
547  void setIconURL( const KURL &url );
548 
556  void createNewWindow( const KURL &url, const KParts::URLArgs &args = KParts::URLArgs() );
557 
565  void createNewWindow( const KURL &url, const KParts::URLArgs &args,
566  const KParts::WindowArgs &windowArgs, KParts::ReadOnlyPart *&part );
567 
576  void loadingProgress( int percent );
580  void speedProgress( int bytesPerSecond );
581 
582  void infoMessage( const TQString & );
583 
588  void popupMenu( const TQPoint &global, const KFileItemList &items );
589 
596  void popupMenu( KXMLGUIClient *client, const TQPoint &global, const KFileItemList &items );
597 
598  void popupMenu( KXMLGUIClient *client, const TQPoint &global, const KFileItemList &items, const KParts::URLArgs &args, KParts::BrowserExtension::PopupFlags i );
599 
608  void popupMenu( const TQPoint &global, const KURL &url,
609  const TQString &mimeType, mode_t mode = (mode_t)-1 );
610 
620  void popupMenu( KXMLGUIClient *client,
621  const TQPoint &global, const KURL &url,
622  const TQString &mimeType, mode_t mode = (mode_t)-1 );
623 
633  void popupMenu( KXMLGUIClient *client,
634  const TQPoint &global, const KURL &url,
635  const KParts::URLArgs &args, KParts::BrowserExtension::PopupFlags i, mode_t mode = (mode_t)-1 );
636 
642  void selectionInfo( const KFileItemList &items );
647  void selectionInfo( const TQString &text );
652  void selectionInfo( const KURL::List &urls );
653 
658  void mouseOverInfo( const KFileItem* item );
659 
664  void addWebSideBar(const KURL &url, const TQString& name);
665 
669  void moveTopLevelWidget( int x, int y );
670 
674  void resizeTopLevelWidget( int w, int h );
675 
680  void requestFocus(KParts::ReadOnlyPart *part);
681 
687  void setPageSecurity( int );
688 
689 #define TDEPARTS_BROWSEREXTENSION_HAS_ITEMS_REMOVED
690 
694  void itemsRemoved( const KFileItemList &items );
695 
696 private slots:
697  void slotCompleted();
698  void slotOpenURLRequest( const KURL &url, const KParts::URLArgs &args );
699  void slotEmitOpenURLRequestDelayed();
700  void slotEnableAction( const char *, bool );
701  void slotSetActionText( const char*, const TQString& );
702 
703 private:
704  KParts::ReadOnlyPart *m_part;
705  URLArgs m_args;
706 public:
707  typedef TQMap<TQCString,int> ActionNumberMap;
708 
709 private:
710  static ActionNumberMap * s_actionNumberMap;
711  static ActionSlotMap * s_actionSlotMap;
712  static void createActionSlotMap();
713 protected:
714  virtual void virtual_hook( int id, void* data );
715 private:
716  BrowserExtensionPrivate *d;
717 };
718 
724 class TDEPARTS_EXPORT BrowserHostExtension : public TQObject
725 {
726  Q_OBJECT
727 public:
728  BrowserHostExtension( KParts::ReadOnlyPart *parent,
729  const char *name = 0L );
730 
731  virtual ~BrowserHostExtension();
732 
738  virtual TQStringList frameNames() const;
739 
745  virtual const TQPtrList<KParts::ReadOnlyPart> frames() const;
746 
752  BrowserHostExtension *findFrameParent(KParts::ReadOnlyPart *callingPart, const TQString &frame);
753 
758  virtual bool openURLInFrame( const KURL &url, const KParts::URLArgs &urlArgs );
759 
764  static BrowserHostExtension *childObject( TQObject *obj );
765 
766 protected:
772  enum { VIRTUAL_FIND_FRAME_PARENT = 0x10 };
773  struct FindFrameParentParams
774  {
775  BrowserHostExtension *parent;
776  KParts::ReadOnlyPart *callingPart;
777  TQString frame;
778  };
779 
780  virtual void virtual_hook( int id, void* data );
781 private:
782  class BrowserHostExtensionPrivate;
783  BrowserHostExtensionPrivate *d;
784 };
785 
792 class TDEPARTS_EXPORT LiveConnectExtension : public TQObject
793 {
794  Q_OBJECT
795 public:
796  enum Type {
797  TypeVoid=0, TypeBool, TypeFunction, TypeNumber, TypeObject, TypeString
798  };
799  typedef TQValueList<QPair<Type, TQString> > ArgList;
800 
801  LiveConnectExtension( KParts::ReadOnlyPart *parent, const char *name = 0L );
802 
803  virtual ~LiveConnectExtension() {}
807  virtual bool get( const unsigned long objid, const TQString & field, Type & type, unsigned long & retobjid, TQString & value );
811  virtual bool put( const unsigned long objid, const TQString & field, const TQString & value );
815  virtual bool call( const unsigned long objid, const TQString & func, const TQStringList & args, Type & type, unsigned long & retobjid, TQString & value );
819  virtual void unregister( const unsigned long objid );
820 
821  static LiveConnectExtension *childObject( TQObject *obj );
822 signals:
826  virtual void partEvent( const unsigned long objid, const TQString & event, const ArgList & args );
827 };
828 
829 }
830 
831 #endif
832 
KParts::BrowserExtension
The Browser Extension is an extension (yes, no kidding) to KParts::ReadOnlyPart, which allows a bette...
Definition: browserextension.h:308
KURL
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::URLArgs::frameName
TQString frameName
The frame in which to open the URL.
Definition: browserextension.h:139
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::URLArgs::docState
TQStringList docState
This buffer can be used by the part to save and restore its contents.
Definition: browserextension.h:70
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::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::yOffset
int yOffset
yOffset vertical scrolling position, xOffset.
Definition: browserextension.h:85
KParts
Definition: browserextension.cpp:64
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::URLArgs::serviceType
TQString serviceType
The servicetype (usually mimetype) to use when opening the next URL.
Definition: browserextension.h:89
KParts::ReadOnlyPart
Base class for any "viewer" part.
Definition: part.h:338
KParts::URLArgs::postData
TQByteArray postData
TDEHTML-specific field, contents of the HTTP POST data.
Definition: browserextension.h:94

tdeparts

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

tdeparts

Skip menu "tdeparts"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  •     tdecore
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  • tdeioslave
  •   http
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeparts by doxygen 1.8.8
This website is maintained by Timothy Pearson.