org.kde.koala

Class ReadWritePart

public class ReadWritePart extends ReadOnlyPart

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(). See ReadWritePartSignals for signals emitted by ReadWritePart

UNKNOWN: Base class for an "editor" part.

Constructor Summary
protected ReadWritePart(Class dummy)
Method Summary
StringclassName()
booleancloseURL()
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).
booleancloseURL(boolean promptToSave)
Call this method instead of the above if you need control if the save prompt is shown.
booleanisModified()
booleanisReadWrite()
QMetaObjectmetaObject()
booleanqueryClose()
If the document has been modified, ask the user to save changes.
booleansave()
Save the file in the location from which it was opened.
booleansaveAs(KURL url)
Save the file to a new location.
voidsetModified(boolean modified)
Sets the modified flag of the part.
voidsetModified()
Call setModified() whenever the contents get modified.
voidsetReadWrite(boolean readwrite)
Changes the behavior of this part to readonly or readwrite.
voidsetReadWrite()
booleanwaitSaveComplete()
Waits for any pending upload job to finish and returns whether the last save() action was successful.

Constructor Detail

ReadWritePart

protected ReadWritePart(Class dummy)

Method Detail

className

public String className()

closeURL

public boolean 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.

Returns: false on cancel

UNKNOWN: Called when closing the current url (e.

closeURL

public boolean closeURL(boolean promptToSave)
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()

UNKNOWN: Call this method instead of the above if you need control if the save prompt is shown.

isModified

public boolean isModified()

Returns: true if the document has been modified.

UNKNOWN:

isReadWrite

public boolean isReadWrite()

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

UNKNOWN:

metaObject

public QMetaObject metaObject()

queryClose

public boolean 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.

UNKNOWN: If the document has been modified, ask the user to save changes.

save

public boolean save()
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.

UNKNOWN: Save the file in the location from which it was opened.

saveAs

public boolean saveAs(KURL url)
Save the file to a new location. Calls save(), no need to reimplement

UNKNOWN: Save the file to a new location.

setModified

public void setModified(boolean modified)
Sets the modified flag of the part.

UNKNOWN: Sets the modified flag of the part.

setModified

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

UNKNOWN: Call setModified() whenever the contents get modified.

setReadWrite

public void setReadWrite(boolean readwrite)
Changes the behavior of this part to readonly or readwrite.

Parameters: readwrite set to true to enable readwrite mode

UNKNOWN: Changes the behavior of this part to readonly or readwrite.

setReadWrite

public void setReadWrite()

waitSaveComplete

public boolean waitSaveComplete()
Waits for any pending upload job to finish and returns whether the last save() action was successful.

UNKNOWN: Waits for any pending upload job to finish and returns whether the last save() action was successful.