• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.8.3 API Reference
  • KDE Home
  • 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 #define FIX_KMAIL_INSERT_IMAGE 1
00035 
00036 class KUrl;
00037 class QFileInfo;
00038 namespace KPIMTextEdit {
00039 
00040 class TextEditPrivate;
00041 class EMailQuoteHighlighter;
00042 
00047 struct EmbeddedImage
00048 {
00049   QByteArray image;   
00050   QString contentID;  
00051   QString imageName;  
00052 };
00053 
00060 struct ImageWithName
00061 {
00062   QImage image; 
00063   QString name; 
00064 };
00065 
00066 typedef QSharedPointer<ImageWithName> ImageWithNamePtr;
00067 typedef QList< ImageWithNamePtr > ImageWithNameList;
00068 typedef QList< QSharedPointer<EmbeddedImage> > ImageList;
00069 
00081 class KPIMTEXTEDIT_EXPORT TextEdit : public KRichTextWidget,
00082                                      // TODO: KDE5: get rid of the spell interface
00083                                      protected KTextEditSpellInterface
00084 {
00085   Q_OBJECT
00086 
00087   public:
00088 
00094     explicit TextEdit( const QString &text, QWidget *parent = 0 );
00095 
00100     explicit TextEdit( QWidget *parent = 0 );
00101 
00110     explicit TextEdit( QWidget *parent, const QString &configFile );
00111 
00120     void enableImageActions();
00121 
00125     ~TextEdit();
00126 
00136     virtual void createActions( KActionCollection *actionCollection );
00137 
00144     void addImage( const KUrl &url );
00145 
00156     void loadImage( const QImage &image, const QString &matchName, const QString &resourceName );
00157 
00162     void deleteCurrentLine();
00163 
00171     ImageList embeddedImages() const;
00172 
00179     ImageWithNameList imagesWithName() const;
00180 
00185     QString toWrappedPlainText() const;
00186 
00191     QString toCleanPlainText() const;
00192 
00204     virtual void setHighlighterColors( EMailQuoteHighlighter *highlighter );
00205 
00209     bool isLineQuoted( const QString &line ) const;
00210 
00221     virtual int quoteLength( const QString &line ) const;
00222 
00227     virtual const QString defaultQuoteSign() const;
00228 
00246     static QByteArray imageNamesToContentIds( const QByteArray &htmlBody,
00247                                               const ImageList &imageList );
00248 
00257     bool isFormattingUsed() const;
00258 
00263     QString configFile() const;
00264 
00268     bool isEnableImageActions() const;
00269 
00273     void insertImage( const QImage &image, const QFileInfo &info );
00274 
00275   protected:
00276 
00280     virtual bool canInsertFromMimeData( const QMimeData *source ) const;
00281 
00285     virtual void insertFromMimeData( const QMimeData *source );
00286 
00291     virtual bool eventFilter( QObject *o, QEvent *e );
00292 
00297     virtual void keyPressEvent ( QKeyEvent *e );
00298 
00299     // For the explaination for these four methods, see the comment at the
00300     // spellCheckingEnabled variable of the private class.
00301 
00305     virtual bool isSpellCheckingEnabled() const;
00306 
00310     virtual void setSpellCheckingEnabled( bool enable );
00311 
00316     virtual bool shouldBlockBeSpellChecked( const QString &block ) const;
00317 
00322     virtual void createHighlighter();
00323 
00324   private:
00325     std::auto_ptr<TextEditPrivate> const d;
00326     friend class TextEditPrivate;
00327     Q_PRIVATE_SLOT( d, void _k_slotAddImage() )
00328     Q_PRIVATE_SLOT( d, void _k_slotDeleteLine() )
00329 };
00330 
00331 } // namespace
00332 
00333 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Mon Apr 30 2012 21:48:46 by doxygen 1.8.0 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.8.3 API Reference

Skip menu "kdepimlibs-4.8.3 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