|
1 /* |
|
2 * Copyright (c) 2002 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: Displays the phonenumber of a speed dial entry |
|
15 * when 'View number' is chosen from the menu. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 // INCLUDE FILES |
|
25 #include "SpdiaNote.h" |
|
26 |
|
27 // ================= MEMBER FUNCTIONS ======================= |
|
28 #include <aknnotecontrol.h> |
|
29 #include <AknUtils.h> |
|
30 #include <AknBidiTextUtils.h> |
|
31 #include "Speeddial.laf" |
|
32 |
|
33 CSpdiaNoteDialog::CSpdiaNoteDialog() |
|
34 { |
|
35 } |
|
36 |
|
37 CSpdiaNoteDialog::CSpdiaNoteDialog(CSpdiaNoteDialog** aDialog) |
|
38 : iDialog(aDialog) |
|
39 { |
|
40 } |
|
41 |
|
42 CSpdiaNoteDialog::~CSpdiaNoteDialog() |
|
43 { |
|
44 delete iPhoneNumberString; |
|
45 |
|
46 if (iDialog) |
|
47 { |
|
48 *iDialog = NULL; |
|
49 } |
|
50 } |
|
51 void CSpdiaNoteDialog::SetPhoneNumberL(const TDesC& aNumber) |
|
52 { |
|
53 delete iPhoneNumberString; |
|
54 iPhoneNumberString = NULL; |
|
55 iPhoneNumberString = aNumber.AllocL(); |
|
56 } |
|
57 |
|
58 void CSpdiaNoteDialog::ClipPhoneNumberFromBeginningL(TInt aWidth, TInt16 fontId) |
|
59 { |
|
60 const CFont* font = iEikonEnv->NormalFont(); |
|
61 |
|
62 if ( AknLayoutUtils::Variant() == EApacVariant ) |
|
63 { |
|
64 font = ApacPlain16(); |
|
65 } |
|
66 HBufC* buf = iPhoneNumberString->AllocLC(); |
|
67 TPtr ptr = buf->Des(); |
|
68 if( AknLayoutUtils::ScalableLayoutInterfaceAvailable() ) |
|
69 { |
|
70 if ( AknTextUtils::ClipToFit( |
|
71 ptr, |
|
72 *AknLayoutUtils::FontFromId(fontId), |
|
73 aWidth, |
|
74 AknTextUtils::EClipFromBeginning ) ) |
|
75 { |
|
76 NoteControl()->SetTextL( ptr, |
|
77 SDM_VIEW_NUMBER_LINE_NUMBER_FOR_PHONE_NUMBER ); |
|
78 } |
|
79 |
|
80 } |
|
81 else |
|
82 { |
|
83 if ( AknTextUtils::ClipToFit( |
|
84 ptr, |
|
85 *font, |
|
86 aWidth, |
|
87 AknTextUtils::EClipFromBeginning ) ) |
|
88 { |
|
89 NoteControl()->SetTextL( ptr, |
|
90 SDM_VIEW_NUMBER_LINE_NUMBER_FOR_PHONE_NUMBER ); |
|
91 } |
|
92 } |
|
93 CleanupStack::PopAndDestroy(); // buf |
|
94 } |