• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.10.5 API Reference
  • KDE Home
  • Contact Us
 

kpimidentities

  • kpimidentities
signature.h
1 /*
2  Copyright (c) 2002-2004 Marc Mutz <mutz@kde.org>
3  Copyright (c) 2007 Tom Albers <tomalbers@kde.nl>
4  Copyright (c) 2009 Thomas McGuire <mcguire@kde.org>
5  Author: Stefan Taferner <taferner@kde.org>
6 
7  This library is free software; you can redistribute it and/or modify it
8  under the terms of the GNU Library General Public License as published by
9  the Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version.
11 
12  This library is distributed in the hope that it will be useful, but WITHOUT
13  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
15  License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to the
19  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20  02110-1301, USA.
21 */
22 
23 #ifndef KPIMIDENTITIES_SIGNATURE_H
24 #define KPIMIDENTITIES_SIGNATURE_H
25 
26 #include "kpimidentities_export.h"
27 
28 #include <kdemacros.h>
29 
30 #include <QtCore/QString>
31 #include <QtCore/QStringList>
32 #include <QtCore/QList>
33 #include <QtCore/QHash>
34 #include <QtCore/QVariant>
35 
36 namespace KPIMIdentities
37 {
38  class Signature;
39  class Identity;
40 }
41 class KConfigGroup;
42 class KRichTextEdit;
43 
44 namespace KPIMTextEdit
45 {
46  class TextEdit;
47 }
48 
49 namespace KPIMIdentities
50 {
51 
52  KPIMIDENTITIES_EXPORT QDataStream &operator<<
53  ( QDataStream &stream, const KPIMIdentities::Signature &sig );
54  KPIMIDENTITIES_EXPORT QDataStream &operator>>
55  ( QDataStream &stream, KPIMIdentities::Signature &sig );
56 
89  class KPIMIDENTITIES_EXPORT Signature
90  {
91  friend class Identity;
92 
93  friend KPIMIDENTITIES_EXPORT QDataStream &operator<< ( QDataStream &stream, const Signature &sig );
94  friend KPIMIDENTITIES_EXPORT QDataStream &operator>> ( QDataStream &stream, Signature &sig );
95 
96  public:
98  enum Type {
99  Disabled = 0,
100  Inlined = 1,
101  FromFile = 2,
102  FromCommand = 3
103  };
104 
109  enum Placement {
110  Start,
111  End,
112  AtCursor
113  };
114 
116  bool operator== ( const Signature &other ) const;
117 
119  Signature();
121  Signature( const QString &text );
123  Signature( const QString &url, bool isExecutable );
125  Signature( const Signature &that );
127  Signature& operator= ( const Signature &that );
129  ~Signature();
130 
132  QString rawText( bool *ok=0 ) const;
133 
136  QString withSeparator( bool *ok=0 ) const;
137 
140  void setText( const QString &text );
141  QString text() const;
142 
148  QString toPlainText() const;
149 
152  void setUrl( const QString &url, bool isExecutable=false );
153  QString url() const;
154 
156  Type type() const;
157  void setType( Type type );
158 
164  void setInlinedHtml( bool isHtml );
165 
170  bool isInlinedHtml() const;
171 
187  void setImageLocation( const QString &path );
188 
200  void addImage( const QImage &image, const QString &imageName );
201 
202 
208  void setEnabledSignature(bool enabled);
209  bool isEnabledSignature() const;
210 
216  void KDE_DEPRECATED insertIntoTextEdit( KRichTextEdit *textEdit,
217  Placement placement = End, bool addSeparator = true );
218 
219  enum AddedTextFlag {
220  AddNothing = 0,
221  AddSeparator = 1 << 0,
222 
223  AddNewLines = 1 << 1
224 
225  };
226 
228  typedef QFlags<AddedTextFlag> AddedText;
229 
246  // TODO: KDE5: BIC: Reorder parameters, the order here is a workaround for ambiguous parameters
247  // with the deprecated method
248  void insertIntoTextEdit( Placement placement, AddedText addedText,
249  KPIMTextEdit::TextEdit *textEdit ) const;
250 
254  //TODO; KDE5 merge with previous method
255  void insertIntoTextEdit( Placement placement, AddedText addedText,
256  KPIMTextEdit::TextEdit *textEdit, bool forceDisplay ) const;
257 
280  static void KDE_DEPRECATED insertPlainSignatureIntoTextEdit( const QString &signature,
281  KRichTextEdit *textEdit,
282  Placement placement = End,
283  bool isHtml = false );
284 
285  protected:
286 
287  // TODO: KDE5: BIC: Move all to private class
288  void writeConfig( KConfigGroup &config ) const;
289  void readConfig( const KConfigGroup &config );
290 
291  private:
292  void insertSignatureText(Placement placement, AddedText addedText, KPIMTextEdit::TextEdit *textEdit, bool forceDisplay) const;
293 
294  // TODO: KDE5: BIC: Move all to private class
295 
299  void assignFrom( const Signature &that );
300 
305  void cleanupImages() const;
306 
310  void saveImages() const;
311 
312  QString textFromFile( bool *ok ) const;
313  QString textFromCommand( bool *ok ) const;
314 
315  // TODO: KDE5: BIC: Add a d-pointer!!!
316  // There is already a pseude private class in the .cpp, using a hash.
317  QString mUrl;
318  QString mText;
319  Type mType;
320  bool mInlinedHtml;
321  };
322 
323  Q_DECLARE_OPERATORS_FOR_FLAGS( Signature::AddedText )
324 
325 }
326 
327 #endif /*kpim_signature_h*/
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Jul 13 2013 01:30:05 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kpimidentities

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

kdepimlibs-4.10.5 API Reference

Skip menu "kdepimlibs-4.10.5 API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kioslave
  •   imap4
  •   mbox
  •   nntp
  • kldap
  • kmbox
  • kmime
  • kontactinterface
  • kpimidentities
  • kpimtextedit
  • 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