• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • applications API Reference
  • KDE Home
  • Contact Us
 

KTextEditor

  • KTextEditor
  • ModificationInterface
Public Types | Public Member Functions | List of all members
KTextEditor::ModificationInterface Class Referenceabstract
Document Extension Interfaces

#include <modificationinterface.h>

Public Types

enum  ModifiedOnDiskReason { OnDiskUnmodified = 0, OnDiskModified = 1, OnDiskCreated = 2, OnDiskDeleted = 3 }
 

Public Member Functions

 ModificationInterface ()
 
virtual ~ModificationInterface ()
 
virtual void modifiedOnDisk (KTextEditor::Document *document, bool isModified, KTextEditor::ModificationInterface::ModifiedOnDiskReason reason)=0
 
virtual void setModifiedOnDisk (ModifiedOnDiskReason reason)=0
 
virtual void setModifiedOnDiskWarning (bool on)=0
 
virtual void slotModifiedOnDisk (View *view=0)=0
 

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 <cullm.nosp@m.ann@.nosp@m.kde.o.nosp@m.rg>

Definition at line 70 of file modificationinterface.h.

Member Enumeration Documentation

enum KTextEditor::ModificationInterface::ModifiedOnDiskReason

Reasons why a document is modified on disk.

Enumerator
OnDiskUnmodified 

Not modified.

OnDiskModified 

The file was modified by another program.

OnDiskCreated 

The file was created by another program.

OnDiskDeleted 

The file was deleted.

Definition at line 84 of file modificationinterface.h.

Constructor & Destructor Documentation

ModificationInterface::ModificationInterface ( )

Definition at line 221 of file ktexteditor.cpp.

ModificationInterface::~ModificationInterface ( )
virtual

Virtual destructor.

Definition at line 225 of file ktexteditor.cpp.

Member Function Documentation

virtual void KTextEditor::ModificationInterface::modifiedOnDisk ( KTextEditor::Document *  document,
bool  isModified,
KTextEditor::ModificationInterface::ModifiedOnDiskReason  reason 
)
pure virtual

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

Parameters
documentthe Document object that represents the file on disk
isModifiedif true, the file was modified rather than created or deleted
reasonthe reason why the signal was emitted
See also
setModifiedOnDisk()
virtual void KTextEditor::ModificationInterface::setModifiedOnDisk ( ModifiedOnDiskReason  reason)
pure virtual

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
reasonthe modified-on-disk reason.
See also
ModifiedOnDiskReason, modifiedOnDisk()
virtual void KTextEditor::ModificationInterface::setModifiedOnDiskWarning ( bool  on)
pure virtual

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
oncontrols, whether the editor should show a warning dialog for files modified on disk
virtual void KTextEditor::ModificationInterface::slotModifiedOnDisk ( View *  view = 0)
pure virtual

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
viewthe view that should be notified of the user's decision
See also
setModifiedOnDisk(), modifiedOnDisk()

The documentation for this class was generated from the following files:
  • modificationinterface.h
  • ktexteditor.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat May 9 2020 03:56:48 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KTextEditor

Skip menu "KTextEditor"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

applications API Reference

Skip menu "applications API Reference"
  •   kate
  •       kate
  •   KTextEditor
  •   Kate
  • Konsole

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal