kpimidentities
signature.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KPIMIDENTITIES_SIGNATURE_H
00023 #define KPIMIDENTITIES_SIGNATURE_H
00024
00025 #include "kpimidentities_export.h"
00026
00027 #include <kdemacros.h>
00028
00029 #include <QtCore/QString>
00030 #include <QtCore/QStringList>
00031 #include <QtCore/QList>
00032 #include <QtCore/QHash>
00033 #include <QtCore/QVariant>
00034
00035 namespace KPIMIdentities
00036 {
00037 class Signature;
00038 }
00039 class KConfigGroup;
00040
00041 namespace KPIMIdentities
00042 {
00043
00044 KPIMIDENTITIES_EXPORT QDataStream &operator<<
00045 ( QDataStream &stream, const KPIMIdentities::Signature &sig );
00046 KPIMIDENTITIES_EXPORT QDataStream &operator>>
00047 ( QDataStream &stream, KPIMIdentities::Signature &sig );
00048
00053 class KPIMIDENTITIES_EXPORT Signature
00054 {
00055 friend class Identity;
00056
00057 friend KPIMIDENTITIES_EXPORT QDataStream &operator<< ( QDataStream &stream, const Signature &sig );
00058 friend KPIMIDENTITIES_EXPORT QDataStream &operator>> ( QDataStream &stream, Signature &sig );
00059
00060 public:
00062 enum Type {
00063 Disabled = 0,
00064 Inlined = 1,
00065 FromFile = 2,
00066 FromCommand = 3
00067 };
00068
00070 bool operator== ( const Signature &other ) const;
00071
00073 Signature();
00075 Signature( const QString &text );
00077 Signature( const QString &url, bool isExecutable );
00078
00080 QString rawText( bool *ok=0 ) const;
00081
00084 QString withSeparator( bool *ok=0 ) const;
00085
00088 void setText( const QString &text );
00089 QString text() const;
00090
00093 void setUrl( const QString &url, bool isExecutable=false );
00094 QString url() const;
00095
00097 Type type() const;
00098 void setType( Type type );
00099
00105 void setInlinedHtml( bool isHtml );
00106
00111 bool isInlinedHtml() const;
00112
00113 protected:
00114 void writeConfig( KConfigGroup &config ) const;
00115 void readConfig( const KConfigGroup &config );
00116
00117 private:
00118 QString textFromFile( bool *ok ) const;
00119 QString textFromCommand( bool *ok ) const;
00120
00121 QString mUrl;
00122 QString mText;
00123 Type mType;
00124 bool mInlinedHtml;
00125 };
00126
00127 }
00128
00129 #endif