|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Implementation of ConvergedMessageAttachment class |
|
15 * |
|
16 */ |
|
17 |
|
18 //SYSTEM INCLUDES |
|
19 #include "convergedmessageattachment.h" |
|
20 |
|
21 //USER INCLUDES |
|
22 |
|
23 //---------------------------------------------------------------- |
|
24 // ConvergedMessageAttachment::ConvergedMessageAttachment |
|
25 // @see header |
|
26 //---------------------------------------------------------------- |
|
27 ConvergedMessageAttachment::ConvergedMessageAttachment( |
|
28 const QString& filepath, |
|
29 const int attachmenttype ) |
|
30 { |
|
31 mPath = filepath; |
|
32 mType = attachmenttype; |
|
33 } |
|
34 |
|
35 //---------------------------------------------------------------- |
|
36 // ConvergedMessageAttachment::~ConvergedMessageAttachment |
|
37 // @see header |
|
38 //---------------------------------------------------------------- |
|
39 ConvergedMessageAttachment::~ConvergedMessageAttachment() |
|
40 { |
|
41 } |
|
42 |
|
43 //---------------------------------------------------------------- |
|
44 // ConvergedMessageAttachment::setFilePath |
|
45 // @see header |
|
46 //---------------------------------------------------------------- |
|
47 void ConvergedMessageAttachment::setFilePath( |
|
48 const QString& filepath ) |
|
49 { |
|
50 mPath = filepath; |
|
51 } |
|
52 |
|
53 //---------------------------------------------------------------- |
|
54 // ConvergedMessageAttachment::filePath |
|
55 // @see header |
|
56 //---------------------------------------------------------------- |
|
57 const QString& ConvergedMessageAttachment::filePath() const |
|
58 { |
|
59 return mPath; |
|
60 } |
|
61 |
|
62 //---------------------------------------------------------------- |
|
63 // ConvergedMessageAttachment::attachmentType |
|
64 // @see header |
|
65 //---------------------------------------------------------------- |
|
66 void ConvergedMessageAttachment::setAttachmentType( |
|
67 const int attachmenttype ) |
|
68 { |
|
69 mType = attachmenttype; |
|
70 } |
|
71 |
|
72 //---------------------------------------------------------------- |
|
73 // ConvergedMessageAttachment::attachmentType |
|
74 // @see header |
|
75 //---------------------------------------------------------------- |
|
76 int ConvergedMessageAttachment::attachmentType() const |
|
77 { |
|
78 return mType; |
|
79 } |
|
80 |
|
81 //---------------------------------------------------------------- |
|
82 // ConvergedMessageAttachment::serialize |
|
83 // @see header |
|
84 //---------------------------------------------------------------- |
|
85 void ConvergedMessageAttachment::serialize( |
|
86 QDataStream &stream) const |
|
87 { |
|
88 //put path and type of attachment into the stream |
|
89 stream << mPath; |
|
90 QString attType = QString::number(mType); |
|
91 stream << attType; |
|
92 } |
|
93 |
|
94 //---------------------------------------------------------------- |
|
95 // ConvergedMessageAttachment::deserialize |
|
96 // @see header |
|
97 //---------------------------------------------------------------- |
|
98 void ConvergedMessageAttachment::deserialize( |
|
99 QDataStream &stream) |
|
100 { |
|
101 //get path and type of attachment from the stream |
|
102 stream >> mPath; |
|
103 QString attType; |
|
104 stream >> attType; |
|
105 mType = attType.toInt(); |
|
106 } |
|
107 |
|
108 //---------------------------------------------------------------- |
|
109 // ConvergedMessageAttachment::operator== |
|
110 // @see header |
|
111 //---------------------------------------------------------------- |
|
112 bool ConvergedMessageAttachment::operator==( |
|
113 const ConvergedMessageAttachment &other) const |
|
114 { |
|
115 bool result = false; |
|
116 |
|
117 if( mPath == other.filePath() && |
|
118 mType == other.attachmentType() ) |
|
119 { |
|
120 result = true; |
|
121 } |
|
122 |
|
123 return result; |
|
124 } |
|
125 |
|
126 //eof |
|
127 |