2
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB
|
|
3 |
*
|
|
4 |
* All rights reserved.
|
|
5 |
* This component and the accompanying materials are made available
|
|
6 |
* under the terms of the License "Eclipse Public License v1.0"
|
|
7 |
* which accompanies this distribution, and is available
|
|
8 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
9 |
*
|
|
10 |
* Initial Contributors:
|
|
11 |
* EmbedDev AB - initial contribution.
|
|
12 |
*
|
|
13 |
* Contributors:
|
|
14 |
*
|
|
15 |
* Description:
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
#include "FeedInfo.h"
|
|
20 |
#include <e32hashtab.h>
|
|
21 |
#include <fbs.h>
|
|
22 |
|
|
23 |
EXPORT_C CFeedInfo* CFeedInfo::NewL()
|
|
24 |
{
|
|
25 |
CFeedInfo* self = new (ELeave) CFeedInfo();
|
|
26 |
CleanupStack::PushL(self);
|
|
27 |
self->ConstructL();
|
|
28 |
CleanupStack::Pop();
|
|
29 |
return self;
|
|
30 |
}
|
|
31 |
|
|
32 |
EXPORT_C CFeedInfo* CFeedInfo::NewLC()
|
|
33 |
{
|
|
34 |
CFeedInfo* self = new (ELeave) CFeedInfo();
|
|
35 |
CleanupStack::PushL(self);
|
|
36 |
self->ConstructL();
|
|
37 |
return self;
|
|
38 |
}
|
|
39 |
|
|
40 |
EXPORT_C CFeedInfo* CFeedInfo::CopyL() const
|
|
41 |
{
|
|
42 |
CFeedInfo* copy = CFeedInfo::NewLC();
|
|
43 |
copy->SetUrlL(Url());
|
|
44 |
copy->SetTitleL(Title());
|
|
45 |
copy->SetDescriptionL(Description());
|
|
46 |
copy->SetImageUrlL(ImageUrl());
|
|
47 |
copy->SetLinkL(Link());
|
|
48 |
copy->SetBuildDate(BuildDate());
|
|
49 |
copy->SetLastUpdated(LastUpdated());
|
|
50 |
copy->SetImageFileNameL(ImageFileName());
|
|
51 |
copy->iFeedIcon->Duplicate(iFeedIcon->Handle());
|
|
52 |
if(CustomTitle())
|
|
53 |
{
|
|
54 |
copy->SetCustomTitle();
|
|
55 |
}
|
|
56 |
|
|
57 |
copy->SetLastError(LastError());
|
|
58 |
copy->SetFeedIconIndex(FeedIconIndex());
|
|
59 |
CleanupStack::Pop(copy);
|
|
60 |
return copy;
|
|
61 |
}
|
|
62 |
CFeedInfo::CFeedInfo()
|
|
63 |
{
|
|
64 |
iCustomTitle = EFalse;
|
|
65 |
iFeedIconIndex = -1;
|
|
66 |
}
|
|
67 |
|
|
68 |
EXPORT_C CFeedInfo::~CFeedInfo()
|
|
69 |
{
|
|
70 |
delete iUrl;
|
|
71 |
delete iTitle;
|
|
72 |
delete iDescription;
|
|
73 |
delete iImageUrl;
|
|
74 |
delete iImageFileName;
|
|
75 |
delete iLink;
|
|
76 |
delete iFeedIcon;
|
|
77 |
}
|
|
78 |
|
|
79 |
void CFeedInfo::ConstructL()
|
|
80 |
{
|
|
81 |
iFeedIcon = new (ELeave) CFbsBitmap;
|
|
82 |
}
|
|
83 |
|
|
84 |
EXPORT_C const TDesC& CFeedInfo::Url() const
|
|
85 |
{
|
|
86 |
return iUrl ? *iUrl : KNullDesC();
|
|
87 |
}
|
|
88 |
|
|
89 |
EXPORT_C void CFeedInfo::SetUrlL(const TDesC &aUrl)
|
|
90 |
{
|
|
91 |
if (iUrl)
|
|
92 |
{
|
|
93 |
delete iUrl;
|
|
94 |
iUrl = NULL;
|
|
95 |
}
|
|
96 |
|
|
97 |
iUrl = aUrl.AllocL();
|
|
98 |
iUid = DefaultHash::Des16(Url());
|
|
99 |
}
|
|
100 |
|
|
101 |
EXPORT_C const TDesC& CFeedInfo::Title() const
|
|
102 |
{
|
|
103 |
return iTitle ? *iTitle : KNullDesC();
|
|
104 |
}
|
|
105 |
|
|
106 |
EXPORT_C void CFeedInfo::SetTitleL(const TDesC &aTitle)
|
|
107 |
{
|
|
108 |
if(iTitle)
|
|
109 |
{
|
|
110 |
delete iTitle;
|
|
111 |
iTitle = NULL;
|
|
112 |
}
|
|
113 |
iTitle = aTitle.AllocL();
|
|
114 |
}
|
|
115 |
|
|
116 |
EXPORT_C const TDesC& CFeedInfo::Description() const
|
|
117 |
{
|
|
118 |
return iDescription ? *iDescription : KNullDesC();
|
|
119 |
}
|
|
120 |
|
|
121 |
EXPORT_C void CFeedInfo::SetDescriptionL(const TDesC &aDescription)
|
|
122 |
{
|
|
123 |
if (iDescription)
|
|
124 |
{
|
|
125 |
delete iDescription;
|
|
126 |
iDescription = NULL;
|
|
127 |
}
|
|
128 |
|
|
129 |
iDescription = aDescription.AllocL();
|
|
130 |
}
|
|
131 |
|
|
132 |
EXPORT_C const TDesC& CFeedInfo::ImageUrl() const
|
|
133 |
{
|
|
134 |
return iImageUrl ? *iImageUrl : KNullDesC();
|
|
135 |
}
|
|
136 |
|
|
137 |
EXPORT_C void CFeedInfo::SetImageUrlL(const TDesC &aImageUrl)
|
|
138 |
{
|
|
139 |
if (iImageUrl)
|
|
140 |
{
|
|
141 |
delete iImageUrl;
|
|
142 |
iImageUrl = NULL;
|
|
143 |
}
|
|
144 |
iImageUrl = aImageUrl.AllocL();
|
|
145 |
}
|
|
146 |
|
|
147 |
EXPORT_C const TDesC& CFeedInfo::Link() const
|
|
148 |
{
|
|
149 |
return iLink ? *iLink : KNullDesC();
|
|
150 |
}
|
|
151 |
|
|
152 |
EXPORT_C void CFeedInfo::SetLinkL(const TDesC& aLink)
|
|
153 |
{
|
|
154 |
if (iLink)
|
|
155 |
{
|
|
156 |
delete iLink;
|
|
157 |
iLink = NULL;
|
|
158 |
}
|
|
159 |
iLink = aLink.AllocL();
|
|
160 |
}
|
|
161 |
|
|
162 |
EXPORT_C TTime CFeedInfo::BuildDate() const
|
|
163 |
{
|
|
164 |
return iBuildDate;
|
|
165 |
}
|
|
166 |
|
|
167 |
EXPORT_C void CFeedInfo::SetBuildDate(TTime aBuildDate)
|
|
168 |
{
|
|
169 |
iBuildDate = aBuildDate;
|
|
170 |
}
|
|
171 |
|
|
172 |
EXPORT_C TTime CFeedInfo::LastUpdated() const
|
|
173 |
{
|
|
174 |
return iLastUpdated;
|
|
175 |
}
|
|
176 |
|
|
177 |
EXPORT_C void CFeedInfo::SetLastUpdated(TTime aUpdated)
|
|
178 |
{
|
|
179 |
iLastUpdated = aUpdated;
|
|
180 |
}
|
|
181 |
|
|
182 |
EXPORT_C TUint CFeedInfo::Uid() const
|
|
183 |
{
|
|
184 |
return iUid;
|
|
185 |
}
|
|
186 |
|
|
187 |
EXPORT_C const TDesC& CFeedInfo::ImageFileName() const
|
|
188 |
{
|
|
189 |
return iImageFileName ? *iImageFileName : KNullDesC();
|
|
190 |
}
|
|
191 |
|
|
192 |
EXPORT_C void CFeedInfo::SetImageFileNameL(const TDesC& aFileName)
|
|
193 |
{
|
|
194 |
if (iImageFileName)
|
|
195 |
{
|
|
196 |
delete iImageFileName;
|
|
197 |
iImageFileName = NULL;
|
|
198 |
}
|
|
199 |
iImageFileName = aFileName.AllocL();
|
|
200 |
}
|
|
201 |
|
|
202 |
EXPORT_C TBool CFeedInfo::CustomTitle() const
|
|
203 |
{
|
|
204 |
return iCustomTitle;
|
|
205 |
}
|
|
206 |
|
|
207 |
EXPORT_C void CFeedInfo::SetCustomTitle()
|
|
208 |
{
|
|
209 |
iCustomTitle = ETrue;
|
|
210 |
}
|
|
211 |
|
|
212 |
EXPORT_C void CFeedInfo::SetLastError(TInt aLastError)
|
|
213 |
{
|
|
214 |
iLastError = aLastError;
|
|
215 |
}
|
|
216 |
|
|
217 |
EXPORT_C TInt CFeedInfo::LastError() const
|
|
218 |
{
|
|
219 |
return iLastError;
|
|
220 |
}
|
|
221 |
|
|
222 |
EXPORT_C CFbsBitmap* CFeedInfo::FeedIcon() const
|
|
223 |
{
|
|
224 |
return iFeedIcon;
|
|
225 |
}
|
|
226 |
|
|
227 |
EXPORT_C void CFeedInfo::SetFeedIcon(CFbsBitmap* aBitmapToClone)
|
|
228 |
{
|
|
229 |
iFeedIcon->Duplicate(aBitmapToClone->Handle());
|
|
230 |
}
|
|
231 |
|
|
232 |
void CFeedInfo::ImageOperationCompleteL(TInt /*aError*/)
|
|
233 |
{
|
|
234 |
|
|
235 |
}
|
|
236 |
|
|
237 |
EXPORT_C TInt CFeedInfo::FeedIconIndex() const
|
|
238 |
{
|
|
239 |
return iFeedIconIndex;
|
|
240 |
}
|
|
241 |
|
|
242 |
EXPORT_C void CFeedInfo::SetFeedIconIndex(TInt aIndex)
|
|
243 |
{
|
|
244 |
iFeedIconIndex = aIndex;
|
|
245 |
}
|