KParts::ReadWritePart Class Reference
Base class for an "editor" part. More...
#include <part.h>
Inheritance diagram for KParts::ReadWritePart:

Public Slots | |
virtual void | setModified () |
virtual bool | save () |
bool | waitSaveComplete () |
Signals | |
void | sigQueryClose (bool *handled, bool *abortClosing) |
Public Member Functions | |
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) |
Protected Slots | |
void | slotUploadFinished (KIO::Job *job) |
Protected Member Functions | |
virtual bool | saveFile ()=0 |
virtual bool | saveToURL () |
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.
Definition at line 535 of file part.h.
Constructor & Destructor Documentation
|
Constructor See parent constructor for instructions.
|
|
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. |
Member Function Documentation
|
Definition at line 557 of file part.h. Referenced by closeURL(), and queryClose(). |
|
Changes the behavior of this part to readonly or readwrite.
|
|
Definition at line 568 of file part.h. Referenced by closeURL(), and 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().
Definition at line 482 of file part.cpp. References KURL::fileName(), KFileDialog::getSaveURL(), KURL::isEmpty(), isModified(), isReadWrite(), save(), saveAs(), sigQueryClose(), KParts::ReadOnlyPart::url(), waitSaveComplete(), KMessageBox::warningYesNoCancel(), and KParts::Part::widget(). Referenced by closeURL(). |
|
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.
Reimplemented from KParts::ReadOnlyPart. Definition at line 524 of file part.cpp. References KParts::ReadOnlyPart::closeURL(), isModified(), isReadWrite(), and queryClose(). Referenced by 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()
Definition at line 536 of file part.cpp. References KParts::ReadOnlyPart::closeURL(), and closeURL(). |
|
Save the file to a new location. Calls save(), no need to reimplement Definition at line 551 of file part.cpp. References KURL::isLocalFile(), KURL::isValid(), kdError(), KTempFile::name(), KURL::path(), KURL::prettyURL(), save(), KParts::Part::setWindowCaption(), and KURL::url(). Referenced by queryClose(). |
|
Sets the modified flag of the part.
|
|
set handled to true, if you don't want the default handling set abortClosing to true, if you handled the request, but for any reason don't want to allow closing the document Referenced by queryClose(). |
|
Call setModified() whenever the contents get modified. This is a slot for convenience, so that you can connect it to a signal, like textChanged(). Definition at line 477 of file part.cpp. Referenced by saveToURL(). |
|
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. Definition at line 541 of file part.cpp. References KParts::ReadOnlyPart::canceled(), saveFile(), and saveToURL(). Referenced by queryClose(), and saveAs(). |
|
Waits for any pending upload job to finish and returns whether the last save() action was successful.
Definition at line 669 of file part.cpp. Referenced by queryClose(). |
|
Save to a local file.
You need to implement it, to save to
Referenced by save(). |
|
Save the file.
Uploads the file, if
Definition at line 595 of file part.cpp. References KParts::ReadOnlyPart::completed(), KIO::file_move(), KURL::isLocalFile(), KTempFile::name(), setModified(), KURL::setPath(), KTempFile::unlink(), and KParts::Part::widget(). Referenced by save(). |
The documentation for this class was generated from the following files: