• Skip to content
  • Skip to link menu
KDE 4.4 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 
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 
00108     void enableImageActions();
00109 
00113     ~TextEdit();
00114 
00124     virtual void createActions( KActionCollection *actionCollection );
00125 
00132     void addImage( const KUrl &url );
00133 
00144     void loadImage( const QImage &image, const QString &matchName, const QString &resourceName );
00145 
00150     void deleteCurrentLine();
00151 
00159     ImageList embeddedImages() const;
00160 
00167     ImageWithNameList imagesWithName() const;
00168 
00173     QString toWrappedPlainText() const;
00174 
00179     QString toCleanPlainText() const;
00180 
00192     virtual void setHighlighterColors( EMailQuoteHighlighter *highlighter );
00193 
00197     bool isLineQuoted( const QString &line ) const;
00198 
00209     virtual int quoteLength( const QString &line ) const;
00210 
00215     virtual const QString defaultQuoteSign() const;
00216 
00234     static QByteArray imageNamesToContentIds( const QByteArray &htmlBody, const ImageList &imageList );
00235 
00244     bool isFormattingUsed() const;
00245 
00246   protected:
00247 
00251     virtual bool canInsertFromMimeData( const QMimeData *source ) const;
00252 
00256     virtual void insertFromMimeData( const QMimeData *source );
00257 
00262     virtual bool eventFilter( QObject*o, QEvent* e );
00263 
00268     virtual void keyPressEvent ( QKeyEvent * e );
00269 
00270     // For the explaination for these four methods, see the comment at the
00271     // spellCheckingEnabled variable of the private class.
00272 
00276     virtual bool isSpellCheckingEnabled() const;
00277 
00281     virtual void setSpellCheckingEnabled( bool enable );
00282 
00287     virtual bool shouldBlockBeSpellChecked( const QString& block ) const;
00288 
00293     virtual void createHighlighter();
00294 
00295   private:
00296 
00297     std::auto_ptr<TextEditPrivate> const d;
00298     friend class TextEditPrivate;
00299     Q_PRIVATE_SLOT( d, void _k_slotAddImage() )
00300     Q_PRIVATE_SLOT( d, void _k_slotDeleteLine() )
00301 };
00302 
00303 } // namespace
00304 
00305 #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
  •   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.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