class KWrite

The KWrite text editor widget. More...

Definition#include <kwrite.h>
InheritsKParts::ReadWritePart (kparts)
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Slots

Signals

Public Members

Protected Types

Protected Methods

Protected Slots

Protected Members


Detailed Description

The KWrite text editor widget. It has many options, document/view architecture and syntax highlight.

 KWrite (QWidget * parentWidget, QObject *parent, int flags = kHandleOwnDND, KWriteDoc *doc = 0L)

The document can be used by more than one KWrite objects. HandleOwnURIDrops should be set to false for a container that can handle URI drops better than KWriteView does.

KWrite ()

[virtual]

Decrements the reference count of the document and deletes it if zero

KWriteWidgetwidget ()

returns the editor widget

KWriteViewview ()

returns the view widget

KWriteDocdoc ()

returns the document

void  setCursorPosition (int line, int col)

Sets the current cursor position

int  currentLine ()

Returns the current line number, that is the line the cursor is on. For the first line it returns 0. Signal newCurPos() is emitted on cursor position changes.

int  currentColumn ()

Returns the current column number. It handles tab's correctly. For the first column it returns 0.

int  currentCharNum ()

Returns the number of the character, that the cursor is on (cursor x)

void  setConfig (int)

Sets the config flags

int  config ()

Returns the config flags. See the cfXXX constants in the .h file.

void  setReadWrite (bool readWrite = true)

[virtual]

Sets Read/Write mode, which is a doc-property. ReadWritePart::m_bReadWrite is therefore not used.

Reimplemented from ReadWritePart

bool  isReadWrite ()

[virtual]

Returns true if the document is in read/write mode.

Reimplemented from ReadWritePart

void  setModified (bool modified = true)

[virtual]

Sets the modification status of the document. ReadWritePart::m_bModified is not used.

Reimplemented from ReadWritePart

bool  isModified ()

[virtual]

Returns true if the document has been modified.

Reimplemented from ReadWritePart

bool  isLastView ()

Returns true if this editor is the only owner of its document

int  undoState ()

Bit 0 : undo possible, Bit 1 : redo possible. Used to enable/disable undo/redo menu items and toolbar buttons

int  nextUndoType ()

Returns the type of the next undo group.

int  nextRedoType ()

Returns the type of the next redo group.

void  undoTypeList (QValueList<int>& lst)

Returns a list of all available undo types, in undo order.

void  redoTypeList (QValueList<int>& lst)

Returns a list of all available redo types, in redo order.

QString  undoTypeName (int undoType)

Returns a short text description of the given undo type, which is obtained with nextUndoType(), nextRedoType(), undoTypeList(), and redoTypeList(), suitable for display in a menu entry. It is not translated; use i18n() before displaying this string.

void  emitNewStatus ()

[virtual]

enables or disables cut, copy and other edit commands and emits the newStatus signal

void  emitNewUndo ()

[virtual]

enables or disables undo and redo and emits the newUndo signal

void  optionsDialog ()

[slot]

Presents a options dialog to the user

void  doStateCommand (int cmdNum)

[slot]

Executes state command cmdNum

void  toggleInsert ()

[slot]

Toggles Insert mode

void  toggleVertical ()

[slot]

Toggles "Vertical Selections" option

void  newCursorPos ()

[signal]

The cursor position has changed. Use currentLine() and currentColumn to get the position

void  newConfig ()

[signal]

The configuration has changed. This is used to update the status bar

void  newStatus ()

[signal]

isReadWrite(), isModified() or hasMarkedText() have changed. This is used to enbable/disable cut, copy and other edit commands.

void  newUndo ()

[signal]

The undo/redo enable status has changed

void  fileChanged ()

[signal]

The file name has changed. The main window can use this to change its caption

void  statusMsg (const QString &)

[signal]

Emits messages for the status bar

int  numLines ()

Gets the number of text lines;

QString  text ()

Gets the complete document content as string

QString  currentTextLine ()

Gets the text line where the cursor is on

QString  textLine (int num)

Gets a text line

QString  currentWord ()

Gets the word where the cursor is on

QString  word (int x, int y)

Gets the word at position x, y. Can be used to find the word under the mouse cursor

void  setText (const QString &)

Discard old text without warning and set new text

void  insertText (const QString &)

Insert text at the current cursor position. If length is a positive number, it restricts the number of inserted characters

bool  hasMarkedText ()

Queries if there is marked text

QString  markedText ()

Gets the marked text as string

void  loadFile (QIODevice &, bool insert = false)

Loads a file from the given QIODevice. For insert = false the old contents will be lost.

void  writeFile (QIODevice &)

Writes the document into the given QIODevice

bool  loadFile (const QString &name, int flags = 0)

Loads the file given in name into the editor

bool  writeFile (const QString &name)

Saves the file as given in name

void  loadURL (const KURL &url, int flags = 0)

Loads the file given in url into the editor. See the lfXXX constants in the .h file.

void  writeURL (const KURL &url, int flags = 0)

Saves the file as given in url

void  slotGETFinished (int id)

[protected slot]

Gets signals from iojob

bool  hasFileName ()

Returns true if the document has a filename(not counting the path).

const QString  fileName ()

Returns the URL of the currnet file

void  setFileName (const QString &)

Set the file name. This starts the automatic highlight selection.

bool  canDiscard ()

Mainly for internal use. Returns true if the current document can be discarded. If the document is modified, the user is asked if he wants to save it. On "cancel" the function returns false.

void  newDoc ()

[slot]

Opens a new untitled document in the text widget. The user is given a chance to save the current document if the current document has been modified.

bool  openFile ()

[virtual slot]

open file for KParts

bool  saveFile ()

[virtual slot]

save file for KParts

Reimplemented from ReadWritePart

void  doCursorCommand (int cmdNum)

[slot]

Does cursor command cmdNum

void  doEditCommand (int cmdNum)

[slot]

Does edit command cmdNum

void  doBookmarkCommand (int cmdNum)

[slot]

Does bookmark command cmdNum

void  clear ()

Clears the document without any warnings or requesters.

void  cut ()

[slot]

Moves the marked text into the clipboard

void  copy ()

[slot]

Copies the marked text into the clipboard

void  paste ()

[slot]

Inserts text from the clipboard at the actual cursor position

void  undo ()

[slot]

Undoes the last operation. The number of undo steps is configurable

void  redo ()

[slot]

Repeats an operation which has been undone before.

void  undoMultiple (int count)

[slot]

Undoes <count> operations. Called by slot undo().

void  redoMultiple (int count)

[slot]

Repeats <count> operation which have been undone before. Called by slot redo().

void  undoHistory ()

[slot]

Displays the undo history dialog

void  indent ()

[slot]

Moves the current line or the selection one position to the right

void  unindent ()

[slot]

Moves the current line or the selection one position to the left

void  cleanIndent ()

[slot]

Optimizes the selected indentation, replacing tabs and spaces as needed

void  selectAll ()

[slot]

Selects all text

void  unselectAll ()

[slot]

Deselects all text

void  invertSelection ()

[slot]

Inverts the current selection

void  find ()

[slot]

Presents a search dialog to the user

void  replace ()

[slot]

Presents a replace dialog to the user

void  findAgain ()

[slot]

Repeasts the last search or replace operation. On replace, the user is prompted even if the "Prompt On Replace" option was off.

void  gotoLine ()

[slot]

Presents a "Goto Line" dialog to the user

void  installRBPopup (QPopupMenu *)

Install a Popup Menu. The Popup Menu will be activated on a right mouse button press event.

void  setBookmark ()

[slot]

Shows a popup that lets the user choose the bookmark number

void  addBookmark ()

[slot]

Adds the actual edit position to the end of the bookmark list

void  clearBookmarks ()

[slot]

Clears all bookmarks

void  setBookmark (int n)

[slot]

Sets the actual edit position as bookmark number n

void  gotoBookmark (int n)

[slot]

Sets the cursor to the bookmark n

void  updateBMPopup ()

[protected slot]

Updates the bookmark popup menu when it emit aboutToShow()

void  readConfig (KConfig *)

Reads config entries out of the KConfig object

void  writeConfig (KConfig *)

Writes config entries into the KConfig object

void  readSessionConfig (KConfig *)

Reads session config out of the KConfig object. This also includes the actual cursor position and the bookmarks.

void  writeSessionConfig (KConfig *)

Writes session config into the KConfig object

int  highlightNum ()

Gets the current highlight number

void  setHighlight (int n)

[slot]

Sets the highlight number n

void  hlDef ()

[slot]

Presents the highlight defaults dialog to the user

void  hlDlg ()

[slot]

Presents the highlight setup dialog to the user

int  eolMode ()

Get the end of line mode (Unix, Macintosh or Dos)

void  setEolMode (int)

[slot]

Set the end of line mode (Unix, Macintosh or Dos)

KSpellConfigksConfig ()

Returns the KSpellConfig object

void  setKSConfig (const KSpellConfig)

Sets the KSpellConfig object. (The object is copied internally.)

void  spellcheck_progress (unsigned int percent)

[signal]

This says spellchecking is <i>percent</i> done.

void  spellcheck_done ()

[signal]

Emitted when spellcheck is complete.