equal
deleted
inserted
replaced
21 |
21 |
22 /*! |
22 /*! |
23 Constructs message part private with null id |
23 Constructs message part private with null id |
24 */ |
24 */ |
25 NmMessagePartPrivate::NmMessagePartPrivate() |
25 NmMessagePartPrivate::NmMessagePartPrivate() |
26 : mOwnId(0), mSize(0), mFetchedSize(0), |
26 : mPartId(0), mSize(0), mFetchedSize(0), |
27 mTextContent(0) |
27 mTextContent(0) |
28 { |
28 { |
29 } |
29 } |
30 |
30 |
31 /*! |
31 /*! |
81 } |
81 } |
82 |
82 |
83 /*! |
83 /*! |
84 Constructs message part with id \a id, parent id and mailbox id is set null |
84 Constructs message part with id \a id, parent id and mailbox id is set null |
85 */ |
85 */ |
86 NmMessagePart::NmMessagePart(const NmId &id) |
86 NmMessagePart::NmMessagePart(const NmId &partId) |
87 { |
87 { |
88 d = new NmMessagePartPrivate(); |
88 d = new NmMessagePartPrivate(); |
89 d->mOwnId = id; |
89 d->mPartId = partId; |
90 } |
|
91 |
|
92 /*! |
|
93 Constructs message part with id \a id and with parent id \a parentId, |
|
94 mailbox id is set to null |
|
95 */ |
|
96 NmMessagePart::NmMessagePart(const NmId &id, const NmId &parentId) |
|
97 { |
|
98 d = new NmMessagePartPrivate(); |
|
99 d->mOwnId = id; |
|
100 mEnvelope.setParentId(parentId); |
|
101 } |
|
102 |
|
103 /*! |
|
104 Constructs message part with id \a id, with parent id \a parentId and |
|
105 with mailbox id \a mailboxId |
|
106 */ |
|
107 NmMessagePart::NmMessagePart( |
|
108 const NmId &id, |
|
109 const NmId &parentId, |
|
110 const NmId &mailboxId) |
|
111 { |
|
112 d = new NmMessagePartPrivate(); |
|
113 d->mOwnId = id; |
|
114 mEnvelope.setParentId(parentId); |
|
115 mEnvelope.setMailboxId(mailboxId); |
|
116 } |
90 } |
117 |
91 |
118 /*! |
92 /*! |
119 Constructs new NmMessagePart object from private message part data |
93 Constructs new NmMessagePart object from private message part data |
120 */ |
94 */ |
127 /*! |
101 /*! |
128 Copy constructor |
102 Copy constructor |
129 */ |
103 */ |
130 NmMessagePart::NmMessagePart(const NmMessagePart &part) : d(part.d) |
104 NmMessagePart::NmMessagePart(const NmMessagePart &part) : d(part.d) |
131 { |
105 { |
132 mEnvelope.setParentId(part.mEnvelope.parentId()); |
|
133 mEnvelope.setMailboxId(part.mEnvelope.mailboxId()); |
|
134 } |
106 } |
135 |
107 |
136 /*! |
108 /*! |
137 Assignment operator |
109 Assignment operator |
138 */ |
110 */ |
139 NmMessagePart &NmMessagePart::operator=(const NmMessagePart &part) |
111 NmMessagePart &NmMessagePart::operator=(const NmMessagePart &part) |
140 { |
112 { |
141 if (this != &part) { |
113 if (this != &part) { |
142 d = part.d; |
114 d = part.d; |
143 mEnvelope.setParentId(part.mEnvelope.parentId()); |
|
144 mEnvelope.setMailboxId(part.mEnvelope.mailboxId()); |
|
145 } |
115 } |
146 return *this; |
116 return *this; |
147 } |
117 } |
148 |
118 |
149 /*! |
119 /*! |
158 } |
128 } |
159 |
129 |
160 /*! |
130 /*! |
161 Retruns id of message part |
131 Retruns id of message part |
162 */ |
132 */ |
163 NmId NmMessagePart::id() const |
133 NmId NmMessagePart::partId() const |
164 { |
134 { |
165 return d->mOwnId; |
135 return d->mPartId; |
166 } |
136 } |
167 |
137 |
168 /*! |
138 /*! |
169 Sets id of message part from \a id |
139 Sets id of message part from \a id |
170 */ |
140 */ |
171 void NmMessagePart::setId(const NmId &id) |
141 void NmMessagePart::setPartId(const NmId &id) |
172 { |
142 { |
173 d->mOwnId = id; |
143 d->mPartId = id; |
174 } |
|
175 |
|
176 /*! |
|
177 Returns parts parent id |
|
178 */ |
|
179 NmId NmMessagePart::parentId() const |
|
180 { |
|
181 return mEnvelope.parentId(); |
|
182 } |
|
183 |
|
184 /*! |
|
185 Sets message part parent id from \a id |
|
186 */ |
|
187 void NmMessagePart::setParentId(const NmId &id) |
|
188 { |
|
189 mEnvelope.setParentId(id); |
|
190 } |
|
191 |
|
192 /*! |
|
193 Returns mailbox id where part belong to |
|
194 */ |
|
195 NmId NmMessagePart::mailboxId() const |
|
196 { |
|
197 return mEnvelope.mailboxId(); |
|
198 } |
|
199 |
|
200 /*! |
|
201 Sets mailbox id from \a id |
|
202 */ |
|
203 void NmMessagePart::setMailboxId(const NmId &id) |
|
204 { |
|
205 mEnvelope.setMailboxId(id); |
|
206 } |
144 } |
207 |
145 |
208 /*! |
146 /*! |
209 Returns message part size in bytes |
147 Returns message part size in bytes |
210 */ |
148 */ |
344 } |
282 } |
345 d->mChildParts.clear(); |
283 d->mChildParts.clear(); |
346 } |
284 } |
347 for (int i = 0; i < parts.count(); i++) { |
285 for (int i = 0; i < parts.count(); i++) { |
348 if (parts[i] != NULL) { |
286 if (parts[i] != NULL) { |
349 parts[i]->setParentId(this->id()); |
|
350 parts[i]->setMailboxId(this->mailboxId()); |
|
351 d->mChildParts.append(parts[i]); |
287 d->mChildParts.append(parts[i]); |
352 } |
288 } |
353 } |
289 } |
354 } |
290 } |
355 |
291 |
370 void NmMessagePart::addChildPart(NmMessagePart *part) |
306 void NmMessagePart::addChildPart(NmMessagePart *part) |
371 { |
307 { |
372 if (!part) { |
308 if (!part) { |
373 return; |
309 return; |
374 } |
310 } |
375 part->setParentId(this->id()); |
|
376 part->setMailboxId(this->mailboxId()); |
|
377 d->mChildParts.append(part); |
311 d->mChildParts.append(part); |
378 } |
312 } |
379 |
313 |
380 /*! |
314 /*! |
381 Removes and deletes child part which id is \a partId. If id is not found |
315 Removes and deletes child part which id is \a partId. If id is not found |
382 simply returns |
316 simply returns |
383 */ |
317 */ |
384 void NmMessagePart::removeChildPart(const NmId &partId) |
318 void NmMessagePart::removeChildPart(const NmId &partId) |
385 { |
319 { |
386 for (int i = 0; i < d->mChildParts.count(); i++) { |
320 for (int i = 0; i < d->mChildParts.count(); i++) { |
387 if (d->mChildParts[i]->id() == partId) { |
321 if (d->mChildParts[i]->partId() == partId) { |
388 delete d->mChildParts[i]; |
322 delete d->mChildParts[i]; |
389 d->mChildParts.removeAt(i); |
323 d->mChildParts.removeAt(i); |
390 return; |
324 return; |
391 } |
325 } |
392 } |
326 } |