application/src/PodcastAppui.cpp
author teknolog
Thu, 25 Feb 2010 17:33:06 +0000
changeset 8 aab3aa4acdd6
parent 2 29cda98b007e
child 11 f6c975c3b702
permissions -rw-r--r--
Checked all TRAP_IGNORE
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     1
/*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     2
* Copyright (c) 2007-2010 Sebastian Brannstrom, Lars Persson, EmbedDev AB
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     3
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     4
* All rights reserved.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     5
* This component and the accompanying materials are made available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     6
* under the terms of the License "Eclipse Public License v1.0"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     7
* which accompanies this distribution, and is available
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     8
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
     9
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    10
* Initial Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    11
* EmbedDev AB - initial contribution.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    12
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    13
* Contributors:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    14
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    15
* Description:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    16
*
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    17
*/
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    18
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    19
#include "PodcastAppui.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    20
#include <Podcast.rsg>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    21
#include "Podcast.hrh"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    22
#include "PodcastFeedView.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    23
#include "PodcastShowsView.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    24
#include "PodcastQueueView.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    25
#include "PodcastSettingsView.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    26
#include "PodcastSearchView.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    27
#include "ShowEngine.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    28
#include "PodcastModel.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    29
#include "debug.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    30
#include "..\help\podcatcher.hlp.hrh"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    31
#include "PodcastApp.h"
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    32
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    33
#include <HLPLCH.H>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    34
#include <avkon.hrh>
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    35
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    36
const TUint KDelayLaunch = 1000;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    37
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    38
CPodcastAppUi::CPodcastAppUi(CPodcastModel* aPodcastModel):iPodcastModel(aPodcastModel)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    39
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    40
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    41
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    42
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    43
void CPodcastAppUi::ConstructL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    44
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    45
    DP("CPodcastAppUi::ConstructL() BEGIN");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    46
    BaseConstructL(CAknAppUi::EAknEnableSkin); 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    47
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    48
    DP("Constructing FeedView");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    49
	iFeedView = CPodcastFeedView::NewL(*iPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    50
	this->AddViewL(iFeedView);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    51
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    52
    DP("Constructing ShowsView");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    53
	iShowsView = CPodcastShowsView::NewL(*iPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    54
	this->AddViewL(iShowsView);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    55
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    56
    DP("Constructing QueueView");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    57
    iQueueView = CPodcastQueueView::NewL(*iPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    58
	this->AddViewL(iQueueView);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    59
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    60
    DP("Constructing SearchView");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    61
	iSearchView = CPodcastSearchView::NewL(*iPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    62
	this->AddViewL(iSearchView);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    63
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    64
    DP("Constructing SettingsView");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    65
	iSettingsView = CPodcastSettingsView::NewL(*iPodcastModel);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    66
	this->AddViewL(iSettingsView);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    67
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    68
	iNaviPane =( CAknNavigationControlContainer * ) StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidNavi ) );
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    69
	NaviShowTabGroupL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    70
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    71
	// start a timer to let ConstructL finish before we display any dialogs or start downloading
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    72
	// this provides another entry point in HandleTimeout below
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    73
	iStartTimer = CTimeout::NewL(*this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    74
	iStartTimer->After(KDelayLaunch);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    75
    DP("CPodcastAppUi::ConstructL() END");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    76
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    77
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    78
CPodcastAppUi::~CPodcastAppUi()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    79
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    80
    if(iNaviDecorator)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    81
    	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    82
    	iNaviPane->Pop(iNaviDecorator);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    83
    	delete iNaviDecorator;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    84
    	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    85
	delete iStartTimer;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    86
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    87
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    88
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    89
// CPodcastAppUi::DynInitMenuPaneL(TInt aResourceId,CEikMenuPane* aMenuPane)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    90
//  This function is called by the EIKON framework just before it displays
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    91
//  a menu pane. Its default implementation is empty, and by overriding it,
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    92
//  the application can set the state of menu items dynamically according
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    93
//  to the state of application data.
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    94
// ------------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    95
//
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    96
void CPodcastAppUi::DynInitMenuPaneL(
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    97
    TInt /*aResourceId*/,CEikMenuPane* /*aMenuPane*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    98
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
    99
    // no implementation required 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   100
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   101
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   102
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   103
// CPodcastAppUi::HandleCommandL(TInt aCommand)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   104
// takes care of command handling
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   105
// -----------------------------------------------------------------------------
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   106
//
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   107
void CPodcastAppUi::HandleCommandL( TInt aCommand )
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   108
    {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   109
    switch ( aCommand )
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   110
        {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   111
        case EAknSoftkeyExit:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   112
            {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   113
            Exit();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   114
            break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   115
            }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   116
        case EEikCmdExit:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   117
        	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   118
			TApaTask task(CEikonEnv::Static()->WsSession());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   119
			task.SetWgId(CEikonEnv::Static()->RootWin().Identifier());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   120
			task.SendToBackground(); 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   121
			break;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   122
        	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   123
	case EPodcastHelp:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   124
        	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   125
        	CArrayFix<TCoeHelpContext>* buf = CPodcastAppUi::AppHelpContextL();		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   126
        	HlpLauncher::LaunchHelpApplicationL(iEikonEnv->WsSession(), buf);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   127
        	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   128
        	break;      	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   129
        default:
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   130
            break;      
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   131
        }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   132
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   133
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   134
CArrayFix<TCoeHelpContext>* CPodcastAppUi::HelpContextL() const
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   135
   { 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   136
    CArrayFixFlat<TCoeHelpContext>* array = 
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   137
                new(ELeave)CArrayFixFlat<TCoeHelpContext>(1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   138
    CleanupStack::PushL(array);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   139
    // todo: view detection doesn't seem to work
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   140
    if (ViewShown(KUidPodcastSearchViewID)) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   141
		array->AppendL(TCoeHelpContext(KUidPodcast,KContextSettings));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   142
    } else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   143
		array->AppendL(TCoeHelpContext(KUidPodcast,KContextApplication));
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   144
    }
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   145
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   146
    CleanupStack::Pop(array);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   147
    return array;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   148
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   149
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   150
void CPodcastAppUi::NaviShowTabGroupL()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   151
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   152
	iNaviDecorator = iNaviPane->CreateTabGroupL();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   153
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   154
	iTabGroup = STATIC_CAST(CAknTabGroup*, iNaviDecorator->DecoratedControl());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   155
	iTabGroup->SetTabFixedWidthL(EAknTabWidthWithTwoTabs);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   156
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   157
	HBufC *label1 = iEikonEnv->AllocReadResourceLC(R_TABGROUP_FEEDS);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   158
	iTabGroup->AddTabL(KTabIdFeeds,*label1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   159
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   160
	HBufC *label3 = iEikonEnv->AllocReadResourceLC(R_TABGROUP_QUEUE);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   161
	iTabGroup->AddTabL(KTabIdQueue,*label3);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   162
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   163
//	HBufC *label4 = iEikonEnv->AllocReadResourceLC(R_TABGROUP_SEARCH);			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   164
//	iTabGroup->AddTabL(KTabIdSearch,*label4);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   165
//	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   166
//	CleanupStack::PopAndDestroy(label4);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   167
	CleanupStack::PopAndDestroy(label3);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   168
	CleanupStack::PopAndDestroy(label1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   169
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   170
	iTabGroup->SetActiveTabByIndex(0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   171
	iTabGroup->SetObserver(this);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   172
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   173
	iNaviPane->Pop();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   174
	iNaviPane->PushL(*iNaviDecorator);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   175
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   176
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   177
void CPodcastAppUi::TabChangedL (TInt aIndex)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   178
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   179
	DP("CPodcastListView::TabChangedL ");
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   180
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   181
	TUid newview = TUid::Uid(0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   182
	TUid messageUid = TUid::Uid(0);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   183
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   184
	if (aIndex == KTabIdFeeds) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   185
		newview = KUidPodcastFeedViewID;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   186
	} else if (aIndex == KTabIdQueue) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   187
		newview = KUidPodcastQueueViewID;
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   188
	} else {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   189
		User::Leave(KErrTooBig);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   190
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   191
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   192
	if(newview.iUid != 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   193
		{			
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   194
		ActivateLocalViewL(newview,  messageUid, KNullDesC8());
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   195
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   196
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   197
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   198
void CPodcastAppUi::SetActiveTab(TInt aIndex) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   199
	iTabGroup->SetActiveTabByIndex(aIndex);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   200
}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   201
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   202
void CPodcastAppUi::HandleTimeout(const CTimeout& /*aId*/, TInt /*aError*/)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   203
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   204
	iFeedView->CheckResumeDownload();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   205
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   206
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   207
void CPodcastAppUi::UpdateQueueTab(TInt aQueueLength)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   208
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   209
	if (aQueueLength == 0)
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   210
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   211
		HBufC *queue = iEikonEnv->AllocReadResourceLC(R_TABGROUP_QUEUE);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   212
		iTabGroup->ReplaceTabL(KTabIdQueue, *queue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   213
		CleanupStack::PopAndDestroy(queue);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   214
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   215
	else
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   216
		{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   217
		HBufC *queueTemplate = iEikonEnv->AllocReadResourceLC(R_TABGROUP_QUEUE_COUNTER);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   218
		HBufC *queueCounter = HBufC::NewLC(queueTemplate->Length()+2);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   219
		queueCounter->Des().Format(*queueTemplate, aQueueLength);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   220
		
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   221
		iTabGroup->ReplaceTabL(KTabIdQueue, *queueCounter);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   222
		CleanupStack::PopAndDestroy(queueCounter);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   223
		CleanupStack::PopAndDestroy(queueTemplate);	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   224
		}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   225
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   226
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   227
void CPodcastAppUi::TabLeft()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   228
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   229
	TInt ati = iTabGroup->ActiveTabIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   230
	if(ati > 0) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   231
		SetActiveTab(ati-1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   232
		TabChangedL(ati-1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   233
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   234
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   235
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   236
void CPodcastAppUi::TabRight()
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   237
	{
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   238
	TInt ati = iTabGroup->ActiveTabIndex();
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   239
	
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   240
	if(ati < iTabGroup->TabCount()-1) {
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   241
		SetActiveTab(ati+1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   242
		TabChangedL(ati+1);
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   243
	}
29cda98b007e Initial import of Podcatcher from the Bergamot project
skip
parents:
diff changeset
   244
	}