|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Multiquery for user name and password |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "NSmlDMAuthQueryDlg.h" |
|
21 #include "NSmlDMSyncProfile.h" |
|
22 #include "NSmlDMSyncDebug.h" |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // CNSmlDMMultiQuery::NewL |
|
28 // Two-phased constructor. |
|
29 // ----------------------------------------------------------------------------- |
|
30 // |
|
31 CNSmlDMMultiQuery* CNSmlDMMultiQuery::NewL( CNSmlDMSyncAppEngine* aAppEngine, |
|
32 TInt aProfileId, |
|
33 TBool aIsHttp ) |
|
34 { |
|
35 CNSmlDMMultiQuery* self = new( ELeave ) CNSmlDMMultiQuery( aAppEngine, |
|
36 aProfileId, |
|
37 aIsHttp ); |
|
38 CleanupStack::PushL( self ); |
|
39 CleanupStack::Pop( self ); |
|
40 return self; |
|
41 } |
|
42 |
|
43 // ----------------------------------------------------------------------------- |
|
44 // CNSmlDMMultiQuery::CNSmlDMMultiQuery |
|
45 // C++ default constructor can NOT contain any code, that |
|
46 // might leave. |
|
47 // ----------------------------------------------------------------------------- |
|
48 // |
|
49 CNSmlDMMultiQuery::CNSmlDMMultiQuery( CNSmlDMSyncAppEngine* aAppEngine, |
|
50 TInt aProfileId, |
|
51 TBool aIsHttp, |
|
52 TTone aTone /*= ENoTone*/ ) |
|
53 : CAknMultiLineDataQueryDialog( aTone ), |
|
54 iAppEngine( aAppEngine ), |
|
55 iProfileId( aProfileId ), |
|
56 iIsHttp( aIsHttp ) |
|
57 { |
|
58 } |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // Destructor. |
|
62 // ----------------------------------------------------------------------------- |
|
63 // |
|
64 CNSmlDMMultiQuery::~CNSmlDMMultiQuery() |
|
65 { |
|
66 delete iTimer; |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // CNSmlDMMultiQuery::OkToExitL |
|
71 // ----------------------------------------------------------------------------- |
|
72 // |
|
73 TBool CNSmlDMMultiQuery::OkToExitL( TInt aButtonId ) |
|
74 { |
|
75 FLOG( "[OMADM] CNSmlDMMultiQuery::OkToExitL" ); |
|
76 |
|
77 if ( iTimer ) |
|
78 { |
|
79 iTimer->Cancel(); |
|
80 } |
|
81 |
|
82 TBool retValue = CAknMultiLineDataQueryDialog::OkToExitL( aButtonId ); |
|
83 |
|
84 if ( aButtonId == EAknSoftkeySave ) |
|
85 { |
|
86 CAknMultilineQueryControl* firstControl = FirstControl(); |
|
87 firstControl->GetText(iUsername); |
|
88 |
|
89 CAknMultilineQueryControl* secondControl = SecondControl(); |
|
90 secondControl->GetText(iPassword); |
|
91 |
|
92 CNSmlDMSyncProfile* profile = iAppEngine->OpenProfileL( iProfileId ); |
|
93 if ( iIsHttp ) |
|
94 { |
|
95 profile->SetHttpUserNameL( iUsername ); |
|
96 profile->SetHttpPasswordL( iPassword ); |
|
97 } |
|
98 else |
|
99 { |
|
100 profile->SetUserNameL( iUsername ); |
|
101 profile->SetPasswordL( iPassword ); |
|
102 } |
|
103 profile->SaveL(); |
|
104 iAppEngine->CloseProfile(); |
|
105 } |
|
106 return retValue; |
|
107 } |
|
108 |
|
109 // ----------------------------------------------------------------------------- |
|
110 // CNSmlDMMultiQuery::PostLayoutDynInitL |
|
111 // ----------------------------------------------------------------------------- |
|
112 // |
|
113 void CNSmlDMMultiQuery::PostLayoutDynInitL() |
|
114 { |
|
115 FLOG( "[OMADM] CNSmlDMMultiQuery:" ); |
|
116 |
|
117 iTimer = CNSmlDMQueryTimer::NewL( this ); |
|
118 iTimer->After( NSmlDMAuthQueryShowTime * KMultiplier ); // iTime == microseconds |
|
119 } |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CNSmlDMMultiQuery::HandleTimerEndL |
|
123 // ----------------------------------------------------------------------------- |
|
124 // |
|
125 void CNSmlDMMultiQuery::HandleTimerEndL() |
|
126 { |
|
127 FLOG( "[OMADM] CNSmlDMMultiQuery:" ); |
|
128 |
|
129 delete iTimer; |
|
130 iTimer = 0; |
|
131 TryExitL( EEikBidCancel ); |
|
132 } |
|
133 |
|
134 // ----------------------------------------------------------------------------- |
|
135 // CNSmlDMAlertTimer implementation |
|
136 // ----------------------------------------------------------------------------- |
|
137 |
|
138 // ----------------------------------------------------------------------------- |
|
139 // CNSmlDMQueryTimer::CNSmlDMQueryTimer |
|
140 // C++ default constructor can NOT contain any code, that |
|
141 // might leave. |
|
142 // ----------------------------------------------------------------------------- |
|
143 // |
|
144 CNSmlDMQueryTimer::CNSmlDMQueryTimer() : CTimer( EPriorityStandard ) |
|
145 { |
|
146 } |
|
147 |
|
148 // ----------------------------------------------------------------------------- |
|
149 // Destructor. |
|
150 // ----------------------------------------------------------------------------- |
|
151 // |
|
152 CNSmlDMQueryTimer::~CNSmlDMQueryTimer() |
|
153 { |
|
154 Cancel(); |
|
155 } |
|
156 |
|
157 // ----------------------------------------------------------------------------- |
|
158 // CNSmlDMQueryTimer::NewL |
|
159 // Two-phased constructor. |
|
160 // ----------------------------------------------------------------------------- |
|
161 // |
|
162 CNSmlDMQueryTimer* CNSmlDMQueryTimer::NewL( CNSmlDMMultiQuery* aAlertDialog ) |
|
163 { |
|
164 CNSmlDMQueryTimer* self = new (ELeave) CNSmlDMQueryTimer(); |
|
165 CleanupStack::PushL(self); |
|
166 self->ConstructL( aAlertDialog ); |
|
167 CleanupStack::Pop(); // self |
|
168 return self; |
|
169 } |
|
170 |
|
171 // ----------------------------------------------------------------------------- |
|
172 // CNSmlDMQueryTimer::ConstructL |
|
173 // Symbian 2nd phase constructor can leave. |
|
174 // ----------------------------------------------------------------------------- |
|
175 // |
|
176 void CNSmlDMQueryTimer::ConstructL( CNSmlDMMultiQuery* aAlertDialog ) |
|
177 { |
|
178 FLOG( "[OMADM] CNSmlDMQueryTimer: ConstructL" ); |
|
179 |
|
180 iAlertDialog = aAlertDialog; |
|
181 CTimer::ConstructL(); |
|
182 CActiveScheduler::Add(this); |
|
183 } |
|
184 |
|
185 // ----------------------------------------------------------------------------- |
|
186 // CNSmlDMQueryTimer::RunL |
|
187 // ----------------------------------------------------------------------------- |
|
188 // |
|
189 void CNSmlDMQueryTimer::RunL() |
|
190 { |
|
191 FLOG( "[OMADM] CNSmlDMQueryTimer:" ); |
|
192 |
|
193 iAlertDialog->HandleTimerEndL(); |
|
194 } |
|
195 |
|
196 // End of File |