20
|
1 |
/*
|
|
2 |
* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Implementation of the class CFMRadioChannelListView
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <featmgr.h>
|
|
21 |
#include <aknViewAppUi.h>
|
|
22 |
#include <akntitle.h>
|
|
23 |
#include <avkon.hrh>
|
|
24 |
#include <avkon.rsg>
|
|
25 |
#include <StringLoader.h>
|
|
26 |
#include <eikmenup.h>
|
|
27 |
#include <eikbtgpc.h>
|
|
28 |
#include <fmradio.rsg>
|
|
29 |
#include <fmradio.mbg>
|
|
30 |
#include <fmradiouids.h>
|
|
31 |
#include <AknQueryDialog.h>
|
|
32 |
#include <aknnotewrappers.h>
|
|
33 |
#include <data_caging_path_literals.hrh>
|
|
34 |
#include <aknbutton.h>
|
|
35 |
#include <akntoolbar.h>
|
|
36 |
|
|
37 |
#include "fmradioengine.h"
|
|
38 |
#include "fmradio.hrh"
|
|
39 |
#include "fmradiochannellistview.h"
|
|
40 |
#include "fmradiochannellistcontainer.h"
|
|
41 |
#include "debug.h"
|
|
42 |
#include "fmradiordsreceiverbase.h"
|
|
43 |
#include "fmradiopubsub.h"
|
|
44 |
#include "fmradiofrequencyquerydialog.h"
|
|
45 |
#include "fmradioappui.h"
|
|
46 |
|
|
47 |
const TInt KMSKControlID(3);
|
|
48 |
|
|
49 |
// ================= MEMBER FUNCTIONS =======================
|
|
50 |
|
|
51 |
// ---------------------------------------------------------------------------
|
|
52 |
// CFMRadioChannelListView::NewL
|
|
53 |
// Two-phase constructor of CFMRadioChannelListView
|
|
54 |
// ---------------------------------------------------------------------------
|
|
55 |
//
|
|
56 |
CFMRadioChannelListView* CFMRadioChannelListView::NewL(
|
|
57 |
CRadioEngine* aRadioEngine, MChannelListHandler& aObserver )
|
|
58 |
{
|
|
59 |
CFMRadioChannelListView* self = new ( ELeave ) CFMRadioChannelListView( aObserver );
|
|
60 |
CleanupStack::PushL(self);
|
|
61 |
self->ConstructL(aRadioEngine);
|
|
62 |
CleanupStack::Pop( self );
|
|
63 |
return self;
|
|
64 |
}
|
|
65 |
|
|
66 |
// ---------------------------------------------------------------------------
|
|
67 |
// CFMRadioChannelListView::CFMRadioChannelListView
|
|
68 |
//
|
|
69 |
// ---------------------------------------------------------------------------
|
|
70 |
//
|
|
71 |
CFMRadioChannelListView::CFMRadioChannelListView( MChannelListHandler& aObserver ) :
|
|
72 |
iNowPlayingIndex( KErrNotFound ),
|
|
73 |
iObserver( aObserver )
|
|
74 |
{
|
|
75 |
}
|
|
76 |
// ---------------------------------------------------------------------------
|
|
77 |
// CFMRadioChannelListView::ConstructL
|
|
78 |
// EPOC two-phased constructor
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
//
|
|
81 |
void CFMRadioChannelListView::ConstructL(
|
|
82 |
CRadioEngine* aRadioEngine)
|
|
83 |
{
|
|
84 |
iRadioEngine = aRadioEngine;
|
|
85 |
BaseConstructL( R_FMRADIO_CH_LIST_VIEW );
|
|
86 |
PrepareToolbar();
|
|
87 |
|
|
88 |
if ( !AknLayoutUtils::PenEnabled() )
|
|
89 |
{
|
|
90 |
iToolbar->SetToolbarVisibility( EFalse );
|
|
91 |
}
|
|
92 |
|
|
93 |
//called here to ensure that empty channels are named in the way we want them to be.
|
|
94 |
InitializeChannelsL();
|
|
95 |
}
|
|
96 |
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
// CFMRadioChannelListView::~CFMRadioChannelListView
|
|
99 |
// Class destructor
|
|
100 |
// ---------------------------------------------------------------------------
|
|
101 |
//
|
|
102 |
CFMRadioChannelListView::~CFMRadioChannelListView()
|
|
103 |
{
|
|
104 |
if ( iContainer )
|
|
105 |
{
|
|
106 |
AppUi()->RemoveFromViewStack( *this, iContainer );
|
|
107 |
}
|
|
108 |
delete iContainer;
|
|
109 |
}
|
|
110 |
|
|
111 |
// ---------------------------------------------------------------------------
|
|
112 |
// CFMRadioChannelListView::Id
|
|
113 |
// Return the unique identifier corresponding to this view
|
|
114 |
// ---------------------------------------------------------------------------
|
|
115 |
//
|
|
116 |
TUid CFMRadioChannelListView::Id() const
|
|
117 |
{
|
|
118 |
return KFMRadioChannelListViewId;
|
|
119 |
}
|
|
120 |
|
|
121 |
// ---------------------------------------------------------------------------
|
|
122 |
// CFMRadioChannelListView::DoActivateL
|
|
123 |
// Activate the channel list view
|
|
124 |
// ---------------------------------------------------------------------------
|
|
125 |
//
|
|
126 |
void CFMRadioChannelListView::DoActivateL(
|
|
127 |
const TVwsViewId& /*aPrevViewId*/,
|
|
128 |
TUid /*aCustomMessageId*/,
|
|
129 |
const TDesC8& /*aCustomMessage*/ )
|
|
130 |
{
|
|
131 |
FTRACE( FPrint( _L("CFMRadioChannelListView::DoActivateL Start") ) );
|
|
132 |
|
|
133 |
iRadioEngine->RdsReceiver().AddObserver(this);
|
|
134 |
|
|
135 |
iFirstMoveDone = ETrue;
|
|
136 |
|
|
137 |
SetTitleL( R_FMRADIO_STATIONS_VIEW_TITLE );
|
|
138 |
|
|
139 |
if ( !iContainer )
|
|
140 |
{
|
|
141 |
FTRACE( FPrint( _L("CFMRadioChannelListView::DoActivateL inside second, not iContainer if") ) );
|
|
142 |
iContainer = CFMRadioChannelListContainer::NewL( ClientRect(), *iRadioEngine, iObserver );
|
|
143 |
iContainer->SetMopParent( this );
|
|
144 |
iContainer->SetObserver( this );
|
|
145 |
AppUi()->AddToStackL( *this, iContainer );
|
|
146 |
}
|
|
147 |
|
|
148 |
InitializeChannelsL();
|
|
149 |
|
|
150 |
FadeAndShowExit( iFaded );
|
|
151 |
|
|
152 |
AppUi()->HandleCommandL( EFMRadioCmdChannelListViewActive );
|
|
153 |
|
|
154 |
UpdateMiddleSoftKeyL();
|
|
155 |
}
|
|
156 |
|
|
157 |
// ---------------------------------------------------------------------------
|
|
158 |
// CFMRadioChannelListView::HandleCommandL
|
|
159 |
// Interprets view's menu,softkey and other commands and acts
|
|
160 |
// accordingly by calling the appropriate command handler
|
|
161 |
// function for further action.
|
|
162 |
// ---------------------------------------------------------------------------
|
|
163 |
//
|
|
164 |
void CFMRadioChannelListView::HandleCommandL( TInt aCommand )
|
|
165 |
{
|
|
166 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
|
|
167 |
switch ( aCommand )
|
|
168 |
{
|
|
169 |
case EFMRadioCmdMove:
|
|
170 |
{
|
|
171 |
MoveCurrentItemIndexL();
|
|
172 |
break;
|
|
173 |
}
|
|
174 |
case EFMRadioCmdDone:
|
|
175 |
{
|
|
176 |
iMoveMode = EFalse;
|
|
177 |
iFirstMoveDone = ETrue;
|
|
178 |
Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
|
|
179 |
|
|
180 |
UpdateMiddleSoftKeyL();
|
|
181 |
|
|
182 |
iContainer->MoveDoneL();
|
|
183 |
TInt currentIndex = 0;
|
|
184 |
currentIndex = appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() );
|
|
185 |
if ( currentIndex != KErrNotFound )
|
|
186 |
{
|
|
187 |
iRadioEngine->SetCurrentPresetIndex( currentIndex );
|
|
188 |
SetNowPlayingChannel( currentIndex );
|
|
189 |
}
|
|
190 |
ShowToolbar( ETrue );
|
|
191 |
break;
|
|
192 |
}
|
|
193 |
case EFMRadioCmdDrop:
|
|
194 |
{
|
|
195 |
iFirstMoveDone = EFalse;
|
|
196 |
Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_GRAP_DONE );
|
|
197 |
iContainer->HandleDropL();
|
|
198 |
break;
|
|
199 |
}
|
|
200 |
case EFMRadioCmdGrap:
|
|
201 |
{
|
|
202 |
if ( iFirstMoveDone )
|
|
203 |
{
|
|
204 |
Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_DROP_CANCEL );
|
|
205 |
}
|
|
206 |
else
|
|
207 |
{
|
|
208 |
Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_DROP_DONE );
|
|
209 |
}
|
|
210 |
iContainer->ActivateMoveL();
|
|
211 |
break;
|
|
212 |
}
|
|
213 |
case EAknSoftkeyBack: // Go back to the main view
|
|
214 |
{
|
|
215 |
appUi->ActivateLocalViewL( KFMRadioMainViewId );
|
|
216 |
break;
|
|
217 |
}
|
|
218 |
case EEikBidCancel:
|
|
219 |
{
|
|
220 |
CancelMoveL();
|
|
221 |
break;
|
|
222 |
}
|
|
223 |
case EAknSoftkeySelect: // Save a channel to the highlighted slot
|
|
224 |
{
|
|
225 |
break;
|
|
226 |
}
|
|
227 |
case EFMRadioCmdTuneManually:
|
|
228 |
{
|
|
229 |
// If manual tuning is canceled, return to previously tuned frequency.
|
|
230 |
TUint32 prevFreq = iRadioEngine->GetTunedFrequency() / KFMRadioFreqMultiplier;
|
|
231 |
TUint32 retFreq = prevFreq;
|
|
232 |
|
|
233 |
iManualQueryDialog = CFMRadioFrequencyQueryDialog::NewL( retFreq );
|
|
234 |
iManualQueryDialog->SetObserver( this );
|
|
235 |
|
|
236 |
TInt res = iManualQueryDialog->ExecuteLD( R_FMRADIO_MANUAL_TUNING_QUERY );
|
|
237 |
|
|
238 |
if ( res )
|
|
239 |
{
|
|
240 |
if ( iObserver.Channels().Count() < KMaxNumberOfChannelListItems )
|
|
241 |
{
|
|
242 |
TInt usefreq = static_cast<TInt>( retFreq * KFMRadioFreqMultiplier );
|
|
243 |
iRadioEngine->Tune( usefreq );
|
|
244 |
TBuf<KPresetNameLength> stationName;
|
|
245 |
stationName.SetLength( 0 );
|
|
246 |
|
|
247 |
iObserver.AddChannelToListL( stationName, usefreq );
|
|
248 |
|
|
249 |
iObserver.UpdateChannelsL( EStoreAllToRepository, 0, 0 );
|
|
250 |
|
|
251 |
iContainer->AddChannelL( stationName, usefreq, ETrue );
|
|
252 |
|
|
253 |
iRadioEngine->TunePresetL( iObserver.Channels().Count() - 1 );
|
|
254 |
|
|
255 |
TInt index = iRadioEngine->GetPresetIndex();
|
|
256 |
|
|
257 |
iContainer->UpdateItemIconL( index, KNowPlayingIconIndexChList );
|
|
258 |
|
|
259 |
iContainer->UpdateLastListenedChannel( index ); // Update index
|
|
260 |
}
|
|
261 |
else
|
|
262 |
{
|
|
263 |
// Show icon, or overwrite last item, or selected item?
|
|
264 |
CAknInformationNote* infonote = new( ELeave ) CAknInformationNote();
|
|
265 |
|
|
266 |
HBufC* noteText = StringLoader::LoadLC(
|
|
267 |
R_QTN_FMRADIO_LIST_QUERY_LIST_FULL, iCoeEnv );
|
|
268 |
|
|
269 |
|
|
270 |
infonote->ExecuteLD( *noteText );
|
|
271 |
|
|
272 |
CleanupStack::PopAndDestroy( noteText );
|
|
273 |
}
|
|
274 |
}
|
|
275 |
else //cancel pressed, return to previous frequency
|
|
276 |
{
|
|
277 |
iRadioEngine->Tune( static_cast<TInt>( prevFreq * KFMRadioFreqMultiplier ) );
|
|
278 |
}
|
|
279 |
break;
|
|
280 |
}
|
|
281 |
case EFMRadioCmdListenCh:
|
|
282 |
{
|
|
283 |
if ( !AknLayoutUtils::PenEnabled() )
|
|
284 |
{
|
|
285 |
appUi->HandleCommandL( aCommand );
|
|
286 |
// update msk here
|
|
287 |
UpdateMiddleSoftKeyL();
|
|
288 |
}
|
|
289 |
if ( iMoveMode )
|
|
290 |
{
|
|
291 |
MoveActionDoneL();
|
|
292 |
}
|
|
293 |
break;
|
|
294 |
}
|
|
295 |
case EFMRadioToolbarButtonCmdToggleIhf:
|
|
296 |
{
|
|
297 |
if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputHeadset )
|
|
298 |
{
|
|
299 |
appUi->HandleCommandL( EFMRadioCmdActivateIhf );
|
|
300 |
}
|
|
301 |
else
|
|
302 |
{
|
|
303 |
appUi->HandleCommandL( EFMRadioCmdDeactivateIhf );
|
|
304 |
}
|
|
305 |
break;
|
|
306 |
}
|
|
307 |
case EFMRadioCmdErase:
|
|
308 |
{
|
|
309 |
if ( iObserver.Channels().Count() > 0 )
|
|
310 |
{
|
|
311 |
TInt selectedIndex = CurrentlySelectedChannel();
|
|
312 |
|
|
313 |
if ( appUi->EraseChannelL( selectedIndex ) )
|
|
314 |
{
|
|
315 |
if ( iContainer )
|
|
316 |
{
|
|
317 |
iContainer->RemoveChannelL( selectedIndex );
|
|
318 |
}
|
|
319 |
// Dim the rename and delete buttons in case the list is now empty
|
|
320 |
UpdateToolbar();
|
|
321 |
}
|
|
322 |
}
|
|
323 |
break;
|
|
324 |
}
|
|
325 |
default: // Send all other commands to AppUi
|
|
326 |
{
|
|
327 |
appUi->HandleCommandL( aCommand );
|
|
328 |
break;
|
|
329 |
}
|
|
330 |
}
|
|
331 |
}
|
|
332 |
|
|
333 |
// ---------------------------------------------------------------------------
|
|
334 |
// CFMRadioChannelListView::SetLastListenedChannel
|
|
335 |
// Keep track of the last selected channel
|
|
336 |
// ---------------------------------------------------------------------------
|
|
337 |
//
|
|
338 |
void CFMRadioChannelListView::SetLastListenedChannel( TInt aIndex )
|
|
339 |
{
|
|
340 |
iChIndex = aIndex;
|
|
341 |
if ( iContainer && !iMoveMode )
|
|
342 |
{
|
|
343 |
iContainer->UpdateLastListenedChannel( aIndex ); // Update index
|
|
344 |
}
|
|
345 |
}
|
|
346 |
|
|
347 |
// ---------------------------------------------------------------------------
|
|
348 |
// CFMRadioChannelListView::SetNowPlayingChannel
|
|
349 |
// Keep track of the current selected channel
|
|
350 |
// ---------------------------------------------------------------------------
|
|
351 |
//
|
|
352 |
void CFMRadioChannelListView::SetNowPlayingChannel( TInt aChannelIndex )
|
|
353 |
{
|
|
354 |
iNowPlayingIndex = aChannelIndex;
|
|
355 |
|
|
356 |
if ( iContainer && !iMoveMode )
|
|
357 |
{
|
|
358 |
TRAP_IGNORE( iContainer->UpdateItemIconL( aChannelIndex, KNowPlayingIconIndexChList ) )
|
|
359 |
}
|
|
360 |
}
|
|
361 |
|
|
362 |
// ---------------------------------------------------------------------------
|
|
363 |
// CFMRadioChannelListView::CurrentlyPlayingChannel
|
|
364 |
// Returns the index of the playing channel item from the channel list.
|
|
365 |
// ---------------------------------------------------------------------------
|
|
366 |
//
|
|
367 |
TInt CFMRadioChannelListView::CurrentlyPlayingChannel()
|
|
368 |
{
|
|
369 |
return iNowPlayingIndex;
|
|
370 |
}
|
|
371 |
|
|
372 |
// ---------------------------------------------------------------------------
|
|
373 |
// CFMRadioChannelListView::InitializeChannelsL
|
|
374 |
// Initialize the channels with the values currently saved in
|
|
375 |
// the radio engine
|
|
376 |
// ---------------------------------------------------------------------------
|
|
377 |
//
|
|
378 |
void CFMRadioChannelListView::InitializeChannelsL()
|
|
379 |
{
|
|
380 |
FTRACE( FPrint( _L("CFMRadioChannelListView::InitializeChannelsL Start") ) );
|
|
381 |
|
|
382 |
if ( iContainer )
|
|
383 |
{
|
|
384 |
TBool nowPlaying = EFalse;
|
|
385 |
|
|
386 |
RPointerArray<CFMRadioPreset>& channels = iObserver.Channels();
|
|
387 |
TInt channelCount = channels.Count();
|
|
388 |
|
|
389 |
for ( TInt channelIndex = 0; channelCount > channelIndex; channelIndex++ )
|
|
390 |
{
|
|
391 |
FTRACE( FPrint( _L("CFMRadioChannelListView::InitializeChannelsL inside Channel in use") ) );
|
|
392 |
|
|
393 |
iContainer->AddChannelL( channels[ channelIndex ]->PresetName(),
|
|
394 |
channels[ channelIndex ]->PresetFrequency(),
|
|
395 |
nowPlaying );
|
|
396 |
|
|
397 |
UpdateMiddleSoftKeyL();
|
|
398 |
FTRACE( FPrint( _L("CFMRadioChannelListView::InitializeChannelsL inside Channel in use Channel = %d"), iRadioEngine->GetPresetFrequencyL( channelIndex )) );
|
|
399 |
}
|
|
400 |
|
|
401 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
|
|
402 |
|
|
403 |
TInt currentPresetIndex = iRadioEngine->GetPresetIndex();
|
|
404 |
TInt chIndexForTunedFreq = appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() );
|
|
405 |
|
|
406 |
if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode &&
|
|
407 |
currentPresetIndex < channelCount &&
|
|
408 |
currentPresetIndex >= 0 )
|
|
409 |
{
|
|
410 |
SetLastListenedChannel( currentPresetIndex );
|
|
411 |
SetNowPlayingChannel( currentPresetIndex );
|
|
412 |
}
|
|
413 |
else if ( chIndexForTunedFreq != KErrNotFound )
|
|
414 |
{
|
|
415 |
SetLastListenedChannel( chIndexForTunedFreq );
|
|
416 |
SetNowPlayingChannel( chIndexForTunedFreq );
|
|
417 |
}
|
|
418 |
else
|
|
419 |
{
|
|
420 |
SetLastListenedChannel( 0 );
|
|
421 |
}
|
|
422 |
}
|
|
423 |
FTRACE(FPrint(_L("InitializeChannelsL complete")));
|
|
424 |
}
|
|
425 |
|
|
426 |
// ---------------------------------------------------------------------------
|
|
427 |
// CFMRadioChannelListView::ChannelInPlay
|
|
428 |
// Return true/false to indicate whether the channel specified
|
|
429 |
// is in play
|
|
430 |
// ---------------------------------------------------------------------------
|
|
431 |
//
|
|
432 |
TBool CFMRadioChannelListView::ChannelInPlay(
|
|
433 |
TInt aChannelIndex ) const
|
|
434 |
{
|
|
435 |
if( aChannelIndex == iNowPlayingIndex )
|
|
436 |
{
|
|
437 |
return ETrue;
|
|
438 |
}
|
|
439 |
else
|
|
440 |
{
|
|
441 |
return EFalse;
|
|
442 |
}
|
|
443 |
}
|
|
444 |
|
|
445 |
// ---------------------------------------------------------------------------
|
|
446 |
// CFMRadioChannelListView::FadeAndShowExit
|
|
447 |
// Fade the view and all controls associated with it. Change
|
|
448 |
// the soft keys so that "Exit" is displayed
|
|
449 |
// ---------------------------------------------------------------------------
|
|
450 |
//
|
|
451 |
void CFMRadioChannelListView::FadeAndShowExit( TBool aFaded )
|
|
452 |
{
|
|
453 |
iFaded = aFaded;
|
|
454 |
if( iContainer && iToolbar )
|
|
455 |
{
|
|
456 |
if ( aFaded ) // Fade
|
|
457 |
{
|
|
458 |
// In case options menu is open when headset is disconnected
|
|
459 |
StopDisplayingMenuBar();
|
|
460 |
iContainer->SetFaded( aFaded );
|
|
461 |
iToolbar->SetDimmed( ETrue );
|
|
462 |
TRAP_IGNORE( Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_EXIT ) );
|
|
463 |
}
|
|
464 |
else
|
|
465 |
{
|
|
466 |
iContainer->SetFaded(aFaded);
|
|
467 |
iToolbar->SetDimmed( EFalse );
|
|
468 |
UpdateToolbar();
|
|
469 |
|
|
470 |
if ( iMoveMode )
|
|
471 |
{
|
|
472 |
TRAP_IGNORE
|
|
473 |
(
|
|
474 |
Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_EMPTY_CANCEL );
|
|
475 |
UpdateMiddleSoftKeyL();
|
|
476 |
)
|
|
477 |
}
|
|
478 |
else
|
|
479 |
{
|
|
480 |
TRAP_IGNORE( Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK ) );
|
|
481 |
}
|
|
482 |
}
|
|
483 |
Cba()->DrawDeferred();
|
|
484 |
iToolbar->DrawDeferred();
|
|
485 |
}
|
|
486 |
}
|
|
487 |
|
|
488 |
// ---------------------------------------------------------------------------
|
|
489 |
// CFMRadioChannelListView::UpdateDisplayForFocusGained
|
|
490 |
// Update the view after a focus gained event.
|
|
491 |
// 1. Fade/Unfade view
|
|
492 |
// 2. Update MSK label
|
|
493 |
// ---------------------------------------------------------------------------
|
|
494 |
//
|
|
495 |
void CFMRadioChannelListView::UpdateDisplayForFocusGained()
|
|
496 |
{
|
|
497 |
FadeAndShowExit( iFaded );
|
|
498 |
|
|
499 |
// Don't display MSK if display is faded.
|
|
500 |
if ( !iFaded )
|
|
501 |
{
|
|
502 |
TRAP_IGNORE( UpdateMiddleSoftKeyL() );
|
|
503 |
}
|
|
504 |
}
|
|
505 |
|
|
506 |
// ---------------------------------------------------------------------------
|
|
507 |
// CFMRadioChannelListView::UpdateChannelListContentL
|
|
508 |
// Make a request to the channel container to update the
|
|
509 |
// content of the channel at aIndex with the values specified
|
|
510 |
// ---------------------------------------------------------------------------
|
|
511 |
//
|
|
512 |
void CFMRadioChannelListView::UpdateChannelListContentL(
|
|
513 |
TInt aIndex,
|
|
514 |
const TDesC& aChannelName,
|
|
515 |
TInt aChannelFrequency )
|
|
516 |
{
|
|
517 |
if ( iContainer )
|
|
518 |
{
|
|
519 |
iContainer->UpdateChannelListContentL( aIndex, aChannelName, aChannelFrequency );
|
|
520 |
}
|
|
521 |
}
|
|
522 |
|
|
523 |
// ---------------------------------------------------------------------------
|
|
524 |
// CFMRadioChannelListView::CurrentlySelectedChannel
|
|
525 |
// Returns the index of the selected channel item from the
|
|
526 |
// channel list. If the container is active get the info from
|
|
527 |
// it, because it may have more up-to-date info.
|
|
528 |
// ---------------------------------------------------------------------------
|
|
529 |
//
|
|
530 |
TInt CFMRadioChannelListView::CurrentlySelectedChannel()
|
|
531 |
{
|
|
532 |
if ( iContainer )
|
|
533 |
{
|
|
534 |
iChIndex = iContainer->CurrentlySelectedChannel();
|
|
535 |
}
|
|
536 |
return iChIndex;
|
|
537 |
}
|
|
538 |
|
|
539 |
// ---------------------------------------------------------------------------
|
|
540 |
// CFMRadioChannelListView::NextChannel
|
|
541 |
// Retrieve the index of the next channel that has been set.
|
|
542 |
// ---------------------------------------------------------------------------
|
|
543 |
//
|
|
544 |
TInt CFMRadioChannelListView::NextChannel()
|
|
545 |
{
|
|
546 |
if ( iContainer )
|
|
547 |
{
|
|
548 |
iChIndex = iContainer->CurrentlySelectedChannel();
|
|
549 |
}
|
|
550 |
else
|
|
551 |
{
|
|
552 |
iChIndex = iRadioEngine->GetPresetIndex();
|
|
553 |
}
|
|
554 |
|
|
555 |
iChIndex = iChIndex + 1;
|
|
556 |
|
|
557 |
if ( iChIndex >= iObserver.Channels().Count() )
|
|
558 |
{
|
|
559 |
iChIndex = 0;
|
|
560 |
}
|
|
561 |
|
|
562 |
return iChIndex;
|
|
563 |
}
|
|
564 |
|
|
565 |
// ---------------------------------------------------------------------------
|
|
566 |
// CFMRadioChannelListView::PreviousChannel
|
|
567 |
// Retrieve the index of the previous channel that has been set.
|
|
568 |
// ---------------------------------------------------------------------------
|
|
569 |
//
|
|
570 |
TInt CFMRadioChannelListView::PreviousChannel()
|
|
571 |
{
|
|
572 |
if ( iContainer )
|
|
573 |
{
|
|
574 |
iChIndex = iContainer->CurrentlySelectedChannel();
|
|
575 |
}
|
|
576 |
else
|
|
577 |
{
|
|
578 |
iChIndex = iRadioEngine->GetPresetIndex();
|
|
579 |
}
|
|
580 |
|
|
581 |
|
|
582 |
if ( iChIndex <= 0 )
|
|
583 |
{
|
|
584 |
iChIndex = iObserver.Channels().Count() - 1;
|
|
585 |
}
|
|
586 |
else
|
|
587 |
{
|
|
588 |
iChIndex = iChIndex - 1;
|
|
589 |
}
|
|
590 |
|
|
591 |
return iChIndex;
|
|
592 |
}
|
|
593 |
|
|
594 |
// ---------------------------------------------------------------------------
|
|
595 |
// CFMRadioChannelListView::HandleControlEventL
|
|
596 |
// Handles control event observing. In this case the interest
|
|
597 |
// is only on the channel selection from the channel list.
|
|
598 |
// Other events are not reported by the container,
|
|
599 |
// ---------------------------------------------------------------------------
|
|
600 |
//
|
|
601 |
void CFMRadioChannelListView::HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType )
|
|
602 |
{
|
|
603 |
if ( aControl == iContainer )
|
|
604 |
{
|
|
605 |
// don't change channels in move mode
|
|
606 |
if ( !iMoveMode )
|
|
607 |
{
|
|
608 |
if ( aEventType == MCoeControlObserver::EEventRequestFocus )
|
|
609 |
{
|
|
610 |
// Don't display MSK when display is faded.
|
|
611 |
if ( !iFaded )
|
|
612 |
{
|
|
613 |
if ( !AknLayoutUtils::PenEnabled() )
|
|
614 |
{
|
|
615 |
UpdateMiddleSoftKeyL();
|
|
616 |
}
|
|
617 |
else
|
|
618 |
{
|
|
619 |
AppUi()->HandleCommandL( EFMRadioCmdListenCh );
|
|
620 |
}
|
|
621 |
}
|
|
622 |
}
|
|
623 |
|
|
624 |
else if ( aEventType == MCoeControlObserver::EEventStateChanged )
|
|
625 |
{
|
|
626 |
// Send command to Ui
|
|
627 |
AppUi()->HandleCommandL( EFMRadioCmdListenCh );
|
|
628 |
}
|
|
629 |
}
|
|
630 |
}
|
|
631 |
|
|
632 |
else if ( iManualQueryDialog && aControl == iManualQueryDialog && aEventType == MCoeControlObserver::EEventStateChanged )
|
|
633 |
{
|
|
634 |
TUint32 newFreq = static_cast<CFMRadioFrequencyQueryDialog*>( iManualQueryDialog )->Frequency();
|
|
635 |
iRadioEngine->Tune( static_cast<TInt>( newFreq * KFMRadioFreqMultiplier ) );
|
|
636 |
}
|
|
637 |
}
|
|
638 |
|
|
639 |
// ---------------------------------------------------------------------------
|
|
640 |
// CFMRadioChannelListView::DoDeactivate
|
|
641 |
// Deactivate the channel list view
|
|
642 |
// ---------------------------------------------------------------------------
|
|
643 |
//
|
|
644 |
void CFMRadioChannelListView::DoDeactivate()
|
|
645 |
{
|
|
646 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>(AppUi());
|
|
647 |
if ( appUi->RadioEngine() )
|
|
648 |
{
|
|
649 |
iRadioEngine->RdsReceiver().RemoveObserver( this );
|
|
650 |
}
|
|
651 |
|
|
652 |
if ( iContainer )
|
|
653 |
{
|
|
654 |
appUi->RemoveFromViewStack( *this, iContainer );
|
|
655 |
}
|
|
656 |
delete iContainer;
|
|
657 |
iContainer = NULL;
|
|
658 |
}
|
|
659 |
|
|
660 |
// ---------------------------------------------------------------------------
|
|
661 |
// CFMRadioChannelListView::DynInitMenuPaneL
|
|
662 |
// Sets the state of menu items dynamically according to the
|
|
663 |
// state of application data.
|
|
664 |
// ---------------------------------------------------------------------------
|
|
665 |
//
|
|
666 |
void CFMRadioChannelListView::DynInitMenuPaneL( TInt aResourceId, CEikMenuPane* aMenuPane )
|
|
667 |
{
|
|
668 |
if ( aResourceId == R_FMRADIO_CH_LIST_OPTIONS_MENU ) // Main menu
|
|
669 |
{
|
|
670 |
if ( iRadioEngine->IsAudioRoutingPossible() )
|
|
671 |
{
|
|
672 |
if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputIHF )
|
|
673 |
{
|
|
674 |
// Delete existing menu option and add a new one
|
|
675 |
aMenuPane->DeleteMenuItem( EFMRadioCmdActivateIhf );
|
|
676 |
if ( iRadioEngine->IsHeadsetConnected() )
|
|
677 |
{
|
|
678 |
aMenuPane->SetItemTextL( EFMRadioCmdDeactivateIhf, R_QTN_FMRADIO_OPTIONS_DEACTIVATE );
|
|
679 |
}
|
|
680 |
}
|
|
681 |
else
|
|
682 |
{
|
|
683 |
// Delete existing menu option and add a new one
|
|
684 |
aMenuPane->DeleteMenuItem( EFMRadioCmdDeactivateIhf );
|
|
685 |
aMenuPane->SetItemTextL( EFMRadioCmdActivateIhf, R_QTN_FMRADIO_OPTIONS_ACTIVATE );
|
|
686 |
}
|
|
687 |
}
|
|
688 |
else
|
|
689 |
{
|
|
690 |
aMenuPane->SetItemDimmed( EFMRadioCmdDeactivateIhf, ETrue );
|
|
691 |
aMenuPane->SetItemDimmed( EFMRadioCmdActivateIhf, ETrue );
|
|
692 |
}
|
|
693 |
|
|
694 |
// if help is not enabled, disable help option
|
|
695 |
if ( !FeatureManager::FeatureSupported( KFeatureIdHelp ) )
|
|
696 |
{
|
|
697 |
aMenuPane->SetItemDimmed( EAknCmdHelp, ETrue );
|
|
698 |
}
|
|
699 |
|
|
700 |
TInt channelCount = iObserver.Channels().Count();
|
|
701 |
|
|
702 |
// don't show stylus pop-up menu during move operation
|
|
703 |
if ( channelCount > 1 && !iMoveMode )
|
|
704 |
{
|
|
705 |
aMenuPane->SetItemDimmed( EFMRadioCmdMove, EFalse );
|
|
706 |
}
|
|
707 |
else
|
|
708 |
{
|
|
709 |
aMenuPane->SetItemDimmed( EFMRadioCmdMove, ETrue );
|
|
710 |
}
|
|
711 |
|
|
712 |
if ( iMoveMode || channelCount < 1 )
|
|
713 |
{
|
|
714 |
// hide rename and erase
|
|
715 |
aMenuPane->SetItemDimmed( EFMRadioCmdRename, ETrue );
|
|
716 |
aMenuPane->SetItemDimmed( EFMRadioCmdErase, ETrue );
|
|
717 |
}
|
|
718 |
else
|
|
719 |
{
|
|
720 |
aMenuPane->SetItemDimmed( EFMRadioCmdRename, EFalse );
|
|
721 |
aMenuPane->SetItemDimmed( EFMRadioCmdErase, EFalse );
|
|
722 |
}
|
|
723 |
}
|
|
724 |
}
|
|
725 |
|
|
726 |
// ---------------------------------------------------------------------------
|
|
727 |
// CFMRadioChannelListView::LayoutChangedL
|
|
728 |
// ---------------------------------------------------------------------------
|
|
729 |
//
|
|
730 |
void CFMRadioChannelListView::LayoutChangedL( TInt aType )
|
|
731 |
{
|
|
732 |
if ( iContainer )
|
|
733 |
{
|
|
734 |
iContainer->SetRect( ClientRect() );
|
|
735 |
iContainer->HandleResourceChange( aType );
|
|
736 |
}
|
|
737 |
}
|
|
738 |
|
|
739 |
// ---------------------------------------------------------------------------------------------
|
|
740 |
// Sets middle softkey label.
|
|
741 |
// ---------------------------------------------------------------------------------------------
|
|
742 |
//
|
|
743 |
void CFMRadioChannelListView::SetMiddleSoftKeyLabelL(
|
|
744 |
TInt aResourceId,
|
|
745 |
TInt aCommandId )
|
|
746 |
{
|
|
747 |
|
|
748 |
CEikButtonGroupContainer* cbaGroup = Cba();
|
|
749 |
if ( cbaGroup )
|
|
750 |
{
|
|
751 |
cbaGroup->RemoveCommandFromStack( KMSKControlID, iCurrentMSKCommandId );
|
|
752 |
HBufC* middleSKText = StringLoader::LoadLC( aResourceId, iCoeEnv );
|
|
753 |
TPtr mskPtr = middleSKText->Des();
|
|
754 |
cbaGroup->AddCommandToStackL(
|
|
755 |
KMSKControlID,
|
|
756 |
aCommandId,
|
|
757 |
mskPtr );
|
|
758 |
CleanupStack::PopAndDestroy( middleSKText );
|
|
759 |
iCurrentMSKCommandId = aCommandId;
|
|
760 |
}
|
|
761 |
}
|
|
762 |
|
|
763 |
// ---------------------------------------------------------------------------------------------
|
|
764 |
// Updates the middle softkey functionality.
|
|
765 |
// ---------------------------------------------------------------------------------------------
|
|
766 |
//
|
|
767 |
void CFMRadioChannelListView::UpdateMiddleSoftKeyL()
|
|
768 |
{
|
|
769 |
|
|
770 |
if ( ( iContainer &&
|
|
771 |
( iContainer->CurrentlySelectedChannel() == iRadioEngine->GetPresetIndex()
|
|
772 |
|| iObserver.Channels().Count() == 0 ) ) ||
|
|
773 |
iMoveMode )
|
|
774 |
{
|
|
775 |
SetMiddleSoftKeyLabelL(R_QTN_FMRADIO_NONE, EFMRadioCmdListenCh);
|
|
776 |
}
|
|
777 |
else
|
|
778 |
{
|
|
779 |
SetMiddleSoftKeyLabelL(R_QTN_FMRADIO_MSK_LISTEN, EFMRadioCmdListenCh);
|
|
780 |
}
|
|
781 |
}
|
|
782 |
|
|
783 |
// -----------------------------------------------------------------------------------------------
|
|
784 |
// CFMRadioChannelListView::SetEmptyChannelListItem
|
|
785 |
// Set empty channel list item when preset is deleted from fmradiopresetutility
|
|
786 |
// -----------------------------------------------------------------------------------------------
|
|
787 |
//
|
|
788 |
void CFMRadioChannelListView::SetEmptyChannelListItemL( const TInt aIndex ) const
|
|
789 |
{
|
|
790 |
FTRACE( FPrint( _L("CFMRadioChannelListView::SetEmptyChannelListItem index = %d"), aIndex ) );
|
|
791 |
|
|
792 |
if ( iContainer )
|
|
793 |
{
|
|
794 |
iContainer->RemoveChannelL( aIndex );
|
|
795 |
}
|
|
796 |
|
|
797 |
// Dim the rename and delete buttons in case the list is now empty
|
|
798 |
UpdateToolbar();
|
|
799 |
}
|
|
800 |
|
|
801 |
// -----------------------------------------------------------------------------------------------
|
|
802 |
// CFMRadioChannelListView::RdsDataProgrammeService
|
|
803 |
//
|
|
804 |
// -----------------------------------------------------------------------------------------------
|
|
805 |
//
|
|
806 |
void CFMRadioChannelListView::RdsDataProgrammeService( const TDesC& /*aProgramService*/ )
|
|
807 |
{
|
|
808 |
}
|
|
809 |
|
|
810 |
// --------------------------------------------------------------------------------
|
|
811 |
// CFMRadioChannelListView::RdsDataPsNameIsStatic
|
|
812 |
// --------------------------------------------------------------------------------
|
|
813 |
//
|
|
814 |
void CFMRadioChannelListView::RdsDataPsNameIsStatic( TBool aStatic )
|
|
815 |
{
|
|
816 |
const TDesC& programmeService = iRadioEngine->RdsReceiver().ProgrammeService();
|
|
817 |
if ( iContainer &&
|
|
818 |
aStatic &&
|
|
819 |
programmeService.Length() &&
|
|
820 |
!iMoveMode )
|
|
821 |
{
|
|
822 |
TInt currentPresetIx = iRadioEngine->GetPresetIndex();
|
|
823 |
// When we haven't preset name, ps name will save as preset name
|
|
824 |
if ( iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode &&
|
|
825 |
currentPresetIx != KErrNotFound )
|
|
826 |
{
|
|
827 |
RPointerArray<CFMRadioPreset>& channels = iObserver.Channels();
|
|
828 |
|
|
829 |
// this checks that index is not out of bound and cause -21 error during update
|
|
830 |
if ( currentPresetIx < channels.Count() )
|
|
831 |
{
|
|
832 |
const TDesC& stationName = channels[ currentPresetIx ]->PresetName();
|
|
833 |
TInt presetFreq = channels[ currentPresetIx ]->PresetFrequency();
|
|
834 |
|
|
835 |
if ( stationName.Length() == 0 ) //Set and save PSname only if no name set before
|
|
836 |
{
|
|
837 |
TRAP_IGNORE(
|
|
838 |
{
|
|
839 |
iContainer->UpdateChannelListContentL( currentPresetIx,
|
|
840 |
programmeService,
|
|
841 |
presetFreq );
|
|
842 |
|
|
843 |
iRadioEngine->SetPresetNameFrequencyL( currentPresetIx, programmeService, presetFreq );
|
|
844 |
channels[ currentPresetIx ]->SetPresetNameL( programmeService );
|
|
845 |
} )
|
|
846 |
}
|
|
847 |
}
|
|
848 |
}
|
|
849 |
}
|
|
850 |
}
|
|
851 |
|
|
852 |
// --------------------------------------------------------------------------------
|
|
853 |
// CFMRadioMainView::PrepareToolbar
|
|
854 |
// Prepare toolbar for displaying basic radio command buttons
|
|
855 |
// --------------------------------------------------------------------------------
|
|
856 |
//
|
|
857 |
void CFMRadioChannelListView::PrepareToolbar()
|
|
858 |
{
|
|
859 |
// get toolbar from view
|
|
860 |
iToolbar = Toolbar();
|
|
861 |
// Set observer
|
|
862 |
iToolbar->SetToolbarObserver( this );
|
|
863 |
}
|
|
864 |
|
|
865 |
// --------------------------------------------------------------------------------
|
|
866 |
// CFMRadioMainView::UpdateToolbar
|
|
867 |
// Set the dimmed status of buttons according to list state
|
|
868 |
// --------------------------------------------------------------------------------
|
|
869 |
//
|
|
870 |
void CFMRadioChannelListView::UpdateToolbar() const
|
|
871 |
{
|
|
872 |
if ( iContainer && iToolbar && AknLayoutUtils::PenEnabled() )
|
|
873 |
{
|
|
874 |
if ( iRadioEngine->IsAudioRoutingPossible() )
|
|
875 |
{
|
|
876 |
if ( iRadioEngine->IsHeadsetConnected() )
|
|
877 |
{
|
|
878 |
CAknButton* centerButton = NULL;
|
|
879 |
centerButton = static_cast<CAknButton*>( iToolbar->ControlOrNull( EFMRadioToolbarButtonCmdToggleIhf ) );
|
|
880 |
|
|
881 |
iToolbar->SetItemDimmed( EFMRadioToolbarButtonCmdToggleIhf, EFalse, ETrue );
|
|
882 |
|
|
883 |
if ( iRadioEngine->GetAudioOutput() == CRadioEngine::EFMRadioOutputIHF )
|
|
884 |
{
|
|
885 |
if ( centerButton )
|
|
886 |
{
|
|
887 |
centerButton->SetCurrentState( 1, ETrue );
|
|
888 |
}
|
|
889 |
}
|
|
890 |
else
|
|
891 |
{
|
|
892 |
if ( centerButton )
|
|
893 |
{
|
|
894 |
centerButton->SetCurrentState( 0, ETrue );
|
|
895 |
}
|
|
896 |
}
|
|
897 |
}
|
|
898 |
else
|
|
899 |
{
|
|
900 |
iToolbar->SetItemDimmed( EFMRadioToolbarButtonCmdToggleIhf, ETrue, ETrue );
|
|
901 |
}
|
|
902 |
}
|
|
903 |
else
|
|
904 |
{
|
|
905 |
iToolbar->SetItemDimmed( EFMRadioToolbarButtonCmdToggleIhf, ETrue, ETrue );
|
|
906 |
}
|
|
907 |
}
|
|
908 |
}
|
|
909 |
|
|
910 |
// --------------------------------------------------------------------------------
|
|
911 |
// CFMRadioChannelListView::OfferToolbarEventL
|
|
912 |
// Handle commands from toolbar.
|
|
913 |
// --------------------------------------------------------------------------------
|
|
914 |
//
|
|
915 |
void CFMRadioChannelListView::OfferToolbarEventL( TInt aCommandId )
|
|
916 |
{
|
|
917 |
HandleCommandL( aCommandId );
|
|
918 |
}
|
|
919 |
|
|
920 |
// ---------------------------------------------------------
|
|
921 |
// CFMRadioChannelListView::ShowToolbar
|
|
922 |
// Sets toolbar visibility.
|
|
923 |
// ---------------------------------------------------------
|
|
924 |
//
|
|
925 |
void CFMRadioChannelListView::ShowToolbar( TBool aVisible )
|
|
926 |
{
|
|
927 |
if ( AknLayoutUtils::PenEnabled() &&
|
|
928 |
iToolbar &&
|
|
929 |
iContainer )
|
|
930 |
{
|
|
931 |
iToolbar->SetToolbarVisibility( aVisible );
|
|
932 |
iToolbar->UpdateBackground();
|
|
933 |
iToolbar->DrawDeferred();
|
|
934 |
// set correct container rect with or without toolbar
|
|
935 |
iContainer->SetRect( ClientRect() );
|
|
936 |
}
|
|
937 |
}
|
|
938 |
|
|
939 |
|
|
940 |
// -----------------------------------------------------------------------------------------------
|
|
941 |
// CFMRadioChannelListView::RdsDataRadioText
|
|
942 |
// From MFMRadioRdsObserver, implementation not needed.
|
|
943 |
// -----------------------------------------------------------------------------------------------
|
|
944 |
//
|
|
945 |
void CFMRadioChannelListView::RdsDataRadioText( const TDesC& /*aRadioText*/ ){}
|
|
946 |
|
|
947 |
void CFMRadioChannelListView::RdsDataRadioTextPlus( const TInt aRTPlusClass, const TDesC& aRadioText )
|
|
948 |
{
|
|
949 |
if ( aRTPlusClass == ERTplusProgramHomepage &&
|
|
950 |
iRadioEngine->GetRadioMode() == CRadioEngine::ERadioPresetMode )
|
|
951 |
{
|
|
952 |
TInt currentPresetIx = iRadioEngine->GetPresetIndex();
|
|
953 |
if ( currentPresetIx < iObserver.Channels().Count() )
|
|
954 |
{
|
|
955 |
TRAP_IGNORE
|
|
956 |
(
|
|
957 |
// save permanently
|
|
958 |
iRadioEngine->SaveUrlToPresetL( currentPresetIx, aRadioText );
|
|
959 |
// save to ui list
|
|
960 |
iObserver.Channels()[ currentPresetIx ]->SetPresetUrlL( aRadioText );
|
|
961 |
)
|
|
962 |
}
|
|
963 |
}
|
|
964 |
}
|
|
965 |
|
|
966 |
// -----------------------------------------------------------------------------------------------
|
|
967 |
// CFMRadioChannelListView::RdsAfSearchBegin
|
|
968 |
// From MFMRadioRdsObserver, implementation not needed.
|
|
969 |
// -----------------------------------------------------------------------------------------------
|
|
970 |
//
|
|
971 |
void CFMRadioChannelListView::RdsAfSearchBegin(){}
|
|
972 |
|
|
973 |
// -----------------------------------------------------------------------------------------------
|
|
974 |
// CFMRadioChannelListView::RdsAfSearchEnd
|
|
975 |
// From MFMRadioRdsObserver, implementation not needed.
|
|
976 |
// -----------------------------------------------------------------------------------------------
|
|
977 |
//
|
|
978 |
void CFMRadioChannelListView::RdsAfSearchEnd( TUint32 /* aFrequency*/, TInt /*aError*/ ){}
|
|
979 |
|
|
980 |
// -----------------------------------------------------------------------------------------------
|
|
981 |
// CFMRadioChannelListView::RdsAfSearchStateChange
|
|
982 |
// From MFMRadioRdsObserver, implementation not needed.
|
|
983 |
// -----------------------------------------------------------------------------------------------
|
|
984 |
//
|
|
985 |
void CFMRadioChannelListView::RdsAfSearchStateChange( TBool /* aEnabled*/ ){}
|
|
986 |
|
|
987 |
// -----------------------------------------------------------------------------------------------
|
|
988 |
// CFMRadioChannelListView::RdsAvailable
|
|
989 |
// From MFMRadioRdsObserver, implementation not needed.
|
|
990 |
// -----------------------------------------------------------------------------------------------
|
|
991 |
//
|
|
992 |
void CFMRadioChannelListView::RdsAvailable( TBool /*aAvailable*/ ){}
|
|
993 |
|
|
994 |
// ---------------------------------------------------------
|
|
995 |
// CFMRadioChannelListView::SetTitleL
|
|
996 |
// ---------------------------------------------------------
|
|
997 |
//
|
|
998 |
void CFMRadioChannelListView::SetTitleL( TInt aResourceId )
|
|
999 |
{
|
|
1000 |
HBufC* title = StringLoader::LoadLC( aResourceId, iCoeEnv );
|
|
1001 |
static_cast<CAknTitlePane*>( StatusPane()->ControlL( TUid::Uid( EEikStatusPaneUidTitle ) ) )->SetTextL( *title, ETrue );
|
|
1002 |
CleanupStack::PopAndDestroy( title );
|
|
1003 |
}
|
|
1004 |
|
|
1005 |
|
|
1006 |
// ---------------------------------------------------------
|
|
1007 |
// CFMRadioChannelListView::MoveCurrentItemIndexL
|
|
1008 |
// ---------------------------------------------------------
|
|
1009 |
//
|
|
1010 |
void CFMRadioChannelListView::MoveCurrentItemIndexL()
|
|
1011 |
{
|
|
1012 |
iMoveMode = ETrue;
|
|
1013 |
|
|
1014 |
Cba()->SetCommandSetL( R_FMRADIO_SOFTKEYS_EMPTY_CANCEL );
|
|
1015 |
UpdateMiddleSoftKeyL();
|
|
1016 |
ShowToolbar( EFalse );
|
|
1017 |
|
|
1018 |
iContainer->HideIconsL();
|
|
1019 |
|
|
1020 |
iContainer->ActivateMoveL();
|
|
1021 |
}
|
|
1022 |
|
|
1023 |
// ---------------------------------------------------------
|
|
1024 |
// CFMRadioChannelListView::MoveActionDoneL
|
|
1025 |
// ---------------------------------------------------------
|
|
1026 |
//
|
|
1027 |
void CFMRadioChannelListView::MoveActionDoneL()
|
|
1028 |
{
|
|
1029 |
iMoveMode = EFalse;
|
|
1030 |
iFirstMoveDone = ETrue;
|
|
1031 |
Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
|
|
1032 |
|
|
1033 |
UpdateMiddleSoftKeyL();
|
|
1034 |
iContainer->HandleDropL();
|
|
1035 |
iContainer->MoveDoneL();
|
|
1036 |
|
|
1037 |
TInt currentIndex = 0;
|
|
1038 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
|
|
1039 |
currentIndex = appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() );
|
|
1040 |
|
|
1041 |
if ( currentIndex != KErrNotFound )
|
|
1042 |
{
|
|
1043 |
iRadioEngine->SetCurrentPresetIndex( currentIndex );
|
|
1044 |
SetNowPlayingChannel( currentIndex );
|
|
1045 |
}
|
|
1046 |
ShowToolbar( ETrue );
|
|
1047 |
}
|
|
1048 |
|
|
1049 |
// ---------------------------------------------------------
|
|
1050 |
// CFMRadioChannelListView::CancelMoveL
|
|
1051 |
// ---------------------------------------------------------
|
|
1052 |
//
|
|
1053 |
void CFMRadioChannelListView::CancelMoveL()
|
|
1054 |
{
|
|
1055 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
|
|
1056 |
TBool viewActive = appUi->ActiveView() == KFMRadioChannelListViewId && iContainer;
|
|
1057 |
if ( viewActive && ( iContainer->MoveCanceledL() || iMoveMode ) )
|
|
1058 |
{
|
|
1059 |
iMoveMode = EFalse;
|
|
1060 |
iFirstMoveDone = ETrue;
|
|
1061 |
iContainer->ReIndexAllL();
|
|
1062 |
Cba()->SetCommandSetL( R_AVKON_SOFTKEYS_OPTIONS_BACK );
|
|
1063 |
UpdateMiddleSoftKeyL();
|
|
1064 |
TInt currentIndex = 0;
|
|
1065 |
currentIndex = appUi->MatchingChannelL( iRadioEngine->GetTunedFrequency() );
|
|
1066 |
if ( currentIndex != KErrNotFound )
|
|
1067 |
{
|
|
1068 |
SetNowPlayingChannel( currentIndex );
|
|
1069 |
}
|
|
1070 |
ShowToolbar( ETrue );
|
|
1071 |
}
|
|
1072 |
}
|
|
1073 |
|
|
1074 |
// ---------------------------------------------------------
|
|
1075 |
// CFMRadioChannelListView::StopSeekL
|
|
1076 |
// ---------------------------------------------------------
|
|
1077 |
//
|
|
1078 |
void CFMRadioChannelListView::StopSeekL()
|
|
1079 |
{
|
|
1080 |
// update icon if radio is in tuner mode i.e.
|
|
1081 |
// "accessory seek up/down" is launched
|
|
1082 |
if ( iContainer &&
|
|
1083 |
iRadioEngine->GetRadioMode() == CRadioEngine::ERadioTunerMode )
|
|
1084 |
{
|
|
1085 |
CFMRadioAppUi* appUi = static_cast<CFMRadioAppUi*>( AppUi() );
|
|
1086 |
TInt tunedFrequency = iRadioEngine->GetTunedFrequency();
|
|
1087 |
const TInt index = appUi->MatchingChannelL( tunedFrequency );
|
|
1088 |
|
|
1089 |
if ( index == KErrNotFound )
|
|
1090 |
{
|
|
1091 |
// frequency is not saved, hide now playing icon
|
|
1092 |
iContainer->HideIconsL();
|
|
1093 |
}
|
|
1094 |
else
|
|
1095 |
{
|
|
1096 |
SetNowPlayingChannel( index );
|
|
1097 |
SetLastListenedChannel( index );
|
|
1098 |
}
|
|
1099 |
}
|
|
1100 |
}
|
|
1101 |
|
|
1102 |
// End of File
|