18
|
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: Provides SavedWayptsView's details.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include <StringLoader.h>
|
|
21 |
#include <AknUtils.h>
|
|
22 |
#include <blid.rsg>
|
|
23 |
#include "CBlidSavedWayptsLBModel.h"
|
|
24 |
#include "MBlidLocation.h"
|
|
25 |
#include "MBlidSettings.h"
|
|
26 |
#include "MBlidRouter.h"
|
|
27 |
#include "bliduiconsts.h"
|
|
28 |
#include "Blid.hrh"
|
|
29 |
#include "Blidutils.h"
|
|
30 |
#include "Debug.h"
|
|
31 |
#include "lbscommon.h"
|
|
32 |
|
|
33 |
|
|
34 |
// ================= MEMBER FUNCTIONS =======================
|
|
35 |
// ----------------------------------------------------------------------------
|
|
36 |
// CBlidSavedWayptsLBModel::NewLC
|
|
37 |
// Two-phased constructor.
|
|
38 |
// ----------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
CBlidSavedWayptsLBModel* CBlidSavedWayptsLBModel::NewLC( MBlidLocation* aLocationModel,
|
|
41 |
MBlidSettings* aSettings,MBlidRouter* aRouter )
|
|
42 |
{
|
|
43 |
CBlidSavedWayptsLBModel* ptr =
|
|
44 |
new (ELeave) CBlidSavedWayptsLBModel( aLocationModel, aSettings,aRouter );
|
|
45 |
CleanupStack::PushL(ptr);
|
|
46 |
ptr->ConstructL();
|
|
47 |
return ptr;
|
|
48 |
}
|
|
49 |
|
|
50 |
// ----------------------------------------------------------------------------
|
|
51 |
// CBlidSavedWayptsLBModel::CBlidSavedWayptsLBModel
|
|
52 |
// C++ default constructor can NOT contain any code, that
|
|
53 |
// might leave.
|
|
54 |
// ----------------------------------------------------------------------------
|
|
55 |
//
|
|
56 |
CBlidSavedWayptsLBModel::CBlidSavedWayptsLBModel(MBlidLocation* aLocationModel,
|
|
57 |
MBlidSettings* aSettings,MBlidRouter* aRouter):
|
|
58 |
iLocationModel( aLocationModel ), iSettingsModel( aSettings ),iRouter(aRouter)
|
|
59 |
{
|
|
60 |
}
|
|
61 |
|
|
62 |
// ----------------------------------------------------------------------------
|
|
63 |
// CBlidSavedWayptsLBModel::ConstructL
|
|
64 |
// Symbian 2nd phase constructor can leave.
|
|
65 |
// ----------------------------------------------------------------------------
|
|
66 |
//
|
|
67 |
void CBlidSavedWayptsLBModel::ConstructL()
|
|
68 |
{
|
|
69 |
iBuffer = HBufC::NewL( KBlidLBLineMaxLen );
|
|
70 |
}
|
|
71 |
|
|
72 |
// ---------------------------------------------------------
|
|
73 |
// CBlidSavedWayptsLBModel::~CBlidSavedWayptsLBModel
|
|
74 |
// ---------------------------------------------------------
|
|
75 |
//
|
|
76 |
CBlidSavedWayptsLBModel::~CBlidSavedWayptsLBModel()
|
|
77 |
{
|
|
78 |
delete iBuffer;
|
|
79 |
}
|
|
80 |
|
|
81 |
|
|
82 |
// ----------------------------------------------------------------------------
|
|
83 |
// CBlidSavedWayptsLBModel::MdcaCount
|
|
84 |
// ----------------------------------------------------------------------------
|
|
85 |
//
|
|
86 |
TInt CBlidSavedWayptsLBModel::MdcaCount() const
|
|
87 |
{
|
|
88 |
|
|
89 |
TInt count(iRouter->Count());
|
|
90 |
return count;
|
|
91 |
}
|
|
92 |
|
|
93 |
// ----------------------------------------------------------------------------
|
|
94 |
// CBlidSavedWayptsLBModel::MdcaPoint
|
|
95 |
// ----------------------------------------------------------------------------
|
|
96 |
//
|
|
97 |
TPtrC16 CBlidSavedWayptsLBModel::MdcaPoint(TInt aIndex) const
|
|
98 |
{
|
|
99 |
TPtr ptr( iBuffer->Des() );
|
|
100 |
ptr.Zero();
|
|
101 |
HBufC* name = (HBufC*)NULL;
|
|
102 |
TBuf<KBlidWaypointNameMaxLen> temp;
|
|
103 |
temp.Zero();
|
|
104 |
if(aIndex < iRouter->Count())
|
|
105 |
{
|
|
106 |
name = iRouter->At(aIndex).Name();
|
|
107 |
}
|
|
108 |
if ( name )
|
|
109 |
{
|
|
110 |
_LIT(KFormatString,"%d");
|
|
111 |
ptr.Format(KFormatString,1);
|
|
112 |
ptr.Append( EKeyTab );
|
|
113 |
ptr.Append( *name );
|
|
114 |
}
|
|
115 |
else
|
|
116 |
{
|
|
117 |
ptr.Append( EKeyTab );
|
|
118 |
}
|
|
119 |
|
|
120 |
AknTextUtils::LanguageSpecificNumberConversion( ptr );
|
|
121 |
delete name;
|
|
122 |
return iBuffer->Des();
|
|
123 |
}
|
|
124 |
|
|
125 |
|