• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • KDE-PIM Libraries
  • KDE Home
  • Contact Us
 

kpimidentities

signature.h
00001 /*
00002     Copyright (c) 2002-2004 Marc Mutz <mutz@kde.org>
00003     Copyright (c) 2007 Tom Albers <tomalbers@kde.nl>
00004     Copyright (c) 2009 Thomas McGuire <mcguire@kde.org>
00005     Author: Stefan Taferner <taferner@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 
00023 #ifndef KPIMIDENTITIES_SIGNATURE_H
00024 #define KPIMIDENTITIES_SIGNATURE_H
00025 
00026 #include "kpimidentities_export.h"
00027 
00028 #include <kdemacros.h>
00029 
00030 #include <QtCore/QString>
00031 #include <QtCore/QStringList>
00032 #include <QtCore/QList>
00033 #include <QtCore/QHash>
00034 #include <QtCore/QVariant>
00035 
00036 namespace KPIMIdentities
00037 {
00038   class Signature;
00039   class Identity;
00040 }
00041 class KConfigGroup;
00042 class KRichTextEdit;
00043 
00044 namespace KPIMTextEdit
00045 {
00046   class TextEdit;
00047 }
00048 
00049 namespace KPIMIdentities
00050 {
00051 
00052   KPIMIDENTITIES_EXPORT QDataStream &operator<<
00053   ( QDataStream &stream, const KPIMIdentities::Signature &sig );
00054   KPIMIDENTITIES_EXPORT QDataStream &operator>>
00055   ( QDataStream &stream, KPIMIdentities::Signature &sig );
00056 
00089   class KPIMIDENTITIES_EXPORT Signature
00090   {
00091       friend class Identity;
00092 
00093       friend KPIMIDENTITIES_EXPORT QDataStream &operator<< ( QDataStream &stream, const Signature &sig );
00094       friend KPIMIDENTITIES_EXPORT QDataStream &operator>> ( QDataStream &stream, Signature &sig );
00095 
00096     public:
00098       enum Type {
00099         Disabled = 0,
00100         Inlined = 1,
00101         FromFile = 2,
00102         FromCommand = 3
00103       };
00104 
00109       enum Placement {
00110         Start,                   
00111         End,                     
00112         AtCursor                 
00113       };
00114 
00116       bool operator== ( const Signature &other ) const;
00117 
00119       Signature();
00121       Signature( const QString &text );
00123       Signature( const QString &url, bool isExecutable );
00125       Signature( const Signature &that );
00127       Signature& operator= ( const Signature &that );
00129       ~Signature();
00130 
00132       QString rawText( bool *ok=0 ) const;
00133 
00136       QString withSeparator( bool *ok=0 ) const;
00137 
00140       void setText( const QString &text );
00141       QString text() const;
00142 
00148       QString toPlainText() const;
00149 
00152       void setUrl( const QString &url, bool isExecutable=false );
00153       QString url() const;
00154 
00156       Type type() const;
00157       void setType( Type type );
00158 
00164       void setInlinedHtml( bool isHtml );
00165 
00170       bool isInlinedHtml() const;
00171 
00187       void setImageLocation( const QString &path );
00188 
00200       void addImage( const QImage &image, const QString &imageName );
00201 
00207       void KDE_DEPRECATED insertIntoTextEdit( KRichTextEdit *textEdit,
00208                                               Placement placement = End, bool addSeparator = true );
00209 
00210       enum AddedTextFlag {
00211         AddNothing = 0,         
00212         AddSeparator = 1 << 0,  
00213 
00214         AddNewLines = 1 << 1    
00215 
00216       };
00217 
00219       typedef QFlags<AddedTextFlag> AddedText;
00220        
00237       // TODO: KDE5: BIC: Reorder parameters, the order here is a workaround for ambiguous parameters
00238       //                  with the deprecated method
00239       void insertIntoTextEdit( Placement placement, AddedText addedText,
00240                                KPIMTextEdit::TextEdit *textEdit ) const;
00241 
00264       static void KDE_DEPRECATED insertPlainSignatureIntoTextEdit( const QString &signature,
00265                                                                    KRichTextEdit *textEdit,
00266                                                                    Placement placement = End,
00267                                                                    bool isHtml = false );
00268 
00269     protected:
00270 
00271       // TODO: KDE5: BIC: Move all to private class
00272       void writeConfig( KConfigGroup &config ) const;
00273       void readConfig( const KConfigGroup &config );
00274 
00275     private:
00276 
00277       // TODO: KDE5: BIC: Move all to private class
00278 
00282       void assignFrom( const Signature &that );
00283 
00288       void cleanupImages() const;
00289 
00293       void saveImages() const;
00294 
00295       QString textFromFile( bool *ok ) const;
00296       QString textFromCommand( bool *ok ) const;
00297 
00298       // TODO: KDE5: BIC: Add a d-pointer!!!
00299       //       There is already a pseude private class in the .cpp, using a hash.
00300       QString mUrl;
00301       QString mText;
00302       Type    mType;
00303       bool mInlinedHtml;
00304   };
00305 
00306   Q_DECLARE_OPERATORS_FOR_FLAGS(Signature::AddedText)
00307 
00308 }
00309 
00310 #endif /*kpim_signature_h*/

kpimidentities

Skip menu "kpimidentities"
  • Main Page
  • Alphabetical List
  • Class List
  • File List
  • Class Members
  • Related Pages

KDE-PIM Libraries

Skip menu "KDE-PIM Libraries"
  • akonadi
  •   contact
  •   kmime
  • kabc
  • 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
Generated for KDE-PIM Libraries by doxygen 1.7.4
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