phonebookui/Phonebook2/UIControls/src/CPbk2AddressSelect.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 13 Oct 2010 14:15:33 +0300
branchRCL_3
changeset 85 38bb213f60ba
parent 68 9da50d567e3c
permissions -rw-r--r--
Revision: 201039 Kit: 201041
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
63
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 address selection.
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 <CPbk2AddressSelect.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
// Phonebook 2
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
#include "CPbk2SelectFieldDlg.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include "MPbk2ControlKeyObserver.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include <MPbk2ContactNameFormatter.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include <CPbk2FieldPropertyArray.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
#include <TPbk2AddressSelectParams.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 <MPbk2ApplicationServices2.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
#include <CPbk2ServiceManager.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
#include <MPbk2AppUi.h>
85
38bb213f60ba Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 68
diff changeset
    31
#include <Pbk2UIControls.rsg>
38bb213f60ba Revision: 201039
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 68
diff changeset
    32
#include <Pbk2Commands.rsg>
63
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
#include <CPbk2ApplicationServices.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
#include <TPbk2StoreContactAnalyzer.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
// Virtual Phonebook
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
#include <CVPbkFieldFilter.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
#include <MVPbkStoreContactField.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
#include <MVPbkStoreContact.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
#include <CVPbkFieldTypeSelector.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
#include <MVPbkContactFieldData.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
#include <MVPbkStoreContactFieldCollection.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    43
#include <CVPbkContactManager.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
#include <CVPbkDefaultAttribute.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
#include <MVPbkFieldType.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
#include <TVPbkFieldVersitProperty.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
// System includes
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
#include <avkon.hrh>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
#include <aknnotewrappers.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
#include <StringLoader.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
//SpSettings
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
#include <spsettings.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
#include <spentry.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
#include <spproperty.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
#include <spsettingsvoiputils.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
/// Unnamed namespace for local definitions
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
namespace {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
#ifdef _DEBUG
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
enum TPanicCode
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
    EPanicPostCond_Constructor = 1,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
    EPanicPreCond_ExecuteLD
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
    };
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
static void Panic(TPanicCode aReason)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
    _LIT(KPanicText, "CPbk2AddressSelect");
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
    User::Panic(KPanicText, aReason);
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
#endif // _DEBUG
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
#define KOneVOIPServiceAvailable    1
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
const TInt KFirstField = 0;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
const TInt KDefaultTitleFormat = MPbk2ContactNameFormatter::EUseSeparator;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
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
 * Returns index of given field in store contact field collection.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
 *
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
 * @param aCollection   Store contact field collection.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
 * @param aField        Store contact field to search for.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
 * @return  Index of the given field.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
 */
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
inline TInt IndexOfField(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
        const MVPbkStoreContactFieldCollection& aCollection,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
        const MVPbkStoreContactField& aField )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
    TInt ret = KErrNotFound;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
    const TInt count = aCollection.FieldCount();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
    for ( TInt i = 0; i < count; ++i )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
        MVPbkStoreContactField* field = aCollection.FieldAtLC( i );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
        if ( aField.IsSame( *field ) )
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
            ret = i;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
            CleanupStack::PopAndDestroy(); // field
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
        CleanupStack::PopAndDestroy(); // field
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
    return ret;
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
} /// namespace
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
// MODULE DATA STRUCTURES
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   114
/**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   115
 * Special field selection dialog class for CPbk2AddressSelect.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
 * The main purpose of this class is to
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
 * get #include of MPbk2ControlKeyObserver
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
 * away from public header CPbk2AddressSelect.h.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
 */
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
NONSHARABLE_CLASS(CPbk2AddressSelect::CSelectFieldDlg) :
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
        public CPbk2SelectFieldDlg,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
        private MPbk2ControlKeyObserver
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
    public:  // Construction
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
        /**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
         * Constructor.
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
         * @param aParent   Parent.
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
        CSelectFieldDlg( CPbk2AddressSelect& aParent ) :
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
                iParent( aParent )
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
            SetObserver( this );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
            }
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
    private: // From MPbk2ControlKeyObserver
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
        TKeyResponse Pbk2ControlKeyEventL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
            ( const TKeyEvent& aKeyEvent, TEventCode aType );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
    private: // Data
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
        /// Ref: Parent
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
        CPbk2AddressSelect& iParent;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
    };
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
// CPbk2AddressSelect::CSelectFieldDlg::Pbk2ControlKeyEventL
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
TKeyResponse CPbk2AddressSelect::CSelectFieldDlg::Pbk2ControlKeyEventL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
        ( const TKeyEvent& aKeyEvent, TEventCode aType )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
    // Forward call to virtual function in CPbk2AddressSelect interface
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
    return iParent.Pbk2ControlKeyEventL( aKeyEvent,aType );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
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
// CPbk2AddressSelect::CPbk2AddressSelect
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
// --------------------------------------------------------------------------
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
CPbk2AddressSelect::CPbk2AddressSelect( 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
    TPbk2AddressSelectParams& aParams,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
    const TArray<MVPbkStoreContact*>* aStoreContactsArray,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
    const TArray<CPbk2PresenceIconInfo*>* aPresenceIconsArray ):
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
    iParams( aParams ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
    iStoreContactsArray( aStoreContactsArray ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
    iPresenceIconsArray( aPresenceIconsArray )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
    __ASSERT_DEBUG
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
        ( !iFieldDlg && !iDestroyedPtr,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
          Panic( EPanicPostCond_Constructor ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   174
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
// CPbk2AddressSelect::~CPbk2AddressSelect
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   178
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   179
EXPORT_C CPbk2AddressSelect::~CPbk2AddressSelect()
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
    // Tell ExecuteLD this object is already destroyed
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
    if (iDestroyedPtr)
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
        *iDestroyedPtr = ETrue;
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
    // Set eliminator pointer to NULL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
    if ( iSelfPtr )
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
        *iSelfPtr = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
        }
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
    delete iFieldDlg;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
    delete iFieldFilter;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
    delete iFieldTypeSelector;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
    iFieldFilterArray.ResetAndDestroy();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
    }
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
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
// CPbk2AddressSelect::NewL
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
EXPORT_C CPbk2AddressSelect* CPbk2AddressSelect::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
        ( TPbk2AddressSelectParams& aParams )
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
    CPbk2AddressSelect* self = new ( ELeave ) CPbk2AddressSelect(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
        aParams, NULL, NULL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
    CleanupStack::PushL( self );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
    self->ConstructL( NULL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
    CleanupStack::Pop( self );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
    return self;
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   214
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   215
// CPbk2AddressSelect::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
// --------------------------------------------------------------------------
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
EXPORT_C CPbk2AddressSelect* CPbk2AddressSelect::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
        ( TPbk2AddressSelectParams& aParams,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
          CVPbkFieldTypeSelector& aFieldTypeSelector,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
          const TArray<MVPbkStoreContact*>* aStoreContactsArray,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
          const TArray<CPbk2PresenceIconInfo*>* aPresenceIconsArray )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
    CPbk2AddressSelect* self = new ( ELeave ) CPbk2AddressSelect( aParams,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   225
        aStoreContactsArray, aPresenceIconsArray );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   226
    CleanupStack::PushL( self );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   227
    self->ConstructL( &aFieldTypeSelector );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
    CleanupStack::Pop( self );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
    return self;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   230
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
// CPbk2AddressSelect::ConstructL
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
void CPbk2AddressSelect::ConstructL(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
    CVPbkFieldTypeSelector* aFieldTypeSelector )
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
    // Read the resource referenced in address select resource struct
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
    const TInt fieldTypeSelectorRes = iParams.iResReader.ReadInt32();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
    TResourceReader selectorReader;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
    CCoeEnv::Static()->CreateResourceReaderLC
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
        ( selectorReader, fieldTypeSelectorRes );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
    if ( aFieldTypeSelector == NULL )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
        // Give that resource reader to the field type selector
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
        iFieldTypeSelector = CVPbkFieldTypeSelector::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
            ( selectorReader, iParams.iContactManager.FieldTypes() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
    else
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
        iFieldTypeSelector = CVPbkFieldTypeSelector::NewL(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
            *aFieldTypeSelector );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
    CleanupStack::PopAndDestroy(); // selectorReader
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
    iNoAddressesForNamePromptResource = iParams.iResReader.ReadInt32();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
    iNoAddressesPromptResource = iParams.iResReader.ReadInt32();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
    iSoftKeyResource = iParams.iResReader.ReadInt32();
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
    const CVPbkFieldFilter::TConfig config
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   262
        ( const_cast<MVPbkStoreContactFieldCollection&>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   263
            ( iParams.iContact.Fields() ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   264
                iFieldTypeSelector, NULL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   265
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   266
    iFieldFilter = CVPbkFieldFilter::NewL( config );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   267
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   268
    if ( iStoreContactsArray != NULL && iStoreContactsArray->Count() != 0 )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   269
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
        TInt count = iStoreContactsArray->Count();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
        for ( TInt i = 0; i < count; i++ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
            const CVPbkFieldFilter::TConfig conf
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
                ( const_cast<MVPbkStoreContactFieldCollection&>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
                    ( iStoreContactsArray->operator[](i)->Fields() ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
                      iFieldTypeSelector, NULL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   277
            CVPbkFieldFilter* fieldFilter = CVPbkFieldFilter::NewL( conf );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
            CleanupStack::PushL( fieldFilter );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
            iFieldFilterArray.AppendL( fieldFilter );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   280
            CleanupStack::Pop(); //fieldfilter
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
        }
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
    CPbk2ApplicationServices* appServices =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
        CPbk2ApplicationServices::InstanceLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
    iAttributeManager =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
        &appServices->ContactManager().ContactAttributeManagerL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
    CleanupStack::PopAndDestroy(); // appServices
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
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
// CPbk2AddressSelect::ExecuteLD
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
EXPORT_C MVPbkStoreContactField* CPbk2AddressSelect::ExecuteLD()
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
    __ASSERT_DEBUG( !iFieldDlg, Panic( EPanicPreCond_ExecuteLD ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
    // "D" function semantics
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
    CleanupStack::PushL( this );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
    TBool thisDestroyed = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
    // Ensure that thisDestroyed will be ETrue if this object is destroyed.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
    // See in destructor how this is done.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
    iDestroyedPtr = &thisDestroyed;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   306
    SelectFieldL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   307
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   308
    MVPbkStoreContactField* returnedField = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   309
    if ( iSelectedField )
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
        // We cannot return iSelectedField directly since if its NULL,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   312
        // it's value changes to 0xdedede before it is returned.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   313
        // Therefore we must test iSelectedField before assigning it
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
        // to returnedField.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   315
        returnedField = iSelectedField;
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 ( thisDestroyed )
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
        // This object has already been destroyed
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   321
        CleanupStack::Pop( this );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   322
        returnedField = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   323
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
    else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   326
        CleanupStack::PopAndDestroy( this );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   327
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   328
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
    return returnedField;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   332
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   333
// CPbk2AddressSelect::AttemptExitL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
// --------------------------------------------------------------------------
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
EXPORT_C void CPbk2AddressSelect::AttemptExitL( TBool aAccept )
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
    if ( iFieldDlg )
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
        iFieldDlg->AttemptExitL( aAccept );
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
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   343
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
// CPbk2AddressSelect::Pbk2ControlKeyEventL
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   348
EXPORT_C TKeyResponse CPbk2AddressSelect::Pbk2ControlKeyEventL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   349
        ( const TKeyEvent& aKeyEvent, TEventCode aType )
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
    TKeyResponse ret = EKeyWasNotConsumed;
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
    if ( aType == EEventKey && aKeyEvent.iCode == EKeyPhoneSend )
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
        // Event is Send key, tell field selection dialog to accept
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
        // current selection
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
        AttemptExitL( ETrue );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
        ret = EKeyWasConsumed;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   359
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   360
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   361
    return ret;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   362
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   363
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   364
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
// CPbk2AddressSelect::SetCba
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   366
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   367
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
EXPORT_C void CPbk2AddressSelect::SetCba( TInt aCbaResourceId )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   370
    iSoftKeyResource = aCbaResourceId;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   371
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   372
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   373
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   374
// CPbk2AddressSelect::RequestExitL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   375
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   376
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   377
void CPbk2AddressSelect::RequestExitL( TInt aCommandId )
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
    if ( aCommandId == EEikBidCancel )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   380
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   381
        AttemptExitL( EFalse );
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
    else if ( aCommandId == EEikBidOk )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   384
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   385
        AttemptExitL( ETrue );
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
    }
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
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   390
// CPbk2AddressSelect::ForceExit
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   393
void CPbk2AddressSelect::ForceExit()
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
    TRAPD( err, AttemptExitL( EFalse ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   396
    if ( err != KErrNone )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   397
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   398
        // If not nicely then use the force
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   399
        delete this;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   400
        }
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
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
// CPbk2AddressSelect::ResetWhenDestroyed
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
void CPbk2AddressSelect::ResetWhenDestroyed(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   408
        MPbk2DialogEliminator** aSelfPtr )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   409
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   410
    iSelfPtr = aSelfPtr;
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
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
// CPbk2AddressSelect::AddressField
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   415
// Returns true if aField is an applicable address field.
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
TBool CPbk2AddressSelect::AddressField
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   419
        ( const MVPbkStoreContactField& aField ) const
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
    TBool ret = EFalse;
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
    // Return true if field belongs to the selector
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   424
    ret = ( iFieldFilter->FindField( aField ) ==
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   425
        KErrNotFound ) ? EFalse : ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   426
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   427
    return ret;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   428
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   429
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   430
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   431
// CPbk2AddressSelect::NoAddressesL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   432
// Called if there are no applicable address fields in a contact passed
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   433
// to ExecuteLD.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   434
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   435
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   436
void CPbk2AddressSelect::NoAddressesL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   437
        ( TPbk2AddressSelectParams aParams ) const
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   438
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   439
    if ( !aParams.iSuppressWarnings )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   440
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   441
        HBufC* prompt = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   442
        HBufC* name = aParams.iNameFormatter.GetContactTitleOrNullL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   443
            ( iParams.iContact.Fields(), KDefaultTitleFormat );
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
        if ( name )
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
            CleanupStack::PushL(name);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   448
            prompt = StringLoader::LoadL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   449
                ( iNoAddressesForNamePromptResource, *name );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   450
            CleanupStack::PopAndDestroy(); // name
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   451
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   452
        else
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
            prompt = StringLoader::LoadL( iNoAddressesPromptResource );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   455
            }
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
        if ( prompt )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   458
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   459
            CleanupStack::PushL( prompt );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   460
            // This is a waiting dialog because the address select might be
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   461
            // used from the application server and the information note will
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   462
            // disappear if the application server closes before the
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   463
            // note timeout has expired, thus causing blinking
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   464
            CAknInformationNote* noteDlg =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   465
                new ( ELeave ) CAknInformationNote( ETrue );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   466
            noteDlg->ExecuteLD( *prompt );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   467
            CleanupStack::PopAndDestroy(); // prompt
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
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
// CPbk2AddressSelect::SelectFieldL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   474
// --------------------------------------------------------------------------
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
inline void CPbk2AddressSelect::SelectFieldL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   477
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   478
    // If currently focused field is an applicable field
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   479
    if ( iParams.iFocusedField && AddressField( *iParams.iFocusedField ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   480
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   481
        // Applicable field was focused -> return field
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   482
        SetSelectedFieldL( iParams.iFocusedField );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   483
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   484
    else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   485
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   486
        TBool found = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   487
        // Focus is in on some other field, first check default field
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   488
        if ( iParams.iDefaultPriorities &&
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   489
             iParams.iUseDefaultDirectly &&
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   490
             iParams.iDefaultPriorities->Count() > 0 )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   491
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   492
            found = SelectFromDefaultFieldsL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   493
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   494
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   495
        if ( !found )
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
            // No direct call to focused or default number, we have to
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   498
            // select from applicable fields
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   499
            SelectFromApplicableFieldsL();
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
    }
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
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   505
// CPbk2AddressSelect::SelectFromApplicableFieldsL
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
inline void CPbk2AddressSelect::SelectFromApplicableFieldsL()
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
    TInt indexOfDefault = IndexOfDefaultFieldL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   511
    TInt fieldCount = iFieldFilter->FieldCount();
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
    // check also addiotnal contacts
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   514
    if ( iFieldFilterArray.Count() > 0 )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   515
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   516
        TInt count = iFieldFilterArray.Count();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   517
        for ( TInt i = 0; i < count; i++ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   518
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   519
            fieldCount += iFieldFilterArray[i]->FieldCount();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   520
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   521
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   522
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   523
    // Different actions for different number of applicable fields found
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   524
    if ( fieldCount == 0 )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   525
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   526
        // No applicable addresses found
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   527
        NoAddressesL( iParams );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   528
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   529
    else if ( fieldCount == 1 && !iParams.iQueryAlways )
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
        // Exactly one applicable address found, just return it
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   532
        if ( iFieldFilter->FieldCount() != 0 )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   533
        	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   534
         	SetSelectedFieldL( &iFieldFilter->FieldAt( KFirstField ) ); 
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
        else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   537
        	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   538
        	SetSelectedFieldL( &iFieldFilterArray[0]->FieldAt( KFirstField ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   539
        	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   540
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   541
    else if (fieldCount > 1 || iParams.iQueryAlways )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   542
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   543
        HBufC* title = LoadDialogTitleL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   544
  
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   545
        // Run the address selection dialog
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   546
        CleanupStack::PushL( title );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   547
        iFieldDlg = new ( ELeave ) CSelectFieldDlg( *this );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   548
        iFieldDlg->ResetWhenDestroyed( &iFieldDlg );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   549
        const MVPbkStoreContactField* field = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   550
        field = iFieldDlg->ExecuteLCD
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   551
            ( *iFieldFilter, 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   552
              iFieldFilterArray,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   553
              iPresenceIconsArray,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   554
              iParams.iContactManager,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   555
              iParams.iFieldPropertyArray,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   556
              iSoftKeyResource,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   557
              iParams.iCommMethod,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   558
              *title,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   559
              indexOfDefault );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   560
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   561
        SetSelectedFieldL( field );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   562
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   563
        CleanupStack::PopAndDestroy( 2 ); // field, title
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   564
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   565
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   566
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   567
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   568
// CPbk2AddressSelect::IndexOfDefaultFieldL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   569
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   570
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   571
inline TInt CPbk2AddressSelect::IndexOfDefaultFieldL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   572
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   573
    TInt ret = KErrNotFound;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   574
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   575
    const MVPbkStoreContactField* field = FindDefaultFieldLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   576
    if ( field )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   577
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   578
        ret = iFieldFilter->FindField( *field );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   579
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   580
    CleanupStack::PopAndDestroy(); // field
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   581
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   582
    return ret;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   583
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   584
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   585
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   586
// CPbk2AddressSelect::SelectFromDefaultFieldsL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   587
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   588
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   589
inline TBool CPbk2AddressSelect::SelectFromDefaultFieldsL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   590
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   591
    TBool found = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   592
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   593
    const MVPbkStoreContactField* field = FindDefaultFieldLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   594
    if ( field )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   595
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   596
        SetSelectedFieldL( field );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   597
        found = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   598
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   599
    CleanupStack::PopAndDestroy(); // field
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   600
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   601
    return found;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   602
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   603
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   604
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   605
// CPbk2AddressSelect::FindDefaultFieldLC
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   606
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   607
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   608
MVPbkStoreContactField* CPbk2AddressSelect::FindDefaultFieldLC()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   609
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   610
    MVPbkStoreContactField* ret = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   611
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   612
    // Go through the default priorities array, and
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   613
    // check does a specific default exist
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   614
    if ( iParams.iDefaultPriorities )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   615
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   616
        const TInt defaultCount = iParams.iDefaultPriorities->Count();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   617
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   618
        for (TInt i=0; i<defaultCount; ++i)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   619
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   620
            TVPbkDefaultType defaultType =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   621
                (TVPbkDefaultType) iParams.iDefaultPriorities->At(i);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   622
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   623
            // Create an attribute prototype out of the attribute identifier
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   624
            CVPbkDefaultAttribute* attr =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   625
                CVPbkDefaultAttribute::NewL( defaultType );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   626
            CleanupStack::PushL( attr );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   627
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   628
            if ( iAttributeManager->HasContactAttributeL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   629
                    ( *attr, iParams.iContact ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   630
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   631
                const MVPbkStoreContactFieldCollection& fields =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   632
                    iParams.iContact.Fields();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   633
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   634
                // Get the field with attribute
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   635
                const TInt fieldCount = fields.FieldCount();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   636
                for ( TInt j = 0; j < fieldCount; ++j )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   637
                    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   638
                    if ( iAttributeManager->HasFieldAttributeL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   639
                            ( *attr, fields.FieldAt( j ) ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   640
                        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   641
                        ret = fields.FieldAtLC( j );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   642
                        CleanupStack::Pop(); // ret
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   643
                        break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   644
                        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   645
                    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   646
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   647
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   648
            CleanupStack::PopAndDestroy( attr );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   649
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   650
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   651
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   652
    CleanupDeletePushL( ret );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   653
    return ret;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   654
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   655
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   656
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   657
// CPbk2AddressSelect::SetSelectedFieldL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   658
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   659
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   660
inline void CPbk2AddressSelect::SetSelectedFieldL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   661
        ( const MVPbkStoreContactField* aField )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   662
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   663
    if ( aField )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   664
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   665
        const MVPbkStoreContactFieldCollection& fields =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   666
            iParams.iContact.Fields();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   667
        TInt index = IndexOfField( fields, *aField );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   668
        if ( index >= 0 )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   669
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   670
            // field from main contact
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   671
            iSelectedField = fields.FieldAtLC( index );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   672
            CleanupStack::Pop();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   673
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   674
        else if ( iStoreContactsArray != NULL &&
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   675
                  iStoreContactsArray->Count() > 0 )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   676
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   677
            // field from additional contact
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   678
            TInt count = iStoreContactsArray->Count();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   679
            for( TInt i = 0; i < count; i++ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   680
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   681
                const MVPbkStoreContactFieldCollection& xspFields =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   682
                    iStoreContactsArray->operator[](i)->Fields();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   683
                index = IndexOfField( xspFields, *aField );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   684
                if ( index >= 0 )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   685
                    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   686
                    iSelectedField = xspFields.FieldAtLC( index );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   687
                    CleanupStack::Pop();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   688
                    break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   689
                    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   690
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   691
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   692
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   693
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   694
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   695
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   696
// CPbk2AddressSelect::IsVoiceCallExistL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   697
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   698
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   699
inline TBool CPbk2AddressSelect::IsVoiceCallExistL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   700
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   701
    TInt countFields = iParams.iContact.Fields().FieldCount();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   702
    TPbk2StoreContactAnalyzer analyzer( iParams.iContactManager, NULL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   703
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   704
    for ( TInt i = 0; i < countFields; i++ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   705
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   706
        const MVPbkStoreContactField& field =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   707
            iParams.iContact.Fields().FieldAt( i );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   708
        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   709
        // If the field is voice call, then return ETrue.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   710
        if ( analyzer.IsFieldTypeIncludedL( field, R_PHONEBOOK2_PHONENUMBER_SELECTOR ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   711
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   712
            return ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   713
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   714
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   715
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   716
    // No voice call filed, return EFalse.    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   717
    return EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   718
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   719
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   720
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   721
// CPbk2AddressSelect::GetVoiceAndVOIPCallDialogTitleL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   722
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   723
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   724
inline HBufC* CPbk2AddressSelect::GetVoiceAndVOIPCallDialogTitleL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   725
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   726
    HBufC* title (NULL);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   727
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   728
    // If the popped up dialog is started in namelist view.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   729
    // Then, the title of the dialog should obey such rules:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   730
    // 1. When there are only VoIP addresses for contact or if VoIP is preferred.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   731
    // Then show "Internet call:"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   732
    // 2. In other cases show "Call:". This would be shown when:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   733
    // 2.1 VoIP is not preferred and there's at least one Voice call number for the contact
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   734
    // 2.2 So even in case when there's only voice call numbers.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   735
    // The title should be "Call:" instead of "Voice call:" 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   736
    if ( iParams.iTitleResId == R_QTN_PHOB_QTL_CALL_TO_NAME )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   737
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   738
        // Check whether VoIP is preferred.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   739
        CSPSettingsVoIPUtils* sPSettings = CSPSettingsVoIPUtils::NewLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   740
        if ( sPSettings->IsPreferredTelephonyVoIP() ||
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   741
             !IsVoiceCallExistL() )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   742
        	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   743
        	title = GetVOIPDialogTitleL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   744
        	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   745
        else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   746
        	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   747
        	title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_CALL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   748
        	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   749
        CleanupStack::PopAndDestroy( sPSettings ); 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   750
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   751
    else if ( iParams.iCommMethod == VPbkFieldTypeSelectorFactory::EVoiceCallSelector )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   752
        {                               
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   753
        title =  StringLoader::LoadL( R_QTN_CCA_POPUP_VOICE_CALL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   754
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   755
    else if ( iParams.iCommMethod == VPbkFieldTypeSelectorFactory::EVOIPCallSelector )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   756
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   757
        title = GetVOIPDialogTitleL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   758
        }	
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   759
    return title;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   760
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   761
	
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   762
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   763
// CPbk2AddressSelect::LoadDialogTitleL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   764
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   765
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   766
inline HBufC* CPbk2AddressSelect::LoadDialogTitleL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   767
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   768
    HBufC* title = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   769
    switch( iParams.iCommMethod )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   770
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   771
        case VPbkFieldTypeSelectorFactory::EVoiceCallSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   772
        case VPbkFieldTypeSelectorFactory::EVOIPCallSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   773
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   774
            title = GetVoiceAndVOIPCallDialogTitleL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   775
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   776
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   777
        	
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   778
        case VPbkFieldTypeSelectorFactory::EUniEditorSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   779
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   780
            title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_MESSAGE );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   781
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   782
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   783
        case VPbkFieldTypeSelectorFactory::EEmailEditorSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   784
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   785
            title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_EMAIL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   786
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   787
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   788
        case VPbkFieldTypeSelectorFactory::EInstantMessagingSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   789
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   790
            title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_CHAT );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   791
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   792
            }    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   793
        case VPbkFieldTypeSelectorFactory::EURLSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   794
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   795
            title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_URL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   796
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   797
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   798
        case VPbkFieldTypeSelectorFactory::EVideoCallSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   799
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   800
            title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_VIDEO_CALL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   801
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   802
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   803
        case VPbkFieldTypeSelectorFactory::EFindOnMapSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   804
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   805
            if ( AreGeoFieldsForAddressesL() )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   806
            	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   807
                title = StringLoader::LoadL( R_QTN_CCA_POPUP_SHOW_ON_MAP );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   808
            	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   809
            else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   810
            	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   811
            	title = StringLoader::LoadL( R_QTN_CCA_POPUP_FIND_ON_MAP );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   812
            	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   813
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   814
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   815
        case VPbkFieldTypeSelectorFactory::EAssignFromMapSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   816
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   817
            title = StringLoader::LoadL( R_QTN_CCA_POPUP_ASSIGN_FROM_MAP );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   818
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   819
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   820
        case VPbkFieldTypeSelectorFactory::EPocSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   821
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   822
            title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_PUSH_TO_TALK );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   823
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   824
            }       
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   825
        default:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   826
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   827
            HBufC* entryTitle = iParams.iNameFormatter.GetContactTitleL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   828
                ( iParams.iContact.Fields(), KDefaultTitleFormat );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   829
            CleanupStack::PushL( entryTitle );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   830
            
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   831
            if ( iParams.iTitleResId )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   832
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   833
                if ( iParams.iIncludeContactNameInPrompt )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   834
                    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   835
                    title = StringLoader::LoadL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   836
                        ( iParams.iTitleResId, *entryTitle );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   837
                    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   838
                else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   839
                    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   840
                    title = StringLoader::LoadL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   841
                        ( iParams.iTitleResId );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   842
                    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   843
                CleanupStack::PopAndDestroy( entryTitle );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   844
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   845
            else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   846
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   847
                title = entryTitle; // takes ownership of entryTitle
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   848
                CleanupStack::Pop( entryTitle );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   849
                entryTitle = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   850
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   851
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   852
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   853
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   854
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   855
    return title;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   856
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   857
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   858
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   859
// CPbk2AddressSelect::AreGeoFieldsForAddressesL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   860
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   861
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   862
TBool CPbk2AddressSelect::AreGeoFieldsForAddressesL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   863
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   864
    TBool result = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   865
    TBool generalAddress = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   866
    TBool homeAddress = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   867
    TBool workAddress = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   868
    TInt startIndex = 0;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   869
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   870
    TPbk2StoreContactAnalyzer analyzer( iParams.iContactManager, NULL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   871
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   872
    TInt countFields = iParams.iContact.Fields().FieldCount();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   873
    for ( TInt i = 0; i < countFields; i++ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   874
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   875
        const MVPbkStoreContactField& field =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   876
            iParams.iContact.Fields().FieldAt( i );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   877
        TInt countProps =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   878
            field.BestMatchingFieldType()->VersitProperties().Count();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   879
        TArray<TVPbkFieldVersitProperty> props =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   880
            field.BestMatchingFieldType()->VersitProperties();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   881
        for ( TInt ii = 0; ii < countProps; ii++ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   882
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   883
            if ( props[ ii ].Name() == EVPbkVersitNameADR )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   884
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   885
                if ( props[ ii ].Parameters().Contains(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   886
                    	EVPbkVersitParamHOME ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   887
                    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   888
                    homeAddress = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   889
                    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   890
                else if ( props[ ii ].Parameters().Contains(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   891
                    	EVPbkVersitParamWORK ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   892
                    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   893
                    workAddress = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   894
                    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   895
                else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   896
                    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   897
                    generalAddress = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   898
                    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   899
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   900
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   901
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   902
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   903
    if ( !homeAddress )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   904
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   905
        if ( analyzer.HasFieldL( R_PHONEBOOK2_HOME_GEO_SELECTOR,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   906
        		startIndex, &iParams.iContact ) != KErrNotFound )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   907
        	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   908
        	homeAddress = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   909
        	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   910
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   911
    if ( !workAddress )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   912
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   913
        if ( analyzer.HasFieldL( R_PHONEBOOK2_WORK_GEO_SELECTOR,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   914
        		startIndex, &iParams.iContact ) != KErrNotFound )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   915
        	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   916
        	workAddress = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   917
        	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   918
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   919
    if ( !generalAddress )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   920
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   921
        if ( analyzer.HasFieldL( R_PHONEBOOK2_GENERAL_GEO_SELECTOR,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   922
        		startIndex, &iParams.iContact ) != KErrNotFound )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   923
        	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   924
        	generalAddress = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   925
        	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   926
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   927
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   928
    if ( generalAddress && homeAddress && workAddress )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   929
    	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   930
    	result = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   931
    	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   932
    else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   933
    	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   934
    	result = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   935
    	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   936
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   937
    return result;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   938
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   939
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   940
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   941
// CPbk2AddressSelect::GetVOIPDialogTitleL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   942
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   943
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   944
inline HBufC* CPbk2AddressSelect::GetVOIPDialogTitleL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   945
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   946
    //Usecase : If we have only one voip service, the voip(Internet Call)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   947
    //dialog title must be "ServiceName" appended with "call:". 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   948
    //eg : If we have a service named SKYPE installed in the Phone
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   949
    //and if SKYPE supports VOIP, dialog title should be 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   950
    //"SKYPE call:". 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   951
    //If we have more than one voip service, then the VOIP dialog title must be
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   952
    //should be R_QTN_PHOB_TITLE_POPUP_VOIP_CALL 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   953
    //as defined in the rss   
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   954
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   955
    //Check whether we have more than one voip service configured
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   956
    //in the Phone
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   957
    HBufC* title (NULL);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   958
    TPtrC tempTitle;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   959
    RIdArray idArray;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   960
    CleanupClosePushL(idArray);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   961
    CSPSettings* settings = CSPSettings::NewLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   962
    TInt numServSupportInternetCall (0); //Num of Service that support InternetCall
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   963
    TServiceId serviceId (0); //Stores the last found Service Id of VOIP Service
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   964
    TInt findResult = settings->FindServiceIdsL(idArray);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   965
    if ( findResult == KErrNone )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   966
    	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   967
	    for (TInt i = 0; i < idArray.Count(); ++i)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   968
	        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   969
	        TBool supported( EFalse );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   970
	        CSPEntry* entry = CSPEntry::NewLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   971
	        TServiceId id = idArray[i];
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   972
	        User::LeaveIfError( settings->FindEntryL(id, *entry) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   973
	        const CSPProperty* property = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   974
	        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   975
	        //Mandatory Settings for VOIP
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   976
	        if (entry->GetProperty(property, EPropertyServiceAttributeMask) == KErrNone)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   977
	            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   978
	            TInt value = 0;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   979
	            property->GetValue(value);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   980
	            if ( value & ESupportsInternetCall )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   981
	                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   982
	                serviceId = id;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   983
	                numServSupportInternetCall++;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   984
	                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   985
	            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   986
	        CleanupStack::PopAndDestroy(); // entry
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   987
	        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   988
	    CleanupStack::PopAndDestroy(2); // settings, idArray    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   989
	    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   990
	    if ( KOneVOIPServiceAvailable == numServSupportInternetCall )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   991
	        { 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   992
	        // get the XSP ServiceName 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   993
	        // CPbk2ServiceManager stores all the brandinfo
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   994
	        // related to the services configured to the phone
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   995
	        // use this to show uniform icon & name throughout PhoneBook
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   996
	        MPbk2ApplicationServices2* servicesExtension = 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   997
	            reinterpret_cast<MPbk2ApplicationServices2*>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   998
	                ( Phonebook2::Pbk2AppUi()->ApplicationServices().
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   999
	                    MPbk2ApplicationServicesExtension(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1000
	                        KMPbk2ApplicationServicesExtension2Uid ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1001
	        CPbk2ServiceManager& servMan = servicesExtension->ServiceManager();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1002
	        const CPbk2ServiceManager::RServicesArray& services = servMan.Services();    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1003
	        for ( TInt i = 0; i < services.Count(); i++ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1004
	            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1005
	            const CPbk2ServiceManager::TService& service = services[i];
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1006
	            //Found the appropriate service info
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1007
	            if ( service.iServiceId == serviceId )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1008
	                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1009
	                tempTitle.Set( service.iDisplayName );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1010
	                break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1011
	                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1012
	            }            
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1013
	        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1014
    	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1015
    if ( tempTitle.Length() )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1016
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1017
        title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_VOIP_CALL_SINGLE_SERVICE, 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1018
                tempTitle);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1019
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1020
    else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1021
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1022
        title = StringLoader::LoadL( R_QTN_PHOB_TITLE_POPUP_VOIP_CALL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1023
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1024
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1025
    return title;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1026
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1027
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1028
// End of File