libkcal
attachment.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include "attachment.h"
00023
00024 using namespace KCal;
00025
00026 Attachment::Attachment( const Attachment &attachment)
00027 {
00028 mMimeType = attachment.mMimeType;
00029 mData = attachment.mData;
00030 mBinary = attachment.mBinary;
00031 mShowInline = attachment.mShowInline;
00032 mLabel = attachment.mLabel;
00033 }
00034
00035 Attachment::Attachment(const QString& uri, const QString& mime)
00036 {
00037 mMimeType = mime;
00038 mData = uri;
00039 mBinary = false;
00040 mShowInline = false;
00041 mLabel = QString::null;
00042 }
00043
00044 Attachment::Attachment(const char *base64, const QString& mime)
00045 {
00046 mMimeType = mime;
00047 mData = QString::fromUtf8(base64);
00048 mBinary = true;
00049 mShowInline = false;
00050 mLabel = QString::null;
00051 }
00052
00053 bool Attachment::isUri() const
00054 {
00055 return !mBinary;
00056 }
00057
00058 QString Attachment::uri() const
00059 {
00060 if (!mBinary)
00061 return mData;
00062 else
00063 return QString::null;
00064 }
00065
00066 void Attachment::setUri(const QString& uri)
00067 {
00068 mData = uri;
00069 mBinary = false;
00070 }
00071
00072 bool Attachment::isBinary() const
00073 {
00074 return mBinary;
00075 }
00076
00077 char *Attachment::data() const
00078 {
00079 if (mBinary)
00080
00081 return const_cast<char*>( mData.latin1() );
00082 else
00083 return 0;
00084 }
00085
00086 void Attachment::setData(const char *base64)
00087 {
00088 mData = QString::fromUtf8(base64);
00089 mBinary = true;
00090 }
00091
00092 QString Attachment::mimeType() const
00093 {
00094 return mMimeType;
00095 }
00096
00097 void Attachment::setMimeType(const QString& mime)
00098 {
00099 mMimeType = mime;
00100 }
00101
00102 bool Attachment::showInline() const
00103 {
00104 return mShowInline;
00105 }
00106
00107 void Attachment::setShowInline( bool showinline )
00108 {
00109 mShowInline = showinline;
00110 }
00111
00112 QString Attachment::label() const
00113 {
00114 return mLabel;
00115 }
00116
00117 void Attachment::setLabel( const QString& label )
00118 {
00119 mLabel = label;
00120 }
00121
|