phonebookui/Phonebook2/UIControls/src/CPbk2MemoryEntryDefaultsDlg.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 14 Sep 2010 20:54:53 +0300
branchRCL_3
changeset 21 9da50d567e3c
parent 20 f4a778e096c2
permissions -rw-r--r--
Revision: 201033 Kit: 201035
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     1
/*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     2
* Copyright (c) 2005-2007 Nokia Corporation and/or its subsidiary(-ies).
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     3
* All rights reserved.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     8
*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
     9
* Initial Contributors:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    11
*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    12
* Contributors:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    13
*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    14
* Description:  Phonebook 2 memory entry defaults dialog.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    15
*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    16
*/
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
// INCLUDE FILES
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
#include "CPbk2MemoryEntryDefaultsDlg.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
// Phonebook 2
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
#include "CPbk2FieldListBoxModel.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
#include "CPbk2DefaultAttributeProcess.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include "CPbk2FieldSelector.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
#include <CPbk2MemoryEntryDefaultsAssignDlg.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
#include <CPbk2IconArray.h>
21
9da50d567e3c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    28
#include <pbk2uicontrols.rsg>
20
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
#include <CPbk2PresentationContact.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
#include <CPbk2PresentationContactField.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
#include <CPbk2PresentationContactFieldCollection.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
#include <CPbk2FieldPropertyArray.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
#include <CPbk2StorePropertyArray.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
#include <Phonebook2PrivateCRKeys.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
#include <TPbk2DestructionIndicator.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
#include <phonebook2ece.mbg>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
#include <CPbk2ApplicationServices.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
#include <CPbk2ServiceManager.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
#include <MPbk2ApplicationServices.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    40
#include <ccappcommlauncherpluginrsc.rsg>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
// Virtual Phonebook
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 <CVPbkFieldFilter.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    46
#include <CVPbkFieldTypeSelector.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
#include <MVPbkContactFieldData.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
#include <MVPbkContactOperationBase.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
#include <MVPbkFieldType.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
#include <VPbkFieldType.hrh>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
#include <TVPbkStoreContactAnalyzer.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
#include <VPbkVariant.hrh>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
// System includes
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
#include <aknlists.h>   // EikControlFactory
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
#include <barsread.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
#include <StringLoader.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
#include <featmgr.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
#include <centralrepository.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
#include <gulicon.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
#include <AknIconArray.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
#include <eikclbd.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
#include <aknlists.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
#include <aknPopup.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
#include <aknlayoutscalable_avkon.cdl.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
//SpSettings
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
#include <spsettings.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
#include <spentry.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
#include <spproperty.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
// For checking mailbox accounts
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
#include <emailinterfacefactory.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
#include <memailmailbox.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
// Debugging headers
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
#include <Pbk2Debug.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
// LOCAL CONSTANTS AND MACROS
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
const TInt KGranularity = 4;
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
const TUid KCRUidCCACommLauncher = {0x20019548};
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
const TInt KCommunicationMethodOrder  = 0x00000001;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
const TInt KCCAppCommLauncherMaxOrderBufLength = 128;
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
_LIT( KPbk2ECEIconFileName, "\\resource\\apps\\phonebook2ece.mif" );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
#ifdef _DEBUG
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
enum TPanicCode
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
    EPanicPostCond_Constructor = 1,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
    EPanicPostCond_ConstructL,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
    EPanicPreCond_FixIndex,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
    EPanicPostCond_FixIndex,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
    EPanicLogic_DefaultFieldL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
    };
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
static void Panic(TPanicCode aReason)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
    _LIT(KPanicText, "CPbk2MemoryEntryDefaultsDlg");
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
    User::Panic(KPanicText, aReason);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
#endif // _DEBUG
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
// Defaults settings map
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
struct TDefaultsItem
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
    VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector selectorId;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
    TInt titleResId;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
    TInt iconId;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
    TInt iconMaskId;
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   116
/**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
 * Defines Defaults appearance.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   118
 */
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   119
const TDefaultsItem KDefaultsSettingsTable[] = {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
    { VPbkFieldTypeSelectorFactory::EVoiceCallSelector, R_QTN_PHOB_SETI_CALL_DEFAULT,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
    EMbmPhonebook2eceQgn_prop_pb_comm_call_large, EMbmPhonebook2eceQgn_prop_pb_comm_call_large_mask },
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
    { VPbkFieldTypeSelectorFactory::EEmailEditorSelector, R_QTN_PHOB_SETI_EMAIL_DEFAULT, 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
    EMbmPhonebook2eceQgn_prop_pb_comm_email_large, EMbmPhonebook2eceQgn_prop_pb_comm_email_large_mask },
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
    { VPbkFieldTypeSelectorFactory::EInstantMessagingSelector, R_QTN_PHOB_SETI_CHAT_DEFAULT,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
    EMbmPhonebook2eceQgn_prop_pb_comm_chat_large, EMbmPhonebook2eceQgn_prop_pb_comm_chat_large_mask },
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
    { VPbkFieldTypeSelectorFactory::EVOIPCallSelector, R_QTN_PHOB_SETI_VOIP_DEFAULT,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
    EMbmPhonebook2eceQgn_prop_pb_comm_voip_large, EMbmPhonebook2eceQgn_prop_pb_comm_voip_large_mask},
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
    { VPbkFieldTypeSelectorFactory::EURLSelector, R_QTN_PHOB_SETI_OPENLINK_DEFAULT, 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
    EMbmPhonebook2eceQgn_prop_pb_comm_url_large, EMbmPhonebook2eceQgn_prop_pb_comm_url_large_mask },
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
    { VPbkFieldTypeSelectorFactory::EVideoCallSelector, R_QTN_PHOB_SETI_VIDEO_DEFAULT, 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
    EMbmPhonebook2eceQgn_prop_pb_comm_vcall_large, EMbmPhonebook2eceQgn_prop_pb_comm_vcall_large_mask },
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
    { VPbkFieldTypeSelectorFactory::EPocSelector, R_QTN_PHOB_SETI_POC_DEFAULT,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
            EMbmPhonebook2eceQgn_prop_nrtyp_poc, EMbmPhonebook2eceQgn_prop_nrtyp_poc_mask },
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
    { VPbkFieldTypeSelectorFactory::EUniEditorSelector, R_QTN_PHOB_SETI_MESSAGE_DEFAULT,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
    EMbmPhonebook2eceQgn_prop_pb_comm_message_large, EMbmPhonebook2eceQgn_prop_pb_comm_message_large_mask}
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
const TInt KDefaultsSettingsTableLength = sizeof( KDefaultsSettingsTable ) / sizeof( TDefaultsItem );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
// LOCAL FUNCTIONS
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
/**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
 * Returns the default property at given selector id.
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
 * @param aSelectorID           The selector id of the used default.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
 * @param aDefaultProperties    Array of properties at given index on return.
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
void PropertiesAtIndexL( const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
        CArrayFixFlat<TVPbkDefaultType>& aDefaultProperties )
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
    switch ( aSelectorID )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   152
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   153
        case VPbkFieldTypeSelectorFactory::EVoiceCallSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
            aDefaultProperties.AppendL( EVPbkDefaultTypePhoneNumber );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
            break;
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
        case VPbkFieldTypeSelectorFactory::EVideoCallSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
            aDefaultProperties.AppendL( EVPbkDefaultTypeVideoNumber );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
        case VPbkFieldTypeSelectorFactory::EUniEditorSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
            if (FeatureManager::FeatureSupported(KFeatureIdMMS))
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
                aDefaultProperties.AppendL( EVPbkDefaultTypeMms );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   168
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   169
            else if (FeatureManager::FeatureSupported(KFeatureIdEmailOverSms))
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
                aDefaultProperties.AppendL( EVPbkDefaultTypeEmailOverSms );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
            else
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
                aDefaultProperties.AppendL( EVPbkDefaultTypeSms );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
            break;
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
        case VPbkFieldTypeSelectorFactory::EEmailEditorSelector:
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
            aDefaultProperties.AppendL( EVPbkDefaultTypeEmail );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
            break;
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
        case VPbkFieldTypeSelectorFactory::EVOIPCallSelector:
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
            aDefaultProperties.AppendL( EVPbkDefaultTypeVoIP );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   188
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   189
        case VPbkFieldTypeSelectorFactory::EPocSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   190
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   191
            aDefaultProperties.AppendL( EVPbkDefaultTypePOC );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
        case VPbkFieldTypeSelectorFactory::EInstantMessagingSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
            aDefaultProperties.AppendL( EVPbkDefaultTypeChat );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
            break;
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
        case VPbkFieldTypeSelectorFactory::EURLSelector:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   201
            aDefaultProperties.AppendL( EVPbkDefaultTypeOpenLink );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
        default:
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
            User::Leave( KErrNotFound );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   209
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   210
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
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
 * Returns field selector.
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
 * @param aFieldTypes       Fieldtype list to use in selectors
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
 * @param aDefaultIndex     The index of the default to use.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
 * @return  Field selector which is left to cleanupstack.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
 */
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
CPbk2FieldSelector* ConstructFieldSelectorLC( 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
        const MVPbkFieldTypeList& aFieldTypes,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
        const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   222
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   223
     // Create composite field selector
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
    CPbk2FieldSelector* selector = CPbk2FieldSelector::NewLC();        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   225
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   226
    // Construct a filtered store contact field collection
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   227
    CVPbkFieldTypeSelector* fieldTypeSelector = 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
        VPbkFieldTypeSelectorFactory::BuildContactActionTypeSelectorL( aSelectorID , aFieldTypes );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   230
    // takes ownership, no need to push to cleanupstack
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
    selector->AddIncludedSelector( fieldTypeSelector );
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
    return selector;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   234
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   235
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   236
/**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
 * Creates a filed filter.
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
 * @param aFieldsCollection A collection of fields.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
 * @param aSelectorID       The selector id of the current default.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
 * @param aManager          Reference to contact manager.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
 * @return  Returns a field filter.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
 */
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
CVPbkFieldFilter* CreateFilterL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
        ( MVPbkStoreContactFieldCollection& aFieldsCollection,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
          const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
          const CVPbkContactManager& aManager )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
    CPbk2FieldSelector* selector = ConstructFieldSelectorLC( 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
            aManager.FieldTypes(), 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
            aSelectorID );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   252
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
    const CVPbkFieldFilter::TConfig config
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
        ( const_cast<MVPbkStoreContactFieldCollection&>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
            ( aFieldsCollection ), selector, NULL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
    CVPbkFieldFilter* fieldFilter = CVPbkFieldFilter::NewL( config );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
    CleanupStack::PopAndDestroy( selector );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
    return fieldFilter;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   262
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   263
/**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   264
 * Returns fields applicable to be set as the selected default.
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
 * @param aContact          The contact whose fields to show.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   267
 * @param aSelectorId       The selector id of the default to use.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   268
 * @param aManager          Reference to contact manager.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   269
 * @return  Collection of fields applicable to use as default.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
 *          Leaves two objects on to cleanup stack. 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   271
 */
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   272
CPbk2PresentationContactFieldCollection* ApplicableFieldsCXL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
        ( CPbk2PresentationContact& aContact,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
          VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorId,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
          const CVPbkContactManager& aManager )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   277
    CVPbkFieldFilter* fieldFilter = 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
            CreateFilterL( aContact.Fields(),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
                           aSelectorId, aManager );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   280
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   281
    CleanupStack::PushL( fieldFilter );
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
    CPbk2PresentationContactFieldCollection* fields =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
        CPbk2PresentationContactFieldCollection::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
            ( aContact.PresentationFields().FieldProperties(),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
              *fieldFilter, aContact );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   287
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   288
    CleanupStack::PushL( fields );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
    return fields;
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
/**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   293
 * Checks whether the passed contact field candidate is of
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   294
 * correct field type and has the correct attribute assigned.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
 *
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   296
 * @param aCandidate        Contact field candidate.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   297
 * @param aSelectorId       Selector id.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
 * @param aAttribute        Contact attribute.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
 * @param aManager          Virtual Phonebook contact manager.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
 * @return  ETrue if the candidate fulfills all the requirements.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
 */
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
TBool CandidateApprovedL( MVPbkStoreContactField& aCandidate,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
        VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorId,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
        CVPbkDefaultAttribute& aAttribute,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
        CVPbkContactManager& aManager )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   306
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   307
    TBool ret = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   308
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   309
    // Verify the field is of correct type
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   310
    TVPbkStoreContactAnalyzer analyzer( aManager, NULL );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   311
    if ( analyzer.IsFieldTypeIncludedL( aCandidate, aSelectorId ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   312
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   313
        // Check if field has default attribute defaultType
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
        if ( aManager.ContactAttributeManagerL().
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   315
             HasFieldAttributeL( aAttribute, aCandidate ) )
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
            ret = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   318
            }
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   321
    return ret;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   322
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   323
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
/**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
 * Finds default field identified by given index.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   326
 *
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   327
 * @param aContact      The contact where to find the default from.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   328
 * @param aSelectorId   The selector id of the default to use.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
 * @param aManager      A reference to contact manager.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
 * @return  Store contact field which has the appropriate default assigned,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
 *          or NULL if not found.
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
MVPbkStoreContactField* FindDefaultFieldL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
        ( MVPbkStoreContact& aContact,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   335
          const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorId,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   336
          CVPbkContactManager& aManager )
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
    MVPbkStoreContactField* field = NULL;
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
    // First find all the default properties matching the default type
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   341
    CArrayFixFlat<TVPbkDefaultType>* defaultProperties =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   342
        new( ELeave ) CArrayFixFlat<TVPbkDefaultType>( KGranularity );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   343
    CleanupStack::PushL( defaultProperties );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
    PropertiesAtIndexL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
        ( aSelectorId, *defaultProperties );
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
    // Check if the contact has any of the default properties defined
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   348
    for ( TInt i = 0; i < defaultProperties->Count() && !field; ++i )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   349
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   350
        // Loop through contact's fields and find the specified field
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   351
        CVPbkDefaultAttribute* attr =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   352
            CVPbkDefaultAttribute::NewL( defaultProperties->At( i ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   353
        CleanupStack::PushL( attr );
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
        const TInt fieldCount = aContact.Fields().FieldCount();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
        for ( TInt j = 0; j < fieldCount && !field ; ++j )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
            MVPbkStoreContactField* candidate =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   359
                aContact.Fields().FieldAtLC( j );
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
            if ( CandidateApprovedL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   362
                ( *candidate, aSelectorId, *attr, aManager ) )
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
                field = candidate;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
                CleanupStack::Pop(); // candidate
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
            else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
                CleanupStack::PopAndDestroy(); // candidate
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   370
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   371
            }
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
        CleanupStack::PopAndDestroy ( attr );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   374
        }
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
    CleanupStack::PopAndDestroy( defaultProperties );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   377
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   378
    return field;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   379
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   380
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   381
/**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   382
 * Returns default field identified by aDefaultIndex from aContact
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   383
 * or NULL if the default is not set.
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
 * @param aContact          Reference to a contact.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   386
 * @param aSelectorId       The selector id of the default to use.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   387
 * @param aManager          Reference to contact manager.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   388
 * @return  The correct default field.
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
CPbk2PresentationContactField* DefaultFieldL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   391
        ( CPbk2PresentationContact& aContact,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   392
          const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorId,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   393
          CVPbkContactManager& aManager )
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
    CPbk2PresentationContactField* result = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   396
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   397
    // Find the correct default field
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   398
    MVPbkStoreContactField* defaultField = FindDefaultFieldL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   399
        ( aContact.StoreContact(), aSelectorId, aManager );
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
    if ( defaultField )
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
        // Find the corresponding presentation field
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   404
        CPbk2PresentationContactFieldCollection& presentationFields =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   405
            aContact.PresentationFields();
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
        for (TInt i = 0; i < presentationFields.FieldCount(); ++i)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   408
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   409
            CPbk2PresentationContactField& victim =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   410
                presentationFields.At( i );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   411
            if ( victim.IsSame( *defaultField ) )
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
                result = &victim;    // temporary reference is ok
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   414
                break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   415
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   416
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   417
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   418
    delete defaultField;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   419
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   420
    return result;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   421
    }
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
/**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   424
 * Returns the default UI text for default field identified by aDefaultIndex.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   425
 *
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   426
 * @param aSelectorId   Selector id of the default.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   427
 * @return  Text for the default.
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
HBufC* DefaultFieldTextLC( const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorId )
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
    for( TInt idx = 0; idx < KDefaultsSettingsTableLength; idx++ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   432
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   433
        TDefaultsItem tmpItem = KDefaultsSettingsTable[ idx ];
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   434
        if( tmpItem.selectorId == aSelectorId )
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
            return StringLoader::LoadLC( tmpItem.titleResId );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   437
            }
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
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   440
    User::Leave(KErrNotFound);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   441
    return NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   442
    } 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   443
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
 * Loads and creates an icon from given indexes.
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
 * @param aBmpId    Index of icon.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   448
 * @param aMaskId   Index of icon mask.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   449
 * @return          An icon.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   450
 */   
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   451
CGulIcon* LoadIconLC( TInt aBmpId, TInt aMaskId )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   452
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   453
    CFbsBitmap* bmp = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   454
    CFbsBitmap* mask = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   455
    CGulIcon* icon = CGulIcon::NewLC();
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
    AknIconUtils::CreateIconLC( 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   458
        bmp, mask, KPbk2ECEIconFileName, aBmpId, aMaskId );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   459
                               
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   460
    icon->SetBitmap( bmp );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   461
    icon->SetMask( mask );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   462
    CleanupStack::Pop( 2 ); // bmp, mask
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   463
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   464
    return icon;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   465
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   466
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   467
/**
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   468
 * Loads and creates an icon from given indexes.
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
 * @param aBmpId    Index of icon.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   471
 * @param aMaskId   Index of icon mask.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   472
 * @return          An icon.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   473
 */   
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   474
CGulIcon* MapSelectorId2IconLC( const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorId )
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
    for( TInt idx = 0; idx < KDefaultsSettingsTableLength; idx++ )
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
        TDefaultsItem tmpItem = KDefaultsSettingsTable[ idx ];
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   479
        if( tmpItem.selectorId == aSelectorId )
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
            return LoadIconLC( tmpItem.iconId, tmpItem.iconMaskId );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   482
            }
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
        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   485
    User::Leave( KErrNotFound );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   486
    return NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   487
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   488
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   489
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   490
// CPbk2MemoryEntryDefaultsDlg::CPbk2MemoryEntryDefaultsDlg
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   493
inline CPbk2MemoryEntryDefaultsDlg::CPbk2MemoryEntryDefaultsDlg
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   494
        ( CPbk2PresentationContact& aContact,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   495
          CVPbkContactManager& aManager ):
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   496
            iContact( aContact ), iManager( aManager ), iLVFlags( 0 ), iServiceName( NULL )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   497
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   498
    // Do nothing
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   499
    }
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
// CPbk2MemoryEntryDefaultsDlg::~CPbk2MemoryEntryDefaultsDlg
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
CPbk2MemoryEntryDefaultsDlg::~CPbk2MemoryEntryDefaultsDlg()
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
    PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   508
        ("CPbk2MemoryEntryDefaultsDlg destructor start"));
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   509
    if (iDestroyedPtr)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   510
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   511
        *iDestroyedPtr = ETrue;
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
    delete iListBox;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   514
    delete iAttributeProcess;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   515
    delete iDefaultsTable;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   516
    delete iServiceName;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   517
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   518
    FeatureManager::UnInitializeLib();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   519
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   520
    PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   521
        ("CPbk2MemoryEntryDefaultsDlg destructor end"));
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   524
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   525
// CPbk2MemoryEntryDefaultsDlg::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   526
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   527
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   528
EXPORT_C CPbk2MemoryEntryDefaultsDlg* CPbk2MemoryEntryDefaultsDlg::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   529
        ( CPbk2PresentationContact& aContact, CVPbkContactManager& aManager )
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
    CPbk2MemoryEntryDefaultsDlg* self = new(ELeave)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   532
        CPbk2MemoryEntryDefaultsDlg(aContact, aManager);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   533
    CleanupStack::PushL(self);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   534
    self->ConstructL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   535
    CleanupStack::Pop(self);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   536
    return self;
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
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
// CPbk2MemoryEntryDefaultsDlg::ConstructL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   541
// --------------------------------------------------------------------------
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
inline void CPbk2MemoryEntryDefaultsDlg::ConstructL()
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
    // Initialize feature manager
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   546
    FeatureManager::InitializeLibL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   547
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   548
    // Read local variation flags
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   549
    CRepository* key = CRepository::NewL(TUid::Uid(KCRUidPhonebook));
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   550
    TInt err = key->Get(KPhonebookLocalVariationFlags, iLVFlags);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   551
    if (err != KErrNone)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   552
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   553
        // If there were problems reading the flags, assume everything is off
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   554
        iLVFlags = 0;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   555
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   556
    delete key;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   557
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   558
    // Create a list box
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   559
    iListBox = static_cast<CEikFormattedCellListBox*>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   560
        (EikControlFactory::CreateByTypeL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   561
                (EAknCtDoubleLargeGraphicPopupMenuListBox).iControl);
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   564
	CAknPopupList::ConstructL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   565
		(iListBox, R_PBK2_SOFTKEYS_OK_BACK_OK,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   566
		AknPopupLayouts::EMenuDoubleLargeGraphicWindow);
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
    // Init list box
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   569
    iListBox->ConstructL( this, CEikListBox::ELeftDownInViewRect );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   570
    iListBox->CreateScrollBarFrameL( ETrue );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   571
    iListBox->ScrollBarFrame()->SetScrollBarVisibilityL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   572
        ( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   573
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   574
    // Set title of pop up list
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   575
    HBufC* heading = StringLoader::LoadLC
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   576
        ( R_QTN_PHOB_TITLE_DEFAULT_SETTINGS );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   577
    SetTitleL( *heading );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   578
    CleanupStack::PopAndDestroy( heading );
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
    iDefaultsTable 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   581
       = new (ELeave) CArrayFixFlat<VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector>( KGranularity );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   582
        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   583
    CreateTableOfDefaultsL();
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
    CreateLinesL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   586
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   587
    __ASSERT_DEBUG(iListBox && !iDestroyedPtr,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   588
        Panic(EPanicPostCond_ConstructL));
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   589
    }
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
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   592
// CPbk2MemoryEntryDefaultsDlg::ExecuteLD
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   593
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   594
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   595
EXPORT_C void CPbk2MemoryEntryDefaultsDlg::ExecuteLD()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   596
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   597
    CAknPopupList::ExecuteLD();
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
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
// CPbk2MemoryEntryDefaultsDlg::ProcessCommandL
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
void CPbk2MemoryEntryDefaultsDlg::ProcessCommandL( TInt aCommandId )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   605
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   606
    PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   607
        ("CPbk2MemoryEntryDefaultsDlg::ProcessCommandL start"));
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   608
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   609
    switch ( aCommandId )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   610
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   611
        case EAknSoftkeyOk:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   612
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   613
            // Equal item order in iDefaultsTable and iListBox
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   614
            TInt currentItemIndex( iListBox->CurrentItemIndex() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   615
            // iListBox and iDefaultsTable have the same lenght. But its
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   616
            // possible that further changes could break that assumption.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   617
            if( currentItemIndex < iDefaultsTable->Count() )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   618
                DefaultsAssignPopupL( iDefaultsTable->At( currentItemIndex ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   619
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   620
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   621
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   622
        default:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   623
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   624
            PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   625
                ("About to call CAknPopupList::ProcessCommandL"));
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   626
            CAknPopupList::ProcessCommandL( aCommandId );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   627
            PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   628
                ("Called CAknPopupList::ProcessCommandL"));
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   629
            break;
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
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   632
    PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   633
        ("CPbk2MemoryEntryDefaultsDlg::ProcessCommandL end"));
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   634
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   635
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   636
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   637
// CPbk2MemoryEntryDefaultsDlg::HandleListBoxEventL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   638
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   639
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   640
void CPbk2MemoryEntryDefaultsDlg::HandleListBoxEventL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   641
        ( CEikListBox* aListBox, TListBoxEvent aEventType )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   642
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   643
    // Respond to events from listbox item
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   644
    if ( aListBox == iListBox )
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
        // Handle pointer events - copied source from 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   647
        // CCCAppCommLauncherContainer::HandleListBoxEventL 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   648
        TBool executeContactAction = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   649
        if ( aEventType == EEventItemDraggingActioned )
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
            iHasBeenDragged = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   652
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   653
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   654
        else if ( aEventType == EEventItemSingleClicked )
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
            if (!iHasBeenDragged)
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
                executeContactAction = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   660
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   661
            else
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
                iHasBeenDragged = EFalse;
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
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   666
        else if ( aEventType == EEventEnterKeyPressed)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   667
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   668
            executeContactAction = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   669
            iHasBeenDragged = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   670
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   671
        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   672
        if ( executeContactAction )
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
            ProcessCommandL( EAknSoftkeyOk );     
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   675
            }
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
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   678
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   679
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   680
// CPbk2MemoryEntryDefaultsDlg::AttributeProcessCompleted
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   681
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   682
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   683
void CPbk2MemoryEntryDefaultsDlg::AttributeProcessCompleted()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   684
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   685
    delete iField;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   686
    iField = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   687
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   688
    // Redraw
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   689
    TRAP_IGNORE( CreateLinesL() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   690
    iListBox->DrawDeferred();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   691
    DrawDeferred();
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
// CPbk2MemoryEntryDefaultsDlg::AttributeProcessFailed
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   696
// --------------------------------------------------------------------------
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
void CPbk2MemoryEntryDefaultsDlg::AttributeProcessFailed( TInt aErrorCode )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   699
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   700
    delete iField;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   701
    iField = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   702
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   703
    iCoeEnv->HandleError( aErrorCode );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   704
    }
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
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   707
// CPbk2MemoryEntryDefaultsDlg::CreateLinesL
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   710
void CPbk2MemoryEntryDefaultsDlg::CreateLinesL() const
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
    CDesCArray* lines = static_cast<CDesCArray*>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   713
        (iListBox->Model()->ItemTextArray());
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   714
    lines->Reset();
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
    // int = icon id, string = first text, string = second text
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   717
    _LIT(KFormat, "%d\t%S\t%S\t" );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   718
    HBufC* noDefault = StringLoader::LoadLC( R_QTN_PHOB_SETI_NO_DEFAULT );
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
    for ( TInt idx = 0; idx < iDefaultsTable->Count(); ++idx )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   721
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   722
        HBufC* defaultFieldText = DefaultFieldTextLC( iDefaultsTable->At(idx) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   723
        const CPbk2PresentationContactField* field =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   724
            DefaultFieldL( iContact, iDefaultsTable->At(idx), iManager );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   725
        TPtrC label;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   726
        if( field )
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
            label.Set( field->FieldLabel() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   729
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   730
        else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   731
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   732
            label.Set( *noDefault );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   733
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   734
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   735
        // Allocate and format the listbox line
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   736
        HBufC* lineBuf = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   737
        // If only one Voip service avaliable, use voip service name on internet call item
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   738
        if ( iServiceName && 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   739
        		( iDefaultsTable->At( idx ) == VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   740
        	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   741
        	// Use Voip service name
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   742
            HBufC* str = StringLoader::LoadLC( R_QTN_CCA_VOIP_CALL_WITH_SERVICENAME, 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   743
                        *iServiceName,             
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   744
                        iCoeEnv );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   745
        	lineBuf = HBufC::NewLC( KFormat().Length()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   746
        	            + str->Length() + label.Length() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   747
        	TPtr line( lineBuf->Des() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   748
        	line.Format( KFormat, idx, str, &label);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   749
        	lines->AppendL( line ) ;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   750
        	CleanupStack::PopAndDestroy(2); // lineBuf, str
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   751
        	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   752
        else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   753
        	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   754
        	// Use default text
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   755
        	lineBuf = HBufC::NewLC( KFormat().Length()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   756
        	            + defaultFieldText->Length() + label.Length() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   757
        	TPtr line( lineBuf->Des() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   758
        	line.Format( KFormat, idx, defaultFieldText, &label);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   759
        	lines->AppendL( line ) ;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   760
        	CleanupStack::PopAndDestroy(); // lineBuf
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
        // Cleanup
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   764
        CleanupStack::PopAndDestroy(); // defaultFieldText        
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
   
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   767
    CleanupStack::PopAndDestroy(); // noDefault
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   768
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   769
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
// CPbk2MemoryEntryDefaultsDlg::DefaultsAssignPopupL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   772
// --------------------------------------------------------------------------
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
TBool CPbk2MemoryEntryDefaultsDlg::DefaultsAssignPopupL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   775
        ( VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID )
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
    TBool thisDestroyed = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   778
    iDestroyedPtr = &thisDestroyed;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   779
    TPbk2DestructionIndicator indicator
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   780
        ( &thisDestroyed, iDestroyedPtr );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   781
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   782
    TBool result = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   783
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   784
    // Construct a presentation contact field collection,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   785
    // containing fields that apply to the field type requirements
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   786
    // of the chosen default
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   787
    CPbk2PresentationContactFieldCollection* fields =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   788
        ApplicableFieldsCXL( iContact, aSelectorID, iManager );
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
    // Construct and launch the assign dialog
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   791
    CPbk2MemoryEntryDefaultsAssignDlg* assignDlg =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   792
        CPbk2MemoryEntryDefaultsAssignDlg::NewL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   793
   const TInt index = assignDlg->ExecuteLD(*fields, iManager,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   794
          iContact.PresentationFields().FieldProperties(), aSelectorID);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   795
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   796
    if (!thisDestroyed)
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
        // Next find the field index is referencing
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   799
        MVPbkStoreContactField* field = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   800
        const TInt fieldCount = fields->FieldCount();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   801
        // Notice that the last index of the listbox
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   802
        // is bound to 'no default' selection, hence the index
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   803
        // must be smaller than field count.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   804
        if (index > KErrNotFound && index < fieldCount)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   805
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   806
            // Set the new default
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   807
            field = &fields->At(index);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   808
            if (field)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   809
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   810
                SetDefaultL(aSelectorID, *field);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   811
                }
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   814
        else if (index == fieldCount)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   815
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   816
            // User selected the 'no default' option
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   817
            RemoveDefaultL( aSelectorID );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   818
            }
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   821
    CleanupStack::PopAndDestroy( 2 ); // ApplicableFieldsLCX
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   822
    return result;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   823
    }
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
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   826
// CPbk2MemoryEntryDefaultsDlg::IsSupported
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   827
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   828
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   829
TBool CPbk2MemoryEntryDefaultsDlg::IsSupported
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   830
        ( const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID ) const
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   831
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   832
    TBool ret(ETrue);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   833
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   834
    // Skip the line if Email field not supported or having no mailbox
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   835
    if ( aSelectorID == VPbkFieldTypeSelectorFactory::EEmailEditorSelector )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   836
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   837
        if ( !FeatureManager::FeatureSupported( KFeatureIdEmailUi ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   838
        	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   839
        	ret = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   840
        	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   841
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   842
    // Do not add video fields if they are not enabled
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   843
    else if ( ( aSelectorID == VPbkFieldTypeSelectorFactory::EVideoCallSelector ) &&
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   844
              !( iLVFlags & EVPbkLVAddVideoTelephonyFields ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   845
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   846
        ret = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   847
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   848
    // Do not add Voip fields if they are not enabled
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   849
    else if ( aSelectorID == VPbkFieldTypeSelectorFactory::EVOIPCallSelector &&
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   850
              !FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   851
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   852
        ret = EFalse;
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
    // Do not add POC fields if they are not enabled
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   855
    else if ( ( aSelectorID == VPbkFieldTypeSelectorFactory::EPocSelector ) &&
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   856
              !( iLVFlags & EVPbkLVPOC ) )
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
        ret = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   859
        }
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
    return ret;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   862
    }
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
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   865
// CPbk2MemoryEntryDefaultsDlg::HasMailboxAccountsL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   866
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   867
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   868
TBool CPbk2MemoryEntryDefaultsDlg::HasMailboxAccountsL() const
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
	using namespace EmailInterface;
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
	TBool result = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   873
	CEmailInterfaceFactory* factory = CEmailInterfaceFactory::NewL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   874
	CleanupStack::PushL( factory );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   875
	MEmailInterface* ifPtr = factory->InterfaceL( KEmailClientApiInterface );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   876
	MEmailClientApi* clientApi = static_cast<MEmailClientApi*>( ifPtr );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   877
	CleanupReleasePushL( *clientApi );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   878
	
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   879
	// Get mailboxs
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   880
	RMailboxPtrArray mailboxes;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   881
	clientApi->GetMailboxesL( mailboxes );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   882
	TInt count = mailboxes.Count();	
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   883
	if ( count > 0 )
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
		result = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   886
		}
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
	// Release mailboxs before releasing clientapi
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   889
	for ( TInt i=0; i<count; i++ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   890
		{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   891
		MEmailMailbox* mailbox = mailboxes[i];
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   892
		mailbox->Release();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   893
		}	
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   894
	mailboxes.Close();	
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   895
	CleanupStack::PopAndDestroy( 2 ); // clientApi and factory
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
	return result;
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
// CPbk2MemoryEntryDefaultsDlg::IsAvailable
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
TBool CPbk2MemoryEntryDefaultsDlg::IsAvailableL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   904
        ( const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID ) const
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   905
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   906
    CVPbkFieldFilter* filter = CreateFilterL(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   907
              iContact.Fields(), aSelectorID, iManager );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   908
  
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   909
    TInt nbrOfEntries = filter->FieldCount();
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
    delete filter;
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
    return ( 0 < nbrOfEntries );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   914
    }
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
void CPbk2MemoryEntryDefaultsDlg::CreateTableOfDefaultsL()
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
    TRAPD( err, ReadDefaultsFromRepositoryL() )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   919
    if( err != KErrNone )
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
        //add defaults without order
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   922
        iDefaultsTable->Reset();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   923
        iDefaultsTable->AppendL( VPbkFieldTypeSelectorFactory::EVoiceCallSelector );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   924
        iDefaultsTable->AppendL( VPbkFieldTypeSelectorFactory::EVOIPCallSelector );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   925
        iDefaultsTable->AppendL( VPbkFieldTypeSelectorFactory::EUniEditorSelector );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   926
        iDefaultsTable->AppendL( VPbkFieldTypeSelectorFactory::EEmailEditorSelector );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   927
        iDefaultsTable->AppendL( VPbkFieldTypeSelectorFactory::EInstantMessagingSelector );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   928
        iDefaultsTable->AppendL( VPbkFieldTypeSelectorFactory::EURLSelector );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   929
        iDefaultsTable->AppendL( VPbkFieldTypeSelectorFactory::EVideoCallSelector );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   930
        }
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
    TInt idx;
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
    // Filter services
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   935
    // Only show supported and contact-related items
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   936
    for( idx = 0; idx < iDefaultsTable->Count(); idx++ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   937
        {        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   938
        if( !IsSupported( iDefaultsTable->At( idx ) ) ||
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   939
            !IsAvailableL( iDefaultsTable->At( idx ) ) 
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
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   942
            // remove item at current position from array
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   943
            iDefaultsTable->Delete( idx, 1 );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   944
            idx--;
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
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   947
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   948
    // Load icon of each RELEVANT communication 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   949
    // methode and add it to the listbox.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   950
    CAknIconArray* iconArray = new (ELeave) CAknIconArray( KGranularity );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   951
    CleanupStack::PushL( iconArray );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   952
    for( idx = 0; idx < iDefaultsTable->Count(); idx++ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   953
        { 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   954
        CGulIcon* icon = MapSelectorId2IconLC( iDefaultsTable->At( idx ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   955
        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   956
        // Important: iconArray positions matchs
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   957
        // with iDefaultsTable positions
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   958
        iconArray->AppendL( icon );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   959
        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   960
        // If only one Voip service avaliable, use brand icon on internet call item
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   961
        TServiceId serviceId;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   962
        if ( ( iDefaultsTable->At( idx ) == VPbkFieldTypeSelectorFactory::EVOIPCallSelector ) &&
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   963
        		( SupportedVOIPServicesL( serviceId ) == 1 ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   964
        	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   965
            CFbsBitmap* bitmap (NULL);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   966
            CFbsBitmap* mask (NULL);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   967
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   968
            // Load Voip brand bitmap and mask              
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   969
            LoadVoipServiceInfoL( serviceId, bitmap, mask );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   970
            
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   971
            if ( bitmap || mask )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   972
                {          
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   973
                iconArray->At(idx)->SetBitmap(bitmap);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   974
                iconArray->At(idx)->SetMask(mask);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   975
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   976
        	}
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
        CleanupStack::Pop(1); // icon
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   979
        }  
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   980
    // iListBox takes ownership of iconArray
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   981
    iListBox->ItemDrawer()->ColumnData()->SetIconArray( iconArray );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   982
    CleanupStack::Pop(1); // iconArray
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   983
    }
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
// CPbk2MemoryEntryDefaultsDlg::ReadDefaultsFromRepositoryL
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   989
void CPbk2MemoryEntryDefaultsDlg::ReadDefaultsFromRepositoryL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   990
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   991
    //*** read item order out of repository ***
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   992
    CRepository* repository = CRepository::NewLC( KCRUidCCACommLauncher );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   993
    TBuf<KCCAppCommLauncherMaxOrderBufLength> orderBuf;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   994
    TInt error = repository->Get( KCommunicationMethodOrder, orderBuf );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   995
    CleanupStack::PopAndDestroy( repository );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   996
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   997
    TLex orderLex( orderBuf );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   998
    TPtrC numToken;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   999
    TLex numLex;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1000
    TInt commMethodType;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1001
    const TInt bufLength = orderBuf.Length() - 1;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1002
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1003
    while ( orderLex.Offset() < bufLength )
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
        numToken.Set( orderLex.NextToken() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1006
        numLex.Assign( numToken );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1007
        // if defined value is string instead of a number,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1008
        // use the default array
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1009
        User::LeaveIfError( numLex.Val( commMethodType ));
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1010
        // if defined value is outside of the possible comm method
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1011
        // values, use the default array
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1012
        TBool validMethod(EFalse);    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1013
        for( TInt idx = 0; idx < KDefaultsSettingsTableLength; idx++ )
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( KDefaultsSettingsTable[ idx ].selectorId == commMethodType )
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
                validMethod = ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1018
                break;
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
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1021
        User::LeaveIfError( !validMethod ? KErrArgument : 0 );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1022
        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1023
        // If commMethodType invalid, function leaves with KErrNotFound
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1024
        VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector selectorID =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1025
        VPbkFieldTypeSelectorFactory::CreateActionTypeSelectorIdL( commMethodType );
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
        iDefaultsTable->AppendL( selectorID );  
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1028
        }    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1029
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1030
    // if no comm methods defined, use the default array
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1031
    User::LeaveIfError( iDefaultsTable->Count() ? 0 : KErrNotFound );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1032
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1033
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1034
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1035
// CPbk2MemoryEntryDefaultsDlg::SetDefaultL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1036
// Sets aField as the default (identified by aDefaultIndex) field
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1037
// for the contact.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1038
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1039
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1040
void CPbk2MemoryEntryDefaultsDlg::SetDefaultL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1041
        ( const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1042
          MVPbkStoreContactField& aField )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1043
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1044
    delete iField;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1045
    iField = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1046
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1047
    // Find actual store contact field from presentation
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1048
    // contact's store contact
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1049
    for (TInt i = 0; i < iContact.StoreContact().Fields().FieldCount(); ++i)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1050
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1051
        MVPbkStoreContactField* actualField =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1052
            iContact.StoreContact().Fields().FieldAtLC( i );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1053
        if ( aField.IsSame( *actualField ) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1054
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1055
            iField = actualField;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1056
            CleanupStack::Pop(); // actualField
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1057
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1058
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1059
        else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1060
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1061
            CleanupStack::PopAndDestroy(); // actualField
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1062
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1063
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1064
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1065
    if ( iField )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1066
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1067
        // Init attribute set/remove process object
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1068
        delete iAttributeProcess;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1069
        iAttributeProcess = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1070
        iAttributeProcess = CPbk2DefaultAttributeProcess::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1071
            ( iManager, iContact.StoreContact(), *this );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1072
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1073
        CArrayFixFlat<TVPbkDefaultType>* defaultProperties =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1074
            new( ELeave ) CArrayFixFlat<TVPbkDefaultType>( KGranularity );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1075
        CleanupStack::PushL( defaultProperties );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1076
        PropertiesAtIndexL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1077
            ( aSelectorID, *defaultProperties );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1078
        CleanupStack::Pop( defaultProperties );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1079
        iAttributeProcess->SetDefaultsL( defaultProperties, *iField );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1080
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1081
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1082
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1083
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1084
// CPbk2MemoryEntryDefaultsDlg::RemoveDefaultL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1085
// Removes default (identified by aDefaultIndex) from aContact.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1086
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1087
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1088
void CPbk2MemoryEntryDefaultsDlg::RemoveDefaultL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1089
        ( const VPbkFieldTypeSelectorFactory::TVPbkContactActionTypeSelector aSelectorID )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1090
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1091
    delete iAttributeProcess;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1092
    iAttributeProcess = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1093
    iAttributeProcess = CPbk2DefaultAttributeProcess::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1094
        ( iManager, iContact.StoreContact(), *this );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1095
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1096
    CArrayFixFlat<TVPbkDefaultType>* defaultProperties =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1097
        new( ELeave ) CArrayFixFlat<TVPbkDefaultType>( KGranularity );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1098
    CleanupStack::PushL( defaultProperties );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1099
    PropertiesAtIndexL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1100
        ( aSelectorID, *defaultProperties );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1101
    CleanupStack::Pop( defaultProperties );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1102
    iAttributeProcess->RemoveDefaultsL( defaultProperties );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1103
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1104
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1105
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1106
// CPbk2MemoryEntryDefaultsDlg::SupportedVOIPServicesL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1107
// Get supported Voip services
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1108
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1109
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1110
TInt CPbk2MemoryEntryDefaultsDlg::SupportedVOIPServicesL( TServiceId& aServiceId )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1111
    {   
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1112
    TInt availableVoipService = 0;    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1113
    RIdArray idArray;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1114
    CleanupClosePushL(idArray);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1115
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1116
    CSPSettings* settings = CSPSettings::NewL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1117
    CleanupStack::PushL( settings );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1118
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1119
    User::LeaveIfError( settings->FindServiceIdsL(idArray) ); 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1120
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1121
    const TInt count = idArray.Count();   
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1122
    for (TInt i = 0; i < count; ++i)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1123
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1124
        TBool supported( EFalse );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1125
        CSPEntry* entry = CSPEntry::NewLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1126
        TServiceId id = idArray[i];
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1127
        User::LeaveIfError( settings->FindEntryL(id, *entry) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1128
        const CSPProperty* property = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1129
        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1130
        if (entry->GetProperty(property, EPropertyServiceAttributeMask) == KErrNone)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1131
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1132
            TInt value = 0;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1133
            property->GetValue(value);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1134
            supported = value & ESupportsInternetCall; 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1135
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1136
        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1137
        if ( supported )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1138
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1139
            availableVoipService++;            
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1140
            aServiceId = id;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1141
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1142
        CleanupStack::PopAndDestroy(); // entry
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1143
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1144
    CleanupStack::PopAndDestroy(2); // settings, idArray    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1145
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1146
    return availableVoipService;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1147
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1148
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1149
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1150
// CPbk2MemoryEntryDefaultsDlg::LoadVoipServiceInfoL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1151
// Load Voip service info
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1152
// ---------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1153
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1154
void CPbk2MemoryEntryDefaultsDlg::LoadVoipServiceInfoL( 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1155
            TServiceId aServiceId,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1156
            CFbsBitmap*& aBitmap, CFbsBitmap*& aMask )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1157
    {   
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1158
    CPbk2ApplicationServices* appServices =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1159
        CPbk2ApplicationServices::InstanceLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1160
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1161
    CPbk2ServiceManager& servMan = appServices->ServiceManager();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1162
    const CPbk2ServiceManager::RServicesArray& services = servMan.Services();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1163
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1164
    const TInt count = services.Count();   
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1165
    for ( TInt i = 0; i < count; i++ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1166
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1167
        const CPbk2ServiceManager::TService& service = services[i];
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1168
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1169
        if ( service.iServiceId == aServiceId )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1170
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1171
            // Calculate preferred size for xsp service icon 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1172
            TRect mainPane;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1173
            AknLayoutUtils::LayoutMetricsRect(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1174
                AknLayoutUtils::EMainPane, mainPane );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1175
            TAknLayoutRect listLayoutRect;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1176
            listLayoutRect.LayoutRect(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1177
                mainPane,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1178
                AknLayoutScalable_Avkon::list_double_large_graphic_pane_g1(0).LayoutLine() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1179
            TSize size(listLayoutRect.Rect().Size());
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1180
            
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1181
            AknIconUtils::SetSize(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1182
                    service.iBitmap,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1183
                    size );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1184
            AknIconUtils::SetSize(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1185
                    service.iMask,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1186
                    size );                               
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1187
    		
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1188
            aBitmap = new (ELeave) CFbsBitmap;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1189
            CleanupStack::PushL( aBitmap );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1190
            aBitmap->Duplicate( service.iBitmap->Handle() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1191
            
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1192
            aMask = new (ELeave) CFbsBitmap;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1193
            CleanupStack::PushL( aMask );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1194
            aMask->Duplicate( service.iMask->Handle() );                    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1195
                     
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1196
            iServiceName = service.iDisplayName.AllocL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1197
            CleanupStack::Pop( 2 ); // aMask, aBitmap
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1198
            
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1199
            break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1200
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1201
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1202
    CleanupStack::PopAndDestroy(); // appServices
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1203
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1204
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
  1205
//  End of File