• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.9.4 API Reference
  • KDE Home
  • Contact Us
 

KPIMTextedit Library

  • kpimtextedit
textedit.h
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.
21 */
22 #ifndef KPIMTEXTEDIT_TEXTEDIT_H
23 #define KPIMTEXTEDIT_TEXTEDIT_H
24 
25 #include "kpimtextedit_export.h"
26 
27 #include <kpimidentities/signature.h>
28 
29 #include <KDE/KRichTextWidget>
30 
31 #include <QtCore/QSharedPointer>
32 
33 #include <memory>
34 #define FIX_KMAIL_INSERT_IMAGE 1
35 
36 class KUrl;
37 class QFileInfo;
38 namespace KPIMTextEdit {
39 
40 class TextEditPrivate;
41 class EMailQuoteHighlighter;
42 
47 struct EmbeddedImage
48 {
49  QByteArray image;
50  QString contentID;
51  QString imageName;
52 };
53 
60 struct ImageWithName
61 {
62  QImage image;
63  QString name;
64 };
65 
66 typedef QSharedPointer<ImageWithName> ImageWithNamePtr;
67 typedef QList< ImageWithNamePtr > ImageWithNameList;
68 typedef QList< QSharedPointer<EmbeddedImage> > ImageList;
69 
81 class KPIMTEXTEDIT_EXPORT TextEdit : public KRichTextWidget,
82  // TODO: KDE5: get rid of the spell interface
83  protected KTextEditSpellInterface
84 {
85  Q_OBJECT
86 
87  public:
88 
94  explicit TextEdit( const QString &text, QWidget *parent = 0 );
95 
100  explicit TextEdit( QWidget *parent = 0 );
101 
110  explicit TextEdit( QWidget *parent, const QString &configFile );
111 
120  void enableImageActions();
127  void enableEmoticonActions();
131  ~TextEdit();
132 
142  virtual void createActions( KActionCollection *actionCollection );
143 
150  void addImage( const KUrl &url );
151 
162  void loadImage( const QImage &image, const QString &matchName, const QString &resourceName );
163 
168  void deleteCurrentLine();
169 
177  ImageList embeddedImages() const;
178 
185  ImageWithNameList imagesWithName() const;
186 
191  QString toWrappedPlainText() const;
192 
197  QString toCleanPlainText() const;
198 
210  virtual void setHighlighterColors( EMailQuoteHighlighter *highlighter );
211 
215  bool isLineQuoted( const QString &line ) const;
216 
227  virtual int quoteLength( const QString &line ) const;
228 
233  virtual const QString defaultQuoteSign() const;
234 
252  static QByteArray imageNamesToContentIds( const QByteArray &htmlBody,
253  const ImageList &imageList );
254 
263  bool isFormattingUsed() const;
264 
269  QString configFile() const;
270 
274  bool isEnableImageActions() const;
275 
279  bool isEnableEmoticonActions() const;
280 
284  void insertImage( const QImage &image, const QFileInfo &info );
285 
286  protected:
287 
291  virtual bool canInsertFromMimeData( const QMimeData *source ) const;
292 
296  virtual void insertFromMimeData( const QMimeData *source );
297 
302  virtual bool eventFilter( QObject *o, QEvent *e );
303 
308  virtual void keyPressEvent ( QKeyEvent *e );
309 
310  // For the explaination for these four methods, see the comment at the
311  // spellCheckingEnabled variable of the private class.
312 
316  virtual bool isSpellCheckingEnabled() const;
317 
321  virtual void setSpellCheckingEnabled( bool enable );
322 
327  virtual bool shouldBlockBeSpellChecked( const QString &block ) const;
328 
333  virtual void createHighlighter();
334 
335  private:
336  std::auto_ptr<TextEditPrivate> const d;
337  friend class TextEditPrivate;
338  Q_PRIVATE_SLOT( d, void _k_slotAddImage() )
339  Q_PRIVATE_SLOT( d, void _k_slotDeleteLine() )
340  Q_PRIVATE_SLOT( d, void _k_slotAddEmoticon(const QString &) )
341 };
342 
343 } // namespace
344 
345 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Dec 10 2012 13:47:22 by doxygen 1.8.1.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KPIMTextedit Library

Skip menu "KPIMTextedit Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Members
  • File List
  • Related Pages

kdepimlibs-4.9.4 API Reference

Skip menu "kdepimlibs-4.9.4 API Reference"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal