• Skip to content
  • Skip to link menu
KDE 4.5 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 - 2010 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 
00059 struct ImageWithName
00060 {
00061   QImage image; 
00062   QString name; 
00063 };
00064 
00065 typedef QSharedPointer<ImageWithName> ImageWithNamePtr;
00066 typedef QList< ImageWithNamePtr > ImageWithNameList;
00067 typedef QList< QSharedPointer<EmbeddedImage> > ImageList;
00068 
00080 class KPIMTEXTEDIT_EXPORT TextEdit : public KRichTextWidget,
00081                                      protected KTextEditSpellInterface // TODO: KDE5: get rid of the spell interface
00082 {
00083   Q_OBJECT
00084 
00085   public:
00086 
00092     explicit TextEdit( const QString& text, QWidget *parent = 0 );
00093 
00098     explicit TextEdit( QWidget *parent = 0 );
00099 
00100 
00109     explicit TextEdit( QWidget * parent, const QString & configFile );
00110 
00119     void enableImageActions();
00120 
00124     ~TextEdit();
00125 
00135     virtual void createActions( KActionCollection *actionCollection );
00136 
00143     void addImage( const KUrl &url );
00144 
00155     void loadImage( const QImage &image, const QString &matchName, const QString &resourceName );
00156 
00161     void deleteCurrentLine();
00162 
00170     ImageList embeddedImages() const;
00171 
00178     ImageWithNameList imagesWithName() const;
00179 
00184     QString toWrappedPlainText() const;
00185 
00190     QString toCleanPlainText() const;
00191 
00203     virtual void setHighlighterColors( EMailQuoteHighlighter *highlighter );
00204 
00208     bool isLineQuoted( const QString &line ) const;
00209 
00220     virtual int quoteLength( const QString &line ) const;
00221 
00226     virtual const QString defaultQuoteSign() const;
00227 
00245     static QByteArray imageNamesToContentIds( const QByteArray &htmlBody, const ImageList &imageList );
00246 
00255     bool isFormattingUsed() const;
00256 
00257     /*  Return config file
00258      *  @since 4.5
00259      */
00260     QString configFile() const;
00261   protected:
00262 
00266     virtual bool canInsertFromMimeData( const QMimeData *source ) const;
00267 
00271     virtual void insertFromMimeData( const QMimeData *source );
00272 
00277     virtual bool eventFilter( QObject*o, QEvent* e );
00278 
00283     virtual void keyPressEvent ( QKeyEvent * e );
00284 
00285     // For the explaination for these four methods, see the comment at the
00286     // spellCheckingEnabled variable of the private class.
00287 
00291     virtual bool isSpellCheckingEnabled() const;
00292 
00296     virtual void setSpellCheckingEnabled( bool enable );
00297 
00302     virtual bool shouldBlockBeSpellChecked( const QString& block ) const;
00303 
00308     virtual void createHighlighter();
00309 
00310   private:
00311 
00312     std::auto_ptr<TextEditPrivate> const d;
00313     friend class TextEditPrivate;
00314     Q_PRIVATE_SLOT( d, void _k_slotAddImage() )
00315     Q_PRIVATE_SLOT( d, void _k_slotDeleteLine() )
00316 };
00317 
00318 } // namespace
00319 
00320 #endif

KPIMTextedit Library

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

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • kblog
  • kcal
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  •   richtextbuilders
  • kpimutils
  • kresources
  • ktnef
  • kxmlrpcclient
  • mailtransport
  • microblog
  • qgpgme
  • syndication
  •   atom
  •   rdf
  •   rss2
Generated for KDE-PIM Libraries by doxygen 1.7.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