79 { |
79 { |
80 FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::AddEntryAttachment()")); |
80 FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::AddEntryAttachment()")); |
81 |
81 |
82 iStatus = KRequestPending; |
82 iStatus = KRequestPending; |
83 |
83 |
84 TRAPD(error, DoAddEntryAttachmentL(aFilePath, anAttachInfo, aStore)); |
84 TRAPD(error, aStore->AttachmentManagerL().AddLinkedAttachmentL(aFilePath,anAttachInfo, iStatus);); |
|
85 |
85 if (error != KErrNone ) |
86 if (error != KErrNone ) |
86 { |
87 { |
87 //Complete request |
88 //Complete request |
88 TRequestStatus* status = &iStatus; |
89 TRequestStatus* status = &iStatus; |
89 User::RequestComplete(status, error); |
90 User::RequestComplete(status, error); |
94 |
95 |
95 FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::AddEntryAttachment() Done")); |
96 FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::AddEntryAttachment() Done")); |
96 return iStatus.Int(); |
97 return iStatus.Int(); |
97 } |
98 } |
98 |
99 |
99 |
|
100 // --------------------------------------------------------------------------- |
|
101 // DoAddLinkAttachmentL() |
|
102 // --------------------------------------------------------------------------- |
|
103 // |
|
104 void CObexutilsEntryhandler::DoAddEntryAttachmentL( |
|
105 const TDesC &aFilePath, |
|
106 CMsvAttachment* anAttachInfo, |
|
107 CMsvStore* aStore) |
|
108 { |
|
109 FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoAddEntryAttachmentL()")); |
|
110 |
|
111 aStore->AttachmentManagerL().AddLinkedAttachmentL(aFilePath,anAttachInfo, iStatus); |
|
112 |
|
113 //Complete request |
|
114 TRequestStatus* status = &iStatus; |
|
115 User::RequestComplete(status, KErrNone); |
|
116 |
|
117 FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoAddEntryAttachmentL() completed")); |
|
118 } |
|
119 |
|
120 // --------------------------------------------------------------------------- |
|
121 // UpdateLinkAttachment() |
|
122 // --------------------------------------------------------------------------- |
|
123 // |
|
124 TInt CObexutilsEntryhandler::UpdateEntryAttachment( |
|
125 TFileName& aFileName, |
|
126 CMsvAttachment* anOldAttachInfo, |
|
127 CMsvAttachment* aNewAttachInfo, |
|
128 CMsvStore* aStore) |
|
129 { |
|
130 FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::UpdateEntryAttachment()")); |
|
131 |
|
132 iStatus = KRequestPending; |
|
133 |
|
134 TRAPD(error, DoUpdateEntryAttachmentL(aFileName,anOldAttachInfo, aNewAttachInfo, aStore)); |
|
135 if (error != KErrNone ) |
|
136 { |
|
137 //Complete request |
|
138 TRequestStatus* status = &iStatus; |
|
139 User::RequestComplete(status, error); |
|
140 } |
|
141 |
|
142 SetActive(); |
|
143 iSyncWaiter.Start(); |
|
144 |
|
145 FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::UpdateEntryAttachment() Done")); |
|
146 return iStatus.Int(); |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // DoUpdateEntryAttachmentL() |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 void CObexutilsEntryhandler::DoUpdateEntryAttachmentL( |
|
154 TFileName& aFileName, |
|
155 CMsvAttachment* anOldAttachInfo, |
|
156 CMsvAttachment* aNewAttachInfo, |
|
157 CMsvStore* aStore) |
|
158 { |
|
159 FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoUpdateEntryAttachmentL()")); |
|
160 aStore->AttachmentManagerL().RemoveAttachmentL(anOldAttachInfo->Id(), iStatus); |
|
161 aStore->AttachmentManagerL().AddLinkedAttachmentL(aFileName,aNewAttachInfo, iStatus); |
|
162 |
|
163 //Complete request |
|
164 TRequestStatus* status = &iStatus; |
|
165 User::RequestComplete(status, KErrNone); |
|
166 |
|
167 FLOG(_L("[OBEXUTILS]\t CObexutilsEntryhandler::DoUpdateEntryAttachmentL() completed")); |
|
168 } |
|
169 |
100 |
170 // --------------------------------------------------------------------------- |
101 // --------------------------------------------------------------------------- |
171 // From class CActive. |
102 // From class CActive. |
172 // RunL() |
103 // RunL() |
173 // --------------------------------------------------------------------------- |
104 // --------------------------------------------------------------------------- |