~ubuntu-branches/ubuntu/raring/kdepimlibs/raring-proposed

« back to all changes in this revision

Viewing changes to kpimtextedit/textedit.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-14 14:37:07 UTC
  • mfrom: (1.1.72)
  • Revision ID: package-import@ubuntu.com-20111214143707-nvfc00wnfayzn9ig
Tags: 4:4.7.90-0ubuntu1
* New upstream beta release
* Add packages libkalarmcal2 and libakonadi-notes4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
    Copyright (c) 2009 Thomas McGuire <mcguire@kde.org>
3
 
 
4
 
    Based on KMail and libkdepim code by:
5
 
    Copyright 2007 - 2010 Laurent Montel <montel@kde.org>
6
 
 
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.
11
 
 
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.
16
 
 
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
20
 
    02110-1301, USA.
 
2
  Copyright (c) 2009 Thomas McGuire <mcguire@kde.org>
 
3
 
 
4
  Based on KMail and libkdepim code by:
 
5
  Copyright 2007 - 2010 Laurent Montel <montel@kde.org>
 
6
 
 
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.
 
11
 
 
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.
 
16
 
 
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
 
20
  02110-1301, USA.
21
21
*/
22
22
#ifndef KPIMTEXTEDIT_TEXTEDIT_H
23
23
#define KPIMTEXTEDIT_TEXTEDIT_H
79
79
 * @since 4.3
80
80
 */
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
83
84
{
84
85
  Q_OBJECT
85
86
 
90
91
     * @param text the initial plain text of the text edit, interpreted as HTML
91
92
     * @param parent the parent widget
92
93
     */
93
 
    explicit TextEdit( const QString& text, QWidget *parent = 0 );
 
94
    explicit TextEdit( const QString &text, QWidget *parent = 0 );
94
95
 
95
96
    /**
96
97
     * Constructs a TextEdit object.
98
99
     */
99
100
    explicit TextEdit( QWidget *parent = 0 );
100
101
 
101
 
 
102
102
    /**
103
103
     * Constructs a TextEdit object
104
104
     * @param parent the parent widget
107
107
     *
108
108
     * TODO KDE-5 merge with other constructor
109
109
     */
110
 
    explicit TextEdit( QWidget * parent, const QString & configFile );
 
110
    explicit TextEdit( QWidget *parent, const QString &configFile );
111
111
 
112
112
    /**
113
113
     * Calling this allows createActions() to create the add image actions.
144
144
    void addImage( const KUrl &url );
145
145
 
146
146
    /**
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.
149
149
     *
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
152
 
     * @P resourceName.
 
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.
153
153
     *
154
154
     * @since 4.4
155
155
     */
185
185
    QString toWrappedPlainText() const;
186
186
 
187
187
    /**
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.
190
190
     */
191
191
    QString toCleanPlainText() const;
192
192
 
227
227
    virtual const QString defaultQuoteSign() const;
228
228
 
229
229
    /**
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.
233
233
     *
234
234
     * This is useful when building a MIME message with inline images.
235
235
     *
243
243
     *
244
244
     * @return a modified HTML code, where the <img> tags got replaced
245
245
     */
246
 
    static QByteArray imageNamesToContentIds( const QByteArray &htmlBody, const ImageList &imageList );
 
246
    static QByteArray imageNamesToContentIds( const QByteArray &htmlBody,
 
247
                                              const ImageList &imageList );
247
248
 
248
249
    /**
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
252
 
     * is actually used.
 
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.
253
254
     *
254
255
     * @return true if formatting is used anywhere
255
256
     */
256
257
    bool isFormattingUsed() const;
257
258
 
258
 
    /*  Return config file
 
259
    /**
 
260
     *  Return config file.
259
261
     *  @since 4.5
260
262
     */
261
263
    QString configFile() const;
262
264
 
263
 
    /*  Return true if richtext mode support image
 
265
    /**  Return true if richtext mode support image
264
266
     *  @since 4.6
265
267
     */
266
268
    bool isEnableImageActions() const;
267
 
  /*
268
 
   * @since 4.6
269
 
   */
270
 
  void insertImage( const QImage &image, const QFileInfo&info );
 
269
 
 
270
    /**
 
271
     * @since 4.6
 
272
     */
 
273
    void insertImage( const QImage &image, const QFileInfo &info );
271
274
 
272
275
  protected:
273
276
 
285
288
     * Reimplemented from KRichTextWidget to hide the mouse cursor when there
286
289
     * was no mouse movement for some time, using KCursor
287
290
     */
288
 
    virtual bool eventFilter( QObject*o, QEvent* e );
 
291
    virtual bool eventFilter( QObject *o, QEvent *e );
289
292
 
290
293
    /**
291
294
     * Reimplemented to add qoute signs when the user presses enter
292
295
     * on a quoted line.
293
296
     */
294
 
    virtual void keyPressEvent ( QKeyEvent * e );
 
297
    virtual void keyPressEvent ( QKeyEvent *e );
295
298
 
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
311
314
     * quoted text.
312
315
     */
313
 
    virtual bool shouldBlockBeSpellChecked( const QString& block ) const;
 
316
    virtual bool shouldBlockBeSpellChecked( const QString &block ) const;
314
317
 
315
318
    /**
316
319
     * Reimplemented to create our own highlighter which does quote and
319
322
    virtual void createHighlighter();
320
323
 
321
324
  private:
322
 
 
323
325
    std::auto_ptr<TextEditPrivate> const d;
324
326
    friend class TextEditPrivate;
325
327
    Q_PRIVATE_SLOT( d, void _k_slotAddImage() )