|
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: Implementation of class CAuthenticationDialog. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "AuthenticationDialog.h" |
|
21 #include "ConnDlgPlugin.h" |
|
22 #include "ExpiryTimer.h" |
|
23 |
|
24 #include <uikon/eiksrvui.h> |
|
25 |
|
26 |
|
27 // --------------------------------------------------------- |
|
28 // CAuthenticationDialog::CAuthenticationDialog |
|
29 // --------------------------------------------------------- |
|
30 // |
|
31 CAuthenticationDialog::CAuthenticationDialog( |
|
32 CConnDlgAuthenticationPlugin* aPlugin ) |
|
33 : CAknMultiLineDataQueryDialog( CAknQueryDialog::ENoTone ), |
|
34 iPlugin( aPlugin ) |
|
35 { |
|
36 } |
|
37 |
|
38 |
|
39 // --------------------------------------------------------- |
|
40 // CAuthenticationDialog::~CAuthenticationDialog |
|
41 // --------------------------------------------------------- |
|
42 // |
|
43 CAuthenticationDialog::~CAuthenticationDialog() |
|
44 { |
|
45 |
|
46 STATIC_CAST( CEikServAppUi*, |
|
47 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( EFalse ); |
|
48 delete iExpiryTimer; |
|
49 |
|
50 } |
|
51 |
|
52 |
|
53 // --------------------------------------------------------- |
|
54 // CAuthenticationDialog::NewL |
|
55 // --------------------------------------------------------- |
|
56 // |
|
57 CAuthenticationDialog* CAuthenticationDialog::NewL( |
|
58 CConnDlgAuthenticationPlugin* aPlugin, |
|
59 TDes& aUsername, TDes& aPassword ) |
|
60 { |
|
61 CAuthenticationDialog* dialog = new( ELeave ) |
|
62 CAuthenticationDialog( aPlugin ); |
|
63 CleanupStack::PushL( dialog ); |
|
64 |
|
65 dialog->SetDataL( aUsername, aPassword ); |
|
66 |
|
67 CleanupStack::Pop( dialog ); |
|
68 |
|
69 return dialog; |
|
70 } |
|
71 |
|
72 |
|
73 // --------------------------------------------------------- |
|
74 // CAuthenticationDialog::PreLayoutDynInitL() |
|
75 // --------------------------------------------------------- |
|
76 // |
|
77 void CAuthenticationDialog::PreLayoutDynInitL() |
|
78 { |
|
79 CAknMultiLineDataQueryDialog::PreLayoutDynInitL(); |
|
80 |
|
81 if( FirstData( TPtr( 0, 0 ) ).Length() > 0 ) |
|
82 { |
|
83 MakeLeftSoftkeyVisible( ETrue ); |
|
84 } |
|
85 |
|
86 STATIC_CAST( CEikServAppUi*, |
|
87 CCoeEnv::Static()->AppUi() )->SuppressAppSwitching( ETrue ); |
|
88 |
|
89 iExpiryTimer = CExpiryTimer::NewL( *this ); |
|
90 iExpiryTimer->Start(); |
|
91 } |
|
92 |
|
93 |
|
94 // --------------------------------------------------------- |
|
95 // CAuthenticationDialog::SetInitialCurrentLine() |
|
96 // --------------------------------------------------------- |
|
97 // |
|
98 void CAuthenticationDialog::SetInitialCurrentLine() |
|
99 { |
|
100 CAknMultiLineDataQueryDialog::SetInitialCurrentLine(); |
|
101 |
|
102 iFirstEmpty = FirstData( TPtr( 0,0 ) ).Length() == 0; |
|
103 iSecondEmpty = SecondData( TPtr( 0,0 ) ).Length() == 0; |
|
104 if( !iFirstEmpty || !iSecondEmpty ) |
|
105 { |
|
106 MakeLeftSoftkeyVisible( ETrue ); |
|
107 } |
|
108 } |
|
109 |
|
110 |
|
111 // --------------------------------------------------------- |
|
112 // CAuthenticationDialog::OkToExitL |
|
113 // --------------------------------------------------------- |
|
114 // |
|
115 TBool CAuthenticationDialog::OkToExitL( TInt aButtonId ) |
|
116 { |
|
117 if ( CAknMultiLineDataQueryDialog::OkToExitL( aButtonId ) ) |
|
118 { |
|
119 if ( aButtonId == EAknSoftkeySelect || |
|
120 aButtonId == EAknSoftkeyOk || |
|
121 aButtonId == EAknSoftkeyDone ) |
|
122 { |
|
123 iPlugin->CompleteL( KErrNone ); |
|
124 } |
|
125 else if ( aButtonId== EAknSoftkeyCancel ) |
|
126 { |
|
127 iPlugin->CompleteL( KErrCancel ); |
|
128 } |
|
129 |
|
130 return( ETrue ); |
|
131 } |
|
132 |
|
133 return( EFalse ); |
|
134 } |
|
135 |
|
136 |
|
137 // --------------------------------------------------------- |
|
138 // CAuthenticationDialog::HandleQueryEditorStateEventL |
|
139 // |
|
140 // This code is based on AknQueryDialog.cpp |
|
141 // --------------------------------------------------------- |
|
142 // |
|
143 TBool CAuthenticationDialog::HandleQueryEditorStateEventL( |
|
144 CAknQueryControl* aQueryControl, |
|
145 TQueryControlEvent /*aEventType*/, |
|
146 TQueryValidationStatus aStatus ) |
|
147 { |
|
148 if( STATIC_CAST( CAknMultilineQueryControl*, aQueryControl )->IsFirst() ) |
|
149 { |
|
150 iFirstEmpty = ( aStatus == EEditorEmpty ); |
|
151 } |
|
152 |
|
153 if( STATIC_CAST( CAknMultilineQueryControl*, aQueryControl)->IsSecond() ) |
|
154 { |
|
155 iSecondEmpty = ( aStatus == EEditorEmpty ); |
|
156 } |
|
157 |
|
158 MakeLeftSoftkeyVisible( ( !iFirstEmpty ) || ( !iSecondEmpty ) ); |
|
159 |
|
160 return EFalse; |
|
161 } |
|
162 |
|
163 void CAuthenticationDialog::HandleTimedOut() |
|
164 { |
|
165 TRAP_IGNORE( TryExitL(EAknSoftkeyCancel) ); |
|
166 } |
|
167 |
|
168 |
|
169 // End of File |