phonebookui/Phonebook/View/src/CPbkSendKeyAddressSelect.cpp
changeset 0 e686773b3f54
child 21 9da50d567e3c
equal deleted inserted replaced
-1:000000000000 0:e686773b3f54
       
     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: 
       
    15 *       Provides methods for phonebook call number selection dialog.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 
       
    22 #include "CPbkSendKeyAddressSelect.h"
       
    23 #include <avkon.hrh>         // AVKON softkey codes
       
    24 #include <aknnotewrappers.h> // AVKON Notes
       
    25 #include <StringLoader.h>    // StringLoader
       
    26 #include <PbkView.rsg>
       
    27 #include <CPbkContactItem.h>
       
    28 #include <CPbkContactEngine.h>
       
    29 #include <CPbkConstants.h>
       
    30 #include <CPbkFieldInfo.h>
       
    31 #include <featmgr.h>
       
    32 
       
    33 // ================= MEMBER FUNCTIONS =======================
       
    34 
       
    35 EXPORT_C CPbkSendKeyAddressSelect::CPbkSendKeyAddressSelect
       
    36         (CPbkContactEngine& aContactEngine) :
       
    37         iEngine(aContactEngine)
       
    38     {
       
    39     // CBase::operator new(TLeave) resets member data
       
    40     }
       
    41 
       
    42 EXPORT_C CPbkSendKeyAddressSelect::TParams::TParams
       
    43         (const CPbkContactItem& aContact,
       
    44         const TPbkContactItemField* aDefaultField) :
       
    45         TBaseParams(aContact, aDefaultField)
       
    46     {
       
    47     }
       
    48 
       
    49 EXPORT_C TBool CPbkSendKeyAddressSelect::ExecuteLD(TParams& aParams)
       
    50     {
       
    51     return CPbkAddressSelect::ExecuteLD(aParams);
       
    52     }
       
    53 
       
    54 EXPORT_C CPbkSendKeyAddressSelect::~CPbkSendKeyAddressSelect()
       
    55 	{
       
    56     delete iQueryTitle;
       
    57 	}
       
    58 
       
    59 /**
       
    60  * Makes phone number query return selection if Call key is pressed.
       
    61  */ 
       
    62 EXPORT_C TKeyResponse CPbkSendKeyAddressSelect::PbkControlKeyEventL
       
    63         (const TKeyEvent& aKeyEvent,TEventCode aType)
       
    64     {
       
    65     if (aType == EEventKey && aKeyEvent.iCode == EKeyPhoneSend)
       
    66         {
       
    67         // Event is Send key, tell field selection dialog to accept current selection
       
    68         AttemptExitL(ETrue);
       
    69         return EKeyWasConsumed;
       
    70         }
       
    71     return EKeyWasNotConsumed;
       
    72     }
       
    73 
       
    74 EXPORT_C const TDesC& CPbkSendKeyAddressSelect::QueryTitleL()
       
    75     {
       
    76     if (!iQueryTitle)
       
    77         {
       
    78         HBufC* title = ContactItem().GetContactTitleL();
       
    79         CleanupStack::PushL(title);
       
    80         iQueryTitle = StringLoader::LoadL(R_QTN_PHOB_QTL_CALL_TO_NAME, *title);
       
    81         CleanupStack::PopAndDestroy(title);
       
    82         }
       
    83     return *iQueryTitle;
       
    84     }
       
    85 
       
    86 EXPORT_C TInt CPbkSendKeyAddressSelect::QuerySoftkeysResource() const
       
    87     {
       
    88     return R_PBK_SOFTKEYS_CALL_CANCEL;
       
    89     }
       
    90 
       
    91 EXPORT_C TBool CPbkSendKeyAddressSelect::AddressField
       
    92         (const TPbkContactItemField& aField) const
       
    93     {
       
    94     // Return true for non-empty voip fields    
       
    95     TBool ret = ETrue;
       
    96     
       
    97     // Show VoIP fields only if the feature is on        
       
    98     if (FeatureManager::FeatureSupported(KFeatureIdCommonVoip))
       
    99         {
       
   100         ret = aField.FieldInfo().IsVoipField() &&
       
   101             !aField.IsEmptyOrAllSpaces();
       
   102         }
       
   103     else
       
   104         {
       
   105         ret = aField.FieldInfo().IsPhoneNumberField() &&
       
   106             !aField.IsEmptyOrAllSpaces();
       
   107         }
       
   108 
       
   109     if (aField.FieldInfo().FieldId() == EPbkFieldIdPushToTalk)
       
   110         {
       
   111         // If the field is a PTT field, we must query for POC support
       
   112         // and show it only in case the support exists
       
   113         ret = iEngine.Constants()->LocallyVariatedFeatureEnabled(EPbkLVPOC);        
       
   114         // If some product does not want to enable the POC feature, 
       
   115         // it can be variated with Phonebook's central repository flags.
       
   116         }
       
   117     
       
   118     return ret;
       
   119     }
       
   120     
       
   121 
       
   122 EXPORT_C void CPbkSendKeyAddressSelect::NoAddressesL()
       
   123     {
       
   124     HBufC* title = ContactItem().GetContactTitleOrNullL();
       
   125     if (title)
       
   126         {
       
   127         CleanupStack::PushL(title);
       
   128         HBufC* prompt = StringLoader::LoadLC
       
   129             (R_QTN_PHOB_NOTE_NO_NUMBER_TO_NAME, *title);
       
   130         CAknInformationNote* noteDlg = new(ELeave) CAknInformationNote;
       
   131         noteDlg->ExecuteLD(*prompt);
       
   132         CleanupStack::PopAndDestroy(2); // prompt, title
       
   133         }
       
   134     else
       
   135         {
       
   136         CAknNoteWrapper* noteDlg = new(ELeave) CAknNoteWrapper;
       
   137         noteDlg->ExecuteLD(R_QTN_PHOB_NOTE_NO_NUMBER);
       
   138         }
       
   139     }
       
   140     
       
   141 
       
   142 //  End of File