KParts::ReadOnlyPart Class Reference
Base class for any "viewer" part. More...
#include <part.h>
Inheritance diagram for KParts::ReadOnlyPart:

Public Slots | |
virtual bool | openURL (const KURL &url) |
Signals | |
void | started (KIO::Job *) |
void | completed () |
void | completed (bool pendingAction) |
void | canceled (const QString &errMsg) |
Public Methods | |
ReadOnlyPart (QObject *parent=0, const char *name=0) | |
virtual | ~ReadOnlyPart () |
void | setProgressInfoEnabled (bool show) |
bool | isProgressInfoEnabled () const |
void | showProgressInfo (bool show) |
KURL | url () const |
virtual bool | closeURL () |
bool | openStream (const QString &mimeType, const KURL &url) |
bool | writeStream (const QByteArray &data) |
bool | closeStream () |
Protected Slots | |
void | slotJobFinished (KIO::Job *job) |
Protected Methods | |
virtual bool | openFile ()=0 |
void | abortLoad () |
virtual void | guiActivateEvent (GUIActivateEvent *event) |
Protected Attributes | |
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()
Definition at line 330 of file part.h.
Constructor & Destructor Documentation
|
Constructor See also Part for the setXXX methods to call.
|
|
Destructor.
|
Member Function Documentation
|
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. |
|
Returns whether the part shows the progress info dialog used by internal KIO job.
|
|
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() ); Definition at line 331 of file part.cpp. References closeURL(), completed(), QObject::connect(), QFileInfo::extension(), KIO::file_copy(), KURL::fileName(), QString::isEmpty(), KURL::isLocalFile(), QString::isNull(), KURL::isValid(), m_bTemp, m_file, m_url, KTempFile::name(), openFile(), KURL::path(), KURL::prettyURL(), KURL::query(), KURL::setPath(), KParts::Part::setWindowCaption(), started(), and KParts::Part::widget(). Referenced by KParts::BrowserExtension::restoreState(). |
|
Returns the currently in part used URL.
Definition at line 381 of file part.h. References m_url. Referenced by KParts::ReadWritePart::queryClose(), KParts::BrowserExtension::saveState(), and KParts::BrowserRun::scanFile(). |
|
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.
Reimplemented in KParts::ReadWritePart. Definition at line 383 of file part.cpp. References QFile::encodeName(), m_bTemp, and m_file. Referenced by openStream(), and openURL(). |
|
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.
|
|
Send some data to the part. openStream must have been called previously, and must have returned true.
|
|
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. |
|
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. Referenced by openURL(). |
|
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. Referenced by openURL(), and KParts::ReadWritePart::saveToURL(). |
|
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.
|
|
Emit this if loading is canceled by the user or by an error.
|
|
If the part uses the standard implementation of openURL(), it must reimplement this, to open Otherwise simply define it to { return false; } Referenced by openURL(). |
|
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 413 of file part.cpp. References KParts::GUIActivateEvent::activated(), KURL::isEmpty(), m_url, KURL::prettyURL(), and KParts::Part::setWindowCaption(). |
Member Data Documentation
|
Remote (or local) url - the one displayed to the user.
Definition at line 506 of file part.h. Referenced by guiActivateEvent(), openStream(), openURL(), KParts::ReadWritePart::queryClose(), KParts::ReadWritePart::saveAs(), KParts::ReadWritePart::saveToURL(), and url(). |
|
Local file - the only one the part implementation should deal with.
Definition at line 510 of file part.h. Referenced by closeURL(), openURL(), KParts::ReadWritePart::saveAs(), and KParts::ReadWritePart::saveToURL(). |
|
If
Definition at line 514 of file part.h. Referenced by closeURL(), openURL(), KParts::ReadWritePart::saveAs(), and KParts::ReadWritePart::saveToURL(). |
The documentation for this class was generated from the following files: