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) |
void | addImage (const KUrl &url, int width, int height) |
QString | configFile () const |
virtual void | createActions (KActionCollection *actionCollection) |
virtual const QString | defaultQuoteSign () const |
void | deleteCurrentLine () |
ImageList | embeddedImages () const |
void | enableEmoticonActions () |
void | enableImageActions () |
void | enableInsertHtmlActions () |
void | enableInsertTableActions () |
ImageWithNameList | imagesWithName () const |
void | insertImage (const QImage &image, const QFileInfo &info) |
bool | isEnableEmoticonActions () const |
bool | isEnableImageActions () const |
bool | isEnableInsertHtmlActions () const |
bool | isEnableInsertTableActions () 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 &plainText) const |
QString | toCleanPlainText () const |
QString | toWrappedPlainText () const |
QString | toWrappedPlainText (QTextDocument *document) 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 183 of file textedit.cpp.
|
explicit |
Constructs a TextEdit object.
- Parameters
-
parent the parent widget
Definition at line 190 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 197 of file textedit.cpp.
TextEdit::~TextEdit | ( | ) |
Destructor.
Definition at line 205 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 479 of file textedit.cpp.
void TextEdit::addImage | ( | const KUrl & | url, |
int | width, | ||
int | height | ||
) |
Adds an image.
The image is loaded from file and then pasted to the current cursor position with the given width
and height
.
- Parameters
-
url The URL of the file which contains the image width The width the inserted image will have. height The height the inserted image will have.
- Since
- 4.10
Definition at line 474 of file textedit.cpp.
|
protectedvirtual |
Reimplemented for inline image support.
Definition at line 785 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 430 of file textedit.cpp.
|
protectedvirtual |
Reimplemented to create our own highlighter which does quote and spellcheck highlighting.
Definition at line 358 of file textedit.cpp.
|
virtual |
Returns the prefix that is added to a line that is quoted.
By default, this is "> ".
Definition at line 353 of file textedit.cpp.
void TextEdit::deleteCurrentLine | ( | ) |
Deletes the line at the current cursor position.
- Since
- 4.4
Definition at line 818 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 601 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 709 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 699 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 209 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 740 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 580 of file textedit.cpp.
|
protectedvirtual |
Reimplemented for inline image support.
Definition at line 763 of file textedit.cpp.
void TextEdit::insertImage | ( | const QImage & | image, |
const QFileInfo & | info | ||
) |
- Since
- 4.6
Definition at line 755 of file textedit.cpp.
bool KPIMTextEdit::TextEdit::isEnableEmoticonActions | ( | ) | const |
bool KPIMTextEdit::TextEdit::isEnableImageActions | ( | ) | const |
bool KPIMTextEdit::TextEdit::isEnableInsertHtmlActions | ( | ) | const |
- Since
- 4.10
Definition at line 724 of file textedit.cpp.
bool KPIMTextEdit::TextEdit::isEnableInsertTableActions | ( | ) | const |
- Since
- 4.10
Definition at line 729 of file textedit.cpp.
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 802 of file textedit.cpp.
bool KPIMTextEdit::TextEdit::isLineQuoted | ( | const QString & | line | ) | const |
Convenience method for qouteLength( line ) > 0.
Definition at line 325 of file textedit.cpp.
|
protectedvirtual |
Reimplemented from KTextEditSpellInterface.
Definition at line 304 of file textedit.cpp.
|
protectedvirtual |
Reimplemented to add qoute signs when the user presses enter on a quoted line.
Definition at line 244 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 500 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 330 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 373 of file textedit.cpp.
|
protectedvirtual |
Reimplemented from KTextEditSpellInterface.
Definition at line 309 of file textedit.cpp.
|
protectedvirtual |
Reimplemented from KTextEditSpellInterface, to avoid spellchecking quoted text.
Definition at line 320 of file textedit.cpp.
QString TextEdit::toCleanPlainText | ( | const QString & | plainText | ) | const |
- Since
- 4.10
Definition at line 418 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 425 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 379 of file textedit.cpp.
QString TextEdit::toWrappedPlainText | ( | QTextDocument * | document | ) | const |
- Since
- 5.0
Definition at line 385 of file textedit.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:26:01 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.