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) |
Public Member Functions | |
ReadWritePart (QObject *parent=0) | |
virtual | ~ReadWritePart () |
virtual bool | closeUrl () |
virtual bool | closeUrl (bool promptToSave) |
bool | isModified () const |
bool | isReadWrite () const |
virtual bool | queryClose () |
virtual bool | saveAs (const KUrl &url) |
virtual void | setModified (bool modified) |
virtual void | setReadWrite (bool readwrite=true) |
Public Member Functions inherited from KParts::ReadOnlyPart | |
ReadOnlyPart (QObject *parent=0) | |
virtual | ~ReadOnlyPart () |
OpenUrlArguments | arguments () const |
BrowserExtension * | browserExtension () const |
bool | closeStream () |
bool | isProgressInfoEnabled () const |
bool | openStream (const QString &mimeType, const KUrl &url) |
void | setArguments (const OpenUrlArguments &arguments) |
void | setProgressInfoEnabled (bool show) |
void | showProgressInfo (bool show) |
KUrl | url () const |
bool | writeStream (const QByteArray &data) |
Public Member Functions inherited from KParts::Part | |
Part (QObject *parent=0) | |
virtual | ~Part () |
virtual void | embed (QWidget *parentWidget) |
virtual Part * | hitTest (QWidget *widget, const QPoint &globalPos) |
KIconLoader * | iconLoader () |
bool | isSelectable () const |
PartManager * | manager () const |
void | setAutoDeletePart (bool autoDeletePart) |
void | setAutoDeleteWidget (bool autoDeleteWidget) |
virtual void | setManager (PartManager *manager) |
virtual void | setSelectable (bool selectable) |
virtual QWidget * | widget () |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QObject (QObject *parent, const char *name) | |
virtual | ~QObject () |
bool | blockSignals (bool block) |
QObject * | child (const char *objName, const char *inheritsClass, bool recursiveSearch) const |
const QObjectList & | children () const |
const char * | className () const |
bool | connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const |
void | deleteLater () |
void | destroyed (QObject *obj) |
bool | disconnect (const QObject *receiver, const char *method) |
bool | disconnect (const char *signal, const QObject *receiver, const char *method) |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QByteArray > | dynamicPropertyNames () const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name) const |
QList< T > | findChildren (const QRegExp ®Exp) const |
QList< T > | findChildren (const QString &name) const |
bool | inherits (const char *className) const |
void | insertChild (QObject *object) |
void | installEventFilter (QObject *filterObj) |
bool | isA (const char *className) const |
bool | isWidgetType () const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
const char * | name () const |
const char * | name (const char *defaultName) const |
QString | objectName () const |
QObject * | parent () const |
QVariant | property (const char *name) const |
void | removeChild (QObject *object) |
void | removeEventFilter (QObject *obj) |
void | setName (const char *name) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval) |
QThread * | thread () const |
Public Member Functions inherited from KParts::PartBase | |
PartBase () | |
virtual | ~PartBase () |
QObject * | partObject () const |
void | setPartObject (QObject *object) |
Public Member Functions inherited from KXMLGUIClient | |
KXMLGUIClient () | |
KXMLGUIClient (KXMLGUIClient *parent) | |
virtual | ~KXMLGUIClient () |
QAction * | action (const char *name) const |
virtual QAction * | action (const QDomElement &element) const |
virtual KActionCollection * | actionCollection () const |
void | addStateActionDisabled (const QString &state, const QString &action) |
void | addStateActionEnabled (const QString &state, const QString &action) |
void | beginXMLPlug (QWidget *) |
QList< KXMLGUIClient * > | childClients () |
KXMLGUIBuilder * | clientBuilder () const |
virtual KComponentData | componentData () const |
virtual QDomDocument | domDocument () const |
void | endXMLPlug () |
KXMLGUIFactory * | factory () const |
StateChange | getActionsToChangeForState (const QString &state) |
void | insertChildClient (KXMLGUIClient *child) |
virtual QString | localXMLFile () const |
KXMLGUIClient * | parentClient () const |
void | plugActionList (const QString &name, const QList< QAction * > &actionList) |
void | prepareXMLUnplug (QWidget *) |
void | reloadXML () |
void | removeChildClient (KXMLGUIClient *child) |
void | replaceXMLFile (const QString &xmlfile, const QString &localxmlfile, bool merge=false) |
void | setClientBuilder (KXMLGUIBuilder *builder) |
void | setFactory (KXMLGUIFactory *factory) |
void | setXMLGUIBuildDocument (const QDomDocument &doc) |
void | unplugActionList (const QString &name) |
virtual QString | xmlFile () const |
QDomDocument | xmlguiBuildDocument () const |
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 QObject | |
bool | checkConnectArgs (const char *signal, const QObject *object, const char *method) |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const char *signal) |
virtual void | disconnectNotify (const char *signal) |
int | receivers (const char *signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
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 QObject | |
bool | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type) |
bool | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type) |
bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method) |
bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
QString | trUtf8 (const char *sourceText, const char *disambiguation, int n) |
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 () |
Static Protected Member Functions inherited from QObject | |
QByteArray | normalizeSignalSlot (const char *signalSlot) |
Protected Attributes inherited from KParts::PartBase | |
PartBasePrivate * | d_ptr |
Properties inherited from KParts::ReadOnlyPart | |
KUrl | url |
Properties inherited from QObject | |
objectName | |
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-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:25:36 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.