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

kpimidentities

  • sources
  • kde-4.12
  • kdepimlibs
  • 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 
134  QString rawText( bool *ok=0 ) const;
135 
140  QString withSeparator( bool *ok=0 ) const;
141 
144  void setText( const QString &text );
145  QString text() const;
146 
152  QString toPlainText() const;
153 
156  void setUrl( const QString &url, bool isExecutable=false );
157  QString url() const;
158 
160  Type type() const;
161  void setType( Type type );
162 
168  void setInlinedHtml( bool isHtml );
169 
174  bool isInlinedHtml() const;
175 
191  void setImageLocation( const QString &path );
192 
204  void addImage( const QImage &image, const QString &imageName );
205 
206 
212  void setEnabledSignature(bool enabled);
213  bool isEnabledSignature() const;
214 
220  void KPIMIDENTITIES_DEPRECATED insertIntoTextEdit( KRichTextEdit *textEdit,
221  Placement placement = End, bool addSeparator = true );
222 
223  enum AddedTextFlag {
224  AddNothing = 0,
225  AddSeparator = 1 << 0,
226  AddNewLines = 1 << 1
228  };
230 
232  typedef QFlags<AddedTextFlag> AddedText;
233 
250  // TODO: KDE5: BIC: Reorder parameters, the order here is a workaround for ambiguous parameters
251  // with the deprecated method
252  void insertIntoTextEdit( Placement placement, AddedText addedText,
253  KPIMTextEdit::TextEdit *textEdit ) const;
254 
258  //TODO; KDE5 merge with previous method
259  void insertIntoTextEdit( Placement placement, AddedText addedText,
260  KPIMTextEdit::TextEdit *textEdit, bool forceDisplay ) const;
261 
284  static void KPIMIDENTITIES_DEPRECATED insertPlainSignatureIntoTextEdit( const QString &signature,
285  KRichTextEdit *textEdit,
286  Placement placement = End,
287  bool isHtml = false );
288 
289  protected:
290 
291  // TODO: KDE5: BIC: Move all to private class
292  void writeConfig( KConfigGroup &config ) const;
293  void readConfig( const KConfigGroup &config );
294 
295  private:
296  void insertSignatureText(Placement placement, AddedText addedText, KPIMTextEdit::TextEdit *textEdit, bool forceDisplay) const;
297 
298  // TODO: KDE5: BIC: Move all to private class
299 
303  void assignFrom( const Signature &that );
304 
309  void cleanupImages() const;
310 
314  void saveImages() const;
315 
316  QString textFromFile( bool *ok ) const;
317  QString textFromCommand( bool *ok ) const;
318 
319  // TODO: KDE5: BIC: Add a d-pointer!!!
320  // There is already a pseude private class in the .cpp, using a hash.
321  QString mUrl;
322  QString mText;
323  Type mType;
324  bool mInlinedHtml;
325  };
326 
327  Q_DECLARE_OPERATORS_FOR_FLAGS( Signature::AddedText )
328 
329 }
330 
331 #endif /*kpim_signature_h*/
KPIMIdentities::Signature::AddedText
QFlags< AddedTextFlag > AddedText
Describes which additional parts should be added to the signature.
Definition: signature.h:232
KPIMIdentities::Signature::Start
The signature is placed at the start of the textedit.
Definition: signature.h:110
KPIMIdentities::Signature
Abstraction of a signature (aka "footer").
Definition: signature.h:89
KPIMIdentities::Identity
User identity information.
Definition: identity.h:82
KPIMIdentities::Signature::End
The signature is placed at the end of the textedit.
Definition: signature.h:111
KPIMIdentities::Signature::Type
Type
Type of signature (ie.
Definition: signature.h:98
KPIMIdentities::Signature::AddedTextFlag
AddedTextFlag
Definition: signature.h:223
KPIMIdentities::Signature::Placement
Placement
Describes the placement of the signature text when it is to be inserted into a text edit...
Definition: signature.h:109
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:01:12 by doxygen 1.8.7 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 API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



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