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 return mData.utf8().data();
00081 else
00082 return 0;
00083 }
00084
00085 void Attachment::setData(const char *base64)
00086 {
00087 mData = QString::fromUtf8(base64);
00088 mBinary = true;
00089 }
00090
00091 QString Attachment::mimeType() const
00092 {
00093 return mMimeType;
00094 }
00095
00096 void Attachment::setMimeType(const QString& mime)
00097 {
00098 mMimeType = mime;
00099 }
00100
00101 bool Attachment::showInline() const
00102 {
00103 return mShowInline;
00104 }
00105
00106 void Attachment::setShowInline( bool showinline )
00107 {
00108 mShowInline = showinline;
00109 }
00110
00111 QString Attachment::label() const
00112 {
00113 return mLabel;
00114 }
00115
00116 void Attachment::setLabel( const QString& label )
00117 {
00118 mLabel = label;
00119 }
00120
|