|
1 /* |
|
2 * Copyright (c) 2008 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: Implementation of the class CPbkxRclQueryEditor. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "emailtrace.h" |
|
20 #include <pbk2rclengine.rsg> |
|
21 #include <StringLoader.h> |
|
22 #include <aknedsts.h> |
|
23 |
|
24 #include "pbkxremotecontactlookuppanic.h" |
|
25 #include "cpbkxrclqueryeditor.h" |
|
26 #include "pbkxrclengineconstants.h" |
|
27 #include "pbkxrclutils.h" |
|
28 #include "engine.hrh" |
|
29 |
|
30 // ======== MEMBER FUNCTIONS ======== |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // CPbkxRclQueryEditor::CPbkxRclQueryEditor |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 CPbkxRclQueryEditor::CPbkxRclQueryEditor( TDes& aQueryText ) : |
|
37 CAknTextQueryDialog( aQueryText ) |
|
38 { |
|
39 FUNC_LOG; |
|
40 } |
|
41 |
|
42 // --------------------------------------------------------------------------- |
|
43 // CPbkxRclQueryEditor::ConstructL |
|
44 // --------------------------------------------------------------------------- |
|
45 // |
|
46 void CPbkxRclQueryEditor::ConstructL( const TDesC& aAccountName ) |
|
47 { |
|
48 FUNC_LOG; |
|
49 |
|
50 PrepareLC( R_RCL_QUERY_DIALOG ); |
|
51 |
|
52 HBufC* promptBuf = StringLoader::LoadLC( R_QTN_RCL_SEARCH, aAccountName ); |
|
53 SetPromptL( *promptBuf ); |
|
54 CleanupStack::PopAndDestroy( promptBuf ); |
|
55 |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------- |
|
59 // CPbkxRclQueryEditor::NewL |
|
60 // --------------------------------------------------------------------------- |
|
61 // |
|
62 CPbkxRclQueryEditor* CPbkxRclQueryEditor::NewL( |
|
63 const TDesC& aAccountName, |
|
64 TDes& aQueryText ) |
|
65 { |
|
66 FUNC_LOG; |
|
67 CPbkxRclQueryEditor* self = new ( ELeave ) CPbkxRclQueryEditor( aQueryText ); |
|
68 CleanupStack::PushL( self ); |
|
69 self->ConstructL( aAccountName ); |
|
70 CleanupStack::Pop( self ); |
|
71 return self; |
|
72 } |
|
73 |
|
74 // --------------------------------------------------------------------------- |
|
75 // CPbkxRclQueryEditor::~CPbkxRclQueryEditor |
|
76 // --------------------------------------------------------------------------- |
|
77 // |
|
78 CPbkxRclQueryEditor::~CPbkxRclQueryEditor() |
|
79 { |
|
80 FUNC_LOG; |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // CPbkxRclQueryEditor::ExecuteDialogLD |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 TBool CPbkxRclQueryEditor::ExecuteDialogLD() |
|
88 { |
|
89 FUNC_LOG; |
|
90 |
|
91 SetEditorInputModeL(); |
|
92 TInt ret = CAknQueryDialog::RunLD(); |
|
93 return ( TBool )ret; |
|
94 } |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // CPbkxRclQueryEditor::SetEditorInputModeL |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 void CPbkxRclQueryEditor::SetEditorInputModeL() |
|
101 { |
|
102 FUNC_LOG; |
|
103 |
|
104 CAknQueryControl* control = QueryControl(); |
|
105 CEikEdwin* edwin = static_cast<CEikEdwin*>( |
|
106 control->ControlByLayoutOrNull( EDataLayout ) ); |
|
107 |
|
108 User::LeaveIfNull( edwin ); |
|
109 |
|
110 TDes& text = Text(); |
|
111 |
|
112 TCoeInputCapabilities inputCapabilities( edwin->InputCapabilities() ); |
|
113 if ( inputCapabilities.FepAwareTextEditor() |
|
114 && inputCapabilities.FepAwareTextEditor()->Extension1() ) |
|
115 { |
|
116 CAknEdwinState* state = static_cast<CAknEdwinState*>( |
|
117 inputCapabilities.FepAwareTextEditor()->Extension1()->State( |
|
118 KNullUid ) ); |
|
119 |
|
120 if ( text == KNullDesC || |
|
121 PbkxRclUtils::HasAlphaCharsInString( text ) ) |
|
122 { |
|
123 state->SetCurrentInputMode( EAknEditorTextInputMode ); |
|
124 } |
|
125 else |
|
126 { |
|
127 state->SetCurrentInputMode( EAknEditorNumericInputMode ); |
|
128 } |
|
129 } |
|
130 } |
|
131 |