# class ReadOnlyPart | Base class for any "viewer" part. More...
Contains pure virtuals
Full name | `KParts::ReadOnlyPart`
Definition | `#include <part.h>`
Inherits | KParts::Part [public ]
Inherited by | ReadWritePart
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- ReadOnlyPart ( QObject *parent = 0, const char *name = 0 )
- virtual ~ReadOnlyPart ()
- void showProgressInfo ( bool show )
- virtual const KURL & url () const
- virtual bool closeURL ()

#### Public Slots

- virtual bool openURL ( const KURL &url )

#### Signals

- void started ( KIO::Job * )
- void completed ()
- void completed ( bool pendingAction )
- void canceled ( const QString &errMsg )

#### Protected Methods

- virtual bool openFile ()
- void abortLoad ()
- virtual void guiActivateEvent ( GUIActivateEvent *event )

#### Protected Slots

- void slotJobFinished ( KIO::Job * job )

#### Protected Members

- KURL m_url
- QString m_file
- bool m_bTemp

## Detailed Description

Base class for any "viewer" part.

This class takes care of network transparency for you, in the simplest way (synchronously). To use the built-in network transparency, you only need to implement openFile(), not openURL(). To prevent network transparency, or to implement it another way (e.g. asynchronously), 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()

ReadOnlyPart ( QObject *parent = 0, const char *name = 0 ) | ### ReadOnlyPart

Constructor See also Part for the setXXX methods to call.

~ReadOnlyPart () | ### ~ReadOnlyPart

[virtual]

Destructor

void showProgressInfo ( bool show ) | ### showProgressInfo

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.

bool openURL ( const KURL &url ) | ### openURL

[virtual slot]

Only reimplement openURL if you don't want synchronous network transparency Otherwise, reimplement openFile() only .

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

const KURL & url () | ### url

[const virtual]

Retrieves the currently in part used URL.

Returns: The current used URL.

bool closeURL () | ### 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

void started ( KIO::Job * ) | ### started

[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.

void completed () | ### 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 completed ( bool pendingAction ) | ### completed

[signal]

Same as the above signal except besides indicating that the data has been completely loaded it also informs the host, by setting the flag, that a pending action has been generated as a result of completing the requested task (loading the data). An example of this is meta-refresh tags on HTML pages which result in the page either being refreshed or the viewer being redirected to another page. By emitting this signal after appropriately setting the flag, the part can tell the host of the pending scheduled action inorder to give it a chance to accept or cancel that action.

`pendingAction` if true, a pending action exists (ex: a scheduled refresh)

void canceled ( const QString &errMsg ) | ### canceled

[signal]

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

void slotJobFinished ( KIO::Job * job ) | ### slotJobFinished

[protected slots slot]

bool openFile () | ### openFile

[protected pure virtual]

If the part uses the standard implementation of openURL(), it must reimplement this, to open `m_file`. Otherwise simply define it to { return false; }

void abortLoad () | ### abortLoad

[protected]

void guiActivateEvent ( GUIActivateEvent *event ) | ### guiActivateEvent

[protected virtual]

Reimplemented from Part, so that the window caption is set to the current url (decoded) when the part is activated This is the usual behaviour 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 Part.

KURL m_url | ### m_url

[protected]

QString m_file | ### m_file

[protected]

bool m_bTemp | ### m_bTemp

[protected]

Generated by: root@i386.ports.openbsd.org on Wed Apr 25 13:58:48 2001, using kdoc 2.0a53.