• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdepimlibs-4.14.10 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
36namespace KPIMIdentities
37{
38 class Signature;
39 class Identity;
40}
41class KConfigGroup;
42class KRichTextEdit;
43
44namespace KPIMTextEdit
45{
46 class TextEdit;
47}
48
49namespace 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,
227 AddNewLines = 1 << 1
229 };
230
232 typedef QFlags<AddedTextFlag> AddedText;
233
252 // TODO: KDE5: BIC: Reorder parameters, the order here is a workaround for ambiguous parameters
253 // with the deprecated method
254 void insertIntoTextEdit( Placement placement, AddedText addedText,
255 KPIMTextEdit::TextEdit *textEdit ) const;
256
260 //TODO; KDE5 merge with previous method
261 void insertIntoTextEdit( Placement placement, AddedText addedText,
262 KPIMTextEdit::TextEdit *textEdit, bool forceDisplay ) const;
263
288 static void KPIMIDENTITIES_DEPRECATED insertPlainSignatureIntoTextEdit( const QString &signature,
289 KRichTextEdit *textEdit,
290 Placement placement = End,
291 bool isHtml = false );
292
293 protected:
294
295 // TODO: KDE5: BIC: Move all to private class
296 void writeConfig( KConfigGroup &config ) const;
297 void readConfig( const KConfigGroup &config );
298
299 private:
300 void insertSignatureText(Placement placement, AddedText addedText, KPIMTextEdit::TextEdit *textEdit, bool forceDisplay) const;
301
302 // TODO: KDE5: BIC: Move all to private class
303
307 void assignFrom( const Signature &that );
308
313 void cleanupImages() const;
314
318 void saveImages() const;
319
320 QString textFromFile( bool *ok ) const;
321 QString textFromCommand( bool *ok ) const;
322
323 // TODO: KDE5: BIC: Add a d-pointer!!!
324 // There is already a pseude private class in the .cpp, using a hash.
325 QString mUrl;
326 QString mText;
327 Type mType;
328 bool mInlinedHtml;
329 };
330
331 Q_DECLARE_OPERATORS_FOR_FLAGS( Signature::AddedText )
332
333}
334
335#endif /*kpim_signature_h*/
KPIMIdentities::Identity
User identity information.
Definition: identity.h:84
KPIMIdentities::Signature
Abstraction of a signature (aka "footer").
Definition: signature.h:90
KPIMIdentities::Signature::AddedText
QFlags< AddedTextFlag > AddedText
Describes which additional parts should be added to the signature.
Definition: signature.h:232
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
KPIMIdentities::Signature::End
@ End
The signature is placed at the end of the textedit.
Definition: signature.h:111
KPIMIdentities::Signature::Start
@ Start
The signature is placed at the start of the textedit.
Definition: signature.h:110
KPIMIdentities::Signature::AddedTextFlag
AddedTextFlag
Definition: signature.h:223
KPIMIdentities::Signature::Type
Type
Type of signature (ie.
Definition: signature.h:98
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jul 21 2022 00:00:00 by doxygen 1.9.5 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.14.10 API Reference

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