author | William Roberts <williamr@symbian.org> |
Tue, 16 Mar 2010 16:12:26 +0000 | |
branch | Symbian2 |
changeset 2 | 2fe1408b6811 |
parent 1 | 666f914201fb |
child 4 | 837f303aceeb |
permissions | -rw-r--r-- |
williamr@2 | 1 |
/* |
williamr@2 | 2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). |
williamr@2 | 3 |
* All rights reserved. |
williamr@2 | 4 |
* This component and the accompanying materials are made available |
williamr@2 | 5 |
* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members |
williamr@2 | 6 |
* which accompanies this distribution, and is available |
williamr@2 | 7 |
* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html". |
williamr@2 | 8 |
* |
williamr@2 | 9 |
* Initial Contributors: |
williamr@2 | 10 |
* Nokia Corporation - initial contribution. |
williamr@2 | 11 |
* |
williamr@2 | 12 |
* Contributors: |
williamr@2 | 13 |
* |
williamr@2 | 14 |
* Description: |
williamr@2 | 15 |
* Generic Phonebook address selection dialog. Used for selecting recipient |
williamr@2 | 16 |
* address from a contact for Call, Send SMS, email and MMS. |
williamr@2 | 17 |
* |
williamr@2 | 18 |
*/ |
williamr@2 | 19 |
|
williamr@2 | 20 |
|
williamr@2 | 21 |
#ifndef __CPbkAddressSelect_H__ |
williamr@2 | 22 |
#define __CPbkAddressSelect_H__ |
williamr@2 | 23 |
|
williamr@2 | 24 |
// INCLUDES |
williamr@2 | 25 |
#include <e32base.h> |
williamr@2 | 26 |
#include <coedef.h> // TKeyResponse |
williamr@2 | 27 |
#include <w32std.h> // TKeyEvent, TEventCode |
williamr@2 | 28 |
|
williamr@2 | 29 |
|
williamr@2 | 30 |
// FORWARD DECLARATIONS |
williamr@2 | 31 |
class CPbkContactItem; |
williamr@2 | 32 |
class TPbkContactItemField; |
williamr@2 | 33 |
class CPbkSelectFieldDlg; |
williamr@2 | 34 |
class CPbkFieldArray; |
williamr@2 | 35 |
|
williamr@2 | 36 |
|
williamr@2 | 37 |
// CLASS DECLARATION |
williamr@2 | 38 |
|
williamr@2 | 39 |
/** |
williamr@2 | 40 |
* This class is the abstrack base class for Phonebook address selection |
williamr@2 | 41 |
* dialogs. Address selection dialogs are used for selecting recipient |
williamr@2 | 42 |
* address from a contact for Call, Send SMS, email and MMS. Select one |
williamr@2 | 43 |
* of the derived classes for a particular concrete dialog implementation. |
williamr@2 | 44 |
*/ |
williamr@2 | 45 |
class CPbkAddressSelect : public CBase |
williamr@2 | 46 |
{ |
williamr@2 | 47 |
public: // Interface |
williamr@2 | 48 |
/** |
williamr@2 | 49 |
* Parameters for ExecuteLD(TBaseParams&). |
williamr@2 | 50 |
* @see ExecuteLD(TBaseParams&) |
williamr@2 | 51 |
*/ |
williamr@2 | 52 |
class TBaseParams |
williamr@2 | 53 |
{ |
williamr@2 | 54 |
public: // Interface |
williamr@2 | 55 |
/** |
williamr@2 | 56 |
* Returns the contact supplied to constructor. |
williamr@2 | 57 |
* @return Contact item. |
williamr@2 | 58 |
*/ |
williamr@2 | 59 |
IMPORT_C const CPbkContactItem& ContactItem(); |
williamr@2 | 60 |
|
williamr@2 | 61 |
/** |
williamr@2 | 62 |
* Sets the focused field of the contact item. If focused field |
williamr@2 | 63 |
* is a non-empty address field it is returned directly by |
williamr@2 | 64 |
* ExecuteLD. The default value is NULL. |
williamr@2 | 65 |
* @param aFocusedField The focused field to set |
williamr@2 | 66 |
*/ |
williamr@2 | 67 |
IMPORT_C void SetFocusedField(const TPbkContactItemField* aFocusedField); |
williamr@2 | 68 |
|
williamr@2 | 69 |
/** |
williamr@2 | 70 |
* Set to ETrue to use default address of the contact directly. |
williamr@2 | 71 |
* Focused field overrides default address if both are |
williamr@2 | 72 |
* available. The default value is EFalse. |
williamr@2 | 73 |
* @param aUseDefaultDirectly Defines whether the default address |
williamr@2 | 74 |
* should be used directly |
williamr@2 | 75 |
*/ |
williamr@2 | 76 |
IMPORT_C void SetUseDefaultDirectly(TBool aUseDefaultDirectly); |
williamr@2 | 77 |
|
williamr@2 | 78 |
/** |
williamr@2 | 79 |
* Returns the selected field or NULL if no selection was made. |
williamr@2 | 80 |
* @return Selected contact item field. |
williamr@2 | 81 |
*/ |
williamr@2 | 82 |
IMPORT_C const TPbkContactItemField* SelectedField() const; |
williamr@2 | 83 |
|
williamr@2 | 84 |
/** |
williamr@2 | 85 |
* Returns the focused field or NULL if there was no field |
williamr@2 | 86 |
* level focus. |
williamr@2 | 87 |
* @return Focused contact item field. |
williamr@2 | 88 |
*/ |
williamr@2 | 89 |
IMPORT_C const TPbkContactItemField* FocusedField() const; |
williamr@2 | 90 |
|
williamr@2 | 91 |
protected: // Derived class interface |
williamr@2 | 92 |
/** |
williamr@2 | 93 |
* Constructor. |
williamr@2 | 94 |
* |
williamr@2 | 95 |
* @param aContact Contact from which to select an address. |
williamr@2 | 96 |
* @param aDefaultField The field to use as the default. NULL if |
williamr@2 | 97 |
* no default is set for aContact. |
williamr@2 | 98 |
*/ |
williamr@2 | 99 |
IMPORT_C TBaseParams |
williamr@2 | 100 |
(const CPbkContactItem& aContact, |
williamr@2 | 101 |
const TPbkContactItemField* aDefaultField); |
williamr@2 | 102 |
|
williamr@2 | 103 |
private: // Data |
williamr@2 | 104 |
/// Ref: the contact where to select an address |
williamr@2 | 105 |
const CPbkContactItem& iContact; |
williamr@2 | 106 |
/// Ref: the default field of the contact |
williamr@2 | 107 |
const TPbkContactItemField* iDefaultField; |
williamr@2 | 108 |
/// Ref: the focused field of the contact |
williamr@2 | 109 |
const TPbkContactItemField* iFocusedField; |
williamr@2 | 110 |
/// Own: is the default address to be used directly |
williamr@2 | 111 |
TBool iUseDefaultDirectly; |
williamr@2 | 112 |
/// Own: the selected field of the contact |
williamr@2 | 113 |
const TPbkContactItemField* iSelectedField; |
williamr@2 | 114 |
/// Spare data |
williamr@2 | 115 |
TInt32 iSpare1; |
williamr@2 | 116 |
/// Spare data |
williamr@2 | 117 |
TInt32 iSpare2; |
williamr@2 | 118 |
|
williamr@2 | 119 |
private: // friends |
williamr@2 | 120 |
friend class CPbkAddressSelect; |
williamr@2 | 121 |
}; |
williamr@2 | 122 |
|
williamr@2 | 123 |
/** |
williamr@2 | 124 |
* Destructor. Cancels address selection query if active. |
williamr@2 | 125 |
*/ |
williamr@2 | 126 |
IMPORT_C ~CPbkAddressSelect(); |
williamr@2 | 127 |
|
williamr@2 | 128 |
protected: // Base class interface |
williamr@2 | 129 |
/** |
williamr@2 | 130 |
* Constructor. |
williamr@2 | 131 |
*/ |
williamr@2 | 132 |
IMPORT_C CPbkAddressSelect(); |
williamr@2 | 133 |
|
williamr@2 | 134 |
/** |
williamr@2 | 135 |
* Runs an address selection query (if necessary). |
williamr@2 | 136 |
* |
williamr@2 | 137 |
* @param aParams see TBaseParams. |
williamr@2 | 138 |
* @return ETrue if query was accepted, EFalse if canceled. |
williamr@2 | 139 |
*/ |
williamr@2 | 140 |
IMPORT_C TBool ExecuteLD(TBaseParams& aParams); |
williamr@2 | 141 |
|
williamr@2 | 142 |
/** |
williamr@2 | 143 |
* Returns aItem passed to ExecuteLD. |
williamr@2 | 144 |
* @return Contact item. |
williamr@2 | 145 |
*/ |
williamr@2 | 146 |
IMPORT_C const CPbkContactItem& ContactItem() const; |
williamr@2 | 147 |
|
williamr@2 | 148 |
/** |
williamr@2 | 149 |
* Exit any address selection query. Makes ExecuteLD return which means |
williamr@2 | 150 |
* this object is destroyed after this function returns! |
williamr@2 | 151 |
* @param aAccept ETrue means the query selection is accepted and |
williamr@2 | 152 |
* EFalse that query is canceled. |
williamr@2 | 153 |
*/ |
williamr@2 | 154 |
IMPORT_C void AttemptExitL(TBool aAccept); |
williamr@2 | 155 |
|
williamr@2 | 156 |
private: // Base class interface. Private because these functions are |
williamr@2 | 157 |
// only to be called from this classes implementation. |
williamr@2 | 158 |
/** |
williamr@2 | 159 |
* Returns ETrue if aField is an applicable address field. |
williamr@2 | 160 |
* @param aField Contact item field. |
williamr@2 | 161 |
* @return ETrue if the contact item field is an applicable address field. |
williamr@2 | 162 |
*/ |
williamr@2 | 163 |
virtual TBool AddressField(const TPbkContactItemField& aField) const = 0; |
williamr@2 | 164 |
|
williamr@2 | 165 |
/** |
williamr@2 | 166 |
* Called if there are no applicable address fields in aItem passed |
williamr@2 | 167 |
* to ExecuteLD. |
williamr@2 | 168 |
*/ |
williamr@2 | 169 |
virtual void NoAddressesL() = 0; |
williamr@2 | 170 |
|
williamr@2 | 171 |
/** |
williamr@2 | 172 |
* Returns title to use for the address selection list query. |
williamr@2 | 173 |
* @return Title used for the address selection list query. |
williamr@2 | 174 |
*/ |
williamr@2 | 175 |
virtual const TDesC& QueryTitleL() = 0; |
williamr@2 | 176 |
|
williamr@2 | 177 |
/** |
williamr@2 | 178 |
* Returns a softkey resource id to use for the address |
williamr@2 | 179 |
* selection list query. |
williamr@2 | 180 |
* @return Softkey resource if that is used for the address |
williamr@2 | 181 |
* selection list query. |
williamr@2 | 182 |
*/ |
williamr@2 | 183 |
virtual TInt QuerySoftkeysResource() const = 0; |
williamr@2 | 184 |
|
williamr@2 | 185 |
/** |
williamr@2 | 186 |
* Override to handle key events in the list query. |
williamr@2 | 187 |
* The default implementation is empty. |
williamr@2 | 188 |
* @param aKeyEvent The key event. |
williamr@2 | 189 |
* @param aType The key event type. |
williamr@2 | 190 |
*/ |
williamr@2 | 191 |
IMPORT_C virtual TKeyResponse PbkControlKeyEventL |
williamr@2 | 192 |
(const TKeyEvent& aKeyEvent,TEventCode aType); |
williamr@2 | 193 |
|
williamr@2 | 194 |
// Spare virtual functions |
williamr@2 | 195 |
IMPORT_C virtual void Reserved_1(); |
williamr@2 | 196 |
IMPORT_C virtual void Reserved_2(); |
williamr@2 | 197 |
|
williamr@2 | 198 |
private: // data members |
williamr@2 | 199 |
/// Ref: aItem passed to ExecuteLD |
williamr@2 | 200 |
const CPbkContactItem* iContactItem; |
williamr@2 | 201 |
/// Field selection dialog for this class |
williamr@2 | 202 |
class CSelectFieldDlg; |
williamr@2 | 203 |
friend class CSelectFieldDlg; |
williamr@2 | 204 |
/// Own: field selection dialog |
williamr@2 | 205 |
CPbkSelectFieldDlg* iFieldDlg; |
williamr@2 | 206 |
/// Own: field array for iFieldDlg |
williamr@2 | 207 |
CPbkFieldArray* iFields; |
williamr@2 | 208 |
/// Ref: set to ETrue when exeuction enters destructor |
williamr@2 | 209 |
TBool* iDestroyedPtr; |
williamr@2 | 210 |
// Spare data |
williamr@2 | 211 |
TInt32 iSpare1; |
williamr@2 | 212 |
}; |
williamr@2 | 213 |
|
williamr@2 | 214 |
|
williamr@2 | 215 |
#endif // __CPbkAddressSelect_H__ |
williamr@2 | 216 |
|
williamr@2 | 217 |
// End of File |