--- a/application/src/PodcastFeedView.cpp Sat Oct 30 14:28:25 2010 +0100
+++ b/application/src/PodcastFeedView.cpp Sun Oct 31 14:03:27 2010 +0000
@@ -40,7 +40,9 @@
#define KMaxMessageLength 200
#define KMaxTitleLength 100
-_LIT(KFeedFormat, "%d\t%S\t%S%S");
+_LIT(KFeedFormatPortrait, "%d\t%S\t%S%S");
+//_LIT(KFeedFormatPortrait, "%d\t%S");
+_LIT(KFeedFormatLandscape, "%d\t%S");
enum
{
EFeedIcon
@@ -61,6 +63,40 @@
return self;
}
+void CPodcastFeedView::LoadIcons()
+ {
+ iFeedIdForIconArray.Reset();
+
+ CFbsBitmap* bitmap = NULL;
+ CFbsBitmap* mask = NULL;
+ _LIT(KAsterisk, "*");
+ // Load the bitmap for empty icon
+ TFileName fname;
+ fname.Copy(KAsterisk);
+ TParsePtr parser(fname);
+ CArrayPtrFlat< CGulIcon > *iconArray= new(ELeave) CArrayPtrFlat< CGulIcon >(1);
+ CleanupStack::PushL( iconArray );
+
+ // Load svg.-image and mask with a single call
+ AknIconUtils::CreateIconL(bitmap,
+ mask,
+ iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
+ EMbmPodcastFeed,
+ EMbmPodcastFeed_mask);
+
+ /*bitmap = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40);
+ * */
+ CleanupStack::PushL( bitmap );
+ // Load the mask for feed icon
+ //mask = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40m );
+ CleanupStack::PushL( mask );
+ // Append the feed icon to icon array
+ iconArray->AppendL( CGulIcon::NewL( bitmap, mask ) );
+ CleanupStack::Pop(2); // bitmap, mask
+ iListContainer->SetListboxIcons(iconArray);
+ CleanupStack::Pop(iconArray); // icons
+ }
+
CPodcastFeedView::CPodcastFeedView(CPodcastModel& aPodcastModel):iPodcastModel(aPodcastModel)
{
iFirstActivateAfterLaunch = ETrue;
@@ -75,37 +111,9 @@
iFeedsFormat = iEikonEnv->AllocReadResourceL(R_PODCAST_FEEDS_STATUS_FORMAT);
CPodcastListView::ConstructL();
iPodcastModel.FeedEngine().AddObserver(this);
- CArrayPtr< CGulIcon >* icons = new(ELeave) CArrayPtrFlat< CGulIcon >(1);
- CleanupStack::PushL( icons );
-
- CFbsBitmap* bitmap = NULL;
- CFbsBitmap* mask = NULL;
- // Load the bitmap for empty icon
- TFileName fname = KAsterisk;
- TParsePtr parser(fname);
+ SetEmptyTextL(R_PODCAST_NO_FEEDS);
- SetEmptyTextL(R_PODCAST_NO_FEEDS);
-
- // Load svg.-image and mask with a single call
- AknIconUtils::CreateIconL(bitmap,
- mask,
- iEikonEnv->EikAppUi()->Application()->BitmapStoreName(),
- EMbmPodcastFeed,
- EMbmPodcastFeed_mask);
-
- /*bitmap = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40);
- * */
- CleanupStack::PushL( bitmap );
- // Load the mask for feed icon
- //mask = iEikonEnv->CreateBitmapL(KAsterisk,EMbmPodcastFeed_40x40m );
- CleanupStack::PushL( mask );
- // Append the feed icon to icon array
- icons->AppendL( CGulIcon::NewL( bitmap, mask ) );
- CleanupStack::Pop(2); // bitmap, mask
- iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->SetIconArrayL( icons );
- CleanupStack::Pop(icons); // icons
-
- iListContainer->Listbox()->SetListBoxObserver(this);
+ LoadIcons();
iUpdater = CPodcastFeedViewUpdater::NewL(*this);
DP("CPodcastFeedView::ConstructL END");
@@ -145,7 +153,10 @@
itemProps.SetDimmed(EFalse);
iItemArray->Delete(aIndex);
iItemArray->InsertL(aIndex, iListboxFormatbuffer);
- iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps);
+ iItemArrayShort->Delete(aIndex);
+ iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort);
+
+ //iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps);
// If item is visible, redraw it
if (iListContainer->Listbox()->TopItemIndex() <= aIndex
&& iListContainer->Listbox()->BottomItemIndex() >= aIndex)
@@ -207,7 +218,7 @@
void CPodcastFeedView::HandleListBoxEventL(CEikListBox* /* aListBox */, TListBoxEvent aEventType)
{
- DP("CPodcastFeedView::HandleListBoxEventL BEGIN");
+// DP("CPodcastFeedView::HandleListBoxEventL BEGIN");
switch(aEventType)
{
@@ -231,7 +242,7 @@
default:
break;
}
- DP("CPodcastFeedView::HandleListBoxEventL END");
+// DP("CPodcastFeedView::HandleListBoxEventL END");
}
void CPodcastFeedView::FeedUpdateAllCompleteL(TFeedState /*aState*/)
@@ -272,6 +283,7 @@
void CPodcastFeedView::UpdateFeedInfoStatusL(TUint aFeedUid, TBool aIsUpdating)
{
+ DP("CPodcastFeedView::UpdateFeedInfoStatusL BEGIN");
const RFeedInfoArray& feeds = iPodcastModel.FeedEngine().GetSortedFeeds();
// Find the index for the feed i both the feed-array and the listbox
@@ -305,6 +317,8 @@
iItemIdArray.InsertL(aFeedUid, feedsIdx);
iItemArray->Delete(listboxIdx);
iItemArray->InsertL(feedsIdx, KNullDesC);
+ iItemArrayShort->Delete(listboxIdx);
+ iItemArrayShort->InsertL(feedsIdx, KNullDesC);
iListContainer->Listbox()->HandleItemAdditionL();
}
// Update the listbox info
@@ -318,10 +332,12 @@
{
iListContainer->Listbox()->DrawItem(k);
}
+ DP("CPodcastFeedView::UpdateFeedInfoStatusL END");
}
void CPodcastFeedView::FormatFeedInfoListBoxItemL(CFeedInfo& aFeedInfo, TBool aIsUpdating)
{
+ DP("CPodcastFeedView::FormatFeedInfoListBoxItemL BEGIN");
TBuf<KMaxShortDateFormatSpec*2> updatedDate;
TBuf<KMaxUnplayedFeedsLength> unplayedShows;
TUint unplayedCount = 0;
@@ -371,7 +387,7 @@
updatedDate.Zero();
}
}
- CArrayPtr<CGulIcon>* icons = iListContainer->Listbox()->ItemDrawer()->FormattedCellData()->IconArray();
+
iconIndex = iFeedIdForIconArray.Find(aFeedInfo.Uid());
if(iconIndex == KErrNotFound && aFeedInfo.FeedIcon() != NULL && aFeedInfo.ImageFileName().Length() > 0 &&
aFeedInfo.FeedIcon()->SizeInPixels().iHeight > 0 &&
@@ -382,6 +398,8 @@
CFbsBitmap* bmpCopy = new (ELeave) CFbsBitmap;
CleanupStack::PushL(bmpCopy);
bmpCopy->Duplicate(aFeedInfo.FeedIcon()->Handle());
+ CArrayPtr<CGulIcon>* icons = iListContainer->ListboxIcons();
+
icons->AppendL( CGulIcon::NewL(AknIconUtils::CreateIconL(bmpCopy), NULL));
iFeedIdForIconArray.Append(aFeedInfo.Uid());
@@ -396,8 +414,10 @@
if (unplayedShows.Length() > 0 && updatedDate.Length() > 0) {
unplayedShows.Insert(0,_L(", "));
}
-
- iListboxFormatbuffer.Format(KFeedFormat(), iconIndex, &(aFeedInfo.Title()), &updatedDate, &unplayedShows);
+
+ iListboxFormatbuffer.Format(KFeedFormatPortrait(), iconIndex, &(aFeedInfo.Title()), &updatedDate, &unplayedShows);
+ iListboxFormatbufferShort.Format(KFeedFormatLandscape(), iconIndex, &(aFeedInfo.Title()));
+ DP("CPodcastFeedView::FormatFeedInfoListBoxItemL END");
}
void CPodcastFeedView::ImageOperationCompleteL(TInt aError, TUint aHandle, CPodcastModel& /*aPodcastModel*/)
@@ -408,7 +428,8 @@
}
void CPodcastFeedView::UpdateFeedInfoDataL(CFeedInfo* aFeedInfo, TInt aIndex, TBool aIsUpdating )
- {
+ {
+ DP("CPodcastFeedView::UpdateFeedInfoDataL BEGIN");
TListItemProperties itemProps;
itemProps.SetDimmed(aIsUpdating);
FormatFeedInfoListBoxItemL(*aFeedInfo, aIsUpdating);
@@ -417,16 +438,20 @@
if (iListboxFormatbuffer.Compare(compareTo) != 0) {
iItemArray->Delete(aIndex);
+ iItemArrayShort->Delete(aIndex);
if(aIndex>= iItemArray->MdcaCount())
{
iItemArray->AppendL(iListboxFormatbuffer);
+ iItemArrayShort->AppendL(iListboxFormatbufferShort);
}
else
{
iItemArray->InsertL(aIndex, iListboxFormatbuffer);
+ iItemArrayShort->InsertL(aIndex, iListboxFormatbufferShort);
}
}
- iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps);
+ //iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(aIndex, itemProps);
+ DP("CPodcastFeedView::UpdateFeedInfoDataL END");
}
@@ -456,13 +481,16 @@
while (iItemArray->Count() < nbrItems)
{
iItemArray->AppendL(KNullDesC);
+ iItemArrayShort->AppendL(KNullDesC);
TListItemProperties itemProps;
- iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(iItemArray->Count() - 1, itemProps);
+ //iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(iItemArray->Count() - 1, itemProps);
}
while (iItemArray->Count() > nbrItems)
{
iItemArray->Delete(iItemArray->Count() - 1);
+ iItemArrayShort->Delete(iItemArray->Count() - 1);
}
+ //iListContainer->Listbox()->
iUpdater->StartUpdate(nbrItems);
}
else
@@ -471,12 +499,13 @@
TBuf<KMaxFeedNameLength> itemName;
iEikonEnv->ReadResourceL(itemName, R_PODCAST_FEEDS_NO_FEEDS);
iItemArray->Reset();
+ iItemArrayShort->Reset();
iItemIdArray.Reset();
TListItemProperties itemProps;
itemProps.SetDimmed(ETrue);
itemProps.SetHiddenSelection(ETrue);
- iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
+ //iListContainer->Listbox()->ItemDrawer()->SetPropertiesL(0, itemProps);
}
iListContainer->Listbox()->HandleItemAdditionL();
DP("CPodcastFeedView::UpdateListboxItemsL END");
@@ -762,6 +791,7 @@
{
iPodcastModel.FeedEngine().RemoveFeedL(iItemIdArray[index]);
iItemArray->Delete(index);
+ iItemArrayShort->Delete(index);
iItemIdArray.Remove(index);
iListContainer->Listbox()->HandleItemRemovalL();
iListContainer->Listbox()->DrawNow();