libkdepim
KPIM::KMeditor Class Reference
#include <kmeditor.h>

Detailed Description
The KMeditor class provides a widget to edit and display text, specially geared towards writing e-mails.It offers sevaral additional functions of a KRichTextWidget:
- Quote highlighting
- The ability to us an external editor
- Signature handling
- Utility functions like removing whitespace, inserting a file, adding quotes or rot13'ing the text
Definition at line 52 of file kmeditor.h.
Public Types | |
| enum | Placement { Start, End, AtCursor } |
Public Slots | |
| void | slotAddBox () |
| void | slotAddQuotes () |
| void | slotChangeInsertMode () |
| void | slotPasteAsQuotation () |
| void | slotRemoveBox () |
| void | slotRemoveQuotes () |
| void | slotRot13 () |
Signals | |
| void | focusChanged (bool focusGained) |
| void | focusUp () |
| void | overwriteModeText () |
| void | pasteImage () |
Public Member Functions | |
| virtual void | changeHighlighterColors (KEMailQuotingHighlighter *) |
| bool | checkExternalEditorFinished () |
| void | cleanWhitespace (const KPIMIdentities::Signature &sig) |
| int | columnNumber () |
| void | disableWordWrap () |
| void | enableWordWrap (int wrapColumn) |
| void | ensureCursorVisible () |
| KUrl | insertFile (const QStringList &encodingLst, QString &encodingStr) |
| void | insertSignature (const QString &signature, Placement placement=End, bool isHtml=false) |
| void | insertSignature (const KPIMIdentities::Signature &sig, Placement placement=End, bool addSeparator=true) |
| void | killExternalEditor () |
| KMeditor (QWidget *parent=0) | |
| KMeditor (const QString &text, QWidget *parent=0) | |
| int | linePosition () |
| void | paste () |
| virtual QString | quotePrefixName () const |
| void | replaceSignature (const KPIMIdentities::Signature &oldSig, const KPIMIdentities::Signature &newSig) |
| void | setCursorPosition (int linePos, int columnPos) |
| void | setCursorPositionFromStart (unsigned int pos) |
| void | setExternalEditorPath (const QString &path) |
| void | setFontForWholeText (const QFont &font) |
| void | setUseExternalEditor (bool use) |
| virtual QString | smartQuote (const QString &msg) |
| QString | toWrappedPlainText () const |
| virtual | ~KMeditor () |
Protected Member Functions | |
| virtual void | createHighlighter () |
| virtual void | dragEnterEvent (QDragEnterEvent *e) |
| virtual void | dragMoveEvent (QDragMoveEvent *e) |
| virtual bool | eventFilter (QObject *o, QEvent *e) |
| void | handleDragEvent (QDragMoveEvent *e) |
| virtual void | insertFromMimeData (const QMimeData *source) |
| virtual bool | isSpellCheckingEnabled () const |
| virtual void | keyPressEvent (QKeyEvent *e) |
| virtual void | setSpellCheckingEnabled (bool enable) |
| virtual bool | shouldBlockBeSpellChecked (const QString &block) const |
Member Enumeration Documentation
Describes the placement of a text which is to be inserted into this textedit.
- Enumerator:
-
Start The text is placed at the start of the textedit. End The text is placed at the end of the textedit. AtCursor The text is placed at the current cursor position.
Definition at line 62 of file kmeditor.h.
Constructor & Destructor Documentation
| KMeditor::KMeditor | ( | QWidget * | parent = 0 |
) | [explicit] |
| KMeditor::~KMeditor | ( | ) | [virtual] |
Definition at line 427 of file kmeditor.cpp.
Member Function Documentation
| void KMeditor::changeHighlighterColors | ( | KPIM::KEMailQuotingHighlighter * | ) | [virtual] |
Definition at line 501 of file kmeditor.cpp.
| bool KMeditor::checkExternalEditorFinished | ( | ) |
Definition at line 664 of file kmeditor.cpp.
| void KMeditor::cleanWhitespace | ( | const KPIMIdentities::Signature & | sig | ) |
Cleans the whitespace of the edit's text.
Adjacent tabs and spaces will be converted to a single space. Trailing whitespace will be removed. More than 2 newlines in a row will be changed to 2 newlines. Text in quotes or text inside of the given signature will not be cleaned. For undo/redo, this is treated as one operation.
- Parameters:
-
sig text inside this signature will not be cleaned
Definition at line 817 of file kmeditor.cpp.
| int KMeditor::columnNumber | ( | ) |
Definition at line 796 of file kmeditor.cpp.
| void KMeditor::createHighlighter | ( | ) | [protected, virtual] |
Reimplemented to create our own highlighter which does quote and spellcheck highlighting.
Definition at line 486 of file kmeditor.cpp.
| void KMeditor::disableWordWrap | ( | ) |
Disables word wrap.
Note that words are still wrapped at the end of the editor; no scrollbar will appear.
Definition at line 558 of file kmeditor.cpp.
| void KMeditor::dragEnterEvent | ( | QDragEnterEvent * | e | ) | [protected, virtual] |
Definition at line 293 of file kmeditor.cpp.
| void KMeditor::dragMoveEvent | ( | QDragMoveEvent * | e | ) | [protected, virtual] |
Definition at line 301 of file kmeditor.cpp.
| void KMeditor::enableWordWrap | ( | int | wrapColumn | ) |
Enables word wrap.
Words will be wrapped at the specified column.
- Parameters:
-
wrapColumn the column where words will be wrapped
Definition at line 551 of file kmeditor.cpp.
| void KMeditor::ensureCursorVisible | ( | ) |
Reimplemented again to work around a bug (see comment in implementation).
FIXME: This is _not_ virtual in the base class
Definition at line 995 of file kmeditor.cpp.
Definition at line 432 of file kmeditor.cpp.
| void KPIM::KMeditor::focusChanged | ( | bool | focusGained | ) | [signal] |
Emitted whenever the foucs is lost or gained.
- Parameters:
-
focusGained true if the focus was gained, false when it was lost
| void KPIM::KMeditor::focusUp | ( | ) | [signal] |
| void KMeditor::handleDragEvent | ( | QDragMoveEvent * | e | ) | [protected] |
Handles drag enter/move event for dragEnterEvent() and dragMoveEvent().
Definition at line 278 of file kmeditor.cpp.
| KUrl KMeditor::insertFile | ( | const QStringList & | encodingLst, | |
| QString & | encodingStr | |||
| ) |
Definition at line 525 of file kmeditor.cpp.
| void KMeditor::insertFromMimeData | ( | const QMimeData * | source | ) | [protected, virtual] |
Reimplemented to block rich text pastes in plain text mode.
Definition at line 318 of file kmeditor.cpp.
| void KMeditor::insertSignature | ( | const QString & | signature, | |
| Placement | placement = End, |
|||
| bool | isHtml = false | |||
| ) |
Inserts the signature sig into the textedit.
The cursor position is preserved. A leading or trailing newline is also added automatically, depending on the placement. For undo/redo, this is treated as one operation. A separator is not added.
Use the other insertSignature() function if possible, as it has support for separators and does HTML detection automatically.
Rich text mode will be enabled if isHtml is true.
- Parameters:
-
placement defines where in the textedit the signature should be inserted. isHtml defines whether the signature should be inserted as text or html
Definition at line 852 of file kmeditor.cpp.
| void KMeditor::insertSignature | ( | const KPIMIdentities::Signature & | sig, | |
| Placement | placement = End, |
|||
| bool | addSeparator = true | |||
| ) |
Inserts the signature sig into the textedit.
The cursor position is preserved. A leading or trailing newline is also added automatically, depending on the placement. For undo/redo, this is treated as one operation.
Rich text mode will be enabled if the signature is in inlined HTML format.
- Parameters:
-
placement defines where in the textedit the signature should be inserted. addSeparator if true, the separator '--
' will be added in front of the signature
Definition at line 838 of file kmeditor.cpp.
| bool KMeditor::isSpellCheckingEnabled | ( | ) | const [protected, virtual] |
| void KMeditor::keyPressEvent | ( | QKeyEvent * | e | ) | [protected, virtual] |
Definition at line 331 of file kmeditor.cpp.
| void KMeditor::killExternalEditor | ( | ) |
Definition at line 684 of file kmeditor.cpp.
| int KMeditor::linePosition | ( | ) |
Definition at line 790 of file kmeditor.cpp.
| void KPIM::KMeditor::overwriteModeText | ( | ) | [signal] |
| void KMeditor::paste | ( | ) |
FIXME: Huh? This is not virtual in the base classes and thus never called.
Definition at line 309 of file kmeditor.cpp.
| void KPIM::KMeditor::pasteImage | ( | ) | [signal] |
| QString KMeditor::quotePrefixName | ( | ) | const [virtual] |
Definition at line 658 of file kmeditor.cpp.
| void KMeditor::replaceSignature | ( | const KPIMIdentities::Signature & | oldSig, | |
| const KPIMIdentities::Signature & | newSig | |||
| ) |
Replaces all occurrences of the old signature with the new signature.
Text in quotes will be ignored. For undo/redo, this is treated as one operation. If the old signature is empty, nothing is done. If the new signature is empty, the old signature including the separator is removed.
- Parameters:
-
oldSig the old signature, which will be replaced newSig the new signature
Definition at line 915 of file kmeditor.cpp.
| void KMeditor::setCursorPosition | ( | int | linePos, | |
| int | columnPos | |||
| ) |
Definition at line 810 of file kmeditor.cpp.
| void KMeditor::setCursorPositionFromStart | ( | unsigned int | pos | ) |
Definition at line 693 of file kmeditor.cpp.
| void KMeditor::setExternalEditorPath | ( | const QString & | path | ) |
Definition at line 510 of file kmeditor.cpp.
| void KMeditor::setFontForWholeText | ( | const QFont & | font | ) |
Changes the font of the whole text.
Also sets the default font for the document.
- Parameters:
-
font the font that the whole text will get
Definition at line 515 of file kmeditor.cpp.
| void KMeditor::setSpellCheckingEnabled | ( | bool | enable | ) | [protected, virtual] |
| void KMeditor::setUseExternalEditor | ( | bool | use | ) |
Definition at line 505 of file kmeditor.cpp.
| bool KMeditor::shouldBlockBeSpellChecked | ( | const QString & | block | ) | const [protected, virtual] |
Reimplemented from KTextEditSpellInterface, to avoid spellchecking quoted text.
Definition at line 481 of file kmeditor.cpp.
| void KMeditor::slotAddBox | ( | ) | [slot] |
Definition at line 767 of file kmeditor.cpp.
| void KMeditor::slotAddQuotes | ( | ) | [slot] |
Definition at line 599 of file kmeditor.cpp.
| void KMeditor::slotChangeInsertMode | ( | ) | [slot] |
Definition at line 459 of file kmeditor.cpp.
| void KMeditor::slotPasteAsQuotation | ( | ) | [slot] |
Definition at line 563 of file kmeditor.cpp.
| void KMeditor::slotRemoveBox | ( | ) | [slot] |
Definition at line 704 of file kmeditor.cpp.
| void KMeditor::slotRemoveQuotes | ( | ) | [slot] |
Definition at line 573 of file kmeditor.cpp.
| void KMeditor::slotRot13 | ( | ) | [slot] |
Warning: This function switches back to plain text mode.
Definition at line 802 of file kmeditor.cpp.
Definition at line 653 of file kmeditor.cpp.
| QString KMeditor::toWrappedPlainText | ( | ) | const |
Returns the text of the editor as plain text, with linebreaks inserted where word-wrapping occurred.
Definition at line 972 of file kmeditor.cpp.
The documentation for this class was generated from the following files:
KDE 4.2 API Reference