phonebookui/Phonebook2/Commands/src/CPbk2CallCmd.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 14 Sep 2010 20:54:53 +0300
branchRCL_3
changeset 21 9da50d567e3c
parent 20 f4a778e096c2
permissions -rw-r--r--
Revision: 201033 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
* Contributors:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
* Description:  Phonebook 2 call command object.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
*/
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
// INCLUDE FILES
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
#include "CPbk2CallCmd.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
// Phonebook 2
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include "CPbk2CallTypeSelector.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include <Pbk2Commands.hrh>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include <MPbk2ContactNameFormatter.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
#include <MPbk2ContactUiControl.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
#include <MPbk2ApplicationServices.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
#include <MPbk2AppUi.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
#include <CPbk2ApplicationServices.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
// Virtual Phonebook
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
#include <MVPbkStoreContact.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
#include <MVPbkStoreContactField.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
#include <MVPbkContactFieldData.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
#include <MVPbkContactFieldTextData.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
#include <MVPbkContactLink.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
#include <CVPbkFieldTypeSelector.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
#include <MVPbkFieldType.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
#include <MVPbkContactStore.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
#include <MVPbkContactStoreProperties.h>
21
9da50d567e3c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    41
#include <pbk2uicontrols.rsg>
20
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
#include <MVPbkContactFieldUriData.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
// System includes
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
#include <coemain.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
#include <AiwServiceHandler.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
#include <AiwCommon.hrh>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
#include <aiwdialdataext.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
#include <spsettingsvoiputils.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
//SPSettings
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
#include <spsettings.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
#include <spproperty.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
// Debugging headers
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
#include <Pbk2Debug.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
/// Unnamed namespace for local definitions
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
namespace {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
#ifdef _DEBUG
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
enum TPanicCode
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
    EPanicPreCond_ExecuteLD = 1
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
    };
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
void Panic(TPanicCode aReason)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
    _LIT(KPanicText, "CPbk2CallCmd");
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
    User::Panic(KPanicText,aReason);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
#endif // _DEBUG
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
/**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
 * Field type matcher.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
 *
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
 * @param aFieldTypeList    List of field types.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
 * @param aFieldType        Field type to search for.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
 * @param aResourceId       Field type selector resources.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
 * @return  ETrue if match was found.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    81
 */
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    82
TBool MatchesFieldTypeL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
        ( const MVPbkFieldTypeList& aFieldTypeList,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
          const MVPbkFieldType& aFieldType,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
          TInt aResourceId )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
    TResourceReader reader;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
    CCoeEnv::Static()->CreateResourceReaderLC( reader, aResourceId );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
    CVPbkFieldTypeSelector* selector = CVPbkFieldTypeSelector::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
        ( reader, aFieldTypeList );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
    // Check if the field type is the one needed
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
    TBool ret = selector->IsFieldTypeIncluded(aFieldType);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
    CleanupStack::PopAndDestroy(); // resource buffer
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
    delete selector;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
    return ret;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
/**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
 * Sets a phone number to AIW dial data.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
 *
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
 * @param aDialData     Dial data to modify.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
 * @param aContact      Contact containing the number.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
 */
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
void SetDialDataNumberL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
        ( CAiwDialDataExt& aDialData, const MVPbkStoreContact& aContact )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
    const MVPbkFieldTypeList& fieldTypeList =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
            aContact.ParentStore().StoreProperties().SupportedFields();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
    const MVPbkStoreContactFieldCollection& fieldCollection  =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
        aContact.Fields();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
    TInt fieldCount( fieldCollection.FieldCount() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
    for ( TInt i = 0; i < fieldCount; ++i )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
        const MVPbkStoreContactField& field = fieldCollection.FieldAt( i );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
        const MVPbkFieldType* fieldType = field.BestMatchingFieldType();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
        if( MatchesFieldTypeL( fieldTypeList, *fieldType,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
            R_PHONEBOOK2_PHONENUMBER_SELECTOR ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
            const MVPbkContactFieldTextData* textData =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
                &MVPbkContactFieldTextData::Cast
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
                    ( field.FieldData() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
            const TDesC& phoneNumber( textData->Text().Left
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
                ( AIWDialData::KMaximumPhoneNumberLength ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
            aDialData.SetPhoneNumberL( phoneNumber );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
/**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
 * Sets a phone number to AIW dial data.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
 *
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
 * @param aDialData     Dial data to modify.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
 * @param aField        Contact field containing the number.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   136
 */
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   137
void SetDialDataNumberL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
        ( CAiwDialDataExt& aDialData, const MVPbkStoreContactField& aField )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
    TVPbkFieldStorageType dataType = aField.FieldData().DataType();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
    if ( dataType == EVPbkFieldStorageTypeText )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
        const MVPbkContactFieldTextData* textData =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
            &MVPbkContactFieldTextData::Cast( aField.FieldData() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
        const TDesC& phoneNumber( textData->Text().Left
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
            ( AIWDialData::KMaximumPhoneNumberLength ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
        aDialData.SetPhoneNumberL( phoneNumber );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   150
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   151
    if ( dataType == EVPbkFieldStorageTypeUri )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
        const MVPbkContactFieldUriData* textData =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
            &MVPbkContactFieldUriData::Cast( aField.FieldData() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
        const TDesC& phoneNumber( textData->Text().Left
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
            ( AIWDialData::KMaximumPhoneNumberLength ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
        aDialData.SetPhoneNumberL( phoneNumber );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
} /// namespace
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
// CPbk2CallCmd::CPbk2CallCmd
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
CPbk2CallCmd::CPbk2CallCmd( MVPbkStoreContact*& aContact,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
        MVPbkStoreContactField* aSelectedField,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
        MPbk2ContactUiControl& aControl,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
        const TInt aCommandId, CAiwServiceHandler& aServiceHandler,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
        CPbk2CallTypeSelector& aSelector,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
        VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aActionSelector ) :
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
            iContact( aContact ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
            iSelectedField( aSelectedField ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   174
            iControl( &aControl ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
            iCommandId( aCommandId ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
            iServiceHandler( aServiceHandler ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
            iSelector( aSelector ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   178
            iActionSelector( aActionSelector )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   179
            
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   180
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   181
    PBK2_DEBUG_PRINT
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
        (PBK2_DEBUG_STRING("CPbk2CallCmd::CPbk2CallCmd(0x%x)"), this);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   183
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   184
    iControl->RegisterCommand( this );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   185
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
// CPbk2CallCmd::~CPbk2CallCmd
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   189
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   190
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
CPbk2CallCmd::~CPbk2CallCmd()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
    PBK2_DEBUG_PRINT
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
        (PBK2_DEBUG_STRING("CPbk2CallCmd::~CPbk2CallCmd(0x%x)"), this);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
    delete iSelectedField;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
    if( iControl )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   199
        iControl->RegisterCommand( NULL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   201
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
// CPbk2CallCmd::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   206
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
CPbk2CallCmd* CPbk2CallCmd::NewL( MVPbkStoreContact*& aContact,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
        MVPbkStoreContactField* aSelectedField,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
        MPbk2ContactUiControl& aControl,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
        const TInt aCommandId, CAiwServiceHandler& aServiceHandler,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
        CPbk2CallTypeSelector& aSelector )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   212
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   213
    CPbk2CallCmd* self = new (ELeave ) CPbk2CallCmd
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
        ( aContact, aSelectedField, aControl, aCommandId,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
          aServiceHandler, aSelector, VPbkFieldTypeSelectorFactory::EEmptySelector );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
    return self;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
// CPbk2CallCmd::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
CPbk2CallCmd* CPbk2CallCmd::NewL( MVPbkStoreContact*& aContact,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
        MVPbkStoreContactField* aSelectedField,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   225
        MPbk2ContactUiControl& aControl,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   226
        const TInt aCommandId, CAiwServiceHandler& aServiceHandler,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   227
        CPbk2CallTypeSelector& aSelector,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
        VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aActionSelector )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   230
    CPbk2CallCmd* self = new (ELeave ) CPbk2CallCmd
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
        ( aContact, aSelectedField, aControl, aCommandId,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
          aServiceHandler, aSelector, aActionSelector );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
    return self;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
// CPbk2CallCmd::ExecuteLD
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   239
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
void CPbk2CallCmd::ExecuteLD()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
    PBK2_DEBUG_PRINT
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
        (PBK2_DEBUG_STRING("CPbk2CallCmd::ExecuteLD(0x%x)"), this);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
    CleanupStack::PushL( this );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
    // Setup dial data
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
    CAiwDialDataExt* dialData = CAiwDialDataExt::NewLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
    dialData->SetWindowGroup
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
        ( CCoeEnv::Static()->RootWin().Identifier() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   252
    // If there is a default service, use the service 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
    TUint serviceId;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
    CSPSettingsVoIPUtils* sPSettings = CSPSettingsVoIPUtils::NewLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
    if ( !sPSettings->GetPreferredService( serviceId ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
        dialData->SetServiceId( serviceId );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
    CleanupStack::PopAndDestroy( sPSettings );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
    MVPbkContactLink* contactLink = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   262
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   263
    if ( iCommandId == EPbk2CmdCall )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   264
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   265
        // Call was launched with send key, which means
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   266
        // Phonebook has performed address select by itself
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   267
        // and there is selected field instance
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   268
        __ASSERT_DEBUG( iSelectedField &&
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   269
            ( iSelectedField->FieldData().DataType() ==
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
                EVPbkFieldStorageTypeText || 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
                iSelectedField->FieldData().DataType() ==
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
                    EVPbkFieldStorageTypeUri ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
                        Panic( EPanicPreCond_ExecuteLD ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
        // Create field link
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
        contactLink = iSelectedField->CreateLinkLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   277
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
        // Set number
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
        SetDialDataNumberL( *dialData, *iSelectedField );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   280
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
        // We also have select call type by ourselves
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
        SetCallTypeL( *dialData );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   283
        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
        // If field data has service prefix, extract it and find matched service id
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
        // from SP setting, then set the matched service id to daildata.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
        // Service prefix from field data has higher priority over preferred service
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
        TPtrC xspId;        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
        if ( ExtractXspId( iSelectedField, xspId ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
        	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   290
        	TUint srcId = GetMatchedServiceIdL( xspId );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   291
        	
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   292
            if ( srcId != (TUint)KErrNotFound )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   293
            	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   294
            	dialData->SetServiceId( srcId );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
            	} 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   296
        	}      
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   297
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
    else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
        if ( iSelectedField )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
            // If selected field is set create field link from it.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
            contactLink = iSelectedField->CreateLinkLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
        else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   306
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   307
            // Otherwise use contact
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   308
            contactLink = iContact->CreateLinkLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   309
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   310
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   311
        if ( !contactLink )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   312
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   313
            // Temporary contact, set number here
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
            SetDialDataNumberL( *dialData, *iContact );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   315
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   316
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   317
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   318
    if ( contactLink )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   319
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   320
        HBufC8* linkBuffer = contactLink->PackLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   321
        dialData->SetContactLinkL( *linkBuffer );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   322
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   323
    else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
        CPbk2ApplicationServices* appServices = CPbk2ApplicationServices::InstanceLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   326
        MPbk2ContactNameFormatter& nameFormatter =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   327
            appServices->NameFormatter();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   328
        const MVPbkStoreContactFieldCollection& fieldCollection  =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
            iContact->Fields();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
        HBufC* title = nameFormatter.GetContactTitleOrNullL(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
                        fieldCollection,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   332
                        MPbk2ContactNameFormatter::EPreserveLeadingSpaces );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   333
        CleanupStack::PopAndDestroy();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
        CleanupStack::PushL( title );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   335
            
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   336
        if ( title )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   337
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   338
            dialData->SetNameL( *title );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   339
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   340
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   341
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   342
    // Get an empty in param list..
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   343
    CAiwGenericParamList& inParamList = iServiceHandler.InParamListL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
    // ..and pass it to dial data in order for it to fill it
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
    dialData->FillInParamListL( inParamList );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   346
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   347
    if ( contactLink )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   348
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   349
        CleanupStack::PopAndDestroy( 3 ); // linkBuffer, contactLink, dialData
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   350
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   351
    else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   352
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   353
        CleanupStack::PopAndDestroy( 2 ); // title, dialData
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   354
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   355
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
    // If the command id is EPbk2CmdCall it means the call was launched
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
    // with send key and we therefore must use different AIW command
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   359
    // than when the call was selected from the menu
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   360
   if ( iCommandId == EPbk2CmdCall )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   361
       {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   362
        iServiceHandler.ExecuteServiceCmdL(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   363
            KAiwCmdCall,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   364
            inParamList,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
            iServiceHandler.OutParamListL(),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   366
            0,      // No options used.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   367
            NULL);  // No need for callback
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
       }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
   else // the call was launched from menu
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   370
       {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   371
        // Relay the command to AIW for handling
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   372
        iServiceHandler.ExecuteMenuCmdL(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   373
            iCommandId,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   374
            inParamList,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   375
            iServiceHandler.OutParamListL(),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   376
            0,      // No options used.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   377
            NULL);  // No need for callback
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   378
       }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   379
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   380
    // Update UI control
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   381
    if( iControl )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   382
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   383
        TInt fieldIndex = iControl->FocusedFieldIndex();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   384
        iControl->ResetFindL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   385
        if( iContact )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   386
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   387
            iControl->SetFocusedContactL( *iContact );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   388
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   389
        iControl->SetFocusedFieldIndex( fieldIndex );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   390
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   391
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   392
    // Destroy itself as promised
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   393
    CleanupStack::PopAndDestroy(); // this
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   394
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   395
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   396
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   397
// CPbk2CallCmd::ResetUiControl
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   398
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   399
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   400
void CPbk2CallCmd::ResetUiControl( MPbk2ContactUiControl& aUiControl )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   401
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   402
    if( iControl == &aUiControl )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   403
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   404
        iControl = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   405
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   406
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   407
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   408
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   409
// CPbk2CallCmd::AddObserver
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   410
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   411
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   412
void CPbk2CallCmd::AddObserver( MPbk2CommandObserver& /*aObserver*/ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   413
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   414
    // Do nothing
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   415
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   416
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   417
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   418
// CPbk2CallCmd::SetCallTypeL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   419
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   420
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   421
void CPbk2CallCmd::SetCallTypeL( CAiwDialDataExt& dialData )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   422
    { 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   423
    switch( iActionSelector )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   424
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   425
        CAiwDialData::TCallType callType;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   426
        case VPbkFieldTypeSelectorFactory::EEmptySelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   427
            callType = iSelector.SelectCallTypeL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   428
                ( iCommandId, *iContact, iControl->FocusedField(), *iSelectedField );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   429
            dialData.SetCallType( callType );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   430
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   431
        case VPbkFieldTypeSelectorFactory::EVoiceCallSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   432
            dialData.SetCallType( CAiwDialData::EAIWForcedCS );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   433
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   434
        case VPbkFieldTypeSelectorFactory::EVOIPCallSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   435
            callType = iSelector.SelectVoipCallTypeL( iSelectedField );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   436
            dialData.SetCallType( callType );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   437
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   438
        case VPbkFieldTypeSelectorFactory::EVideoCallSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   439
            dialData.SetCallType( CAiwDialData::EAIWForcedVideo );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   440
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   441
        default:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   442
            dialData.SetCallType ( CAiwDialData::EAIWForcedCS);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   443
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   444
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   445
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   446
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   447
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   448
// CPbk2CallCmd::ExtractXspId
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   449
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   450
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   451
TBool CPbk2CallCmd::ExtractXspId(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   452
    const MVPbkStoreContactField* aSelectedField, TPtrC& aXSPId ) const
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   453
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   454
    TBool found = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   455
    _LIT( KColon, ":" );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   456
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   457
	const MVPbkContactFieldData& fieldData = aSelectedField->FieldData();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   458
	TPtrC data  = GetFieldData( fieldData );	  
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   459
    TInt pos = data.Find( KColon );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   460
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   461
    if ( pos > 0 )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   462
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   463
        aXSPId.Set( data.Left( pos ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   464
        found = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   465
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   466
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   467
    return found;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   468
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   469
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   470
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   471
// CPbk2CallCmd::GetMatchedServiceIdL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   472
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   473
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   474
TServiceId CPbk2CallCmd::GetMatchedServiceIdL( const TDesC& aXSPId )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   475
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   476
    TUint ret = ( TUint )KErrNotFound;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   477
    CDesCArrayFlat* nameArray = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   478
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   479
    RIdArray ids;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   480
    CleanupClosePushL( ids );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   481
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   482
    nameArray = new (ELeave) CDesCArrayFlat( 2 );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   483
    CleanupStack::PushL( nameArray );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   484
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   485
    CSPSettings* settings = CSPSettings::NewLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   486
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   487
    settings->FindServiceIdsL( ids );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   488
    settings->FindServiceNamesL( ids, *nameArray );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   489
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   490
    const TInt count = nameArray->MdcaCount();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   491
    for ( TInt i=0; i < count; i++ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   492
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   493
        // Find the mathched service
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   494
        TPtrC name = nameArray->MdcaPoint( i );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   495
        if ( !name.CompareF( aXSPId ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   496
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   497
            // Service found
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   498
            ret = ids[i];
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   499
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   500
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   501
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   502
    CleanupStack::PopAndDestroy( 3 ); // ids, nameArray, settings
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   503
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   504
    return ret;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   505
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   506
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   507
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   508
// CPbk2CallCmd::GetFieldData
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   509
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   510
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   511
TPtrC CPbk2CallCmd::GetFieldData( const MVPbkContactFieldData& aFieldData ) const
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   512
	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   513
	TPtrC text ( KNullDesC() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   514
	
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   515
    switch ( aFieldData.DataType() )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   516
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   517
        // Text storage type
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   518
        case EVPbkFieldStorageTypeText:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   519
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   520
            const MVPbkContactFieldTextData& textData = MVPbkContactFieldTextData::Cast( aFieldData );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   521
            text.Set( textData.Text() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   522
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   523
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   524
        // URI storage type
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   525
        case EVPbkFieldStorageTypeUri:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   526
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   527
            const MVPbkContactFieldUriData& textData = MVPbkContactFieldUriData::Cast( aFieldData );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   528
            text.Set( textData.Text() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   529
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   530
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   531
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   532
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   533
    return text;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   534
	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   535
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   536
// End of File