KTextEditor.ModificationInterface

KDE 4.9 PyKDE API Reference

- KDE's Python API

# ModificationInterface Class Reference

`from PyKDE4.ktexteditor import *`

Namespace: KTextEditor

## Detailed Description

External modification extension interface for the Document.

Introduction

The class ModificationInterface provides methods to handle modifications of all opened files caused by external programs. Whenever the modified-on-disk state changes the signal modifiedOnDisk() is emitted along with a ModifiedOnDiskReason. Set the state by calling setModifiedOnDisk(). Whether the Editor should show warning dialogs to inform the user about external modified files can be controlled with setModifiedOnDiskWarning(). The slot modifiedOnDisk() is called to ask the user what to do whenever a file was modified.

Accessing the ModificationInterface

The ModificationInterface is supposed to be an extension interface for a Document, i.e. the Document inherits the interface provided that the used KTextEditor library implements the interface. Use qobject_cast to access the interface:

     // doc is of type KTextEditor.Document*
     KTextEditor.ModificationInterface *iface =
         qobject_cast<KTextEditor.ModificationInterface*>( doc );

     if( iface ) {
         // the implementation supports the interface
         // do stuff
     }

See also:
  KTextEditor.Document

Author:
  Christoph Cullmann <cullmann@kde.org>

## Enumerations
ModifiedOnDiskReason | { OnDiskUnmodified, OnDiskModified, OnDiskCreated, OnDiskDeleted }
## Methods
| __init__ (self)
| modifiedOnDisk (self, KTextEditor.Document document, bool isModified, KTextEditor.ModificationInterface.ModifiedOnDiskReason reason)
| setModifiedOnDisk (self, KTextEditor.ModificationInterface.ModifiedOnDiskReason reason)
| setModifiedOnDiskWarning (self, bool on)
| slotModifiedOnDisk (self, KTextEditor.View view=0)

## Method Documentation

__init__ | ( |  | self ) |

modifiedOnDisk | ( | self, |
|  | KTextEditor.Document | document,
|  | bool | isModified,
|  | KTextEditor.ModificationInterface.ModifiedOnDiskReason | reason
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

This signal is emitted whenever the document changed its modified-on-disk state.

Parameters:

  | document | the Document object that represents the file on disk

Parameters:

  | isModified | if true, the file was modified rather than created or deleted

Parameters:

  | reason | the reason why the signal was emitted

See also:
  setModifiedOnDisk()

setModifiedOnDisk | ( | self, |
|  | KTextEditor.ModificationInterface.ModifiedOnDiskReason | reason
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Set the document's modified-on-disk state to reason. KTextEditor implementations should emit the signal modifiedOnDisk() along with the reason. When the document is in a clean state again the reason should be ModifiedOnDiskReason.OnDiskUnmodified.

Parameters:

  | reason | the modified-on-disk reason.

See also:
  ModifiedOnDiskReason, modifiedOnDisk()

setModifiedOnDiskWarning | ( | self, |
|  | bool | on
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Control, whether the editor should show a warning dialog whenever a file was modified on disk. If on is true the editor will show warning dialogs.

Parameters:

  | on | controls, whether the editor should show a warning dialog for files modified on disk

slotModifiedOnDisk | ( | self, |
|  | KTextEditor.View | view=0
| ) |  |  |

Abstract method:
  This method is abstract and can be overridden but not called directly.

Ask the user what to do, if the file was modified on disk. The argument view is used to avoid asking again, when the editor regains focus after the dialog is hidden.

Parameters:

  | view | the view that should be notified of the user's decision

See also:
  setModifiedOnDisk(), modifiedOnDisk()

## Enumeration Documentation

ModifiedOnDiskReason

Reasons why a document is modified on disk.

Enumerator:

  OnDiskUnmodified = 0 |
  OnDiskModified = 1 |
  OnDiskCreated = 2 |
  OnDiskDeleted = 3 |