2
Copyright (c) 2009 Thomas McGuire <mcguire@kde.org>
4
Based on KMail and libkdepim code by:
5
Copyright 2007 - 2010 Laurent Montel <montel@kde.org>
7
This library is free software; you can redistribute it and/or modify it
8
under the terms of the GNU Library General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or (at your
10
option) any later version.
12
This library is distributed in the hope that it will be useful, but WITHOUT
13
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15
License for more details.
17
You should have received a copy of the GNU Library General Public License
18
along with this library; see the file COPYING.LIB. If not, write to the
19
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
2
Copyright (c) 2009 Thomas McGuire <mcguire@kde.org>
4
Based on KMail and libkdepim code by:
5
Copyright 2007 - 2010 Laurent Montel <montel@kde.org>
7
This library is free software; you can redistribute it and/or modify it
8
under the terms of the GNU Library General Public License as published by
9
the Free Software Foundation; either version 2 of the License, or (at your
10
option) any later version.
12
This library is distributed in the hope that it will be useful, but WITHOUT
13
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15
License for more details.
17
You should have received a copy of the GNU Library General Public License
18
along with this library; see the file COPYING.LIB. If not, write to the
19
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22
22
#ifndef KPIMTEXTEDIT_TEXTEDIT_H
23
23
#define KPIMTEXTEDIT_TEXTEDIT_H
81
81
class KPIMTEXTEDIT_EXPORT TextEdit : public KRichTextWidget,
82
protected KTextEditSpellInterface // TODO: KDE5: get rid of the spell interface
82
// TODO: KDE5: get rid of the spell interface
83
protected KTextEditSpellInterface
90
91
* @param text the initial plain text of the text edit, interpreted as HTML
91
92
* @param parent the parent widget
93
explicit TextEdit( const QString& text, QWidget *parent = 0 );
94
explicit TextEdit( const QString &text, QWidget *parent = 0 );
96
97
* Constructs a TextEdit object.
108
108
* TODO KDE-5 merge with other constructor
110
explicit TextEdit( QWidget * parent, const QString & configFile );
110
explicit TextEdit( QWidget *parent, const QString &configFile );
113
113
* Calling this allows createActions() to create the add image actions.
144
144
void addImage( const KUrl &url );
147
* Loads an image into the textedit. The difference to addImage() is that this function expects
148
* that the image tag is already present in the HTML source.
147
* Loads an image into the textedit. The difference to addImage() is that this
148
* function expects that the image tag is already present in the HTML source.
150
* So what this message does is that it scans the HTML source for the image tag that matches the
151
* @p matchName, and then inserts the @p image as a resource, giving that resource the name
150
* So what this message does is that it scans the HTML source for the image
151
* tag that matches the @p matchName, and then inserts the @p image as a
152
* resource, giving that resource the name @p resourceName.
185
185
QString toWrappedPlainText() const;
188
* Same as toPlainText() from QTextEdit, only that it removes embedded images and
189
* converts non-breaking space characters to normal spaces.
188
* Same as toPlainText() from QTextEdit, only that it removes embedded images
189
* and converts non-breaking space characters to normal spaces.
191
191
QString toCleanPlainText() const;
227
227
virtual const QString defaultQuoteSign() const;
230
* For all given embedded images, this function replace the image name in the <img> tag of the
231
* HTML body with cid:content-id,
232
* so that the HTML references the image body parts, see RFC 2557.
230
* For all given embedded images, this function replace the image name
231
* in the <img> tag of the HTML body with cid:content-id, so that the
232
* HTML references the image body parts, see RFC 2557.
234
234
* This is useful when building a MIME message with inline images.
244
244
* @return a modified HTML code, where the <img> tags got replaced
246
static QByteArray imageNamesToContentIds( const QByteArray &htmlBody, const ImageList &imageList );
246
static QByteArray imageNamesToContentIds( const QByteArray &htmlBody,
247
const ImageList &imageList );
249
250
* Checks if rich text formatting is used anywhere.
250
* This is not the same as checking whether textMode() returns "Rich", since
251
* that only tells that rich text mode is enabled, but not if any special formatting
251
* This is not the same as checking whether textMode() returns "Rich",
252
* since that only tells that rich text mode is enabled, but not if any
253
* special formatting is actually used.
254
255
* @return true if formatting is used anywhere
256
257
bool isFormattingUsed() const;
258
/* Return config file
260
* Return config file.
261
263
QString configFile() const;
263
/* Return true if richtext mode support image
265
/** Return true if richtext mode support image
266
268
bool isEnableImageActions() const;
270
void insertImage( const QImage &image, const QFileInfo&info );
273
void insertImage( const QImage &image, const QFileInfo &info );
285
288
* Reimplemented from KRichTextWidget to hide the mouse cursor when there
286
289
* was no mouse movement for some time, using KCursor
288
virtual bool eventFilter( QObject*o, QEvent* e );
291
virtual bool eventFilter( QObject *o, QEvent *e );
291
294
* Reimplemented to add qoute signs when the user presses enter
292
295
* on a quoted line.
294
virtual void keyPressEvent ( QKeyEvent * e );
297
virtual void keyPressEvent ( QKeyEvent *e );
296
299
// For the explaination for these four methods, see the comment at the
297
300
// spellCheckingEnabled variable of the private class.
310
313
* Reimplemented from KTextEditSpellInterface, to avoid spellchecking
313
virtual bool shouldBlockBeSpellChecked( const QString& block ) const;
316
virtual bool shouldBlockBeSpellChecked( const QString &block ) const;
316
319
* Reimplemented to create our own highlighter which does quote and