class ReadWritePart

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

#### Public Methods

- ReadWritePart ( QObject *parent = 0, const char *name = 0 )
- virtual ~ReadWritePart ()
- bool isReadWrite () const
- virtual void setReadWrite ( bool readwrite = true )
- bool isModified () const
- bool queryClose ()
- virtual bool closeURL ()
- bool closeURL ( bool promptToSave )
- virtual bool saveAs ( const KURL &url )
- virtual void setModified ( bool modified )

#### Public Slots

- virtual void setModified ()
- virtual bool save ()

#### Protected Methods

- virtual bool saveFile ()
- virtual bool saveToURL ()

#### Protected Slots

- void slotUploadFinished ( KIO::Job * job )

## Detailed Description

Base class for an "editor" part.

This class handles network transparency for you. Anything that can open a URL, allow modifications, and save (to the same URL or a different one).

A read-write part can be set to read-only mode, using setReadWrite().

Part writers : Any part inheriting ReadWritePart should check isReadWrite before allowing any action that modifies the part. The part probably wants to reimplement setReadWrite, disable those actions. Don't forget to call the parent setReadWrite.

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

Constructor See parent constructor for instructions.

~ReadWritePart () | ### ~ReadWritePart

[virtual]

Destructor Applications using a ReadWritePart should make sure, before destroying it, to call closeURL(). In KMainWindow::queryClose(), for instance, they should allow closing only if the return value of closeURL() was true. This allows to cancel.

bool isReadWrite () | ### isReadWrite

[const]

Returns: true if the part is in read-write mode

void setReadWrite ( bool readwrite = true ) | ### setReadWrite

[virtual]

Changes the behaviour of this part to readonly or readwrite.

Parameters:

readwrite | set to true to enable readwrite mode

bool isModified () | ### isModified

[const]

Returns: true if the document has been modified.

bool queryClose () | ### queryClose

If the document has been modified, ask the user to save changes. This method is meant to be called from KMainWindow::queryClose(). It will also be called from closeURL().

Returns: true if closeURL() can be called without the user losing important data, false if the user chooses to cancel.

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.

If isModified(), queryClose() will be called.

Returns: false on cancel

Reimplemented from ReadOnlyPart.

bool closeURL ( bool promptToSave ) | ### closeURL

Call this method instead of the above if you need control if the save prompt is shown. For example, if you call queryClose() from KMainWindow::queryClose(), you would not want to prompt again when closing the url.

Equivalent to promptToSave ? closeURL() : ReadOnlyPart::closeURL()

Reimplemented from ReadOnlyPart.

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

[virtual]

Save the file to a new location.

Calls save(), no need to reimplement

void setModified ( bool modified ) | ### setModified

[virtual]

Sets the modified flag of the part.

void setModified () | ### setModified

[virtual slot]

Call setModified() whenever the contents get modified. This is a slot for convenience, so that you can connect it to a signal, like textChanged().

bool save () | ### save

[virtual slot]

Save the file in the location from which it was opened. You can connect this to the "save" action. Calls saveFile() and saveToURL(), no need to reimplement.

bool saveFile () | ### saveFile

[protected pure virtual]

Save to a local file. You need to implement it, to save to `m_file`. The framework takes care of re-uploading afterwards.

bool saveToURL () | ### saveToURL

[protected virtual]

Save the file.

Uploads the file, if `m_url` is remote. This will emit started(), and either completed() or canceled(), in case you want to provide feedback.

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

[protected slots slot]

Generated by: root on macppc.ports.openbsd.org on Sat Sep 6 10:37:24 2003, using kdoc 2.0a54.