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

KParts

  • KParts
  • ReadOnlyPart
Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
KParts::ReadOnlyPart Class Reference

#include <part.h>

Inheritance diagram for KParts::ReadOnlyPart:
Inheritance graph
[legend]

Public Slots

virtual bool openUrl (const KUrl &url)
 

Signals

void canceled (const QString &errMsg)
 
void completed ()
 
void completed (bool pendingAction)
 
void started (KIO::Job *)
 
void urlChanged (const KUrl &url)
 
- Signals inherited from KParts::Part
void setStatusBarText (const QString &text)
 
void setWindowCaption (const QString &caption)
 

Public Member Functions

 ReadOnlyPart (QObject *parent=0)
 
virtual ~ReadOnlyPart ()
 
OpenUrlArguments arguments () const
 
BrowserExtension * browserExtension () const
 
bool closeStream ()
 
virtual bool closeUrl ()
 
bool isProgressInfoEnabled () const
 
bool openStream (const QString &mimeType, const KUrl &url)
 
void setArguments (const OpenUrlArguments &arguments)
 
void setProgressInfoEnabled (bool show)
 
void showProgressInfo (bool show)
 
KUrl url () const
 
bool writeStream (const QByteArray &data)
 
- Public Member Functions inherited from KParts::Part
 Part (QObject *parent=0)
 
virtual ~Part ()
 
virtual void embed (QWidget *parentWidget)
 
virtual Part * hitTest (QWidget *widget, const QPoint &globalPos)
 
KIconLoader * iconLoader ()
 
bool isSelectable () const
 
PartManager * manager () const
 
void setAutoDeletePart (bool autoDeletePart)
 
void setAutoDeleteWidget (bool autoDeleteWidget)
 
virtual void setManager (PartManager *manager)
 
virtual void setSelectable (bool selectable)
 
virtual QWidget * widget ()
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObject * child (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArray > dynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
T findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObject * metaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObject * parent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThread * thread () const
 
- Public Member Functions inherited from KParts::PartBase
 PartBase ()
 
virtual ~PartBase ()
 
QObject * partObject () const
 
void setPartObject (QObject *object)
 
- Public Member Functions inherited from KXMLGUIClient
 KXMLGUIClient ()
 
 KXMLGUIClient (KXMLGUIClient *parent)
 
virtual ~KXMLGUIClient ()
 
QAction * action (const char *name) const
 
virtual QAction * action (const QDomElement &element) const
 
virtual KActionCollection * actionCollection () const
 
void addStateActionDisabled (const QString &state, const QString &action)
 
void addStateActionEnabled (const QString &state, const QString &action)
 
void beginXMLPlug (QWidget *)
 
QList< KXMLGUIClient * > childClients ()
 
KXMLGUIBuilder * clientBuilder () const
 
virtual KComponentData componentData () const
 
virtual QDomDocument domDocument () const
 
void endXMLPlug ()
 
KXMLGUIFactory * factory () const
 
StateChange getActionsToChangeForState (const QString &state)
 
void insertChildClient (KXMLGUIClient *child)
 
virtual QString localXMLFile () const
 
KXMLGUIClient * parentClient () const
 
void plugActionList (const QString &name, const QList< QAction * > &actionList)
 
void prepareXMLUnplug (QWidget *)
 
void reloadXML ()
 
void removeChildClient (KXMLGUIClient *child)
 
void replaceXMLFile (const QString &xmlfile, const QString &localxmlfile, bool merge=false)
 
void setClientBuilder (KXMLGUIBuilder *builder)
 
void setFactory (KXMLGUIFactory *factory)
 
void setXMLGUIBuildDocument (const QDomDocument &doc)
 
void unplugActionList (const QString &name)
 
virtual QString xmlFile () const
 
QDomDocument xmlguiBuildDocument () const
 

Protected Member Functions

 ReadOnlyPart (ReadOnlyPartPrivate &dd, QObject *parent)
 
void abortLoad ()
 
virtual void guiActivateEvent (GUIActivateEvent *event)
 
bool isLocalFileTemporary () const
 
QString localFilePath () const
 
virtual bool openFile ()
 
void setLocalFilePath (const QString &localFilePath)
 
void setLocalFileTemporary (bool temp)
 
void setUrl (const KUrl &url)
 
- Protected Member Functions inherited from KParts::Part
 Part (PartPrivate &dd, QObject *parent)
 
virtual void customEvent (QEvent *event)
 
QWidget * hostContainer (const QString &containerName)
 
void loadPlugins ()
 
virtual void partActivateEvent (PartActivateEvent *event)
 
virtual void partSelectEvent (PartSelectEvent *event)
 
virtual void setWidget (QWidget *widget)
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Member Functions inherited from KParts::PartBase
 PartBase (PartBasePrivate &dd)
 
void loadPlugins (QObject *parent, KXMLGUIClient *parentGUIClient, const KComponentData &componentData)
 
virtual void setComponentData (const KComponentData &componentData)
 
virtual void setComponentData (const KComponentData &componentData, bool loadPlugins)
 
void setPluginInterfaceVersion (int version)
 
void setPluginLoadingMode (PluginLoadingMode loadingMode)
 
- Protected Member Functions inherited from KXMLGUIClient
void loadStandardsXmlFile ()
 
virtual void setDOMDocument (const QDomDocument &document, bool merge=false)
 
virtual void setLocalXMLFile (const QString &file)
 
virtual void setXML (const QString &document, bool merge=false)
 
virtual void setXMLFile (const QString &file, bool merge=false, bool setXMLDoc=true)
 
virtual void stateChanged (const QString &newstate, ReverseStateChange reverse=StateNoReverse)
 
virtual void virtual_hook (int id, void *data)
 

Properties

KUrl url
 
- Properties inherited from QObject
 objectName
 

Additional Inherited Members

- Public Types inherited from KXMLGUIClient
enum  ReverseStateChange
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Static Public Member Functions inherited from KXMLGUIClient
static QString findMostRecentXMLFile (const QStringList &files, QString &doc)
 
- Protected Types inherited from KParts::PartBase
enum  PluginLoadingMode { DoNotLoadPlugins = 0, LoadPlugins = 1, LoadPluginsIfEnabled = 2 }
 
- Protected Slots inherited from KParts::Part
void slotWidgetDestroyed ()
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Protected Attributes inherited from KParts::PartBase
PartBasePrivate * d_ptr
 

Detailed Description

Base class for any "viewer" part.

This class takes care of network transparency for you, in the simplest way (downloading to a temporary file, then letting the part load from the temporary file). To use the built-in network transparency, you only need to implement openFile(), not openUrl().

To implement network transparency differently (e.g. for progressive loading, like a web browser does for instance), or to prevent network transparency (but why would you do that?), you can override openUrl().

KParts Application can use the signals to show feedback while the URL is being loaded.

ReadOnlyPart handles the window caption by setting it to the current URL (set in openUrl(), and each time the part is activated). If you want another caption, set it in openFile() and (if the part might ever be used with a part manager) in guiActivateEvent()

Definition at line 488 of file part.h.

Constructor & Destructor Documentation

ReadOnlyPart::ReadOnlyPart ( QObject *  parent = 0)
explicit

Constructor See also Part for the setXXX methods to call.

Definition at line 450 of file part.cpp.

ReadOnlyPart::~ReadOnlyPart ( )
virtual

Destructor.

Definition at line 460 of file part.cpp.

ReadOnlyPart::ReadOnlyPart ( ReadOnlyPartPrivate &  dd,
QObject *  parent 
)
protected

Definition at line 455 of file part.cpp.

Member Function Documentation

void ReadOnlyPart::abortLoad ( )
protected

Definition at line 630 of file part.cpp.

OpenUrlArguments KParts::ReadOnlyPart::arguments ( ) const
Returns
the arguments that were used to open this URL.

Definition at line 760 of file part.cpp.

BrowserExtension * ReadOnlyPart::browserExtension ( ) const

This convenience method returns the browserExtension for this part, or 0 if there isn't any.

Definition at line 748 of file part.cpp.

void KParts::ReadOnlyPart::canceled ( const QString &  errMsg)
signal

Emit this if loading is canceled by the user or by an error.

Parameters
errMsgthe error message, empty if the user canceled the loading voluntarily.
bool ReadOnlyPart::closeStream ( )

Terminate the sending of data to the part.

With some data types (text, html...) closeStream might never actually be called, in the case of continuous streams, for instance plain text or HTML data.

Definition at line 743 of file part.cpp.

bool ReadOnlyPart::closeUrl ( )
virtual

Called when closing the current url (e.g.

document), for instance when switching to another url (note that openUrl() calls it automatically in this case). If the current URL is not fully loaded yet, aborts loading. Deletes the temporary file used when the url is remote.

Returns
always true, but the return value exists for reimplementations

Reimplemented in KParts::ReadWritePart.

Definition at line 646 of file part.cpp.

void KParts::ReadOnlyPart::completed ( )
signal

Emit this when you have completed loading data.

Hosting apps will want to know when the process of loading the data is finished, so that they can access the data when everything is loaded.

void KParts::ReadOnlyPart::completed ( bool  pendingAction)
signal

Same as the above signal except it indicates whether there is a pending action to be executed on a delay timer.

An example of this is the meta-refresh tags on web pages used to reload/redirect after a certain period of time. This signal is useful if you want to give the user the ability to cancel such pending actions.

pendingAction true if a pending action exists, false otherwise.

void ReadOnlyPart::guiActivateEvent ( GUIActivateEvent *  event)
protectedvirtual

Reimplemented from Part, so that the window caption is set to the current url (decoded) when the part is activated This is the usual behavior in 99% of the apps Reimplement if you don't like it - test for event->activated() !

Technical note : this is done with GUIActivateEvent and not with PartActivateEvent because it's handled by the mainwindow (which gets the even after the PartActivateEvent events have been sent)

Reimplemented from KParts::Part.

Definition at line 712 of file part.cpp.

bool ReadOnlyPart::isLocalFileTemporary ( ) const
protected

Definition at line 495 of file part.cpp.

bool ReadOnlyPart::isProgressInfoEnabled ( ) const

Returns whether the part shows the progress info dialog used by internal KIO job.

Definition at line 519 of file part.cpp.

QString ReadOnlyPart::localFilePath ( ) const
protected

Returns the local file path associated with this part.

Definition at line 480 of file part.cpp.

bool ReadOnlyPart::openFile ( )
protectedvirtual

If the part uses the standard implementation of openUrl(), it must reimplement this, to open the local file.

The default implementation is simply { return false; }

Definition at line 569 of file part.cpp.

bool ReadOnlyPart::openStream ( const QString &  mimeType,
const KUrl &  url 
)

Initiate sending data to this part.

This is an alternative to openUrl, which allows the user of the part to load the data itself, and send it progressively to the part.

Parameters
mimeTypethe type of data that is going to be sent to this part.
urlthe URL representing this data. Although not directly used, every ReadOnlyPart has a URL (see url()), so this simply sets it.
Returns
true if the part supports progressive loading and accepts data, false otherwise.

Definition at line 726 of file part.cpp.

bool ReadOnlyPart::openUrl ( const KUrl &  url)
virtualslot

Only reimplement openUrl if you don't want the network transparency support to download from the url into a temporary file (when the url isn't local).

Otherwise, reimplement openFile() only .

If you reimplement it, don't forget to set the caption, usually with emit setWindowCaption( url.prettyUrl() );

Definition at line 535 of file part.cpp.

void KParts::ReadOnlyPart::setArguments ( const OpenUrlArguments &  arguments)

Sets the arguments to use for the next openUrl call.

Definition at line 753 of file part.cpp.

void ReadOnlyPart::setLocalFilePath ( const QString &  localFilePath)
protected

Sets the local file path associated with this part.

Definition at line 487 of file part.cpp.

void ReadOnlyPart::setLocalFileTemporary ( bool  temp)
protected

Definition at line 504 of file part.cpp.

void ReadOnlyPart::setProgressInfoEnabled ( bool  show)

Call this to turn off the progress info dialog used by the internal KIO job.

Use this if you provide another way of displaying progress info (e.g. a statusbar), using the signals emitted by this class, and/or those emitted by the Job given by started.

Definition at line 512 of file part.cpp.

void ReadOnlyPart::setUrl ( const KUrl &  url)
protected

Sets the url associated with this part.

Definition at line 472 of file part.cpp.

void ReadOnlyPart::showProgressInfo ( bool  show)

Definition at line 527 of file part.cpp.

void KParts::ReadOnlyPart::started ( KIO::Job *  )
signal

The part emits this when starting data.

If using a KIO::Job, it sets the job in the signal, so that progress information can be shown. Otherwise, job is 0.

KUrl KParts::ReadOnlyPart::url ( ) const

Returns the URL currently opened in this part.

Returns
The current URL.
void KParts::ReadOnlyPart::urlChanged ( const KUrl &  url)
signal

Emitted by the part when url() changes.

Since
4.10
bool ReadOnlyPart::writeStream ( const QByteArray &  data)

Send some data to the part.

openStream must have been called previously, and must have returned true.

Returns
true if the data was accepted by the part. If false is returned, the application should stop sending data, and doesn't have to call closeStream.

Definition at line 738 of file part.cpp.

Property Documentation

KUrl ReadOnlyPart::url
read

Definition at line 492 of file part.h.


The documentation for this class was generated from the following files:
  • part.h
  • part.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:25:36 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • 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