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

KParts

  • 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
31template <class T1, class T2> struct QPair;
32template<typename T> class Q3PtrList;
33template <class Key, class T> class QMap;
34template<typename T> class QList;
35
36class KFileItem;
37class KFileItemList;
38class QDataStream;
39class QPoint;
40class QString;
41class QStringList;
42
43namespace KParts {
44
45class BrowserInterface;
46
47struct BrowserArgumentsPrivate;
48
64struct 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
181private:
182 BrowserArgumentsPrivate *d;
183};
184
185class WindowArgsPrivate;
186
192class KPARTS_EXPORT WindowArgs
193{
194public:
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
238private:
239 QSharedDataPointer<WindowArgsPrivate> d;
240};
241
249class KPARTS_EXPORT OpenUrlEvent : public Event
250{
251public:
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
264private:
265 class OpenUrlEventPrivate;
266 OpenUrlEventPrivate * const d;
267};
268
320class KPARTS_EXPORT BrowserExtension : public QObject
321{
322 Q_OBJECT
323 Q_PROPERTY( bool urlDropHandling READ isURLDropHandlingEnabled WRITE setURLDropHandlingEnabled )
324public:
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
495Q_SIGNALS:
496#if !defined(Q_MOC_RUN) && !defined(DOXYGEN_SHOULD_SKIP_THIS) && !defined(IN_IDE_PARSER)
497public: // yes, those signals are public; don't tell moc, doxygen or kdevelop :)
498#endif
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
689private 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
699public:
700 typedef QMap<QByteArray,int> ActionNumberMap;
701
702private:
703 class BrowserExtensionPrivate;
704 BrowserExtensionPrivate * const d;
705};
706
712class KPARTS_EXPORT BrowserHostExtension : public QObject
713{
714 Q_OBJECT
715public:
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
754private:
755 class BrowserHostExtensionPrivate;
756 BrowserHostExtensionPrivate * const d;
757};
758
765class KPARTS_EXPORT LiveConnectExtension : public QObject
766{
767 Q_OBJECT
768public:
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 );
795Q_SIGNALS:
796#if !defined(Q_MOC_RUN) && !defined(DOXYGEN_SHOULD_SKIP_THIS) && !defined(IN_IDE_PARSER)
797public: // yes, those signals are public; don't tell moc, doxygen or kdevelop :)
798#endif
802 void partEvent( const unsigned long objid, const QString & event, const KParts::LiveConnectExtension::ArgList & args );
803
804private:
805 class LiveConnectExtensionPrivate;
806 LiveConnectExtensionPrivate * const d;
807};
808
809}
810
811Q_DECLARE_OPERATORS_FOR_FLAGS( KParts::BrowserExtension::PopupFlags )
812
813#endif
814
KFileItemList
KFileItem
KParts::BrowserExtension
The Browser Extension is an extension (yes, no kidding) to KParts::ReadOnlyPart, which allows a bette...
Definition: browserextension.h:321
KParts::BrowserExtension::openUrlNotify
void openUrlNotify()
Tells the hosting browser that the part opened a new URL (which can be queried via KParts::Part::url(...
KParts::BrowserExtension::popupMenu
void popupMenu(const QPoint &global, const KUrl &url, mode_t mode=static_cast< mode_t >(-1), const KParts::OpenUrlArguments &args=KParts::OpenUrlArguments(), const KParts::BrowserArguments &browserArgs=KParts::BrowserArguments(), KParts::BrowserExtension::PopupFlags flags=KParts::BrowserExtension::DefaultPopupItems, const KParts::BrowserExtension::ActionGroupMap &actionGroups=ActionGroupMap())
Emit this to make the browser show a standard popup menu for the given url.
KParts::BrowserExtension::enableAction
void enableAction(const char *name, bool enabled)
Enables or disable a standard action held by the browser.
KParts::BrowserExtension::setLocationBarUrl
void setLocationBarUrl(const QString &url)
Updates the URL shown in the browser's location bar to url.
KParts::BrowserExtension::loadingProgress
void loadingProgress(int percent)
Since the part emits the jobid in the started() signal, progress information is automatically display...
KParts::BrowserExtension::speedProgress
void speedProgress(int bytesPerSecond)
KParts::BrowserExtension::resizeTopLevelWidget
void resizeTopLevelWidget(int w, int h)
Ask the hosting application to resize the top level widget.
KParts::BrowserExtension::selectionInfo
void selectionInfo(const QString &text)
Inform the hosting application about the current selection.
KParts::BrowserExtension::addWebSideBar
void addWebSideBar(const KUrl &url, const QString &name)
Ask the hosting application to add a new HTML (aka Mozilla/Netscape) SideBar entry.
KParts::BrowserExtension::ActionNumberMap
QMap< QByteArray, int > ActionNumberMap
Definition: browserextension.h:700
KParts::BrowserExtension::setActionText
void setActionText(const char *name, const QString &text)
Change the text of a standard action held by the browser.
KParts::BrowserExtension::ActionGroupMap
QMap< QString, QList< QAction * > > ActionGroupMap
Associates a list of actions with a predefined name known by the host's popupmenu: "editactions" for ...
Definition: browserextension.h:493
KParts::BrowserExtension::setPageSecurity
void setPageSecurity(int)
Tell the host (browser) about security state of current page enum PageSecurity { NotCrypted,...
KParts::BrowserExtension::requestFocus
void requestFocus(KParts::ReadOnlyPart *part)
Ask the hosting application to focus part.
KParts::BrowserExtension::selectionInfo
void selectionInfo(const KUrl::List &urls)
Inform the hosting application about the current selection.
KParts::BrowserExtension::openUrlRequestDelayed
void openUrlRequestDelayed(const KUrl &url, const KParts::OpenUrlArguments &arguments, const KParts::BrowserArguments &browserArguments)
This signal is emitted when openUrlRequest() is called, after a 0-seconds timer.
KParts::BrowserExtension::popupMenu
void popupMenu(const QPoint &global, const KFileItemList &items, const KParts::OpenUrlArguments &args=KParts::OpenUrlArguments(), const KParts::BrowserArguments &browserArgs=KParts::BrowserArguments(), KParts::BrowserExtension::PopupFlags flags=KParts::BrowserExtension::DefaultPopupItems, const KParts::BrowserExtension::ActionGroupMap &actionGroups=ActionGroupMap())
Emit this to make the browser show a standard popup menu for the files items.
KParts::BrowserExtension::createNewWindow
void createNewWindow(const KUrl &url, const KParts::OpenUrlArguments &arguments=KParts::OpenUrlArguments(), const KParts::BrowserArguments &browserArguments=KParts::BrowserArguments(), const KParts::WindowArgs &windowArgs=KParts::WindowArgs(), KParts::ReadOnlyPart **part=0)
Asks the hosting browser to open a new window for the given url and return a reference to the content...
KParts::BrowserExtension::moveTopLevelWidget
void moveTopLevelWidget(int x, int y)
Ask the hosting application to move the top level widget.
KParts::BrowserExtension::selectionInfo
void selectionInfo(const KFileItemList &items)
Inform the hosting application about the current selection.
KParts::BrowserExtension::itemsRemoved
void itemsRemoved(const KFileItemList &items)
Inform the host about items that have been removed.
KParts::BrowserExtension::mouseOverInfo
void mouseOverInfo(const KFileItem &item)
Inform the hosting application that the user moved the mouse over an item.
KParts::BrowserExtension::openUrlRequest
void openUrlRequest(const KUrl &url, const KParts::OpenUrlArguments &arguments=KParts::OpenUrlArguments(), const KParts::BrowserArguments &browserArguments=KParts::BrowserArguments())
Asks the host (browser) to open url.
KParts::BrowserExtension::ActionSlotMap
QMap< QByteArray, QByteArray > ActionSlotMap
Definition: browserextension.h:439
KParts::BrowserExtension::setIconUrl
void setIconUrl(const KUrl &url)
Sets the URL of an icon for the currently displayed page.
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
KParts::BrowserExtension::DefaultPopupItems
@ DefaultPopupItems
default value, no additional menu item
Definition: browserextension.h:339
KParts::BrowserExtension::infoMessage
void infoMessage(const QString &)
KParts::BrowserHostExtension
An extension class for container parts, i.e.
Definition: browserextension.h:713
KParts::BrowserInterface
The purpose of this interface is to allow a direct communication between a KPart and the hosting brow...
Definition: browserinterface.h:54
KParts::Event
Base class for all KParts events.
Definition: event.h:38
KParts::LiveConnectExtension
An extension class for LiveConnect, i.e.
Definition: browserextension.h:766
KParts::LiveConnectExtension::partEvent
void partEvent(const unsigned long objid, const QString &event, const KParts::LiveConnectExtension::ArgList &args)
notify a event from the part of object objid
KParts::LiveConnectExtension::ArgList
QList< QPair< Type, QString > > ArgList
Definition: browserextension.h:772
KParts::LiveConnectExtension::Type
Type
Definition: browserextension.h:769
KParts::LiveConnectExtension::TypeBool
@ TypeBool
Definition: browserextension.h:770
KParts::OpenUrlArguments
OpenUrlArguments is the set of arguments that specify how a URL should be opened by KParts::ReadOnlyP...
Definition: part.h:405
KParts::OpenUrlEvent
The KParts::OpenUrlEvent event informs that a given part has opened a given URL.
Definition: browserextension.h:250
KParts::ReadOnlyPart
Base class for any "viewer" part.
Definition: part.h:489
KParts::WindowArgs
The WindowArgs are used to specify arguments to the "create new window" call (see the createNewWindow...
Definition: browserextension.h:193
KUrl::List
KUrl
Q3PtrList
Definition: browserextension.h:32
QEvent
QList
QMap
QObject
QPair
event.h
put
TransferJob * put(const KUrl &url, int permissions, JobFlags flags=DefaultFlags)
get
TransferJob * get(const KUrl &url, LoadType reload=NoReload, JobFlags flags=DefaultFlags)
KParts
test
KGuiItem test()
part.h
KParts::BrowserArguments
BrowserArguments is a set of web-browsing-specific arguments, which allow specifying how a URL should...
Definition: browserextension.h:65
KParts::BrowserArguments::docState
QStringList docState
This buffer can be used by the part to save and restore its contents.
Definition: browserextension.h:81
KParts::BrowserArguments::postData
QByteArray postData
KHTML-specific field, contents of the HTTP POST data.
Definition: browserextension.h:94
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::frameName
QString frameName
The frame in which to open the URL.
Definition: browserextension.h:133
KParts::BrowserArguments::softReload
bool softReload
softReload is set when user just hits reload button.
Definition: browserextension.h:89
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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