| 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 "ShowInfo.h"
 | 
|  |     20 | #include <e32hashtab.h>
 | 
|  |     21 | 
 | 
|  |     22 | EXPORT_C CShowInfo* CShowInfo::NewL(TUint aVersion)
 | 
|  |     23 | 	{
 | 
|  |     24 | 	CShowInfo* self = CShowInfo::NewLC(aVersion);
 | 
|  |     25 | 	CleanupStack::Pop(self);
 | 
|  |     26 | 	return self;
 | 
|  |     27 | 	}
 | 
|  |     28 | 
 | 
|  |     29 | EXPORT_C CShowInfo* CShowInfo::NewLC(TUint /*aVersion*/) {
 | 
|  |     30 | 	CShowInfo* self = new (ELeave) CShowInfo();
 | 
|  |     31 | 	CleanupStack::PushL(self);
 | 
|  |     32 | 	self->ConstructL();
 | 
|  |     33 | 	return self;
 | 
|  |     34 | 	}
 | 
|  |     35 | 
 | 
|  |     36 | void CShowInfo::ConstructL()
 | 
|  |     37 | 	{
 | 
|  |     38 | 	iDownloadState = ENotDownloaded;
 | 
|  |     39 | 	iDelete = EFalse;
 | 
|  |     40 | 	iShowType = EAudioPodcast;
 | 
|  |     41 | 	}
 | 
|  |     42 | 
 | 
|  |     43 | CShowInfo::CShowInfo()
 | 
|  |     44 | 	{
 | 
|  |     45 | 	iTrackNo = KMaxTUint; 
 | 
|  |     46 | 	}
 | 
|  |     47 | 
 | 
|  |     48 | EXPORT_C CShowInfo::~CShowInfo()
 | 
|  |     49 | 	{
 | 
|  |     50 | 	delete iTitle;
 | 
|  |     51 | 	delete iUrl;
 | 
|  |     52 | 	delete iDescription;
 | 
|  |     53 | 	delete iFileName;
 | 
|  |     54 | 	}
 | 
|  |     55 | 
 | 
|  |     56 | EXPORT_C const TDesC& CShowInfo::Title() const
 | 
|  |     57 | 	{
 | 
|  |     58 | 	return iTitle ? *iTitle : KNullDesC();
 | 
|  |     59 | 	}
 | 
|  |     60 | 
 | 
|  |     61 | EXPORT_C void CShowInfo::SetTitleL(const TDesC &aTitle)
 | 
|  |     62 | 	{
 | 
|  |     63 | 	if (iTitle)
 | 
|  |     64 | 		{
 | 
|  |     65 | 		delete iTitle;
 | 
|  |     66 | 		iTitle = NULL;
 | 
|  |     67 | 		}
 | 
|  |     68 | 	iTitle = aTitle.AllocL();
 | 
|  |     69 | 	}
 | 
|  |     70 | 
 | 
|  |     71 | EXPORT_C const TDesC& CShowInfo::Url() const
 | 
|  |     72 | 	{
 | 
|  |     73 | 	return iUrl ? *iUrl : KNullDesC();
 | 
|  |     74 | 	}
 | 
|  |     75 | 
 | 
|  |     76 | EXPORT_C void CShowInfo::SetUrlL(const TDesC &aUrl)
 | 
|  |     77 | 	{
 | 
|  |     78 | 	if (iUrl)
 | 
|  |     79 | 		{
 | 
|  |     80 | 		delete iUrl;
 | 
|  |     81 | 		iUrl = NULL;
 | 
|  |     82 | 		}
 | 
|  |     83 | 	iUrl = aUrl.AllocL();
 | 
|  |     84 | 	iUid = DefaultHash::Des16(Url());
 | 
|  |     85 | 	}
 | 
|  |     86 | 
 | 
|  |     87 | EXPORT_C const TDesC& CShowInfo::Description() const
 | 
|  |     88 | 	{
 | 
|  |     89 | 	return iDescription ? *iDescription : KNullDesC();
 | 
|  |     90 | 	}
 | 
|  |     91 | 
 | 
|  |     92 | EXPORT_C void CShowInfo::SetDescriptionL(const TDesC &aDescription)
 | 
|  |     93 | 	{
 | 
|  |     94 | 	if (iDescription)
 | 
|  |     95 | 		{
 | 
|  |     96 | 		delete iDescription;
 | 
|  |     97 | 		iDescription = NULL;
 | 
|  |     98 | 		}
 | 
|  |     99 | 
 | 
|  |    100 | 	iDescription = aDescription.AllocL();
 | 
|  |    101 | 	}
 | 
|  |    102 | 
 | 
|  |    103 | EXPORT_C TTimeIntervalMicroSeconds CShowInfo::Position() const
 | 
|  |    104 | 	{
 | 
|  |    105 | 	return iPosition;
 | 
|  |    106 | 	}
 | 
|  |    107 | 
 | 
|  |    108 | EXPORT_C void CShowInfo::SetPosition(TTimeIntervalMicroSeconds aPosition)
 | 
|  |    109 | 	{
 | 
|  |    110 | 	iPosition = aPosition;
 | 
|  |    111 | 	}
 | 
|  |    112 | 
 | 
|  |    113 | EXPORT_C TUint CShowInfo::PlayTime() const
 | 
|  |    114 | 	{
 | 
|  |    115 | 	return iPlayTime;
 | 
|  |    116 | 	}
 | 
|  |    117 | 
 | 
|  |    118 | EXPORT_C void CShowInfo::SetPlayTime(TUint aPlayTime)
 | 
|  |    119 | 	{
 | 
|  |    120 | 	iPlayTime = aPlayTime;
 | 
|  |    121 | 	}
 | 
|  |    122 | 
 | 
|  |    123 | EXPORT_C TPlayState CShowInfo::PlayState() const
 | 
|  |    124 | 	{
 | 
|  |    125 | 	return iPlayState;
 | 
|  |    126 | 	}
 | 
|  |    127 | 
 | 
|  |    128 | EXPORT_C void CShowInfo::SetPlayState(TPlayState aPlayState)
 | 
|  |    129 | 	{
 | 
|  |    130 | 	iPlayState = aPlayState;
 | 
|  |    131 | 	}
 | 
|  |    132 | 
 | 
|  |    133 | EXPORT_C TDownloadState CShowInfo::DownloadState() const
 | 
|  |    134 | 	{
 | 
|  |    135 | 	return iDownloadState;
 | 
|  |    136 | 	}
 | 
|  |    137 | 
 | 
|  |    138 | EXPORT_C void CShowInfo::SetDownloadState(TDownloadState aDownloadState)
 | 
|  |    139 | 	{
 | 
|  |    140 | 	iDownloadState = aDownloadState;
 | 
|  |    141 | 	}
 | 
|  |    142 | 
 | 
|  |    143 | EXPORT_C TUint CShowInfo::FeedUid() const
 | 
|  |    144 | 	{
 | 
|  |    145 | 	return iFeedUid;
 | 
|  |    146 | 	}
 | 
|  |    147 | 
 | 
|  |    148 | EXPORT_C void CShowInfo::SetFeedUid(TUint aFeedUid)
 | 
|  |    149 | 	{
 | 
|  |    150 | 	iFeedUid = aFeedUid;
 | 
|  |    151 | 	}
 | 
|  |    152 | 
 | 
|  |    153 | EXPORT_C void CShowInfo::SetUid(TUint aUid)
 | 
|  |    154 | 	{
 | 
|  |    155 | 	iUid = aUid;
 | 
|  |    156 | 	}
 | 
|  |    157 | 		
 | 
|  |    158 | EXPORT_C TUint CShowInfo::Uid() const
 | 
|  |    159 | 	{
 | 
|  |    160 | 	return iUid;
 | 
|  |    161 | 	}
 | 
|  |    162 | 
 | 
|  |    163 | EXPORT_C TUint CShowInfo::ShowSize() const
 | 
|  |    164 | 	{
 | 
|  |    165 | 	return iShowSize;
 | 
|  |    166 | 	}
 | 
|  |    167 | 
 | 
|  |    168 | EXPORT_C void CShowInfo::SetShowSize(TUint aShowSize)
 | 
|  |    169 | 	{
 | 
|  |    170 | 	iShowSize = aShowSize;
 | 
|  |    171 | 	}
 | 
|  |    172 | 
 | 
|  |    173 | EXPORT_C const TTime CShowInfo::PubDate() const
 | 
|  |    174 | 	{
 | 
|  |    175 | 	return iPubDate;
 | 
|  |    176 | 	}
 | 
|  |    177 | 
 | 
|  |    178 | EXPORT_C void CShowInfo::SetPubDate(TTime aPubDate)
 | 
|  |    179 | 	{
 | 
|  |    180 | 	iPubDate = aPubDate;
 | 
|  |    181 | 	}
 | 
|  |    182 | 
 | 
|  |    183 | EXPORT_C const TDesC& CShowInfo::FileName() const
 | 
|  |    184 | 	{
 | 
|  |    185 | 	return iFileName ? *iFileName : KNullDesC();
 | 
|  |    186 | 	}
 | 
|  |    187 | 
 | 
|  |    188 | EXPORT_C void CShowInfo::SetFileNameL(const TDesC &aFileName)
 | 
|  |    189 | 	{
 | 
|  |    190 | 	if (iFileName)
 | 
|  |    191 | 		{
 | 
|  |    192 | 		delete iFileName;
 | 
|  |    193 | 		iFileName = NULL;
 | 
|  |    194 | 		}
 | 
|  |    195 | 	iFileName = aFileName.AllocL();
 | 
|  |    196 | 	}
 | 
|  |    197 | 
 | 
|  |    198 | EXPORT_C void CShowInfo::SetShowType(TShowType aShowType)
 | 
|  |    199 | 	{
 | 
|  |    200 | 	iShowType = aShowType;
 | 
|  |    201 | 	}
 | 
|  |    202 | 
 | 
|  |    203 | EXPORT_C TShowType CShowInfo::ShowType() const
 | 
|  |    204 | 	{
 | 
|  |    205 | 	return iShowType;
 | 
|  |    206 | 	}
 | 
|  |    207 | 
 | 
|  |    208 | EXPORT_C void CShowInfo::SetTrackNo(TUint aTrackId)
 | 
|  |    209 | 	{
 | 
|  |    210 | 	iTrackNo = aTrackId;
 | 
|  |    211 | 	}
 | 
|  |    212 | 
 | 
|  |    213 | EXPORT_C TUint CShowInfo::TrackNo() const
 | 
|  |    214 | 	{
 | 
|  |    215 | 	return iTrackNo;
 | 
|  |    216 | 	}
 | 
|  |    217 | 
 | 
|  |    218 | EXPORT_C CShowInfo::CShowInfo(CShowInfo *aInfo)
 | 
|  |    219 | 	{
 | 
| 76 |    220 | 	if (iTitle)
 | 
|  |    221 | 		delete iTitle;
 | 
| 2 |    222 | 	iTitle = aInfo->Title().Alloc();
 | 
| 76 |    223 | 	
 | 
|  |    224 | 	if(iUrl)
 | 
|  |    225 | 		delete iUrl;
 | 
| 2 |    226 | 	iUrl = aInfo->Url().Alloc();
 | 
| 76 |    227 | 	
 | 
|  |    228 | 	if (iDescription)
 | 
|  |    229 | 		delete iDescription;
 | 
| 2 |    230 | 	iDescription = aInfo->Description().Alloc();
 | 
| 76 |    231 | 	
 | 
|  |    232 | 	if (iFileName)
 | 
|  |    233 | 		delete iFileName;
 | 
| 2 |    234 | 	iFileName = aInfo->FileName().Alloc();
 | 
| 76 |    235 | 	
 | 
| 2 |    236 | 	iPosition = aInfo->Position();
 | 
|  |    237 | 	iPlayTime = aInfo->PlayTime();
 | 
|  |    238 | 	iPlayState = aInfo->PlayState();
 | 
|  |    239 | 	iDownloadState = aInfo->DownloadState();
 | 
|  |    240 | 	iFeedUid = aInfo->FeedUid();
 | 
|  |    241 | 	iUid = aInfo->Uid();
 | 
|  |    242 | 	iShowSize = aInfo->ShowSize();
 | 
|  |    243 | 	iTrackNo = aInfo->TrackNo();
 | 
|  |    244 | 	iPubDate = aInfo->PubDate();
 | 
|  |    245 | 	iShowType = aInfo->ShowType();
 | 
|  |    246 | 	iLastError = aInfo->LastError();
 | 
|  |    247 | 	}
 | 
|  |    248 | 
 | 
|  |    249 | EXPORT_C void CShowInfo::SetLastError(TInt aLastError)
 | 
|  |    250 | 	{
 | 
|  |    251 | 	iLastError = aLastError;
 | 
|  |    252 | 	}
 | 
|  |    253 | 
 | 
|  |    254 | EXPORT_C TInt CShowInfo::LastError() const
 | 
|  |    255 | 	{
 | 
|  |    256 | 	return iLastError;
 | 
|  |    257 | 	}
 |