KPIMTextedit Library
#include <textedit.h>
Inherits KRichTextWidget, and KTextEditSpellInterface.
Public Member Functions | |
TextEdit (const QString &text, QWidget *parent=0) | |
TextEdit (QWidget *parent=0) | |
TextEdit (QWidget *parent, const QString &configFile) | |
~TextEdit () | |
void | addImage (const KUrl &url) |
QString | configFile () const |
virtual void | createActions (KActionCollection *actionCollection) |
virtual const QString | defaultQuoteSign () const |
void | deleteCurrentLine () |
ImageList | embeddedImages () const |
void | enableEmoticonActions () |
void | enableImageActions () |
ImageWithNameList | imagesWithName () const |
void | insertImage (const QImage &image, const QFileInfo &info) |
bool | isEnableEmoticonActions () const |
bool | isEnableImageActions () const |
bool | isFormattingUsed () const |
bool | isLineQuoted (const QString &line) const |
void | loadImage (const QImage &image, const QString &matchName, const QString &resourceName) |
virtual int | quoteLength (const QString &line) const |
virtual void | setHighlighterColors (EMailQuoteHighlighter *highlighter) |
QString | toCleanPlainText () const |
QString | toWrappedPlainText () const |
Static Public Member Functions | |
static QByteArray | imageNamesToContentIds (const QByteArray &htmlBody, const ImageList &imageList) |
Protected Member Functions | |
virtual bool | canInsertFromMimeData (const QMimeData *source) const |
virtual void | createHighlighter () |
virtual bool | eventFilter (QObject *o, QEvent *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 |
Detailed Description
Special textedit that provides additional features which are useful for PIM applications like mail clients.
Additional features this class provides:
- Highlighting quoted text
- Handling of inline images
- Auto-Hiding the cursor
- Handling of pastes and drops of images
- Since
- 4.3
Definition at line 81 of file textedit.h.
Constructor & Destructor Documentation
|
explicit |
Constructs a TextEdit object.
- Parameters
-
text the initial plain text of the text edit, interpreted as HTML parent the parent widget
Definition at line 154 of file textedit.cpp.
|
explicit |
Constructs a TextEdit object.
- Parameters
-
parent the parent widget
Definition at line 161 of file textedit.cpp.
|
explicit |
Constructs a TextEdit object.
- Parameters
-
parent the parent widget configFile the config file
- Since
- 4.6
TODO KDE-5 merge with other constructor
Definition at line 168 of file textedit.cpp.
TextEdit::~TextEdit | ( | ) |
Destructor.
Definition at line 176 of file textedit.cpp.
Member Function Documentation
void TextEdit::addImage | ( | const KUrl & | url | ) |
Adds an image.
The image is loaded from file and then pasted to the current cursor position.
- Parameters
-
url The URL of the file which contains the image
Definition at line 401 of file textedit.cpp.
|
protectedvirtual |
Reimplemented for inline image support.
Definition at line 644 of file textedit.cpp.
QString TextEdit::configFile | ( | ) | const |
|
virtual |
Reimplemented from KMEditor, to support more actions.
The additional action XML names are:
- add_image
- delete_line
The add_image actions is only added if enableImageActions() is called before.
Definition at line 379 of file textedit.cpp.
|
protectedvirtual |
Reimplemented to create our own highlighter which does quote and spellcheck highlighting.
Definition at line 328 of file textedit.cpp.
|
virtual |
Returns the prefix that is added to a line that is quoted.
By default, this is "> ".
Definition at line 323 of file textedit.cpp.
void TextEdit::deleteCurrentLine | ( | ) |
Deletes the line at the current cursor position.
- Since
- 4.4
Definition at line 677 of file textedit.cpp.
QList< QSharedPointer< EmbeddedImage > > TextEdit::embeddedImages | ( | ) | const |
Get a list with all embedded HTML images.
If the same image is contained twice or more in the editor, it will have only one entry in this list.
- Returns
- a list of embedded HTML images of the editor.
Definition at line 510 of file textedit.cpp.
void KPIMTextEdit::TextEdit::enableEmoticonActions | ( | ) |
Calling this allows createActions() to create the add emoticons actions.
Call this method before calling createActions(), otherwise the action will not be added. Don't call this if you don't want to support emoticons actions.
Definition at line 588 of file textedit.cpp.
void KPIMTextEdit::TextEdit::enableImageActions | ( | ) |
Calling this allows createActions() to create the add image actions.
Call this method before calling createActions(), otherwise the action will not be added. Also, if image actions is enabled, the user can paste PNG images.
Don't call this if you don't want to support adding images.
Definition at line 578 of file textedit.cpp.
|
protectedvirtual |
Reimplemented from KRichTextWidget to hide the mouse cursor when there was no mouse movement for some time, using KCursor.
Definition at line 180 of file textedit.cpp.
|
static |
For all given embedded images, this function replace the image name in the.
tag of the HTML body with cid:content-id, so that the HTML references the image body parts, see RFC 2557.
This is useful when building a MIME message with inline images.
Note that this function works on encoded content already.
- Parameters
-
htmlBody the HTML code in which the tag will be modified. The HTML code here could come from toHtml(), for example. imageList the list of images of which the tag will be modified. You can get such a list from the embeddedImages() function.
- Returns
- a modified HTML code, where the tags got replaced
Definition at line 599 of file textedit.cpp.
ImageWithNameList TextEdit::imagesWithName | ( | ) | const |
Same as embeddedImages(), only that this returns a list of general purpose information, whereas the embeddedImages() function returns a list with mail-specific information.
- Since
- 4.4
Definition at line 489 of file textedit.cpp.
|
protectedvirtual |
Reimplemented for inline image support.
Definition at line 622 of file textedit.cpp.
void TextEdit::insertImage | ( | const QImage & | image, |
const QFileInfo & | info | ||
) |
- Since
- 4.6
Definition at line 614 of file textedit.cpp.
bool KPIMTextEdit::TextEdit::isEnableEmoticonActions | ( | ) | const |
bool KPIMTextEdit::TextEdit::isEnableImageActions | ( | ) | const |
bool TextEdit::isFormattingUsed | ( | ) | const |
Checks if rich text formatting is used anywhere.
This is not the same as checking whether textMode() returns "Rich", since that only tells that rich text mode is enabled, but not if any special formatting is actually used.
- Returns
- true if formatting is used anywhere
Definition at line 661 of file textedit.cpp.
bool KPIMTextEdit::TextEdit::isLineQuoted | ( | const QString & | line | ) | const |
Convenience method for qouteLength( line ) > 0.
Definition at line 295 of file textedit.cpp.
|
protectedvirtual |
Reimplemented from KTextEditSpellInterface.
Definition at line 274 of file textedit.cpp.
|
protectedvirtual |
Reimplemented to add qoute signs when the user presses enter on a quoted line.
Definition at line 214 of file textedit.cpp.
void TextEdit::loadImage | ( | const QImage & | image, |
const QString & | matchName, | ||
const QString & | resourceName | ||
) |
Loads an image into the textedit.
The difference to addImage() is that this function expects that the image tag is already present in the HTML source.
So what this message does is that it scans the HTML source for the image tag that matches the matchName
, and then inserts the image
as a resource, giving that resource the name resourceName
.
- Since
- 4.4
Definition at line 417 of file textedit.cpp.
|
virtual |
This is called whenever the editor needs to find out the length of the quote, i.e.
the length of the quote prefix before the real text starts. The default implementation counts the number of spaces, '>' and '|' chars in front of the line.
- Parameters
-
line the line of which the length of the quote prefix should be returned
- Returns
- 0 if the line is not quoted, the length of the quote prefix otherwise FIXME: Not yet used in all places, e.g. keypressEvent() or the quote highlighter
Definition at line 300 of file textedit.cpp.
|
virtual |
This method is called after the highlighter is created.
If you use custom colors for highlighting, override this method and set the colors to the highlighter in it.
The default implementation does nothing, therefore the default colors of the EMailQuoteHighlighter class will be used.
- Parameters
-
highlighter the highlighter that was just created. You need to set the colors of this highlighter.
Definition at line 343 of file textedit.cpp.
|
protectedvirtual |
Reimplemented from KTextEditSpellInterface.
Definition at line 279 of file textedit.cpp.
|
protectedvirtual |
Reimplemented from KTextEditSpellInterface, to avoid spellchecking quoted text.
Definition at line 290 of file textedit.cpp.
QString TextEdit::toCleanPlainText | ( | ) | const |
Same as toPlainText() from QTextEdit, only that it removes embedded images and converts non-breaking space characters to normal spaces.
Definition at line 372 of file textedit.cpp.
QString TextEdit::toWrappedPlainText | ( | ) | const |
Returns the text of the editor as plain text, with linebreaks inserted where word-wrapping occurred.
Definition at line 348 of file textedit.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2012 The KDE developers.
Generated on Tue Dec 4 2012 14:35:25 by doxygen 1.8.1.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.