KParts
#include <part.h>
Public Slots | |
virtual bool | save () |
void | setModified () |
bool | waitSaveComplete () |
Public Slots inherited from KParts::ReadOnlyPart | |
virtual bool | openUrl (const KUrl &url) |
Signals | |
void | sigQueryClose (bool *handled, bool *abortClosing) |
Signals inherited from KParts::ReadOnlyPart | |
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) |
Protected Member Functions | |
virtual bool | saveFile ()=0 |
virtual bool | saveToUrl () |
Protected Member Functions inherited from KParts::ReadOnlyPart | |
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 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) |
Additional Inherited Members | |
Public Types inherited from KXMLGUIClient | |
enum | ReverseStateChange |
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 () |
Protected Attributes inherited from KParts::PartBase | |
PartBasePrivate * | d_ptr |
Properties inherited from KParts::ReadOnlyPart | |
KUrl | url |
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.
Constructor & Destructor Documentation
|
explicit |
|
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.
Member Function Documentation
|
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 KParts::ReadOnlyPart.
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()
bool ReadWritePart::isModified | ( | ) | const |
bool ReadWritePart::isReadWrite | ( | ) | const |
|
virtual |
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.
|
virtualslot |
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.
|
protectedpure virtual |
Save to a local file.
You need to implement it, to save to the local file. The framework takes care of re-uploading afterwards.
- Returns
- true on success, false on failure. On failure the function should inform the user about the problem with an appropriate message box. Standard error messages can be constructed using KIO::buildErrorString() in combination with the error codes defined in kio/global.h
|
protectedvirtual |
Save the file.
Uploads the file, if url
is remote. This will emit started(), and either completed() or canceled(), in case you want to provide feedback.
- Returns
- true on success, false on failure.
|
virtual |
|
slot |
Call setModified() whenever the contents get modified.
This is a slot for convenience, since it simply calls setModified(true), so that you can connect it to a signal, like textChanged().
|
virtual |
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
|
slot |
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:42 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.