19
|
1 |
/*
|
|
2 |
* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: Setting page class for profile name setting.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
// INCLUDES
|
|
21 |
#include "CProfileNameSettingPage.h"
|
|
22 |
|
|
23 |
#include <aknnotewrappers.h>
|
|
24 |
#include <MProfilesNamesArray.h>
|
|
25 |
#include <profilesettingsview.rsg>
|
|
26 |
#include <StringLoader.h>
|
|
27 |
|
|
28 |
#include "CProfileEngineHandler.h"
|
|
29 |
|
|
30 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
31 |
|
|
32 |
// -----------------------------------------------------------------------------
|
|
33 |
// CProfileNameSettingPage::CProfileNameSettingPage
|
|
34 |
// C++ constructor can NOT contain any code, that might leave.
|
|
35 |
// -----------------------------------------------------------------------------
|
|
36 |
//
|
|
37 |
CProfileNameSettingPage::CProfileNameSettingPage(
|
|
38 |
TInt aResourceID,
|
|
39 |
TDes& aText,
|
|
40 |
TInt aTextSettingPageFlags,
|
|
41 |
CProfileEngineHandler& aEngineHandler )
|
|
42 |
: CAknTextSettingPage( aResourceID, aText, aTextSettingPageFlags ),
|
|
43 |
iEngineHandler( aEngineHandler ),
|
|
44 |
iOriginalText( aText )
|
|
45 |
{
|
|
46 |
}
|
|
47 |
|
|
48 |
// -----------------------------------------------------------------------------
|
|
49 |
// CProfileNameSettingPage::OkToExitL
|
|
50 |
// -----------------------------------------------------------------------------
|
|
51 |
//
|
|
52 |
TBool CProfileNameSettingPage::OkToExitL( TBool aAccept )
|
|
53 |
{
|
|
54 |
if( aAccept )
|
|
55 |
{
|
|
56 |
CEikEdwin* edwin = TextControl();
|
|
57 |
TBuf<KProfileMaxProfileNameLength> editedName;
|
|
58 |
edwin->GetText( editedName );
|
|
59 |
|
|
60 |
if( editedName.Compare( iOriginalText ) == 0 )
|
|
61 |
{
|
|
62 |
return ETrue;
|
|
63 |
}
|
|
64 |
if( iEngineHandler.IdArray()->FindByName( editedName ) != KErrNotFound )
|
|
65 |
{
|
|
66 |
// A profile was found that has the same name which user just entered
|
|
67 |
// and it isn't the currently modified profile
|
|
68 |
|
|
69 |
// Show error note
|
|
70 |
HBufC* errorText = StringLoader::LoadLC( R_PROFILE_TEXT_RENAME_ERROR );
|
|
71 |
CAknErrorNote* note = new( ELeave ) CAknErrorNote( ETrue );
|
|
72 |
note->ExecuteLD( *errorText );
|
|
73 |
CleanupStack::PopAndDestroy( errorText );
|
|
74 |
|
|
75 |
// Set original text to editor
|
|
76 |
edwin->SetTextL( &iOriginalText );
|
|
77 |
|
|
78 |
// Don't let the setting page exit
|
|
79 |
return EFalse;
|
|
80 |
}
|
|
81 |
}
|
|
82 |
return ETrue;
|
|
83 |
}
|
|
84 |
|
|
85 |
// End of File
|