• Skip to content
  • Skip to link menu
KDE 4.3 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • Sitemap
  • Contact Us
 

KPIMTextedit Library

textedit.h

00001 /*
00002     Copyright (c) 2009 Thomas McGuire <mcguire@kde.org>
00003 
00004     Based on KMail and libkdepim code by:
00005     Copyright 2007 Laurent Montel <montel@kde.org>
00006 
00007     This library is free software; you can redistribute it and/or modify it
00008     under the terms of the GNU Library General Public License as published by
00009     the Free Software Foundation; either version 2 of the License, or (at your
00010     option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful, but WITHOUT
00013     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00015     License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to the
00019     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00020     02110-1301, USA.
00021 */
00022 #ifndef KPIMTEXTEDIT_TEXTEDIT_H
00023 #define KPIMTEXTEDIT_TEXTEDIT_H
00024 
00025 #include "kpimtextedit_export.h"
00026 
00027 #include <kpimidentities/signature.h>
00028 
00029 #include <KDE/KRichTextWidget>
00030 
00031 #include <QtCore/QSharedPointer>
00032 
00033 #include <memory>
00034 
00035 class KUrl;
00036 
00037 namespace KPIMTextEdit {
00038 
00039 class TextEditPrivate;
00040 class EMailQuoteHighlighter;
00041 
00046 struct EmbeddedImage
00047 {
00048   QByteArray image;   
00049   QString contentID;  
00050   QString imageName;  
00051 };
00052 
00053 typedef QList< QSharedPointer<EmbeddedImage> > ImageList;
00054 
00066 class KPIMTEXTEDIT_EXPORT TextEdit : public KRichTextWidget,
00067                                      protected KTextEditSpellInterface // TODO: KDE5: get rid of the spell interface
00068 {
00069   Q_OBJECT
00070 
00071   public:
00072 
00078     explicit TextEdit( const QString& text, QWidget *parent = 0 );
00079 
00084     explicit TextEdit( QWidget *parent = 0 );
00085 
00094     void enableImageActions();
00095 
00099     ~TextEdit();
00100 
00109     virtual void createActions( KActionCollection *actionCollection );
00110 
00117     void addImage( const KUrl &url );
00118 
00126     ImageList embeddedImages() const;
00127 
00132     QString toWrappedPlainText() const;
00133 
00138     QString toCleanPlainText() const;
00139 
00151     virtual void setHighlighterColors( EMailQuoteHighlighter *highlighter );
00152 
00156     bool isLineQuoted( const QString &line ) const;
00157 
00168     virtual int quoteLength( const QString &line ) const;
00169 
00174     virtual const QString defaultQuoteSign() const;
00175 
00193     static QByteArray imageNamesToContentIds( const QByteArray &htmlBody, const ImageList &imageList );
00194 
00203     bool isFormattingUsed() const;
00204 
00205   protected:
00206 
00210     virtual bool canInsertFromMimeData( const QMimeData *source ) const;
00211 
00215     virtual void insertFromMimeData( const QMimeData *source );
00216 
00221     virtual bool eventFilter( QObject*o, QEvent* e );
00222 
00227     virtual void keyPressEvent ( QKeyEvent * e );
00228 
00229     // For the explaination for these four methods, see the comment at the
00230     // spellCheckingEnabled variable of the private class.
00231 
00235     virtual bool isSpellCheckingEnabled() const;
00236 
00240     virtual void setSpellCheckingEnabled( bool enable );
00241 
00246     virtual bool shouldBlockBeSpellChecked( const QString& block ) const;
00247 
00252     virtual void createHighlighter();
00253 
00254   private:
00255 
00256     std::auto_ptr<TextEditPrivate> const d;
00257     friend class TextEditPrivate;
00258     Q_PRIVATE_SLOT( d, void _k_slotAddImage() )
00259 };
00260 
00261 } // namespace
00262 
00263 #endif

KPIMTextedit Library

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  • kldap
  • kmime
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal