-rw-r--r-- | libkcal/attachment.cpp | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/libkcal/attachment.cpp b/libkcal/attachment.cpp index 1ead923..520ac95 100644 --- a/libkcal/attachment.cpp +++ b/libkcal/attachment.cpp | |||
@@ -1,86 +1,120 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkcal. | 2 | This file is part of libkcal. |
3 | |||
3 | Copyright (c) 2002 Michael Brade <brade@kde.org> | 4 | Copyright (c) 2002 Michael Brade <brade@kde.org> |
4 | 5 | ||
5 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
9 | 10 | ||
10 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 14 | Library General Public License for more details. |
14 | 15 | ||
15 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
19 | */ | 20 | */ |
20 | 21 | ||
21 | #include "attachment.h" | 22 | #include "attachment.h" |
22 | 23 | ||
23 | using namespace KCal; | 24 | using namespace KCal; |
24 | 25 | ||
26 | Attachment::Attachment( const Attachment &attachment) | ||
27 | { | ||
28 | mMimeType = attachment.mMimeType; | ||
29 | mData = attachment.mData; | ||
30 | mBinary = attachment.mBinary; | ||
31 | mShowInline = attachment.mShowInline; | ||
32 | mLabel = attachment.mLabel; | ||
33 | } | ||
34 | |||
25 | Attachment::Attachment(const QString& uri, const QString& mime) | 35 | Attachment::Attachment(const QString& uri, const QString& mime) |
26 | { | 36 | { |
27 | mMimeType = mime; | 37 | mMimeType = mime; |
28 | mData = uri; | 38 | mData = uri; |
29 | mBinary = false; | 39 | mBinary = false; |
40 | mShowInline = false; | ||
41 | mLabel = QString::null; | ||
30 | } | 42 | } |
31 | 43 | ||
32 | Attachment::Attachment(const char *base64, const QString& mime) | 44 | Attachment::Attachment(const char *base64, const QString& mime) |
33 | { | 45 | { |
34 | mMimeType = mime; | 46 | mMimeType = mime; |
35 | mData = QString::fromUtf8(base64); | 47 | mData = QString::fromUtf8(base64); |
36 | mBinary = true; | 48 | mBinary = true; |
49 | mShowInline = false; | ||
50 | mLabel = QString::null; | ||
37 | } | 51 | } |
38 | 52 | ||
39 | bool Attachment::isURI() const | 53 | bool Attachment::isUri() const |
40 | { | 54 | { |
41 | return !mBinary; | 55 | return !mBinary; |
42 | } | 56 | } |
43 | 57 | ||
44 | QString Attachment::uri() const | 58 | QString Attachment::uri() const |
45 | { | 59 | { |
46 | if (!mBinary) | 60 | if (!mBinary) |
47 | return mData; | 61 | return mData; |
48 | else | 62 | else |
49 | return QString::null; | 63 | return QString::null; |
50 | } | 64 | } |
51 | 65 | ||
52 | void Attachment::setURI(const QString& uri) | 66 | void Attachment::setUri(const QString& uri) |
53 | { | 67 | { |
54 | mData = uri; | 68 | mData = uri; |
55 | mBinary = false; | 69 | mBinary = false; |
56 | } | 70 | } |
57 | 71 | ||
58 | bool Attachment::isBinary() const | 72 | bool Attachment::isBinary() const |
59 | { | 73 | { |
60 | return mBinary; | 74 | return mBinary; |
61 | } | 75 | } |
62 | 76 | ||
63 | char *Attachment::data() const | 77 | char *Attachment::data() const |
64 | { | 78 | { |
65 | if (mBinary) | 79 | if (mBinary) |
66 | return mData.utf8().data(); | 80 | return mData.utf8().data(); |
67 | else | 81 | else |
68 | return 0; | 82 | return 0; |
69 | } | 83 | } |
70 | 84 | ||
71 | void Attachment::setData(const char *base64) | 85 | void Attachment::setData(const char *base64) |
72 | { | 86 | { |
73 | mData = QString::fromUtf8(base64); | 87 | mData = QString::fromUtf8(base64); |
74 | mBinary = true; | 88 | mBinary = true; |
75 | } | 89 | } |
76 | 90 | ||
77 | QString Attachment::mimeType() const | 91 | QString Attachment::mimeType() const |
78 | { | 92 | { |
79 | return mMimeType; | 93 | return mMimeType; |
80 | } | 94 | } |
81 | 95 | ||
82 | void Attachment::setMimeType(const QString& mime) | 96 | void Attachment::setMimeType(const QString& mime) |
83 | { | 97 | { |
84 | mMimeType = mime; | 98 | mMimeType = mime; |
85 | } | 99 | } |
86 | 100 | ||
101 | bool Attachment::showInline() const | ||
102 | { | ||
103 | return mShowInline; | ||
104 | } | ||
105 | |||
106 | void Attachment::setShowInline( bool showinline ) | ||
107 | { | ||
108 | mShowInline = showinline; | ||
109 | } | ||
110 | |||
111 | QString Attachment::label() const | ||
112 | { | ||
113 | return mLabel; | ||
114 | } | ||
115 | |||
116 | void Attachment::setLabel( const QString& label ) | ||
117 | { | ||
118 | mLabel = label; | ||
119 | } | ||
120 | |||