|
1 /* |
|
2 * Copyright (c) 2002-2009 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: |
|
15 * Methods for Email address selection dialog. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 // INCLUDE FILES |
|
27 |
|
28 #include "CAddressSelect.h" |
|
29 #include <CPbkContactItem.h> |
|
30 #include <avkon.rsg> // R_AVKON_SOFTKEYS_SELECT_CANCEL; |
|
31 #include <avkon.hrh> // AVKON softkey codes |
|
32 #include <AknNoteWrappers.h> |
|
33 #include <StringLoader.h> // StringLoader |
|
34 #include <CPbkFieldInfo.h> |
|
35 #include <CPbkContactEngine.h> |
|
36 #include "MTPbkAddressSelect.h" |
|
37 #include <PbkAddressSelect.rsg> |
|
38 |
|
39 // ================= MEMBER FUNCTIONS ======================= |
|
40 |
|
41 CAddressSelect::CAddressSelect() |
|
42 { |
|
43 iIsSame = EFalse; |
|
44 } |
|
45 |
|
46 CAddressSelect::TParams::TParams |
|
47 (const CPbkContactItem& aContact) : |
|
48 TBaseParams(aContact, aContact.DefaultEmailField()) |
|
49 { |
|
50 } |
|
51 |
|
52 TBool CAddressSelect::ExecuteLD(TParams& aParams, CMTPbkAddressSelect& aAddressSelect) |
|
53 { |
|
54 TBool ret = EFalse, |
|
55 isSame = EFalse; |
|
56 |
|
57 iContact = &aParams.ContactItem(); |
|
58 iAddressSelect = &aAddressSelect; |
|
59 ret = CPbkAddressSelect::ExecuteLD(aParams); |
|
60 |
|
61 if ( aParams.FocusedField() == aParams.SelectedField() ) |
|
62 { |
|
63 isSame = ETrue; |
|
64 aAddressSelect.SetSelectedAndFocusedField(isSame); |
|
65 } |
|
66 |
|
67 // CPbkAddressSelect::ExecuteLD takes care of LD function semantics |
|
68 |
|
69 return ret; |
|
70 } |
|
71 |
|
72 CAddressSelect::~CAddressSelect() |
|
73 { |
|
74 delete iQueryTitle; |
|
75 } |
|
76 |
|
77 EXPORT_C TBool CAddressSelect::AddressField(const TPbkContactItemField& aField) const |
|
78 { |
|
79 const CPbkContactItem* contact(&ContactItem()); |
|
80 |
|
81 TBool isSame = EFalse; |
|
82 |
|
83 if ( iContact==contact) |
|
84 { |
|
85 isSame = ETrue; |
|
86 iAddressSelect->SetContactReturnValue(isSame); |
|
87 } |
|
88 |
|
89 // Return true for non-empty email fields |
|
90 return ((aField.FieldInfo().FieldId()) == EPbkFieldIdEmailAddress && |
|
91 !aField.IsEmptyOrAllSpaces()); |
|
92 } |
|
93 |
|
94 EXPORT_C void CAddressSelect::NoAddressesL() |
|
95 { |
|
96 // if contact is empty and it hasn't got email addresses it's ok if selected |
|
97 // field and focused field are different |
|
98 TBool isSame = ETrue; |
|
99 iAddressSelect->SetSelectedAndFocusedField(isSame); |
|
100 } |
|
101 |
|
102 EXPORT_C const TDesC& CAddressSelect::QueryTitleL() |
|
103 { |
|
104 iQueryTitle = ContactItem().GetContactTitleL(); |
|
105 return *iQueryTitle; |
|
106 } |
|
107 |
|
108 EXPORT_C TInt CAddressSelect::QuerySoftkeysResource() const |
|
109 { |
|
110 return R_CBA; |
|
111 } |
|
112 |
|
113 // End of File |