securitydialogs/SecUi/Src/SecUiSecurityHandler.cpp
author hgs
Thu, 14 Oct 2010 13:56:11 +0300
changeset 63 989397f9511c
parent 59 881d92421467
child 66 67b3e3c1fc87
permissions -rw-r--r--
201039_03
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
/*
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
     2
 * Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). 
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
     3
 * All rights reserved.
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
     4
 * This component and the accompanying materials are made available
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
     6
 * which accompanies this distribution, and is available
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
     8
 *
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
     9
 * Initial Contributors:
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    10
 * Nokia Corporation - initial contribution.
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    11
 *
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    12
 * Contributors:
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    13
 *
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    14
 * Description:  Provides api for handling security events.
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    15
 *
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    16
 *
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    17
 */
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
    18
#include <e32notif.h>
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    19
#include <aknnotedialog.h>
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    20
#include <etelmm.h>
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
    21
// #include <SecUi.rsg>
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    22
#include <exterror.h>
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    23
#include <textresolver.h>
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
#ifdef __COVER_DISPLAY
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
#include <aknmediatorfacade.h>
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
#endif //__COVER_DISPLAY
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
#include <centralrepository.h> 
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
#include <e32property.h>
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
    30
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    31
#include <PSVariables.h>   // Property values
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    32
#include <coreapplicationuisdomainpskeys.h>
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    33
#include <startupdomainpskeys.h>
39
61986511a9c8 201029_02
hgs
parents: 35
diff changeset
    34
// #include <uikon/eiksrvui.h>
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
#include <settingsinternalcrkeys.h>
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
#include <securityuisprivatepskeys.h>
39
61986511a9c8 201029_02
hgs
parents: 35
diff changeset
    37
// #include <AknNotiferAppServerApplication.h>
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    38
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    39
#include <SCPClient.h>
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    40
#include <securitynotification.h>
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    41
#include "secui.hrh"
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
    42
#include "SecUi.h"
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    43
#include "secuisecurityhandler.h"
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    44
#include "secuicodequerydialog.h"
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    45
#include "secuisecuritysettings.h"
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    46
#include "SecUiWait.h"
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
    47
// #include "SecUiLockObserver.h"
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    48
#include <RemoteLockSettings.h>
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    49
#include <StringLoader.h>
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    50
#include <featmgr.h>
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    51
#include <hb/hbcore/hbtextresolversymbian.h>
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
    52
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
    53
#include "SecQueryUi.h"
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
    54
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    55
//  LOCAL CONSTANTS AND MACROS
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    56
const TInt KMaxNumberOfPUKAttempts(10);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    57
const TInt KMaxNumberOfPINAttempts(3);
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    58
// not used
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
    59
// const TInt KLastRemainingInputAttempt(1);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    60
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
    61
const TInt KTriesToConnectServer(2);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
    62
const TInt KTimeBeforeRetryingRequest(50000);
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
    63
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
// ================= MEMBER FUNCTIONS =======================
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
// CSecurityHandler::CSecurityHandler()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
// C++ constructor
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
    70
// qtdone
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
    71
EXPORT_C CSecurityHandler::CSecurityHandler(RMobilePhone& aPhone) :
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
    72
    iPhone(aPhone), iQueryCanceled(ETrue), iSecurityDlg(NULL), iNoteDlg(NULL)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
    {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
    74
    RDEBUG("0", 0);
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
    75
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
    76
    TInt result = iCustomPhone.Open(aPhone);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    77
    RDEBUG("result", result);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
    78
    TRAP_IGNORE(FeatureManager::InitializeLibL()); //Shouldn't this panic if FM does not initialise??
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    79
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    80
    _LIT(KFileName, "secui_");
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    81
    _LIT(KPath, "z:/resource/qt/translations/");
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    82
    RDEBUG("HbTextResolverSymbian", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    83
    result = HbTextResolverSymbian::Init(KFileName, KPath);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
    84
    RDEBUG("result", result);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
// CSecurityHandler::~CSecurityHandler()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
// Destructor
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
    92
// qtdone
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
EXPORT_C CSecurityHandler::~CSecurityHandler()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
    {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
    95
    RDEBUG("0", 0);
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
    96
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
    97
    if (iDestroyedPtr)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
        {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
        *iDestroyedPtr = ETrue;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
        iDestroyedPtr = NULL;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
        }
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   102
    RDEBUG("calling CancelOpenQuery", 0);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   103
    TInt err = CancelOpenQuery(-1);
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   104
    RDEBUG("err", err);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
    iCustomPhone.Close();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   106
    FeatureManager::UnInitializeLib();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   107
    RDEBUG("1", 1);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   111
// CSecurityHandler::HandleEventL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
// Handles different security events
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   114
// qtdone
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   115
EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   116
    {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   117
    RDEBUG("0", 0);
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   118
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   119
    TInt result = KErrNone;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   120
    HandleEventL(aEvent, result);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   121
    }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   122
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   123
//
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   124
// ----------------------------------------------------------
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   125
// CSecurityHandler::HandleEventL()
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   126
// Handles different security events
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   127
// ----------------------------------------------------------
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   128
// qtdone
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   129
EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent, TBool aStartup, TInt& aResult)
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   130
    {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   131
    RDEBUG("0", 0);
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
   132
	RDEBUG("TBool aStartup", aStartup);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   133
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   134
    iStartup = aStartup;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   135
    HandleEventL(aEvent, aResult);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   140
// CSecurityHandler::HandleEventL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   141
// Handles different security events
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   142
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   143
// qtdone
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   144
EXPORT_C void CSecurityHandler::HandleEventL(RMobilePhone::TMobilePhoneSecurityEvent aEvent, TInt& aResult)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   145
    {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   146
    RDEBUG("0", 0);
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   147
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   148
    /*****************************************************
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   149
     *    Series 60 Customer / ETel
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   150
     *    Series 60  ETel API
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   151
     *****************************************************/
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   152
    TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   153
    TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   154
    RDEBUG("aEvent", aEvent);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   155
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   156
    switch (aEvent)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   157
        {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   158
        case RMobilePhone::EPin1Required:
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   159
            RDEBUG("RMobilePhone::EPin1Required", 0)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   160
            ;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   161
            aResult = Pin1RequiredL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   162
            break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   163
        case RMobilePhone::EPuk1Required:
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   164
            RDEBUG("RMobilePhone::EPuk1Required", 0)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   165
            ;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   166
            Puk1RequiredL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   167
            break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   168
        case RMobilePhone::EPin2Required:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   169
            Pin2RequiredL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   170
            break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   171
        case RMobilePhone::EPuk2Required:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   172
            Puk2RequiredL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   173
            break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   174
        case RMobilePhone::EUniversalPinRequired:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   175
            if (wcdmaSupported || upinSupported)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   176
                {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   177
                aResult = UPinRequiredL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   178
                }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   179
            else
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   180
                aResult = KErrNotSupported;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   181
            break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   182
        case RMobilePhone::EUniversalPukRequired:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   183
            if (wcdmaSupported || upinSupported)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   184
                {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   185
                aResult = UPukRequiredL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   186
                }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   187
            else
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   188
                aResult = KErrNotSupported;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   189
            break;
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
   190
        case RMobilePhone::EPhonePasswordRequired+0x100:	// from Autolock
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   191
        case RMobilePhone::EPhonePasswordRequired:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   192
            aResult = PassPhraseRequiredL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   193
            break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   194
        case RMobilePhone::EICCTerminated:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   195
            SimLockEventL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   196
            break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   197
        default:
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   198
            RDEBUG("default", aEvent)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   199
            ;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   200
            break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   201
        }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   202
    RDEBUG("aResult", aResult);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   203
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   204
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   205
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   206
// CSecurityHandler::AskSecCodeL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   207
// For asking security code e.g in settings
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   208
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   209
// qtdone
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   210
EXPORT_C TBool CSecurityHandler::AskSecCodeL()
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   211
    {
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   212
    /*****************************************************
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   213
     *    Series 60 Customer / ETel
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   214
     *    Series 60  ETel API
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   215
     *****************************************************/
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   216
    RDEBUG("0", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   217
    // if code is still not initialized, then there's no need to ask it. This fixes the error when the RFS requests the code.
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   218
    const TUid KCRUidSCPLockCode =
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   219
        {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   220
        0x2002677B
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   221
        };
1
d5423fbb4f29 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   222
    const TUint32 KSCPLockCodeDefaultLockCode = 0x00000001;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   223
1
d5423fbb4f29 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   224
    CRepository* repository = CRepository::NewL(KCRUidSCPLockCode);
d5423fbb4f29 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   225
    TInt currentLockStatus = -1;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   226
    TInt res = -1;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   227
    TInt lAlphaSupported = 0;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   228
    TInt lCancelSupported = 0;
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   229
    RMobilePhone::TMobilePassword iSecUi_password;
1
d5423fbb4f29 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   230
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   231
    res = repository->Get(KSCPLockCodeDefaultLockCode, currentLockStatus);	// 0x3039 = 12345
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   232
    RDEBUG("res", res);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   233
    RDEBUG("currentLockStatus", currentLockStatus);
1
d5423fbb4f29 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   234
    delete repository;
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   235
    if (res == 0 && (currentLockStatus == 1 || currentLockStatus == 12345) )
1
d5423fbb4f29 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   236
        {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   237
        // code is the default one
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   238
        RDEBUG("code is the default one; supply as default", 1);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   239
        iSecUi_password.Copy(_L("12345"));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   240
        // RDEBUG("code is the default one; no need to request it", 1);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   241
        // return ETrue;
1
d5423fbb4f29 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   242
        }
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   243
    // end check for default code
1
d5423fbb4f29 Revision: 201003
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 0
diff changeset
   244
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   245
    RMobilePhone::TMobilePassword required_fourth;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   246
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   247
    TInt ret = KErrNone;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   248
    TInt status = KErrNone;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   249
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   250
    TInt queryAccepted = KErrCancel;
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   251
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   252
    while (queryAccepted != KErrNone)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   253
        {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   254
        RMobilePhone::TMobilePhoneSecurityCode secCodeType;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   255
        secCodeType = RMobilePhone::ESecurityCodePhonePassword;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   256
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   257
        /* request PIN using QT */
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   258
        CSecQueryUi *iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   259
        RDEBUG("CSecQueryUi", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   260
        iSecQueryUi = CSecQueryUi::NewL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   261
        iQueryCanceled = EFalse;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   262
        lAlphaSupported = ESecUiAlphaSupported;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   263
        lCancelSupported = ESecUiCancelSupported;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   264
        TBuf<0x100> title;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   265
        title.Zero();
48
6ed68423b759 201033_01
hgs
parents: 42
diff changeset
   266
        HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code"));
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   267
        title.Append(stringHolder->Des());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   268
        CleanupStack::PopAndDestroy(stringHolder);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   269
        title.Append(_L("$"));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   270
        title.AppendNum(-1);	// Don't know the number of remaining attempts
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   271
        queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, ESecUiSecretSupported | lAlphaSupported
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   272
                | lCancelSupported | secCodeType);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   273
        RDEBUG("iSecUi_password", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   274
        RDEBUGSTR(iSecUi_password);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   275
        RDEBUG("delete", 0);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   276
        iQueryCanceled = ETrue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   277
        delete iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   278
        RDEBUG("queryAccepted", queryAccepted);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   279
        /* end request PIN using QT */
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   280
        if (queryAccepted != KErrNone)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   281
            {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   282
            ret = EFalse;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   283
            return ret;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   284
            }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   285
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   286
		// Validate the code using SCP. This is needed to get hash
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   287
    RDEBUG("AbortSecurityCode", 0);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   288
    RSCPClient scpClient;
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   289
    RDEBUG("scpClient.Connect", 0);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   290
    TInt tRet = scpClient.Connect();
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   291
    RDEBUG("tRet", tRet);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   292
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   293
    CleanupClosePushL(scpClient);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   294
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   295
    RArray<TDevicelockPolicies> aFailedPolicies;
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   296
    TInt retLockcode = KErrNone;
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   297
    RMobilePhone::TMobilePassword aISACode;
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   298
    TInt scpFlags = 0;
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   299
    RDEBUG("scpClient.VerifyCurrentLockcode", 0);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   300
    // this validate on ISA . No need to do iPhone.VerifySecurityCode
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   301
    retLockcode = scpClient.VerifyCurrentLockcode(iSecUi_password, aISACode, aFailedPolicies, scpFlags);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   302
    RDEBUG("retLockcode", retLockcode);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   303
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   304
    RDEBUG("aISACode", 0);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   305
    RDEBUGSTR(aISACode);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   306
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   307
    RDEBUG("aFailedPolicies.Count()", aFailedPolicies.Count());
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   308
    RDEBUG("Close", 0);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   309
    scpClient.Close();
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   310
    RDEBUG("PopAndDestroy", 0);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   311
    CleanupStack::PopAndDestroy(); //scpClient
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   312
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   313
        CWait* wait = CWait::NewL();
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   314
        RDEBUG("iSecUi_password", 0);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   315
        RDEBUGSTR(iSecUi_password);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   316
        RDEBUG("aISACode", 0);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   317
        RDEBUGSTR(aISACode);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   318
        RDEBUG("VerifySecurityCode", 0);
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   319
        iPhone.VerifySecurityCode(wait->iStatus, secCodeType, aISACode /* not iSecUi_password !!! */, required_fourth);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   320
        RDEBUG("WaitForRequestL", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   321
        status = wait->WaitForRequestL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   322
        RDEBUG("status", status);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   323
        delete wait;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   324
#ifdef __WINS__
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   325
        if (status == KErrNotSupported || status == KErrTimedOut)
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   326
            {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   327
            RDEBUG("status", status);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   328
            status = KErrNone;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   329
            }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   330
#endif
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   331
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   332
        ret = EFalse;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   333
        queryAccepted = KErrCancel; // because it's not yet validated
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   334
        switch (status)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   335
            {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   336
            case KErrNone:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   337
                {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   338
                if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw) && !(FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements)))
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   339
                    {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   340
                    RDEBUG("calling RSCPClient", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   341
                    RSCPClient scpClient;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   342
                    User::LeaveIfError(scpClient.Connect());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   343
                    CleanupClosePushL(scpClient);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   344
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   345
                    TSCPSecCode newCode;
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   346
                    RDEBUG("iSecUi_password", 1);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   347
                    RDEBUGSTR(iSecUi_password);
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
   348
                    newCode.Copy(iSecUi_password);	// this might fail if lenght=10 , because TSCPSecCode=8, while SEC_C_SECURITY_CODE_MAX_LENGTH=10
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   349
                    RDEBUG(
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   350
                            "!!!!!!! ***** deprecated **** !!!!! scpClient.StoreCode",
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   351
                            0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   352
                    scpClient.StoreCode(newCode);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   353
                    RDEBUG("called StoreCode", 1);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   354
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   355
                    CleanupStack::PopAndDestroy(); //scpClient
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   356
                    queryAccepted = KErrNone;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   357
                    }
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   358
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   359
                iQueryCanceled = ETrue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   360
                return ETrue;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   361
                }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   362
            case KErrGsmSSPasswordAttemptsViolation:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   363
            case KErrLocked:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   364
                {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   365
                // security code blocked! 
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   366
                CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   367
                break;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   368
                }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   369
            case KErrGsm0707IncorrectPassword:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   370
            case KErrAccessDenied:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   371
                {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   372
                // code was entered erroneusly
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   373
                CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   374
                break;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   375
                }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   376
            default:
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   377
                {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   378
                CSecuritySettings::ShowResultNoteL(status, CAknNoteDialog::EErrorTone);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   379
                }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   380
            }
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   381
        RDEBUG("while AskSecCodeL", 1);
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
   382
        iSecUi_password.Copy(_L(""));	// clear password so that the next time, it shows empty
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   383
        } // while
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   384
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   385
    iQueryCanceled = ETrue;
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   386
    RDEBUG("ret", ret);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   387
    return ret;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   388
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   389
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   390
// ----------------------------------------------------------
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   391
// Cancels all security code queries
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   392
// aStatus = -1     from destructor
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   393
// aStatus =  1     from API. Will kill all dialogs through signal P&S
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   394
// ----------------------------------------------------------
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   395
// qtdone
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   396
TInt CSecurityHandler::CancelOpenQuery(TInt aStatus)
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   397
    {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   398
    RDEBUG("aStatus", aStatus);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   399
    RDEBUG("iQueryCanceled", iQueryCanceled);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   400
    TInt res = 0;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   401
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   402
    if (aStatus == 1) // also signal all other dialogs
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   403
        {
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   404
        RDEBUG(
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   405
                "set KSecurityUIsDismissDialog to ESecurityUIsDismissDialogOn",
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   406
                ESecurityUIsDismissDialogOn);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   407
        TInt err = RProperty::Set(KPSUidSecurityUIs, KSecurityUIsDismissDialog, ESecurityUIsDismissDialogOn);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   408
        RDEBUG("err", err);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   409
        res += 1;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   410
        }
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   411
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   412
    if (!iQueryCanceled)
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   413
        {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   414
        // notify all dialogs, in particular SecUiNotificationDialog::subscriberKSecurityUIsDismissDialogChanged
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   415
        // this will cancel only the dialog which was opened by same client.
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   416
        res += 0x10;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   417
        iQueryCanceled = ETrue;
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   418
        if (iSecurityDlg != NULL)
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   419
            {
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   420
            RDEBUG("deleting iSecurityDlg", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   421
            res += 0x100;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   422
            delete iSecurityDlg;
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   423
            }
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   424
        if (iNoteDlg != NULL)
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   425
            {
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   426
            RDEBUG("deleting iNoteDlg", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   427
            res += 0x1000;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   428
            delete iNoteDlg;
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   429
            }
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   430
        iNoteDlg = NULL;
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   431
        iSecurityDlg = NULL;
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   432
        }
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   433
    res += 0x10000;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   434
    RDEBUG("res", res);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   435
    return res;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   436
    }
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   437
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   438
//
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   439
// ----------------------------------------------------------
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   440
// CSecurityHandler::CancelSecCodeQuery()    
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   441
// Cancels PIN2 and security code queries
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
   442
// this is used by rfsHandler
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   443
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   444
// qtdone
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   445
EXPORT_C void CSecurityHandler::CancelSecCodeQuery()
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   446
    {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   447
    RDEBUG("0", 0);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   448
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   449
    TInt err = CancelOpenQuery(1);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   450
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   451
    RDEBUG("err", err);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   452
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   453
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   454
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   455
// CSecurityHandler::AskSecCodeInAutoLock()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   456
// for asking security code in autolock
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   457
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   458
// qtdone
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   459
EXPORT_C TBool CSecurityHandler::AskSecCodeInAutoLockL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   460
    {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   461
    /*****************************************************
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   462
     *    Series 60 Customer / ETel
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   463
     *    Series 60  ETel API
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   464
     *****************************************************/
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   465
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   466
    RDEBUG("0", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   467
    TInt res;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   468
    CWait* wait;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   469
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   470
    RMobilePhone::TMobilePhoneLockSetting lockChange(RMobilePhone::ELockSetDisabled);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   471
    RMobilePhone::TMobilePhoneLock lockType = RMobilePhone::ELockPhoneDevice;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   472
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   473
    // get autolock period from Central Repository.
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   474
    CRepository* repository = CRepository::NewL(KCRUidSecuritySettings);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   475
    TInt period = 0;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   476
    res = repository->Get(KSettingsAutoLockTime, period);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   477
    delete repository;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   478
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   479
    RDEBUG("res", res);
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   480
    RDEBUG("period", period);
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   481
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   482
    if (res == KErrNone)
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   483
        {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   484
        // disable autolock in Domestic OS side too if autolock period is 0.
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   485
        if (period == 0)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   486
            {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   487
            RDEBUG("period", period);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   488
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   489
            // If remote lock is enabled, don't disable the domestic OS device lock
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   490
            // since that would render the RemoteLock useless.
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   491
            // Instead just re-set the DOS lock to enabled which as a side effect
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   492
            // requests the security code from the user.
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   493
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   494
            TBool remoteLockStatus(EFalse);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   495
            CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   496
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   497
            if (remoteLockSettings->GetEnabled(remoteLockStatus))
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   498
                {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   499
                RDEBUG("0", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   500
                if (remoteLockStatus)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   501
                    {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   502
                    // Remote lock is enabled
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   503
                    lockChange = RMobilePhone::ELockSetEnabled;
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   504
                    RDEBUG("lockChange", lockChange);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   505
                    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   506
                else
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   507
                    {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   508
                    // Remote lock is disabled
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   509
                    lockChange = RMobilePhone::ELockSetDisabled;
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   510
                    RDEBUG("lockChange", lockChange);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   511
                    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   512
                }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   513
            else
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   514
                {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   515
                // Failed to get remote lock status
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   516
                RDEBUG("Failed", lockChange);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   517
                }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   518
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   519
            delete remoteLockSettings;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   520
            remoteLockSettings = NULL;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   521
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   522
            RDEBUG("lockChange", lockChange);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   523
            wait = CWait::NewL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   524
            RDEBUG("0", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   525
            // this also calls PassPhraseRequiredL ???
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   526
            RDEBUG("SetLockSetting", 1);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   527
            iPhone.SetLockSetting(wait->iStatus, lockType, lockChange);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   528
            res = KErrNone;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   529
            RDEBUG("WaitForRequestL", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   530
            res = wait->WaitForRequestL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   531
            RDEBUG("res", res);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   532
            delete wait;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   533
            } // from   period == 0
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   534
        else
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   535
            { // ask security code
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   536
            RDEBUG("codeQueryNotifier 0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   537
            RNotifier codeQueryNotifier;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   538
            User::LeaveIfError(codeQueryNotifier.Connect());
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   539
            CWait* wait = CWait::NewL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   540
            CleanupStack::PushL(wait);
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
   541
            TInt queryResponse = 0;	// TODO will be changed by SecurityObserver
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   542
            TPckg<TInt> response(queryResponse);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   543
            RDEBUG("0", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   544
            TSecurityNotificationPckg params;
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
   545
            params().iEvent = static_cast<TInt> (0x100+RMobilePhone::EPhonePasswordRequired);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   546
            params().iStartup = EFalse;
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
   547
            RDEBUG("queryResponse", queryResponse);
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   548
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   549
            RDEBUG("StartNotifierAndGetResponse", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   550
            codeQueryNotifier.StartNotifierAndGetResponse(wait->iStatus, KSecurityNotifierUid, params, response);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   551
            // this will eventually call PassPhraseRequiredL
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   552
            RDEBUG("WaitForRequestL", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   553
            res = wait->WaitForRequestL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   554
            RDEBUG("WaitForRequestL", 1);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   555
            RDEBUG("res", res);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   556
            CleanupStack::PopAndDestroy(); // wait
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   557
            if (res == KErrNone)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   558
                res = queryResponse;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   559
            } // from   else period == 0
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   560
        RDEBUG("0", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   561
        }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   562
    else
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   563
        { // can't read repository for KSettingsAutoLockTime
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   564
        RDEBUG("KERRSOMETHING:Call SetLockSetting", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   565
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   566
        // If remote lock is enabled, don't disable the domestic OS device lock
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   567
        // since that would render the RemoteLock useless.
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   568
        // Instead just re-set the DOS lock to enabled which as a side effect
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   569
        // requests the security code from the user.
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   570
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   571
        TBool remoteLockStatus(EFalse);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   572
        CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   573
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   574
        if (remoteLockSettings->GetEnabled(remoteLockStatus))
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   575
            {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   576
            if (remoteLockStatus)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   577
                {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   578
                // Remote lock is enabled
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   579
                lockChange = RMobilePhone::ELockSetEnabled;
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   580
                RDEBUG("lockChange", lockChange);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   581
                }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   582
            else
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   583
                {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   584
                // Remote lock is disabled
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   585
                lockChange = RMobilePhone::ELockSetDisabled;
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   586
                RDEBUG("lockChange", lockChange);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   587
                }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   588
            }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   589
        else
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   590
            {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   591
            // Failed to get remote lock status
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   592
            RDEBUG("Failed", lockChange);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   593
            }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   594
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   595
        delete remoteLockSettings;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   596
        remoteLockSettings = NULL;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   597
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   598
        RDEBUG("0", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   599
        wait = CWait::NewL();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   600
        RDEBUG("SetLockSetting", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   601
        iPhone.SetLockSetting(wait->iStatus, lockType, lockChange);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   602
        RDEBUG("WaitForRequestL", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   603
        res = wait->WaitForRequestL();
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   604
        RDEBUG("WaitForRequestL res", res);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   605
        delete wait;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   606
        }
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   607
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   608
    RDEBUG("res", res);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   609
    switch (res)
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   610
        {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   611
        case KErrNone:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   612
            {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   613
            return ETrue;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   614
            }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   615
        case KErrGsmSSPasswordAttemptsViolation:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   616
        case KErrLocked:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   617
        case KErrGsm0707IncorrectPassword:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   618
        case KErrAccessDenied:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   619
            {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   620
            RDEBUG("KErrAccessDenied", KErrAccessDenied);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   621
            return AskSecCodeInAutoLockL();
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   622
            }
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   623
        case KErrInUse:
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   624
            {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   625
            RDEBUG("KErrInUse", KErrInUse);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   626
            return EFalse;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   627
            }
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   628
        case KErrDied:
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   629
            {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   630
            RDEBUG("KErrDied ", KErrDied);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   631
            return EFalse;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   632
            }
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   633
        case KErrServerTerminated:
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   634
            {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   635
            RDEBUG("KErrServerTerminated ", KErrServerTerminated);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   636
            return EFalse;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   637
            }
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   638
        case KErrServerBusy:
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   639
            {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   640
            RDEBUG("KErrServerBusy ", KErrServerBusy);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   641
            return EFalse;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   642
            }
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   643
        case KErrAbort:
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   644
            {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   645
            RDEBUG("KErrAbort", KErrAbort);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   646
            return EFalse;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   647
            }
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   648
        case KErrCancel:
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   649
            {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   650
            RDEBUG("KErrCancel", KErrCancel);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   651
            // user pressed "cancel"
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   652
            return EFalse;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   653
            }
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   654
        default:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   655
            {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   656
            RDEBUG("default", res);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   657
            return AskSecCodeInAutoLockL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   658
            }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   659
        }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   660
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   661
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   662
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   663
// CSecurityHandler::PassPhraseRequired()    
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   664
// Handles PassPhraseRequired event
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   665
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   666
// qtdone
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   667
TInt CSecurityHandler::PassPhraseRequiredL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   668
    {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   669
    /*****************************************************
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   670
     *    Series 60 Customer / ETel
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   671
     *    Series 60  ETel API
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   672
     *****************************************************/
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
   673
    askPassPhraseRequiredL:
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   674
    RDEBUG("0", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   675
    TBool StartUp = iStartup;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   676
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   677
    RMobilePhone::TMobilePassword iSecUi_password;
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
   678
    iSecUi_password.Copy(_L(""));
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   679
    RMobilePhone::TMobilePassword required_fourth;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   680
    TInt queryAccepted = KErrCancel;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   681
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   682
    TInt autolockState = 0;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   683
    TInt lCancelSupported = 0;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   684
    TInt lEmergencySupported = 0;
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   685
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   686
    TInt err(KErrGeneral);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   687
    err = RProperty::Get(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, autolockState);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   688
    RDEBUG("StartUp", StartUp);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   689
    RDEBUG("err", err);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   690
    if (!StartUp)
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   691
        {
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   692
        RDebug::Printf("%s %s (%u) might leave if StartUp=0 and err=%x", __FILE__, __PRETTY_FUNCTION__, __LINE__, err);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   693
        User::LeaveIfError(err);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   694
        }
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   695
    TBool isConditionSatisfied = EFalse;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   696
    TInt tarmFlag = 0;
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   697
    if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw))
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   698
        {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   699
        TInt tRet = RProperty::Get(KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   700
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   701
        if (tRet != KErrNone)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   702
            {
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
   703
            RDEBUG("Warning: failed to get TARM Admin Flag state", tRet);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   704
            }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   705
        else
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   706
            {
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
   707
            RDEBUG("TARM flag", tarmFlag);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   708
            }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   709
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   710
        if ((StartUp) || (tarmFlag & KSCPFlagResyncQuery))
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   711
            isConditionSatisfied = ETrue;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   712
        }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   713
    else
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   714
        {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   715
        if (StartUp)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   716
            isConditionSatisfied = ETrue;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   717
        }
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   718
63
989397f9511c 201039_03
hgs
parents: 59
diff changeset
   719
	// call TARM so that it verifies that configuration is in sync. This might internally accept the (default) lock code, but doesn't dismiss the query.
989397f9511c 201039_03
hgs
parents: 59
diff changeset
   720
	RDEBUG("isConditionSatisfied", isConditionSatisfied);
989397f9511c 201039_03
hgs
parents: 59
diff changeset
   721
	RSCPClient scpClientConfiguration;
989397f9511c 201039_03
hgs
parents: 59
diff changeset
   722
	User::LeaveIfError( scpClientConfiguration.Connect() );
989397f9511c 201039_03
hgs
parents: 59
diff changeset
   723
  CleanupClosePushL( scpClientConfiguration );
989397f9511c 201039_03
hgs
parents: 59
diff changeset
   724
	RDEBUG("call CheckConfiguration KSCPComplete", KSCPComplete);
989397f9511c 201039_03
hgs
parents: 59
diff changeset
   725
	TInt finalConfStatus = scpClientConfiguration.CheckConfiguration( KSCPComplete );
989397f9511c 201039_03
hgs
parents: 59
diff changeset
   726
	RDEBUG("finalConfStatus", finalConfStatus);
989397f9511c 201039_03
hgs
parents: 59
diff changeset
   727
	RDEBUG("isConditionSatisfied", isConditionSatisfied);
989397f9511c 201039_03
hgs
parents: 59
diff changeset
   728
	CleanupStack::PopAndDestroy();	// scpClientConfiguration
989397f9511c 201039_03
hgs
parents: 59
diff changeset
   729
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   730
    // Security code at bootup: No "cancel" softkey; Emergency calls enabled.
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
   731
    RMobilePhone::TMobilePhoneSecurityCode secCodeTypeToAsk = RMobilePhone::ESecurityCodePhonePassword;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   732
    RDEBUG("isConditionSatisfied", isConditionSatisfied);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   733
    if (isConditionSatisfied)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   734
        {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   735
        // starter or special TARM. NoCancel+Emergency
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   736
        lCancelSupported = ESecUiCancelNotSupported;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   737
        lEmergencySupported = ESecUiEmergencySupported;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   738
        }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   739
    else if (autolockState > EAutolockOff)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   740
        {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   741
        // from unlock. Cancel+Emergency
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   742
        lCancelSupported = ESecUiCancelSupported;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   743
        lEmergencySupported = ESecUiEmergencySupported;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   744
        }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   745
    else
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   746
        {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   747
        // from settings. Cancel+NoEmergency
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   748
        lCancelSupported = ESecUiCancelSupported;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   749
        lEmergencySupported = ESecUiEmergencyNotSupported;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   750
        }
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   751
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   752
    CSecQueryUi *iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   753
    iSecQueryUi = CSecQueryUi::NewL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   754
    iQueryCanceled = EFalse;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   755
    TInt lType = ESecUiSecretSupported | ESecUiAlphaSupported | lCancelSupported | lEmergencySupported | secCodeTypeToAsk;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   756
    RDEBUG("lType", lType);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   757
    TBuf<0x100> title;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   758
    title.Zero();
48
6ed68423b759 201033_01
hgs
parents: 42
diff changeset
   759
    HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_sec_code"));
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   760
    title.Append(stringHolder->Des());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   761
    CleanupStack::PopAndDestroy(stringHolder);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   762
    queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_SECURITY_CODE_MIN_LENGTH, SEC_C_SECURITY_CODE_MAX_LENGTH, lType);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   763
    RDEBUG("iSecUi_password", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   764
    RDEBUGSTR(iSecUi_password);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   765
    RDEBUG("queryAccepted", queryAccepted);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
   766
    iQueryCanceled = ETrue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   767
    delete iSecQueryUi;
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
   768
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   769
    TBool wasCancelledOrEmergency = EFalse;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   770
    RDEBUG("KFeatureIdSapDeviceLockEnhancements",
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   771
            KFeatureIdSapDeviceLockEnhancements);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   772
    if ((queryAccepted == KErrAbort /* =emergency */) || (queryAccepted == KErrCancel))
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   773
        wasCancelledOrEmergency = ETrue;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   774
    RDEBUG("wasCancelledOrEmergency", wasCancelledOrEmergency);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   775
    if (wasCancelledOrEmergency)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   776
        {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   777
        RDEBUG("StartUp", StartUp);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   778
        if (!StartUp)
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   779
            {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   780
            RDEBUG("AbortSecurityCode", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   781
            iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePhonePassword);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   782
            RDEBUG("AbortSecurityCode", 1);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   783
            }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   784
        return KErrCancel;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   785
        }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   786
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   787
    RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePhonePassword;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   788
    CWait* wait = NULL;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   789
    TInt status = KErrNone;
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   790
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   791
		// Validate the code using SCP. This is needed to check expiration
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   792
    RDEBUG("AbortSecurityCode", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   793
    RSCPClient scpClient;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   794
    RDEBUG("scpClient.Connect", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   795
    TInt tRet = scpClient.Connect();
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   796
    RDEBUG("tRet", tRet);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   797
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   798
    CleanupClosePushL(scpClient);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   799
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   800
    RArray<TDevicelockPolicies> aFailedPolicies;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   801
    TDevicelockPolicies failedPolicy;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   802
    TInt retLockcode = KErrNone;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   803
    RMobilePhone::TMobilePassword aISACode;
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   804
    TInt scpFlags = 0;
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   805
    RDEBUG("scpClient.VerifyCurrentLockcode", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   806
    // this validate on ISA . No need to do iPhone.VerifySecurityCode
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   807
    retLockcode = scpClient.VerifyCurrentLockcode(iSecUi_password, aISACode, aFailedPolicies, scpFlags);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   808
    RDEBUG("retLockcode", retLockcode);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   809
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   810
    RDEBUG("aISACode", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   811
    RDEBUGSTR(aISACode);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   812
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   813
    RDEBUG("aFailedPolicies.Count()", aFailedPolicies.Count());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   814
    RDEBUG("EDeviceLockPasscodeExpiration", EDeviceLockPasscodeExpiration); // 8
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   815
    TInt failedEDeviceLockPasscodeExpiration = 0;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   816
    for (TInt i = 0; i < aFailedPolicies.Count(); i++)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   817
        {
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   818
        failedPolicy = aFailedPolicies[i];
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   819
        RDEBUG("failedPolicy", failedPolicy);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   820
        if (failedPolicy == EDeviceLockPasscodeExpiration)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   821
            failedEDeviceLockPasscodeExpiration = EDeviceLockPasscodeExpiration;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   822
        }
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   823
    RDEBUG("Close", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   824
    scpClient.Close();
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   825
    RDEBUG("PopAndDestroy", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   826
    CleanupStack::PopAndDestroy(); //scpClient
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   827
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   828
		RDEBUG("failedEDeviceLockPasscodeExpiration", failedEDeviceLockPasscodeExpiration);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   829
    if (failedEDeviceLockPasscodeExpiration > 0)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   830
        {
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   831
    		// the password has expired. Note that it has NOT been validated. It will be revalidated inside ChangeSecCodeParamsL
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   832
        RMobilePhone::TMobilePassword iNewPassword;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   833
        TInt iFlags = 0;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   834
        iNewPassword.Copy(_L(""));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   835
        TBuf<0x80> iCaption;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   836
        iCaption.Copy(_L("ChangeSecCodeL")); // no need to translate because it's not used
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   837
        TInt iShowError = 1;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   838
        CSecuritySettings* iSecSettings;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   839
        iSecSettings = CSecuritySettings::NewL();
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   840
        TSecUi::InitializeLibL();
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   841
        RDEBUG("calling ChangeSecCodeParamsL", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   842
        status = iSecSettings->ChangeSecCodeParamsL(iSecUi_password, iNewPassword, iFlags, iCaption, iShowError);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   843
        // note that it might have been aborted. The error KErrAbort is shown in this method, not inside ChangeSecCodeParamsL
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   844
        if(status==KErrAccessDenied || status==KErrGsm0707IncorrectPassword)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   845
        	{
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   846
        	// the password expired, but the user typed wrongly. The error was already displayed.
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   847
        	RDEBUG("SCP returned ", KErrAccessDenied);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   848
        	status=R_CODES_DONT_MATCH;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   849
        	RDEBUG("SCP changed to R_CODES_DONT_MATCH", R_CODES_DONT_MATCH);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   850
        	}
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   851
        RDEBUG("status", status);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   852
        RDEBUG("iNewPassword", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   853
        RDEBUGSTR(iNewPassword);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   854
        TSecUi::UnInitializeLib();
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   855
        RDEBUG("deleting iSecSettings", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   856
        delete iSecSettings;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   857
        RDEBUG("deleted iSecSettings", 1);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   858
        }
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   859
    else
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   860
        {
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   861
        RDEBUG( "wait", 0 );
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   862
        RDEBUG("iSecUi_password", 0);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   863
        RDEBUGSTR(iSecUi_password);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   864
        RDEBUG("aISACode", 0);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   865
        RDEBUGSTR(aISACode);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   866
        wait = CWait::NewL();
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   867
        RDEBUG("VerifySecurityCode", 0);
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
   868
        iPhone.VerifySecurityCode(wait->iStatus, secCodeType, aISACode /* not iSecUi_password !!! */, required_fourth);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   869
        RDEBUG("WaitForRequestL",
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   870
                0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   871
        status = wait->WaitForRequestL();
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   872
        RDEBUG("WaitForRequestL status",
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   873
                status);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   874
        delete wait;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   875
#ifdef __WINS__
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   876
        if (status == KErrNotSupported || status == KErrTimedOut)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   877
            {
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   878
            RDEBUG( "status", status );
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   879
            status = KErrNone;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   880
            }
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   881
#endif
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   882
        }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   883
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   884
    TInt returnValue = status;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   885
    RDEBUG("tarmFlag", tarmFlag);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   886
    RDEBUG("StartUp", StartUp);
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   887
    RDEBUG("status", status);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   888
    switch (status)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   889
        {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   890
        case KErrNone:
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   891
            // code approved
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   892
            {
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   893
            RDEBUG("KErrNone", KErrNone);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   894
            if( failedEDeviceLockPasscodeExpiration > 0)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   895
            	{
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   896
            	RDEBUG("code has just been changed. No need to show Confirmation note. failedEDeviceLockPasscodeExpiration", failedEDeviceLockPasscodeExpiration);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   897
            	}
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   898
            else
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   899
            	{
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   900
            	CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   901
            	}
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   902
            RDEBUG("R_CONFIRMATION_NOTE", R_CONFIRMATION_NOTE);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   903
            if (FeatureManager::FeatureSupported(KFeatureIdSapTerminalControlFw))
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   904
                {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   905
                RDEBUG("KFeatureIdSapTerminalControlFw",
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   906
                        KFeatureIdSapTerminalControlFw);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   907
                // Unset the admin flag if set
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   908
                if (tarmFlag & KSCPFlagResyncQuery)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   909
                    {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   910
                    TInt tRet = RProperty::Get(KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   911
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   912
                    if (tRet == KErrNone)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   913
                        {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   914
                        tarmFlag &= ~KSCPFlagResyncQuery;
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   915
                        tRet = RProperty::Set(KSCPSIDAutolock, SCP_TARM_ADMIN_FLAG_UID, tarmFlag);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   916
                        }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   917
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   918
                    if (tRet != KErrNone)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   919
                        {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   920
                        RDEBUG(
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   921
                                "FAILED to unset TARM Admin Flag tRet=",
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   922
                                tRet);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   923
                        }
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
   924
                    }
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   925
                if (!FeatureManager::FeatureSupported(KFeatureIdSapDeviceLockEnhancements))
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   926
                    {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   927
                    RDEBUG("KFeatureIdSapDeviceLockEnhancements", KFeatureIdSapDeviceLockEnhancements);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   928
                    RSCPClient scpClient;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   929
                    RDEBUG("scpClient.Connect", 0);
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
   930
                    TInt tRet = scpClient.Connect();
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
   931
                    RDEBUG("tRet", tRet);
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
   932
                    User::LeaveIfError(tRet);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   933
                    RDEBUG("scpClient.Connect", 1);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   934
                    CleanupClosePushL(scpClient);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   935
                    TSCPSecCode newCode;
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
   936
                    newCode.Copy(iSecUi_password);	// this might fail if lenght=10 , because TSCPSecCode=8, while SEC_C_SECURITY_CODE_MAX_LENGTH=10
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   937
                    RDEBUG(
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   938
                            "!!!!!!! ***** TODO deprecated **** !!!!! scpClient.StoreCode",
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   939
                            0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   940
                    scpClient.StoreCode(newCode);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   941
                    RDEBUG("scpClient.StoreCode", 1);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   942
                    // TODO check whether code is expired.
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   943
                    // This should be done by TARM, and they should ask to change the code
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   944
                    CleanupStack::PopAndDestroy(); //scpClient
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   945
                    }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   946
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   947
                }
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   948
            RDEBUG("StartUp", StartUp);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   949
            if (StartUp)
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   950
                {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   951
                // get autolock period from Central Repository.
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   952
                CRepository* repository = CRepository::NewL(KCRUidSecuritySettings);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   953
                TInt period = 0;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   954
                TInt res = repository->Get(KSettingsAutoLockTime, period);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   955
                delete repository;
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   956
                RDEBUG("res", res);
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   957
                RDEBUG("period", period);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   958
                _LIT_SECURITY_POLICY_PASS( KReadPolicy);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   959
                _LIT_SECURITY_POLICY_C1(KWritePolicy,
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   960
                        ECapabilityWriteDeviceData);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   961
                RProperty::Define(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, RProperty::EInt, KReadPolicy, KWritePolicy);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   962
                RProperty::Set(KPSUidCoreApplicationUIs, KCoreAppUIsAutolockStatus, EAutolockOff);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   963
                RDEBUG("KCoreAppUIsAutolockStatus",
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   964
                        KCoreAppUIsAutolockStatus);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   965
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   966
                if (res == KErrNone)
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   967
                    {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   968
                    // disable autolock in Domestic OS side too if autolock period is 0.
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
   969
                    if (period == 0)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   970
                        {
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
   971
                        // Don't disable the domestic OS device lock
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   972
                        // since that would render the RemoteLock useless.
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   973
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   974
                        TBool remoteLockStatus(EFalse);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   975
                        CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   976
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   977
                        if (remoteLockSettings->GetEnabled(remoteLockStatus))
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   978
                            {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   979
                            if (!remoteLockStatus)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   980
                                {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   981
                                // Remote lock is disabled
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   982
                                RDEBUG(
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   983
                                        "Autolock and RemoteLock are disabled -> disable DOS device lock",
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   984
                                        0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   985
                                // Disable DOS device lock setting
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   986
                                RDEBUG(
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   987
                                        "iCustomPhone.DisablePhoneLock",
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   988
                                        0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   989
                                wait = CWait::NewL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   990
                                iCustomPhone.DisablePhoneLock(wait->iStatus, iSecUi_password);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   991
                                RDEBUG("WaitForRequestL", 0);
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
   992
                                status = wait->WaitForRequestL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
   993
                                RDEBUG("WaitForRequestL", status);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   994
                                delete wait;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   995
                                }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   996
                            }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   997
                        else
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   998
                            {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   999
                            // Failed to get remote lock status
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1000
                            RDEBUG(
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1001
                                    "Autolock is disabled, but failed to get RemoteLock status, so do nothing",
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1002
                                    0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1003
                            }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1004
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1005
                        delete remoteLockSettings;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1006
                        remoteLockSettings = NULL;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1007
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1008
                        }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1009
                    }
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1010
                else // error getting repository
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1011
                    {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1012
                    RDEBUG("error getting repository", 0);
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1013
                    // Don't disable the domestic OS device lock
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1014
                    // since that would render the RemoteLock useless.
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1015
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1016
                    TBool remoteLockStatus(EFalse);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1017
                    CRemoteLockSettings* remoteLockSettings = CRemoteLockSettings::NewL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1018
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1019
                    if (remoteLockSettings->GetEnabled(remoteLockStatus))
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1020
                        {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1021
                        if (!remoteLockStatus)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1022
                            {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1023
                            // Remote lock is disabled
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1024
                            RDEBUG("iCustomPhone.DisablePhoneLock", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1025
                            wait = CWait::NewL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1026
                            iCustomPhone.DisablePhoneLock(wait->iStatus, iSecUi_password);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1027
                            RDEBUG("WaitForRequestL", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1028
                            status = wait->WaitForRequestL();
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1029
                            RDEBUG("WaitForRequestL status", status);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1030
                            delete wait;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1031
                            }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1032
                        }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1033
                    else
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1034
                        {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1035
                        // Failed to get remote lock status
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1036
                        RDEBUG(
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1037
                                "Failed to get Autolock period and RemoteLock status, so do nothing",
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1038
                                0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1039
                        }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1040
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1041
                    delete remoteLockSettings;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1042
                    remoteLockSettings = NULL;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1043
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1044
                    }
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1045
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1046
                } // no Startup
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1047
            }
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1048
            break;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1049
        case KErrGsmSSPasswordAttemptsViolation:
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1050
    				RDEBUG("KErrGsmSSPasswordAttemptsViolation", KErrGsmSSPasswordAttemptsViolation);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1051
    				// and continue
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1052
        case KErrLocked:
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1053
        		{
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1054
            // security code blocked!
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1055
            RDEBUG("KErrLocked", KErrLocked)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1056
            ;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1057
            CSecuritySettings::ShowResultNoteL(R_SEC_BLOCKED, CAknNoteDialog::EErrorTone);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1058
          	}
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1059
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1060
        case KErrGsm0707IncorrectPassword:
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1061
        		{
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1062
    				RDEBUG("KErrGsm0707IncorrectPassword", KErrGsm0707IncorrectPassword);
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1063
            // The Settings caller might retry
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1064
            CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1065
            if(StartUp)
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1066
            	goto askPassPhraseRequiredL;
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1067
          	}
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1068
            break;
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1069
    				// and continue
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1070
        case KErrAccessDenied:
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1071
        		{
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1072
            RDEBUG("KErrAccessDenied", KErrAccessDenied);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1073
            // The Settings caller might retry
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1074
            CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1075
          	}
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1076
            break;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1077
        case R_CODES_DONT_MATCH:	// if password was supposed to be changed, but it failed (the initial verification)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1078
        		{
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1079
            RDEBUG("R_CODES_DONT_MATCH", R_CODES_DONT_MATCH);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1080
            // Error was already displayed
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1081
            returnValue = KErrAccessDenied;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1082
          	}
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1083
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1084
        default:
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1085
        		{
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1086
            RDEBUG("default", status);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1087
            CSecuritySettings::ShowErrorNoteL(status);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1088
            // The Settings caller might retry
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1089
          	}
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1090
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1091
        }
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1092
    RDEBUG("returnValue", returnValue);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1093
    return returnValue;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1094
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1095
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1096
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1097
// CSecurityHandler::Pin1Required()    
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1098
// Handles Pin1Required event
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1099
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1100
// qtdone
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1101
TInt CSecurityHandler::Pin1RequiredL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1102
    {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1103
    /*****************************************************
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1104
     *    Series 60 Customer / ETel
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1105
     *    Series 60  ETel API
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1106
     *****************************************************/
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1107
    RDEBUG("0", 0);
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1108
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1109
    RMobilePhone::TMobilePassword iSecUi_password;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1110
    TInt lCancelSupported = ESecUiCancelNotSupported;
42
hgs
parents: 39
diff changeset
  1111
    TInt lEmergencySupported = ESecUiEmergencyNotSupported;
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1112
    TInt queryAccepted = KErrCancel;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1113
    TInt lAlphaSupported = 0;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1114
    RMobilePhone::TMobilePassword required_fourth;
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1115
    RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePin1;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1116
    RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1117
    RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1118
    TBool StartUp = ETrue;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1119
    TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1120
    TInt err = KErrNone;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1121
    TInt res = KErrGeneral;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1122
    CWait* wait = CWait::NewL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1123
    CleanupStack::PushL(wait);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1124
    RDEBUG("0", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1125
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1126
    StartUp = iStartup;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1127
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1128
    RDEBUG("StartUp", StartUp);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1129
    if (!StartUp)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1130
        {
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1131
        // read a flag to see whether the query is SecUi originated. For example, from CSecuritySettings::ChangePinRequestParamsL
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1132
        err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1133
        if (err != KErrNone)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1134
            {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1135
            RDEBUG("FAILED to get the SECUI query Flag err", err);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1136
            }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1137
        }
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1138
    RDEBUG("err", err);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1139
    RDEBUG("secUiOriginatedQuery", secUiOriginatedQuery);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1140
    RDEBUG("ESecurityUIsSecUIOriginated", ESecurityUIsSecUIOriginated);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1141
    if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone))
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1142
        {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1143
        RDEBUG("0", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1144
        lCancelSupported = ESecUiCancelNotSupported;
42
hgs
parents: 39
diff changeset
  1145
        lEmergencySupported = ESecUiEmergencySupported;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1146
        }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1147
    else
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1148
        {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1149
        lCancelSupported = ESecUiCancelSupported;
42
hgs
parents: 39
diff changeset
  1150
        lEmergencySupported = ESecUiEmergencyNotSupported;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1151
        // it will be RMobilePhone::ESecurityCodePin1 , equivalent to ESecUiNone
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1152
        }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1153
    wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1154
    RDEBUG("GetSecurityCodeInfo", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1155
    iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1156
    res = wait->WaitForRequestL();
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1157
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1158
    RDEBUG("res", res);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1159
#ifdef __WINS__
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1160
    RDEBUG("emulator can't read PIN attempts", res);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1161
    res = KErrNone;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1162
    codeInfo.iRemainingEntryAttempts = 3;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1163
#endif
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1164
		RDEBUG("KErrPermissionDenied", KErrPermissionDenied);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1165
    User::LeaveIfError(res);
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1166
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1167
    RDEBUG("codeInfo.iRemainingEntryAttempts",
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1168
            codeInfo.iRemainingEntryAttempts);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1169
    if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1170
        codeInfo.iRemainingEntryAttempts = -1;
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1171
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1172
    /* request PIN using QT */
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1173
    CSecQueryUi *iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1174
    RDEBUG("CSecQueryUi", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1175
    iSecQueryUi = CSecQueryUi::NewL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1176
    iQueryCanceled = EFalse;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1177
    RDEBUG("SecQueryDialog", 1);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1178
    // ESecUiCodeEtelReqest/ESecUiNone might be useful
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1179
    lAlphaSupported = ESecUiAlphaNotSupported;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1180
    TBuf<0x100> title;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1181
    title.Zero();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1182
    HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin_code"));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1183
    title.Append(stringHolder->Des());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1184
    CleanupStack::PopAndDestroy(stringHolder);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1185
    title.Append(_L("$"));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1186
    title.AppendNum(codeInfo.iRemainingEntryAttempts);
42
hgs
parents: 39
diff changeset
  1187
    TInt amode = ESecUiSecretSupported | lAlphaSupported | lCancelSupported | lEmergencySupported | secCodeType;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1188
    RDEBUG("amode", amode);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1189
    queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, amode);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1190
    RDEBUG("iSecUi_password", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1191
    RDEBUGSTR(iSecUi_password);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1192
    iQueryCanceled = ETrue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1193
    delete iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1194
    RDEBUG("queryAccepted", queryAccepted);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1195
    /* end request PIN using QT */
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1196
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1197
    if (queryAccepted == KErrAbort) // emergency call
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1198
        {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1199
        RDEBUG("queryAccepted", queryAccepted);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1200
        CleanupStack::PopAndDestroy(wait); // this is needed
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1201
        return KErrCancel;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1202
        }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1203
    if (lCancelSupported && (queryAccepted == KErrCancel))
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1204
        {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1205
        // cancel code request
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1206
        RDEBUG("AbortSecurityCode", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1207
        iPhone.AbortSecurityCode(RMobilePhone::ESecurityCodePin1);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1208
        RDEBUG("AbortSecurityCode", 1);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1209
        CleanupStack::PopAndDestroy(wait); // this is needed
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1210
        return KErrCancel;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1211
        }
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1212
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1213
    RDEBUG("iSecUi_password", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1214
    RDEBUGSTR(iSecUi_password);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1215
    RDEBUG("VerifySecurityCode", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1216
    iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1217
    RDEBUG("WaitForRequestL", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1218
    res = wait->WaitForRequestL();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1219
    RDEBUG("WaitForRequestL res", res);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1220
    CleanupStack::PopAndDestroy(wait);
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1221
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1222
    TInt returnValue = res;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1223
    switch (res)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1224
        {
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1225
        case KErrNone:
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1226
            // code approved
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1227
            RDEBUG("code approved", res)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1228
            ;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1229
            if (lCancelSupported == ESecUiCancelNotSupported)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1230
                { // OK note is not displayed in boot-up, to make things faster
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1231
                CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1232
                }
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1233
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1234
        case KErrGsm0707IncorrectPassword:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1235
        case KErrAccessDenied:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1236
            // code was entered erroneously
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1237
            CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1238
           	RDEBUG("StartUp", StartUp);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1239
            if (StartUp)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1240
                {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1241
                returnValue = Pin1RequiredL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1242
                }
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1243
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1244
        case KErrGsmSSPasswordAttemptsViolation:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1245
        case KErrLocked:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1246
            // code blocked; show error note and terminate.
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1247
            // what if not during Startup? Probably it's Ok since the SIM would had also failed at StartUp
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1248
           	RDEBUG("StartUp", StartUp);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1249
            if (StartUp)
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1250
                CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1251
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1252
        case KErrGsm0707SimWrong:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1253
            // sim lock active
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1254
            // no error? This is strange
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1255
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1256
        default:
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1257
        		{
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1258
            CSecuritySettings::ShowErrorNoteL(res);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1259
            if (StartUp)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1260
                {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1261
                returnValue = Pin1RequiredL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1262
                }
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1263
            }
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1264
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1265
        }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1266
    return returnValue;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1267
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1268
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1269
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1270
// CSecurityHandler::Puk1Required()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1271
// Handles Puk1Required event
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1272
// First asks the PUK1, then verifies, then the newPIN + re-type , and then writes . This is odd, but the API needs the PUK and newPIN in same step.
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1273
// Afterwards, the PIN1 might be asked (because the initial program still needs it)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1274
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1275
// qtdone
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1276
TInt CSecurityHandler::Puk1RequiredL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1277
    {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1278
    /*****************************************************
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1279
     *    Series 60 Customer / ETel
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1280
     *    Series 60  ETel API
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1281
     *****************************************************/
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1282
		askPuk1RequiredL:
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1283
    RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1284
    TInt queryAccepted = KErrCancel;
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1285
    RMobilePhone::TMobilePassword puk1_password;
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1286
    RMobilePhone::TMobilePassword aNewPinPassword;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1287
    RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1288
    RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1289
    RMobilePhone::TMobilePhoneSecurityCode blockCodeType;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1290
    blockCodeType = RMobilePhone::ESecurityCodePuk1;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1291
    CWait* wait = CWait::NewL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1292
    CleanupStack::PushL(wait);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1293
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1294
    TBool StartUp(ETrue);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1295
    StartUp = iStartup;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1296
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1297
    TInt res(KErrCancel); // for the first try
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1298
    wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1299
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1300
    TInt thisTry = 0;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1301
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1302
    // If there was a problem (as there might be in case we're dropping off SIM Access Profile); try again a couple of times.
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1303
    while (res != KErrNone && (thisTry++) <= KTriesToConnectServer)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1304
        {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1305
        if (thisTry > 0)
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1306
            User::After(KTimeBeforeRetryingRequest);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1307
        RDEBUG("GetSecurityCodeInfo", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1308
        iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1309
        RDEBUG("WaitForRequestL", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1310
        res = wait->WaitForRequestL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1311
        RDEBUG("WaitForRequestL res", res);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1312
        }
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1313
    RDEBUG("res", res);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1314
    // If there's still an error we're doomed. Bail out.
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1315
    User::LeaveIfError(res);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1316
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1317
    RDEBUG("StartUp", StartUp);
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1318
    RDEBUG("codeInfo.iRemainingEntryAttempts",
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1319
            codeInfo.iRemainingEntryAttempts);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1320
    TInt attempts(codeInfo.iRemainingEntryAttempts);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1321
    RDEBUG("attempts", attempts);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1322
    // show the last "Code Error" note of PIN verify result here so it won't be left under the PUK1 dialog
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1323
    if (!StartUp && (attempts == KMaxNumberOfPUKAttempts))
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1324
        CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1325
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1326
    if (attempts == KMaxNumberOfPINAttempts)
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1327
        attempts = -1;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1328
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1329
    CSecQueryUi *iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1330
    RDEBUG("CSecQueryUi", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1331
    iSecQueryUi = CSecQueryUi::NewL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1332
    iQueryCanceled = EFalse;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1333
    RDEBUG("SecQueryDialog", 1);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1334
    // ESecUiCodeEtelReqest/ESecUiNone might be useful
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1335
    TBuf<0x100> title;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1336
    title.Zero();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1337
    HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk_code"));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1338
    title.Append(stringHolder->Des());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1339
    CleanupStack::PopAndDestroy(stringHolder);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1340
    title.Append(_L("$"));
22
6b63ca65093a Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 19
diff changeset
  1341
    title.AppendNum(attempts);
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1342
    TInt lSecUiCancelSupported = ESecUiCancelSupported | ESecUiEmergencyNotSupported;
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1343
    RDEBUG("StartUp", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1344
    if (StartUp) // how to know whether PUK comes from failing at Starter, or failing at any other PIN (i.e. changing PIN, or changing PIN-request) ???
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1345
    		{
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1346
        lSecUiCancelSupported = ESecUiCancelNotSupported | ESecUiEmergencySupported;
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1347
        RDEBUG("new ", lSecUiCancelSupported);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1348
      	}
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1349
    queryAccepted = iSecQueryUi->SecQueryDialog(title, puk1_password, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1350
            | lSecUiCancelSupported | ESecUiPukRequired);
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1351
    RDEBUG("puk1_password", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1352
    RDEBUGSTR(puk1_password);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1353
    iQueryCanceled = ETrue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1354
    delete iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1355
    RDEBUG("queryAccepted", queryAccepted);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1356
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1357
    if ((queryAccepted == KErrAbort) || (queryAccepted == KErrCancel))
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1358
        {
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1359
        CleanupStack::PopAndDestroy(wait); // this is needed
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1360
        return KErrCancel;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1361
        }
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1362
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1363
    // send code
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1364
    // first we verify the puk. For this, we reset the PIN to the same as the PUK
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1365
    // Hopefully this will never fail in the case "new PIN too long"
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1366
    RDEBUG("VerifySecurityCode", 0);
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1367
    iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, puk1_password, puk1_password);
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1368
    RDEBUG("WaitForRequestL", 0);
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1369
    res = wait->WaitForRequestL();
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1370
    RDEBUG("WaitForRequestL res", res);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1371
    CleanupStack::PopAndDestroy(wait);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1372
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1373
    TInt returnValue = res;
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1374
    switch (res)
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1375
        {
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1376
        case KErrNone:
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1377
            // code approved -> note . The process continue and new-pin is requested
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1378
            CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone);
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1379
            break;
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1380
        case KErrGsm0707IncorrectPassword:
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1381
        case KErrAccessDenied:
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1382
            // wrong PUK code -> note -> ask PUK code again        
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1383
            CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1384
           	RDEBUG("goto askPuk1RequiredL", 0);
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1385
            goto askPuk1RequiredL;
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1386
            // break;
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1387
        case KErrGsm0707SimWrong:
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1388
            // sim lock active
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1389
            // no message ?
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1390
            break;
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1391
        case KErrGsmSSPasswordAttemptsViolation:
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1392
        case KErrLocked:
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1393
            // sim card rejected.
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1394
            break;
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1395
        default:
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1396
            CSecuritySettings::ShowErrorNoteL(res);
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1397
           	RDEBUG("goto askPuk1RequiredL", 0);
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1398
            goto askPuk1RequiredL;
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1399
            // break;
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1400
        }
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1401
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1402
    // Now the PUK1 is validated. It's time for asking the new PIN1
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1403
    RDEBUG("new wait", 0);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1404
    wait = CWait::NewL();
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1405
    CleanupStack::PushL(wait);
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1406
        {
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1407
        // new-pin query
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1408
        CSecQueryUi * iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1409
        RDEBUG("CSecQueryUi", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1410
        iSecQueryUi = CSecQueryUi::NewL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1411
        iQueryCanceled = EFalse;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1412
        RDEBUG("SecQueryDialog", 1);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1413
        TBuf<0x100> title;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1414
        title.Zero();
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1415
        HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin_code"));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1416
        title.Append(stringHolder->Des());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1417
        CleanupStack::PopAndDestroy(stringHolder);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1418
        title.Append(_L("|"));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1419
        HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_verify_new_pin_code"));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1420
        title.Append(stringHolder2->Des());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1421
        CleanupStack::PopAndDestroy(stringHolder2);
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1422
        lSecUiCancelSupported = ESecUiCancelNotSupported; 	// initialy it was ESecUiCancelSupported , but an error said "Becaouse, if it is can be canceled, why desigh this step about newpincode confirm"
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1423
        																										// Somehow both scenarios make sense: User should not cancel because the code has been already changed to PUK.
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1424
        																										// On the other hand, this happened because user forgot the PIN. Now you know it: same as PUK. So user can cancel.
53
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1425
        RDEBUG("StartUp", 0);
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1426
		    if (StartUp) // how to know whether PUK comes from failing at Starter, or failing at any other PIN (i.e. changing PIN, or changing PIN-request) ???
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1427
		    		{
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1428
		    		lSecUiCancelSupported = ESecUiCancelNotSupported;
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1429
		    		}
25dd1e8b2663 201035_01
hgs
parents: 48
diff changeset
  1430
        queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPinPassword, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | lSecUiCancelSupported
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1431
                | ESecUiPukRequired);
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1432
        RDEBUG("aNewPinPassword", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1433
        RDEBUGSTR(aNewPinPassword);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1434
        iQueryCanceled = ETrue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1435
        delete iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1436
        RDEBUG("queryAccepted", queryAccepted);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1437
        }
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1438
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1439
    if ((queryAccepted == KErrAbort) || (queryAccepted == KErrCancel))
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1440
        {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1441
        CleanupStack::PopAndDestroy(wait);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1442
        return KErrCancel;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1443
        }
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1444
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1445
    // send code again, now with the user pin
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1446
    RDEBUG("VerifySecurityCode", 0);
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1447
    iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPinPassword, puk1_password);	// TODO why not ChangeSecurityCode ?
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1448
    RDEBUG("WaitForRequestL", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1449
    res = wait->WaitForRequestL();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1450
    RDEBUG("WaitForRequestL res", res);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1451
    CleanupStack::PopAndDestroy(wait);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1452
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1453
		// this can't fail, because PUK1 was just verified
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1454
    returnValue = res;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1455
    switch (res)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1456
        {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1457
        case KErrNone:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1458
            // code approved -> note
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1459
            CSecuritySettings::ShowResultNoteL(R_PIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1460
            break;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1461
        case KErrGsm0707IncorrectPassword:
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1462
        case KErrAccessDenied:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1463
            // wrong PUK code -> note -> ask PUK code again        
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1464
            CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1465
            returnValue = Puk1RequiredL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1466
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1467
        case KErrGsm0707SimWrong:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1468
            // sim lock active
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1469
            // no message ?
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1470
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1471
        case KErrGsmSSPasswordAttemptsViolation:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1472
        case KErrLocked:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1473
            // sim card rejected.
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1474
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1475
        default:
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1476
            CSecuritySettings::ShowErrorNoteL(res);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1477
            returnValue = Puk1RequiredL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1478
            break;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1479
        }
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1480
    RDEBUG("returnValue", returnValue);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1481
    return returnValue;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1482
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1483
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1484
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1485
// CSecurityHandler::Pin2Required()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1486
// Handles Pin2Required event
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1487
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1488
// qtdone
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1489
void CSecurityHandler::Pin2RequiredL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1490
    {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1491
    /*****************************************************
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1492
     *    Series 60 Customer / ETel
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1493
     *    Series 60  ETel API
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1494
     *****************************************************/
15
318c4eab2439 Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 1
diff changeset
  1495
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1496
    RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1497
    TInt queryAccepted = KErrCancel;
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1498
    RMobilePhone::TMobilePassword iSecUi_password;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1499
    RMobilePhone::TMobilePassword required_fourth;
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1500
    RMobilePhone::TMobilePhoneSecurityCode secCodeType(RMobilePhone::ESecurityCodePin2);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1501
    RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1502
    RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1503
    CWait* wait = CWait::NewL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1504
    CleanupStack::PushL(wait);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1505
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1506
    wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1507
    RDEBUG("GetSecurityCodeInfo", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1508
    iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1509
    RDEBUG("WaitForRequestL", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1510
    TInt ret = wait->WaitForRequestL();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1511
    RDEBUG("WaitForRequestL ret", ret);
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1512
    User::LeaveIfError(ret);
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1513
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1514
    RDEBUG("codeInfo.iRemainingEntryAttempts",
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1515
            codeInfo.iRemainingEntryAttempts);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1516
    if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts)
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1517
        codeInfo.iRemainingEntryAttempts = -1;
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1518
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1519
    /* request PIN using QT */
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1520
    CSecQueryUi *iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1521
    RDEBUG("CSecQueryUi", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1522
    iSecQueryUi = CSecQueryUi::NewL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1523
    iQueryCanceled = EFalse;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1524
    RDEBUG("SecQueryDialog", 1);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1525
    // ESecUiCodeEtelReqest/ESecUiNone might be useful against KLastRemainingInputAttempt
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1526
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1527
    TBuf<0x100> title;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1528
    title.Zero();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1529
    HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_pin2_code"));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1530
    title.Append(stringHolder->Des());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1531
    CleanupStack::PopAndDestroy(stringHolder);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1532
    title.Append(_L("$"));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1533
    title.AppendNum(codeInfo.iRemainingEntryAttempts);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1534
    queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1535
            | ESecUiCancelSupported | secCodeType);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1536
    RDEBUG("iSecUi_password", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1537
    RDEBUGSTR(iSecUi_password);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1538
    RDEBUG("queryAccepted", queryAccepted);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1539
    iQueryCanceled = ETrue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1540
    delete iSecQueryUi;
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1541
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1542
    // If failed or device became locked, any pending request should be cancelled.
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1543
    if (queryAccepted != KErrNone)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1544
        {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1545
        RDEBUG("AbortSecurityCode", 0);
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1546
        iPhone.AbortSecurityCode(secCodeType);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1547
        RDEBUG("AbortSecurityCode", 1);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1548
        CleanupStack::PopAndDestroy(wait);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1549
        return;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1550
        }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1551
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1552
    RDEBUG("VerifySecurityCode", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1553
    iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1554
    RDEBUG("WaitForRequestL", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1555
    TInt status = wait->WaitForRequestL();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1556
    RDEBUG("WaitForRequestL status", status);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1557
    CleanupStack::PopAndDestroy(wait);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1558
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1559
    switch (status)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1560
        {
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1561
        case KErrNone:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1562
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1563
        case KErrGsm0707IncorrectPassword:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1564
        case KErrAccessDenied:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1565
            // code was entered erroneously
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1566
            CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1567
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1568
        case KErrGsmSSPasswordAttemptsViolation:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1569
        case KErrLocked:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1570
            // blocked
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1571
            CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1572
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1573
        default:
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1574
            CSecuritySettings::ShowErrorNoteL(status);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1575
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1576
        }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1577
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1578
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1579
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1580
// CSecurityHandler::Puk2Required()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1581
// Handles Puk2Required event
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1582
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1583
// qtdone
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1584
void CSecurityHandler::Puk2RequiredL()
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1585
    {
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1586
    /*****************************************************
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1587
     *    Series 60 Customer / ETel
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1588
     *    Series 60  ETel API
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1589
     *****************************************************/
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1590
    askPuk2RequiredL:
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1591
    RDEBUG("0", 0);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1592
    TInt queryAccepted = KErrCancel;
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1593
    RMobilePhone::TMobilePassword iSecUi_password;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1594
    RMobilePhone::TMobilePassword aNewPassword;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1595
    RMobilePhone::TMobilePassword verifcationPassword;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1596
    RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1597
    RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1598
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1599
    RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityCodePuk2;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1600
    CWait* wait = CWait::NewL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1601
    CleanupStack::PushL(wait);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1602
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1603
    // ask PUK2
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1604
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1605
    TInt ret(KErrNone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1606
    wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1607
    RDEBUG("GetSecurityCodeInfo", 0);
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1608
    iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1609
    RDEBUG("WaitForRequestL", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1610
    ret = wait->WaitForRequestL();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1611
    RDEBUG("WaitForRequestL ret", ret);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1612
    User::LeaveIfError(ret);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1613
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1614
    /* request PIN using QT */
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1615
    CSecQueryUi *iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1616
    RDEBUG("CSecQueryUi", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1617
    iSecQueryUi = CSecQueryUi::NewL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1618
    iQueryCanceled = EFalse;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1619
    RDEBUG("SecQueryDialog", 1);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1620
    // ESecUiCodeEtelReqest/ESecUiNone might be useful
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1621
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1622
    RDEBUG("codeInfo.iRemainingEntryAttempts",
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1623
            codeInfo.iRemainingEntryAttempts);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1624
    if (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPINAttempts) // TODO this might be 10 ?
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1625
        codeInfo.iRemainingEntryAttempts = -1;
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1626
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1627
    TBuf<0x100> title;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1628
    title.Zero();
48
6ed68423b759 201033_01
hgs
parents: 42
diff changeset
  1629
    HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk2_code"));
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1630
    title.Append(stringHolder->Des());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1631
    CleanupStack::PopAndDestroy(stringHolder);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1632
    title.Append(_L("$"));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1633
    title.AppendNum(codeInfo.iRemainingEntryAttempts);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1634
    queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PUK2_CODE_MIN_LENGTH, SEC_C_PUK2_CODE_MAX_LENGTH, ESecUiSecretNotSupported | ESecUiAlphaNotSupported
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1635
            | ESecUiCancelSupported | secCodeType);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1636
    RDEBUG("iSecUi_password", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1637
    RDEBUGSTR(iSecUi_password);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1638
    iQueryCanceled = ETrue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1639
    delete iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1640
    RDEBUG("queryAccepted", queryAccepted);
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1641
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1642
    if (queryAccepted != KErrNone)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1643
        {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1644
        // cancel "get security unblock code" request
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1645
        RDEBUG("AbortSecurityCode", 0);
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1646
        iPhone.AbortSecurityCode(secCodeType);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1647
        RDEBUG("AbortSecurityCode", 1);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1648
        CleanupStack::PopAndDestroy(1); //wait
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1649
        return;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1650
        }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1651
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1652
    RDEBUG("VerifySecurityCode", 0);
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1653
    iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, iSecUi_password);
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1654
    // this writes the newPIN2 with the value of PUK2. It's ok, since the user forgot it
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1655
    RDEBUG("WaitForRequestL", 0);
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1656
    TInt res = wait->WaitForRequestL();
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1657
    RDEBUG("WaitForRequestL res", res);
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1658
    CleanupStack::PopAndDestroy(wait);
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1659
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1660
    switch (res)
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1661
        {
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1662
        case KErrNone:
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1663
            // code approved -> note
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1664
            CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EConfirmationTone);
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1665
            break;
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1666
        case KErrGsm0707IncorrectPassword:
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1667
        case KErrAccessDenied:
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1668
            // wrong PUK2 code -> note -> ask PUK2 code again        
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1669
            CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1670
            RDEBUG("goto askPuk2RequiredL", 0);
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1671
            goto askPuk2RequiredL;
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1672
            // break;
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1673
        case KErrGsmSSPasswordAttemptsViolation:
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1674
        case KErrLocked:
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1675
            // Pin2 features blocked permanently!
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1676
            CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone);
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1677
            break;
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1678
        default:
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1679
            CSecuritySettings::ShowErrorNoteL(res);
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1680
            RDEBUG("goto askPuk2RequiredL", 0);
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1681
            goto askPuk2RequiredL;
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1682
            // break;
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1683
        }
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1684
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1685
    // now the PUK2 is valid. Time to get the new PIN2
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1686
    wait = CWait::NewL();
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1687
    CleanupStack::PushL(wait);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1688
        {
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1689
        // new pin2 code query
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1690
        CSecQueryUi * iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1691
        RDEBUG("CSecQueryUi", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1692
        iSecQueryUi = CSecQueryUi::NewL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1693
        iQueryCanceled = EFalse;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1694
        TBuf<0x100> title;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1695
        title.Zero();
48
6ed68423b759 201033_01
hgs
parents: 42
diff changeset
  1696
        HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_pin2_code"));
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1697
        title.Append(stringHolder->Des());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1698
        CleanupStack::PopAndDestroy(stringHolder);
48
6ed68423b759 201033_01
hgs
parents: 42
diff changeset
  1699
        title.Append(_L("|"));
6ed68423b759 201033_01
hgs
parents: 42
diff changeset
  1700
        HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify"));
6ed68423b759 201033_01
hgs
parents: 42
diff changeset
  1701
        title.Append(stringHolder2->Des());
6ed68423b759 201033_01
hgs
parents: 42
diff changeset
  1702
        CleanupStack::PopAndDestroy(stringHolder2);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1703
        // ESecUiCodeEtelReqest/ESecUiNone might be useful
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1704
        queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPassword, SEC_C_PIN2_CODE_MIN_LENGTH, SEC_C_PIN2_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1705
                | secCodeType);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1706
        RDEBUG("aNewPassword", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1707
        RDEBUGSTR(aNewPassword);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1708
        iQueryCanceled = ETrue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1709
        delete iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1710
        RDEBUG("queryAccepted", queryAccepted);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1711
        if (queryAccepted != KErrNone)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1712
            {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1713
            // cancel "get security unblock code" request
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1714
            RDEBUG("AbortSecurityCode", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1715
            iPhone.AbortSecurityCode(secCodeType);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1716
            RDEBUG("AbortSecurityCode", 1);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1717
            CleanupStack::PopAndDestroy(1); //wait
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1718
            return;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1719
            }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1720
        }
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1721
    // send code. The code was temporarilly changed before. Thus, this really done to set the new-new one
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1722
    RDEBUG("VerifySecurityCode", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1723
    iPhone.VerifySecurityCode(wait->iStatus, secCodeType, aNewPassword, iSecUi_password);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1724
    RDEBUG("WaitForRequestL", 0);
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  1725
    res = wait->WaitForRequestL();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1726
    RDEBUG("WaitForRequestL res", res);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1727
    CleanupStack::PopAndDestroy(wait);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1728
59
881d92421467 201037_03
hgs
parents: 53
diff changeset
  1729
		// this can't fail, as PUK2 was just verified
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1730
    switch (res)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1731
        {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1732
        case KErrNone:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1733
            // code approved -> note
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1734
            CSecuritySettings::ShowResultNoteL(R_PIN2_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1735
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1736
        case KErrGsm0707IncorrectPassword:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1737
        case KErrAccessDenied:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1738
            // wrong PUK2 code -> note -> ask PUK2 code again        
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1739
            CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1740
            Puk2RequiredL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1741
            break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1742
        case KErrGsmSSPasswordAttemptsViolation:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1743
        case KErrLocked:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1744
            // Pin2 features blocked permanently!
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1745
            CSecuritySettings::ShowResultNoteL(R_PIN2_REJECTED, CAknNoteDialog::EConfirmationTone);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1746
            break;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1747
        default:
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1748
            CSecuritySettings::ShowErrorNoteL(res);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1749
            Puk2RequiredL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1750
            break;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1751
        }
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1752
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1753
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1754
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1755
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1756
// CSecurityHandler::UPinRequiredL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1757
// Hendles UniversalPinRequired event
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1758
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1759
// qtdone
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1760
TInt CSecurityHandler::UPinRequiredL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1761
    {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1762
    /*****************************************************
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1763
     *    Series 60 Customer / ETel
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1764
     *    Series 60  ETel API
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1765
     *****************************************************/
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1766
    TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1767
    TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1768
    RDEBUG("wcdmaSupported", wcdmaSupported);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1769
    RDEBUG("upinSupported", upinSupported);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1770
    if (wcdmaSupported || upinSupported)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1771
        {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1772
        TInt queryAccepted = KErrCancel;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1773
        TInt lCancelSupported = ESecUiCancelNotSupported;
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1774
        RMobilePhone::TMobilePassword iSecUi_password;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1775
        RMobilePhone::TMobilePassword required_fourth;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1776
        RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo;
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1777
        RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1778
        RMobilePhone::TMobilePhoneSecurityCode secCodeType = RMobilePhone::ESecurityUniversalPin;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1779
        CWait* wait = CWait::NewL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1780
        CleanupStack::PushL(wait);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1781
        TBool StartUp = ETrue;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1782
        TInt secUiOriginatedQuery(ESecurityUIsSecUIOriginatedUninitialized);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1783
        TInt err = KErrNone;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1784
        TInt res = KErrGeneral;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1785
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1786
        StartUp = iStartup;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1787
        RDEBUG("StartUp", StartUp);
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1788
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1789
        wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1790
        RDEBUG("GetSecurityCodeInfo", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1791
        iPhone.GetSecurityCodeInfo(wait->iStatus, secCodeType, codeInfoPkg);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1792
        RDEBUG("WaitForRequestL", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1793
        res = wait->WaitForRequestL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1794
        RDEBUG("WaitForRequestL res", res);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1795
        User::LeaveIfError(res);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1796
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1797
        if (!StartUp)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1798
            {
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1799
            // read a flag to see whether the query is SecUi originated. 
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1800
            err = RProperty::Get(KPSUidSecurityUIs, KSecurityUIsSecUIOriginatedQuery, secUiOriginatedQuery);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1801
            }
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1802
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1803
        /* request PIN using QT */
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1804
        CSecQueryUi *iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1805
        RDEBUG("CSecQueryUi", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1806
        iSecQueryUi = CSecQueryUi::NewL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1807
        iQueryCanceled = EFalse;
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1808
        // ESecUiCodeEtelReqest/ESecUiNone might be useful
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1809
        // TODO also support Emergency
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1810
        if (StartUp || (secUiOriginatedQuery != ESecurityUIsSecUIOriginated) || (err != KErrNone))
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1811
            lCancelSupported = ESecUiCancelNotSupported;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1812
        else
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1813
            lCancelSupported = ESecUiCancelSupported;
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1814
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1815
        TBuf<0x100> title;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1816
        title.Zero();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1817
        HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_upin_code"));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1818
        title.Append(stringHolder->Des());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1819
        CleanupStack::PopAndDestroy(stringHolder);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1820
        title.Append(_L("$"));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1821
        title.AppendNum(codeInfo.iRemainingEntryAttempts);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1822
        queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PIN_CODE_MIN_LENGTH, SEC_C_PIN_CODE_MAX_LENGTH, ESecUiSecretSupported | ESecUiAlphaNotSupported
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1823
                | lCancelSupported | ESecUiCodeEtelReqest);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1824
        RDEBUG("iSecUi_password", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1825
        RDEBUGSTR(iSecUi_password);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1826
        iQueryCanceled = ETrue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1827
        delete iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1828
        RDEBUG("queryAccepted", queryAccepted);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1829
        if (queryAccepted != KErrNone)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1830
            {
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1831
            CleanupStack::PopAndDestroy(wait);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1832
            RDEBUG("AbortSecurityCode", 0);
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1833
            iPhone.AbortSecurityCode(RMobilePhone::ESecurityUniversalPin);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1834
            RDEBUG("AbortSecurityCode", 1);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1835
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1836
            return KErrCancel;
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1837
            }
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1838
        RDEBUG("VerifySecurityCode", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1839
        iPhone.VerifySecurityCode(wait->iStatus, secCodeType, iSecUi_password, required_fourth);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1840
        RDEBUG("WaitForRequestL", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1841
        res = wait->WaitForRequestL();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1842
        RDEBUG("WaitForRequestL res", res);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1843
        CleanupStack::PopAndDestroy(wait);
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1844
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1845
        TInt returnValue = res;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1846
        switch (res)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1847
            {
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1848
            case KErrNone:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1849
                // code approved 
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1850
                RDEBUG("code approved ", 0)
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1851
                ;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1852
                CSecuritySettings::ShowResultNoteL(R_CONFIRMATION_NOTE, CAknNoteDialog::EConfirmationTone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1853
                break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1854
            case KErrGsm0707IncorrectPassword:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1855
            case KErrAccessDenied:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1856
                // code was entered erroneously
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1857
                CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1858
                if (StartUp)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1859
                    {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1860
                    returnValue = UPinRequiredL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1861
                    }
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1862
                break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1863
            case KErrGsmSSPasswordAttemptsViolation:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1864
            case KErrLocked:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1865
                // code blocked; show error note and terminate.
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1866
                if (StartUp)
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1867
                    CSecuritySettings::ShowResultNoteL(res, CAknNoteDialog::EErrorTone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1868
                break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1869
            case KErrGsm0707SimWrong:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1870
                // sim lock active
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1871
                break;
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1872
            default: // for example, KErrArgument
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1873
                CSecuritySettings::ShowErrorNoteL(res);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1874
                if (StartUp)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1875
                    {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1876
                    returnValue = UPinRequiredL();
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1877
                    }
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1878
                break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1879
            }
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1880
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1881
        return returnValue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1882
        }
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1883
    else
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1884
        return KErrNone;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1885
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1886
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1887
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1888
// CSecurityHandler::UPukRequiredL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1889
// Handles UPukRequired event
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1890
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1891
// qtdone
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1892
TInt CSecurityHandler::UPukRequiredL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1893
    {
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1894
    TBool wcdmaSupported(FeatureManager::FeatureSupported(KFeatureIdProtocolWcdma));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1895
    TBool upinSupported(FeatureManager::FeatureSupported(KFeatureIdUpin));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1896
    if (wcdmaSupported || upinSupported)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1897
        {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1898
        RDEBUG("0", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1899
        TInt queryAccepted = KErrCancel;
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1900
        RMobilePhone::TMobilePassword iSecUi_password;
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1901
        RMobilePhone::TMobilePassword aNewPassword;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1902
        RMobilePhone::TMobilePhoneSecurityCodeInfoV5 codeInfo;
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1903
        RMobilePhone::TMobilePhoneSecurityCodeInfoV5Pckg codeInfoPkg(codeInfo);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1904
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1905
        RMobilePhone::TMobilePhoneSecurityCode blockCodeType;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1906
        blockCodeType = RMobilePhone::ESecurityUniversalPuk;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1907
        CWait* wait = CWait::NewL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1908
        CleanupStack::PushL(wait);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1909
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1910
        TBool StartUp(ETrue);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1911
        StartUp = iStartup;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1912
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1913
        TInt res(KErrNone);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1914
        wait->SetRequestType(EMobilePhoneGetSecurityCodeInfo);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1915
        RDEBUG("GetSecurityCodeInfo", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1916
        iPhone.GetSecurityCodeInfo(wait->iStatus, blockCodeType, codeInfoPkg);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1917
        RDEBUG("WaitForRequestL", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1918
        res = wait->WaitForRequestL();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1919
        RDEBUG("WaitForRequestL res", res);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1920
        User::LeaveIfError(res);
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1921
        //show last "Code Error" note for UPIN verify result so it won't be left under the PUK1 dialog
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1922
        if (!StartUp && (codeInfo.iRemainingEntryAttempts == KMaxNumberOfPUKAttempts))
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1923
            CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1924
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1925
        // ask UPUK code
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1926
        /* request PIN using QT */
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1927
            {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1928
            CSecQueryUi *iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1929
            RDEBUG("CSecQueryUi", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1930
            iSecQueryUi = CSecQueryUi::NewL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1931
            iQueryCanceled = EFalse;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1932
            // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1933
            // TODO also support Emergency
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1934
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1935
            TBuf<0x100> title;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1936
            title.Zero();
48
6ed68423b759 201033_01
hgs
parents: 42
diff changeset
  1937
            HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_puk_code"));
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1938
            title.Append(stringHolder->Des());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1939
            CleanupStack::PopAndDestroy(stringHolder);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1940
            title.Append(_L("$"));
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1941
            title.AppendNum(codeInfo.iRemainingEntryAttempts);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1942
            queryAccepted = iSecQueryUi->SecQueryDialog(title, iSecUi_password, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1943
                    | ESecUiCancelSupported | ESecUiPukRequired);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1944
            RDEBUG("iSecUi_password", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1945
            RDEBUGSTR(iSecUi_password);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1946
            iQueryCanceled = ETrue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1947
            delete iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1948
            RDEBUG("queryAccepted", queryAccepted);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1949
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1950
            if (queryAccepted != KErrNone)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1951
                {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1952
                CleanupStack::PopAndDestroy(wait);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1953
                return KErrCancel;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1954
                }
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1955
            }
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1956
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1957
            {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1958
            /* request PIN using QT */
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1959
            CSecQueryUi *iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1960
            RDEBUG("CSecQueryUi", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1961
            iSecQueryUi = CSecQueryUi::NewL();
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1962
            iQueryCanceled = EFalse;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1963
            // TODO ESecUiCodeEtelReqest/ESecUiNone might be useful
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1964
            // TODO also support Emergency
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1965
            TBuf<0x100> title;
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1966
            title.Zero();
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1967
            HBufC* stringHolder = HbTextResolverSymbian::LoadLC(_L("txt_pin_code_dialog_new_upin_code"));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1968
            title.Append(stringHolder->Des());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1969
            CleanupStack::PopAndDestroy(stringHolder);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1970
            title.Append(_L("|"));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1971
            HBufC* stringHolder2 = HbTextResolverSymbian::LoadLC(_L("Verify"));
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1972
            title.Append(stringHolder2->Des());
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1973
            CleanupStack::PopAndDestroy(stringHolder2);
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1974
            queryAccepted = iSecQueryUi->SecQueryDialog(title, aNewPassword, SEC_C_PUK_CODE_MIN_LENGTH, SEC_C_PUK_CODE_MAX_LENGTH, ESecUiAlphaNotSupported | ESecUiCancelSupported
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1975
                    | ESecUiPukRequired);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1976
            RDEBUG("aNewPassword", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1977
            RDEBUGSTR(aNewPassword);
30
cc1cea6aabaf 201025_01
hgs
parents: 26
diff changeset
  1978
            iQueryCanceled = ETrue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1979
            delete iSecQueryUi;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1980
            RDEBUG("queryAccepted", queryAccepted);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1981
            if (queryAccepted != KErrNone)
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1982
                {
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1983
                CleanupStack::PopAndDestroy(wait);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1984
                return KErrCancel;
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1985
                }
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1986
            }
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  1987
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1988
        // send code
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1989
        RDEBUG("VerifySecurityCode", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  1990
        iPhone.VerifySecurityCode(wait->iStatus, blockCodeType, aNewPassword, iSecUi_password);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1991
        RDEBUG("WaitForRequestL", 0);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1992
        res = wait->WaitForRequestL();
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1993
        RDEBUG("WaitForRequestL res", res);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1994
        CleanupStack::PopAndDestroy(wait);
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1995
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1996
        TInt returnValue = res;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  1997
        switch (res)
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1998
            {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  1999
            case KErrNone:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2000
                // code approved -> note
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  2001
                CSecuritySettings::ShowResultNoteL(R_UPIN_CODE_CHANGED_NOTE, CAknNoteDialog::EConfirmationTone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2002
                break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2003
            case KErrGsm0707IncorrectPassword:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2004
            case KErrAccessDenied:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2005
                // wrong PUK code -> note -> ask UPUK code again        
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  2006
                CSecuritySettings::ShowResultNoteL(R_CODE_ERROR, CAknNoteDialog::EErrorTone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2007
                returnValue = UPukRequiredL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2008
                break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2009
            case KErrGsm0707SimWrong:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2010
                // sim lock active
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2011
                break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2012
            case KErrGsmSSPasswordAttemptsViolation:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2013
            case KErrLocked:
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2014
                // sim card rejected.
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2015
                break;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2016
            default:
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  2017
                CSecuritySettings::ShowErrorNoteL(res);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2018
                returnValue = UPukRequiredL();
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2019
                break;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  2020
            }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  2021
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2022
        return returnValue;
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  2023
        }
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  2024
    else
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  2025
        // not wcdmaSupported || upinSupported
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2026
        return KErrNone;
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2027
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2028
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2029
//
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2030
// ----------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2031
// CSecurityHandler::SimLockEventL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2032
// Shows "SIM restriction on" note
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2033
// ----------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  2034
// qtdone
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2035
void CSecurityHandler::SimLockEventL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2036
    {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  2037
    RDEBUG("0", 0);
35
f1030a78d563 201027_01
hgs
parents: 30
diff changeset
  2038
    CSecuritySettings::ShowResultNoteL(R_SIM_ON, CAknNoteDialog::EConfirmationTone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2039
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2040
// ---------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2041
// CSecurityHandler::RemoveSplashScreenL()
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2042
// Removes splash screen
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2043
// ---------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2044
void CSecurityHandler::RemoveSplashScreenL() const
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2045
    {
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2046
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2047
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2048
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2049
// ---------------------------------------------------------
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2050
// CSecurityHandler::ShowGenericErrorNoteL(TInt aStatus)
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2051
// Shows a generic error note
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2052
// ---------------------------------------------------------
17
8957df7b0072 Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 15
diff changeset
  2053
// qtdone
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2054
void CSecurityHandler::ShowGenericErrorNoteL(TInt aStatus)
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2055
    {
19
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  2056
    // Let's create TextResolver instance for error resolving...
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  2057
    RDEBUG("aStatus", aStatus);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  2058
    RDEBUG("!!!!! this should never be called !!!!", 0);
098e361762d2 Revision: 201017
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 17
diff changeset
  2059
26
aad866c37519 Revision: 201021
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 22
diff changeset
  2060
    CSecuritySettings::ShowResultNoteL(aStatus, CAknNoteDialog::EErrorTone);
0
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2061
    }
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2062
164170e6151a Revision: 201004
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
  2063
// End of file