phonebookui/Phonebook2/USIMThinExtension/src/CPsu2CopySimContactsCmd.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) 2002-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 copy "new SIM" contacts to phone memory.
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
* NOTE: CPsu2CopySimContactsCmd contains a lot of similar code to this class.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    17
* Reason is that there is no clear place to share common SIM related code between 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    18
* USIMThinExtension.dll and USIMExtension.dll. This is a potential place for
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    19
* future refactoring. 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    20
*
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    21
*/
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    22
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    23
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    24
// INCLUDE FILES
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    25
#include "CPsu2CopySimContactsCmd.h"
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    26
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    27
// Phonebook 2
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    28
#include <MPbk2CommandObserver.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    29
#include <MPbk2StartupMonitor.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    30
#include <CPbk2StoreConfiguration.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    31
#include <CPbk2StorePropertyArray.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    32
#include <CPbk2StoreProperty.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    33
#include <CPbk2StoreViewDefinition.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    34
#include <CPbk2SortOrderManager.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    35
#include <Pbk2ProcessDecoratorFactory.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    36
#include <TPbk2CopyContactsResults.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    37
#include <Phonebook2PublicPSKeys.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    38
#include <Phonebook2PrivatePSKeys.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    39
#include <Pbk2UID.h>
21
9da50d567e3c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    40
#include <pbk2usimthinuires.rsg>
20
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    41
/// Use R_PBK2_GENERAL_CONFIRMATION_QUERY from UI controls
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    42
/// As a core components UiControl's resource file is loaded in core Pbk2
21
9da50d567e3c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    43
#include <pbk2uicontrols.rsg>
20
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    44
/// Use R_GENERAL_COPY_PROGRESS_NOTE from Commands
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    45
/// As a core components Command's resource file is loaded in core Pbk2
21
9da50d567e3c Revision: 201033
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 20
diff changeset
    46
#include <pbk2commands.rsg>
20
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    47
#include <Pbk2DataCaging.hrh>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    48
#include <MPbk2AppUi.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    49
#include <MPbk2ApplicationServices.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    50
#include <MPbk2StoreValidityInformer.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    51
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    52
// Virtual Phonebook
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    53
#include <MVPbkContactStoreProperties.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    54
#include <CVPbkContactManager.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    55
#include <MVPbkContactStore.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    56
#include <MVPbkStoreContact.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    57
#include <MVPbkFieldType.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    58
#include <VPbkContactStoreUris.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    59
#include <CVPbkContactStoreUriArray.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    60
#include <VPbkSimStoreFactory.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    61
#include <MVPbkSimStateInformation.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    62
#include <MVPbkContactStoreList.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    63
#include <MVPbkContactStoreInfo.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    64
#include <MVPbkContactView.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    65
#include <CVPbkContactLinkArray.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    66
#include <MVPbkContactOperationBase.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    67
#include <CVPbkContactCopier.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    68
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    69
// System includes
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    70
#include <AknQueryDialog.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    71
#include <e32property.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    72
#include <StringLoader.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    73
#include <e32cmn.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    74
#include <e32capability.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    75
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    76
// Debugging headers
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    77
#include <Pbk2Debug.h>
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    78
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    79
/// Unnamed namespace for local definitions
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    80
namespace {
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
// CONSTANTS
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    83
const TInt KSimNotChecked = 0;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    84
const TInt KSimChecked = 1;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    85
_LIT( KPsu2ThinUiExtResourceFile, "Pbk2USimThinUIRes.rsc" );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    86
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    87
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    88
#ifdef _DEBUG
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    89
enum TPanicCode
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    90
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    91
    EPreCond_ValidStoreConfigurationL,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    92
    EStorePropertyNotFound_CreateSimViewsL,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    93
    ENullTarget_CopyContactsL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    94
    };
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    95
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    96
void Panic(TInt aReason)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    97
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    98
    _LIT(KPanicText, "CPsu2CopySimContactsCmd");
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
    99
    User::Panic(KPanicText, aReason);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   100
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   101
#endif // _DEBUG
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   102
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   103
/// Tasks
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   104
enum TNextTask
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   105
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   106
    ECheckCopyPrerequisites,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   107
    EOpenSimStores,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   108
    ECheckSimStorePrerequisites,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   109
    ELaunchNewSIMInsertedQuery,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   110
    ECreateSimViews,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   111
    ECopyContacts,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   112
    EShowResults,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   113
    EComplete
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
} /// namespace
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   117
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
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   120
// CPsu2CopySimContactsCmd::CPsu2CopySimContactsCmd
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   121
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   122
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   123
CPsu2CopySimContactsCmd::CPsu2CopySimContactsCmd
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   124
        ( MPbk2StartupMonitor& aStartupMonitor ) :
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   125
            CActive( EPriorityStandard ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   126
            iStartupMonitor( aStartupMonitor ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   127
            iResourceFile( *CCoeEnv::Static() )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   128
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   129
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   130
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   131
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   132
// CPsu2CopySimContactsCmd::~CPsu2CopySimContactsCmd
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   133
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   134
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   135
CPsu2CopySimContactsCmd::~CPsu2CopySimContactsCmd()
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
    Cancel();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   138
    delete iDecorator;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   139
    delete iCopyOperation;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   140
    delete iCopier;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   141
    delete iCopiedContacts;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   142
    delete iValidSourceStoreUris;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   143
    iSourceViews.ResetAndDestroy();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   144
    CloseStores();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   145
    delete iSourceContactLinks;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   146
    iSourceStores.Close();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   147
    iResourceFile.Close();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   148
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   149
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   150
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   151
// CPsu2CopySimContactsCmd::NewL
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   154
CPsu2CopySimContactsCmd* CPsu2CopySimContactsCmd::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   155
        ( MPbk2StartupMonitor& aStartupMonitor )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   156
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   157
    CPsu2CopySimContactsCmd* self =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   158
        new( ELeave ) CPsu2CopySimContactsCmd( aStartupMonitor );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   159
    CleanupStack::PushL( self );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   160
    self->ConstructL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   161
    CleanupStack::Pop( self );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   162
    return self;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   163
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   164
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   165
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   166
// CPsu2CopySimContactsCmd::ConstructL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   167
// Symbian 2nd phase constructor can leave.
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   170
void CPsu2CopySimContactsCmd::ConstructL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   171
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   172
    CActiveScheduler::Add(this);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   173
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   174
    iDecorator = Pbk2ProcessDecoratorFactory::CreateProgressDialogDecoratorL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   175
        ( R_GENERAL_COPY_PROGRESS_NOTE, EFalse );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   176
    iDecorator->SetObserver( *this );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   177
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   178
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   179
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   180
// CPsu2CopySimContactsCmd::RunL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   181
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   182
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   183
void CPsu2CopySimContactsCmd::RunL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   184
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   185
    PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   186
        ("CPsu2CopySimContactsCmd::RunL res %d task %d"),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   187
        iStatus.Int(), iNextTask);
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
    if ( iStatus.Int() == KErrNone )
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
        switch ( iNextTask )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   192
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   193
            case ECheckCopyPrerequisites:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   194
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   195
                CheckCopyPrerequisitesL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   196
                break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   197
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   198
            case EOpenSimStores:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   199
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   200
                OpenSimStoresL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   201
                break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   202
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   203
            case ECheckSimStorePrerequisites:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   204
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   205
                CheckSimStorePrerequisitesL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   206
                break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   207
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   208
            case ELaunchNewSIMInsertedQuery:
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
                LaunchNewSIMInsertedQueryL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   211
                break;
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
            case ECreateSimViews:
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
                CreateSimViewsL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   216
                break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   217
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   218
            case ECopyContacts:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   219
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   220
                CopyContactsL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   221
                break;
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
            case EShowResults:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   224
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   225
                ShowResultsL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   226
                break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   227
                }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   228
            case EComplete: // FALLTHROUGH
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   229
            default:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   230
                {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   231
                CompleteL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   232
                break;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   233
                }
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
    else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   237
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   238
        CompleteWithError( iStatus.Int() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   239
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   240
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   241
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   242
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   243
// CPsu2CopySimContactsCmd::DoCancel
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   244
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   245
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   246
void CPsu2CopySimContactsCmd::DoCancel()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   247
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   248
    // Nothing to do here
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   249
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   250
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   251
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   252
// CPsu2CopySimContactsCmd::RunError
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   253
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   254
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   255
TInt CPsu2CopySimContactsCmd::RunError( TInt aError )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   256
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   257
    iStartupMonitor.HandleStartupFailed( aError );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   258
    iCommandObserver->CommandFinished(*this);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   259
    return KErrNone;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   260
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   261
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
// CPsu2CopySimContactsCmd::ExecuteLD
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   264
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   265
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   266
void CPsu2CopySimContactsCmd::ExecuteLD()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   267
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   268
    iNextTask = ECheckCopyPrerequisites;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   269
    IssueRequest();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   270
    }
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
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   273
// CPsu2CopySimContactsCmd::AddObserver
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   274
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   275
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   276
void CPsu2CopySimContactsCmd::AddObserver( MPbk2CommandObserver& aObserver )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   277
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   278
    iCommandObserver = &aObserver;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   279
    }
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
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   282
// CPsu2CopySimContactsCmd::ResetUiControl
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   283
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   284
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   285
void CPsu2CopySimContactsCmd::ResetUiControl
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   286
        ( MPbk2ContactUiControl& /*aUiControl*/ )
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
    // Do nothing
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   289
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   290
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   291
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   292
// CPsu2CopySimContactsCmd::StoreReady
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   293
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   294
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   295
void CPsu2CopySimContactsCmd::StoreReady
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   296
        ( MVPbkContactStore& /*aContactStore*/)
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   297
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   298
    ++iCounter;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   299
    if ( iSourceStores.Count() == iCounter )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   300
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   301
        iNextTask = ECheckSimStorePrerequisites;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   302
        IssueRequest();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   303
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   304
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   305
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
// CPsu2CopySimContactsCmd::StoreUnavailable
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   310
void CPsu2CopySimContactsCmd::StoreUnavailable
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   311
        ( MVPbkContactStore& aContactStore,  TInt /*aReason*/ )
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
    // Remove URI
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   314
    iValidSourceStoreUris->Remove( aContactStore.StoreProperties().Uri() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   315
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   316
    // Remove store
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   317
    const TInt count = iSourceStores.Count();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   318
    TBool storeRemoved = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   319
    for ( TInt i = 0; i < count && !storeRemoved; ++i )
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
        if ( iSourceStores[i] == &aContactStore )
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
            iSourceStores[i]->Close( *this ); 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   324
            iSourceStores.Remove( i );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   325
            storeRemoved = ETrue;
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
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   328
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   329
    // If all source stores failed to open -> complete command
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   330
    if ( iSourceStores.Count() == 0 )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   331
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   332
        iNextTask = EComplete;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   333
        IssueRequest();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   334
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   335
    // All available stores are open
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   336
    else if ( iSourceStores.Count() == iCounter )
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
        iNextTask = ECheckSimStorePrerequisites;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   339
        IssueRequest();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   340
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   341
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   342
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   343
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   344
// CPsu2CopySimContactsCmd::HandleStoreEventL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   345
// --------------------------------------------------------------------------
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
void CPsu2CopySimContactsCmd::HandleStoreEventL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   348
        ( MVPbkContactStore& /*aContactStore*/,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   349
          TVPbkContactStoreEvent /*aStoreEvent*/ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   350
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   351
    // Nothing to be done here
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   352
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   353
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
// CPsu2CopySimContactsCmd::ContactViewReady
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   356
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   357
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   358
void CPsu2CopySimContactsCmd::ContactViewReady
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   359
        ( MVPbkContactViewBase& /*aView*/)
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
    ++iCounter;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   362
    if ( iSourceViews.Count() == iCounter )
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
        iNextTask = ECopyContacts;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   365
        IssueRequest();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   366
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   367
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   368
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   369
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   370
// CPsu2CopySimContactsCmd::ContactViewUnavailable
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
void CPsu2CopySimContactsCmd::ContactViewUnavailable
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   374
        ( MVPbkContactViewBase& /*aView*/ )
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
    // Nothing to be done here, wait view ready events
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
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
// CPsu2CopySimContactsCmd::ContactAddedToView
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   383
void CPsu2CopySimContactsCmd::ContactAddedToView
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   384
        ( MVPbkContactViewBase& /*aView*/, TInt /*aIndex*/,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   385
          const MVPbkContactLink& /*aContactLink*/ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   386
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   387
    // Nothing to be done here
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   388
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   389
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   390
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   391
// CPsu2CopySimContactsCmd::ContactRemovedFromView
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   392
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   393
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   394
void CPsu2CopySimContactsCmd::ContactRemovedFromView
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   395
        ( MVPbkContactViewBase& /*aView*/, TInt /*aIndex*/,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   396
          const MVPbkContactLink& /*aContactLink*/ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   397
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   398
    // Nothing to be done here
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   399
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   400
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   401
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   402
// CPsu2CopySimContactsCmd::ContactViewError
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   403
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   404
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   405
void CPsu2CopySimContactsCmd::ContactViewError
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   406
        ( MVPbkContactViewBase& /*aView*/, TInt aError,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   407
          TBool /*aErrorNotified*/ )
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
    IssueRequest( aError );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   410
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   411
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   412
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   413
// CPsu2CopySimContactsCmd::StepComplete
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   414
// --------------------------------------------------------------------------
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
void CPsu2CopySimContactsCmd::StepComplete
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   417
        ( MVPbkContactOperationBase& /*aOperation*/, TInt aStepSize )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   418
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   419
    iCopiedSuccessfully += aStepSize;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   420
    iDecorator->ProcessAdvance( aStepSize );
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
// CPsu2CopySimContactsCmd::StepFailed
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   427
TBool CPsu2CopySimContactsCmd::StepFailed
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   428
        ( MVPbkContactOperationBase& /*aOperation*/, TInt /*aStepSize*/,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   429
          TInt aError )
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
    CCoeEnv::Static()->HandleError(aError);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   432
    if( aError == KErrDiskFull )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   433
    	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   434
    	// When disk get full during copy, show the results
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   435
        Cancel();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   436
        delete iCopyOperation;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   437
        iCopyOperation = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   438
        iNextTask = EShowResults;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   439
        IssueRequest();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   440
    	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   441
    else
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
        IssueRequest( aError );
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
    return EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   446
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   447
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   448
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   449
// CPsu2CopySimContactsCmd::OperationComplete
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   452
void CPsu2CopySimContactsCmd::OperationComplete
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   453
        ( MVPbkContactOperationBase& /*aOperation*/ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   454
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   455
    // Decorator calls ProcessDismissed
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   456
    iDecorator->ProcessStopped();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   457
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   458
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   459
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   460
// CPsu2CopySimContactsCmd::ProcessDismissed
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   461
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   462
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   463
void CPsu2CopySimContactsCmd::ProcessDismissed( TInt /*aCancelCode*/ )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   464
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   465
    Cancel();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   466
    delete iCopyOperation;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   467
    iCopyOperation = NULL;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   468
    iNextTask = EShowResults;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   469
    IssueRequest();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   470
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   471
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   472
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   473
// CPsu2CopySimContactsCmd::IssueRequest
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   474
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   475
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   476
void CPsu2CopySimContactsCmd::IssueRequest()
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
    IssueRequest( KErrNone );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   479
    }
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
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   482
// CPsu2CopySimContactsCmd::IssueRequest
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
void CPsu2CopySimContactsCmd::IssueRequest( TInt aResult )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   486
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   487
    TRequestStatus* status = &iStatus;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   488
    User::RequestComplete( status, aResult );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   489
    SetActive();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   490
    }
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
// CPsu2CopySimContactsCmd::CheckCopyPrerequisitesL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   494
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   495
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   496
void CPsu2CopySimContactsCmd::CheckCopyPrerequisitesL()
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
    if ( ValidStoreConfigurationL() && 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   499
         NewSimCardForPhonebook2AppL() )
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
        iNextTask = EOpenSimStores;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   502
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   503
    else
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
        iNextTask = EComplete;
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
    IssueRequest();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   508
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   509
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   510
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   511
// CPsu2CopySimContactsCmd::OpenSimStoresL
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   514
void CPsu2CopySimContactsCmd::OpenSimStoresL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   515
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   516
    // Load and open source stores to contact manager
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   517
    const TInt count = iValidSourceStoreUris->Count();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   518
    for ( TInt i = 0; i < count; ++i )
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
        Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager().
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   521
            LoadContactStoreL( (*iValidSourceStoreUris)[i] );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   522
        MVPbkContactStore* source =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   523
            Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager().
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   524
                ContactStoresL().Find( (*iValidSourceStoreUris)[i] );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   525
        iSourceStores.AppendL( source );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   526
        source->OpenL( *this );
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
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   529
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
// CPsu2CopySimContactsCmd::CheckSimStorePrerequisitesL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   532
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   533
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   534
void CPsu2CopySimContactsCmd::CheckSimStorePrerequisitesL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   535
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   536
    // If there are no contacts to copy then do nothing
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   537
    TInt sourceContactCount = 0;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   538
    const TInt count = iSourceStores.Count();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   539
    for ( TInt i = 0; i < count; ++i )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   540
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   541
        sourceContactCount +=
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   542
            iSourceStores[i]->StoreInfo().NumberOfContactsL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   543
        }
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
    iNextTask = EComplete;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   546
    if ( sourceContactCount > 0 )
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
        iNextTask = ELaunchNewSIMInsertedQuery;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   549
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   550
    else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   551
    	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   552
    	SetNewSimCardKeyL();    	
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   553
    	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   554
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   555
    IssueRequest();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   556
    }
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
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   559
// CPsu2CopySimContactsCmd::LaunchNewSIMInsertedQueryL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   560
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   561
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   562
void CPsu2CopySimContactsCmd::LaunchNewSIMInsertedQueryL()
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
    // Open resource as late as possible so that it's not opened in start-up
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   565
    // if not needed
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   566
    iResourceFile.OpenL( KPbk2RomFileDrive,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   567
        KDC_RESOURCE_FILES_DIR, KPsu2ThinUiExtResourceFile );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   568
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   569
    HBufC* text = StringLoader::LoadLC( R_QTN_SIMP_NOTE_NEW_SIM_COPY );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   570
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   571
    CAknQueryDialog* dlg = CAknQueryDialog::NewL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   572
    TInt ret = dlg->ExecuteLD( R_PBK2_GENERAL_CONFIRMATION_QUERY, *text );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   573
    if ( iAvkonAppUi->IsForeground() )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   574
    	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   575
    	// Despite of user answer set P&S key
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   576
        SetNewSimCardKeyL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   577
        SetShowSIMContactsL( ret );        
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   578
        iNextTask = ret ? ECreateSimViews : EComplete;        
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
    else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   581
    	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   582
	    iNextTask = EComplete;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   583
    	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   584
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   585
    CleanupStack::PopAndDestroy( text );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   586
    IssueRequest();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   587
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   588
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   589
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
// CPsu2CopySimContactsCmd::SetShowSIMContactsL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   592
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   593
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   594
void CPsu2CopySimContactsCmd::SetShowSIMContactsL( TBool aShow )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   595
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   596
    const TDesC& adnUri = VPbkContactStoreUris::SimGlobalAdnUri();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   597
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   598
    CVPbkContactStoreUriArray* uriArray = 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   599
        Phonebook2::Pbk2AppUi()->ApplicationServices().StoreConfiguration().
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   600
            CurrentConfigurationL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   601
    CleanupStack::PushL( uriArray );
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
    if ( iAvkonAppUi->IsForeground() )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   604
    	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   605
	    if ( aShow )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   606
	        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   607
	        if ( !uriArray->IsIncluded(adnUri) )
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
	            // Show SIM contact also in names list:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   610
	            Phonebook2::Pbk2AppUi()->ApplicationServices().StoreConfiguration().
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   611
	                AddContactStoreURIL( adnUri );
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
	        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   614
	    else
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   615
	        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   616
	        if ( uriArray->IsIncluded(adnUri) )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   617
	            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   618
	            // Do not show SIM contacts:
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   619
	            Phonebook2::Pbk2AppUi()->ApplicationServices().StoreConfiguration().
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   620
	                RemoveContactStoreURIL( adnUri );
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
	        }
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
	    iNextTask = EComplete;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   625
    	}
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   626
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   627
    CleanupStack::PopAndDestroy( uriArray );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   628
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   629
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
// CPsu2CopySimContactsCmd::CreateSimViewsL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   633
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   634
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   635
void CPsu2CopySimContactsCmd::CreateSimViewsL()
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
    // Set views ready counter to zero
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   638
    iCounter = 0;
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
    const TInt count = iSourceStores.Count();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   641
    for ( TInt i = 0; i < count; ++i )
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
        // Find store property
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   644
        const CPbk2StoreProperty* prop =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   645
            Phonebook2::Pbk2AppUi()->ApplicationServices().StoreProperties().
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   646
                FindProperty( iSourceStores[i]->StoreProperties().Uri() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   647
        __ASSERT_DEBUG( prop,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   648
            Panic( EStorePropertyNotFound_CreateSimViewsL ) );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   649
        // Get Virtual Phonebook view definition
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   650
        // There is only one view defintion for SIM stores
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   651
        // -> take the first one
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   652
        const CVPbkContactViewDefinition& viewDef =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   653
            (prop->Views())[0]->ViewDefinition();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   654
        MVPbkContactView* view = iSourceStores[i]->CreateViewLC(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   655
            viewDef,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   656
            *this,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   657
            Phonebook2::Pbk2AppUi()->ApplicationServices().
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   658
                SortOrderManager().SortOrder() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   659
        iSourceViews.AppendL( view );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   660
        CleanupStack::Pop(); // view
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   661
        }
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
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
// CPsu2CopySimContactsCmd::CopyContactsL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   666
// --------------------------------------------------------------------------
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
void CPsu2CopySimContactsCmd::CopyContactsL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   669
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   670
    if ( !iCopier )
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
        iCopier = CVPbkContactCopier::NewL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   673
            ( Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   674
        }
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
    // Create an array for source contact links
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   677
    if ( !iSourceContactLinks )
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
        iSourceContactLinks = CVPbkContactLinkArray::NewL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   680
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   681
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   682
    if ( !iCopiedContacts )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   683
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   684
        iCopiedContacts = CVPbkContactLinkArray::NewL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   685
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   686
    
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   687
    // Create links to the contacts that are copied
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   688
    const TInt viewCount = iSourceViews.Count();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   689
    for ( TInt i = 0; i < viewCount; ++i )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   690
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   691
        const TInt contactCount = iSourceViews[i]->ContactCountL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   692
        for( TInt j = 0; j < contactCount; ++j )
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
            MVPbkContactLink* link =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   695
                iSourceViews[i]->ContactAtL(j).CreateLinkLC();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   696
            iSourceContactLinks->AppendL( link );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   697
            CleanupStack::Pop(); // link
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   698
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   699
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   700
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   701
    // Views can be destroyed now because links have been created
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   702
    iSourceViews.ResetAndDestroy();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   703
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   704
    // Get target store
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   705
    MVPbkContactStore* targetStore =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   706
        Phonebook2::Pbk2AppUi()->ApplicationServices().ContactManager().
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   707
            ContactStoresL().Find( VPbkContactStoreUris::DefaultCntDbUri() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   708
    // Target store must exist as cheked in ValidStoreConfigurationL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   709
    __ASSERT_DEBUG( targetStore, Panic( ENullTarget_CopyContactsL ));
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   710
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   711
    // Start copying
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   712
    iCopiedContacts->ResetAndDestroy();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   713
    iCopyOperation = iCopier->CopyContactsL(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   714
        CVPbkContactCopier::EVPbkUsePlatformSpecificDuplicatePolicy,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   715
        *iSourceContactLinks, targetStore, *iCopiedContacts, *this );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   716
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   717
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   718
    // Show progress note
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   719
    iDecorator->ProcessStartedL( iSourceContactLinks->Count() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   720
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   721
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   722
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   723
// CPsu2CopySimContactsCmd::ShowResultsL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   724
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   725
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   726
void CPsu2CopySimContactsCmd::ShowResultsL()
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
    TPbk2CopyContactsResults results(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   729
        iCopiedSuccessfully, iSourceContactLinks->Count() );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   730
    results.ShowNoteL();
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
    iNextTask = EComplete;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   733
    IssueRequest();
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   736
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   737
// CPsu2CopySimContactsCmd::CompleteL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   738
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   739
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   740
void CPsu2CopySimContactsCmd::CompleteL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   741
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   742
    iStartupMonitor.HandleStartupComplete();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   743
    iCommandObserver->CommandFinished( *this );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   744
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   745
    if (iAvkonAppUi->IsForeground())
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   746
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   747
        PublishOpenCompleteL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   748
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   749
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   750
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   751
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   752
// CPsu2CopySimContactsCmd::PublishOpenCompleteL
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   755
void CPsu2CopySimContactsCmd::PublishOpenCompleteL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   756
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   757
    PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   758
        ("CPsu2CopySimContactsCmd::PublishOpenCompleteL") );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   759
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   760
    TInt err = RProperty::Define( TUid::Uid( KPbk2PSUidPublic ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   761
                                  KPhonebookOpenCompleted, RProperty::EInt );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   762
    if ( err != KErrAlreadyExists )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   763
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   764
        User::LeaveIfError( err );
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
    RProperty prop;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   767
    CleanupClosePushL( prop );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   768
    User::LeaveIfError(prop.Attach( TUid::Uid( KPbk2PSUidPublic ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   769
                                    KPhonebookOpenCompleted )); 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   770
    TInt value( EPhonebookClosed );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   771
    err = prop.Get( value );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   772
    if ( err == KErrNone && value != EPhonebookOpenCompleted)
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
        // Only publish once per phonebook opening
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   775
        PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   776
            ("publish EPhonebookOpenCompleted") );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   777
        err = prop.Set( EPhonebookOpenCompleted );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   778
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   779
    User::LeaveIfError( err );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   780
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   781
    CleanupStack::PopAndDestroy(&prop);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   782
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   783
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   784
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   785
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   786
// CPsu2CopySimContactsCmd::CompleteWithError
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   787
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   788
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   789
void CPsu2CopySimContactsCmd::CompleteWithError( TInt aError )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   790
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   791
    iStartupMonitor.HandleStartupFailed( aError );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   792
    iCommandObserver->CommandFinished( *this );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   793
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   794
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   795
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   796
// CPsu2CopySimContactsCmd::ValidStoreConfigurationL
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
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   799
TBool CPsu2CopySimContactsCmd::ValidStoreConfigurationL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   800
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   801
    __ASSERT_DEBUG( !iValidSourceStoreUris,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   802
        Panic(EPreCond_ValidStoreConfigurationL));
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   803
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   804
    CVPbkContactStoreUriArray* currentConfig =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   805
        Phonebook2::Pbk2AppUi()->ApplicationServices().
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   806
            StoreConfiguration().CurrentConfigurationL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   807
    CleanupStack::PushL( currentConfig );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   808
    CVPbkContactStoreUriArray* validConfig =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   809
        Phonebook2::Pbk2AppUi()->ApplicationServices().
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   810
            StoreValidityInformer().CurrentlyValidStoresL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   811
    CleanupStack::PushL( validConfig );
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
    // ADN/SDN is valid source if it's not in current configuration
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   814
    iValidSourceStoreUris = CVPbkContactStoreUriArray::NewL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   815
    const TDesC& adnUri = VPbkContactStoreUris::SimGlobalAdnUri();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   816
    const TDesC& sdnUri = VPbkContactStoreUris::SimGlobalSdnUri();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   817
    if ( !currentConfig->IsIncluded( adnUri ))
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
        iValidSourceStoreUris->AppendL( adnUri );
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
    if ( !currentConfig->IsIncluded( sdnUri ))
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   822
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   823
        iValidSourceStoreUris->AppendL( sdnUri );
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
    // No sim store needs to be handled in this command, 
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   827
    // directly set the flag.
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   828
    if ( iValidSourceStoreUris->Count() == 0 )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   829
    	{
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   830
    	SetNewSimCardKeyL();    	
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   833
    TBool result = EFalse;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   834
    // If there are source stores and contact model is valid
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   835
    // then configuration is valid
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   836
    if ( iValidSourceStoreUris->Count() > 0 &&
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   837
         validConfig->IsIncluded(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   838
            VPbkContactStoreUris::DefaultCntDbUri() ))
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   839
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   840
        result = ETrue;
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   843
    CleanupStack::PopAndDestroy( 2 );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   844
    return result;
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
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
// CPsu2CopySimContactsCmd::NewSimCardForPhonebook2AppL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   849
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   850
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   851
TBool CPsu2CopySimContactsCmd::NewSimCardForPhonebook2AppL()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   852
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   853
    MVPbkSimStateInformation* simStateInfo =
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   854
        VPbkSimStoreFactory::GetSimStateInformationL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   855
    CleanupDeletePushL( simStateInfo );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   856
    TBool newSimCard = simStateInfo->NewSimCardL();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   857
    CleanupStack::PopAndDestroy(); // simStateInfo
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   858
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   859
    if ( newSimCard )
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
        RProperty queryProperty;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   862
        TInt queryDone = KSimNotChecked;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   863
        TInt result = queryProperty.Get(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   864
            TUid::Uid( KPbk2UID3 ), KPhonebookSimCopyAsked, queryDone );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   865
        queryProperty.Close();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   866
        PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   867
            ("CPsu2CopySimContactsCmd::NewSimCardForPhonebook2AppL res %d status %d"),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   868
            result, queryDone);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   869
        // If result is KErrNone it means that the key has been set
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   870
        // and query has been asked before, KErrNotFound means that key
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   871
        // is not set and query hasn't been asked
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   872
        if ( result == KErrNotFound )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   873
            {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   874
            return ETrue;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   875
            }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   876
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   877
    return EFalse;
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   880
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   881
// CPsu2CopySimContactsCmd::CloseStores
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   882
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   883
//
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   884
void CPsu2CopySimContactsCmd::CloseStores()
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   885
    {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   886
    const TInt count = iSourceStores.Count();
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   887
    for ( TInt i = 0; i < count; ++i )
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   888
        {
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   889
        iSourceStores[i]->Close( *this );
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
    }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   892
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   893
// --------------------------------------------------------------------------
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   894
// CPsu2CopySimContactsCmd::SetNewSimCardKeyL
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   895
// --------------------------------------------------------------------------
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
void CPsu2CopySimContactsCmd::SetNewSimCardKeyL()
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
    RProperty queryProperty;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   900
    CleanupClosePushL( queryProperty );
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
    // Check if the key has been defined
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   903
    TInt queryDone = KSimNotChecked;
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   904
    TInt result = queryProperty.Get(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   905
        TUid::Uid( KPbk2UID3 ), KPhonebookSimCopyAsked, queryDone );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   906
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   907
    PBK2_DEBUG_PRINT(PBK2_DEBUG_STRING
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   908
        ("CPsu2CopySimContactsCmd::SetNewSimCardKeyL res %d status %d"),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   909
        result, queryDone);
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   910
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   911
    if ( result == KErrNotFound )
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
        _LIT_SECURITY_POLICY_C1( newSimCardQueryReadPolicy,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   914
            ECapabilityReadUserData );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   915
        _LIT_SECURITY_POLICY_S0( newSimCardQueryWritePolicy, KPbk2UID3 );
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   916
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   917
        // Define a property for query done flag
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   918
        User::LeaveIfError( queryProperty.Define(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   919
            TUid::Uid( KPbk2UID3 ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   920
            KPhonebookSimCopyAsked,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   921
            RProperty::EInt,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   922
            newSimCardQueryReadPolicy,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   923
            newSimCardQueryWritePolicy ));
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   924
        }
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   925
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   926
    // Set the value to KSimChecked
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   927
    User::LeaveIfError( queryProperty.Set(
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   928
        TUid::Uid( KPbk2UID3 ),
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   929
        KPhonebookSimCopyAsked,
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   930
        KSimChecked ));
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
    CleanupStack::PopAndDestroy(); // queryProperty
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
f4a778e096c2 Revert incorrect RCL_3 drop:
Pat Downey <patd@symbian.org>
parents:
diff changeset
   935
//  End of File