|
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: List query dialog suitable for verifier plug-in use. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 #include "lpdglobalplugindialog.h" |
|
21 #include "lpddlgobserver.h" |
|
22 #include "locverifierdlg.hrh" |
|
23 #include <uikon/eiksrvui.h> |
|
24 #include <AknNotiferAppServerApplication.h> |
|
25 #include <e32des16.h> |
|
26 #include "lpdbkupevtlistenerao.h" |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =============================== |
|
29 |
|
30 // ----------------------------------------------------------------------------- |
|
31 // CLpdGlobalPluginDialog::CLpdGlobalPluginDialog |
|
32 // C++ default constructor can NOT contain any code, that |
|
33 // might leave. |
|
34 // ----------------------------------------------------------------------------- |
|
35 // |
|
36 CLpdGlobalPluginDialog::CLpdGlobalPluginDialog( |
|
37 MLpdDlgObserver& aCallBack, |
|
38 CLpdGlobalPluginDialog ** aSelfPtr, |
|
39 CListBoxView::CSelectionIndexArray* aSelected) |
|
40 : CAknListQueryDialog( &iDummyIndex ), |
|
41 iCallBack( aCallBack ), |
|
42 iAppSwitchSuppressed( EFalse ), |
|
43 iSelected( aSelected ), |
|
44 iSelfPtr( aSelfPtr ) |
|
45 { |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // CLpdGlobalPluginDialog::ConstructL |
|
50 // Two-phased constructor. |
|
51 // ----------------------------------------------------------------------------- |
|
52 // |
|
53 void CLpdGlobalPluginDialog::ConstructL() |
|
54 { |
|
55 iBkupListener = CLpdBkupEvtListenerAO::NewL( *this ); |
|
56 iBkupListener->StartL(); |
|
57 } |
|
58 |
|
59 |
|
60 // ----------------------------------------------------------------------------- |
|
61 // CLpdGlobalPluginDialog::NewL |
|
62 // Two-phased constructor. |
|
63 // ----------------------------------------------------------------------------- |
|
64 // |
|
65 CLpdGlobalPluginDialog* CLpdGlobalPluginDialog::NewL( |
|
66 MLpdDlgObserver& aCallBack, |
|
67 CLpdGlobalPluginDialog ** aSelfPtr, |
|
68 CListBoxView::CSelectionIndexArray* aSelected) |
|
69 { |
|
70 CLpdGlobalPluginDialog* self = |
|
71 new( ELeave ) CLpdGlobalPluginDialog( aCallBack, aSelfPtr, aSelected); |
|
72 CleanupStack::PushL(self); |
|
73 self->ConstructL(); |
|
74 CleanupStack::Pop(self); |
|
75 return self; |
|
76 } |
|
77 |
|
78 // Destructor |
|
79 CLpdGlobalPluginDialog::~CLpdGlobalPluginDialog() |
|
80 { |
|
81 if ( iSelfPtr ) |
|
82 { |
|
83 *iSelfPtr = NULL; |
|
84 } |
|
85 if ( iBkupListener ) |
|
86 { |
|
87 delete iBkupListener; |
|
88 } |
|
89 } |
|
90 |
|
91 // ----------------------------------------------------------------------------- |
|
92 // CLpdGlobalPluginDialog::PrepareLC |
|
93 // (other items were commented in a header). |
|
94 // ----------------------------------------------------------------------------- |
|
95 // |
|
96 void CLpdGlobalPluginDialog::PrepareLC( TInt aResourceId ) |
|
97 { |
|
98 CAknDialog::PrepareLC( aResourceId ); |
|
99 } |
|
100 |
|
101 // ----------------------------------------------------------------------------- |
|
102 // CLpdGlobalPluginDialog::RunLD |
|
103 // (other items were commented in a header). |
|
104 // ----------------------------------------------------------------------------- |
|
105 // |
|
106 TInt CLpdGlobalPluginDialog::RunLD() |
|
107 { |
|
108 if ( !iAppSwitchSuppressed ) |
|
109 { |
|
110 TInt err = |
|
111 ((CAknNotifierAppServerAppUi *) |
|
112 iEikonEnv->EikAppUi())->SuppressAppSwitching(ETrue); |
|
113 if (!err) |
|
114 { |
|
115 iAppSwitchSuppressed = ETrue; |
|
116 } |
|
117 } |
|
118 return CAknQueryDialog::RunLD(); |
|
119 } |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // CLpdGlobalPluginDialog::OfferKeyEventL |
|
123 // (other items were commented in a header). |
|
124 // ----------------------------------------------------------------------------- |
|
125 // |
|
126 TKeyResponse CLpdGlobalPluginDialog::OfferKeyEventL( |
|
127 const TKeyEvent& aKeyEvent, |
|
128 TEventCode aType ) |
|
129 { |
|
130 if ( aType != EEventKey ) |
|
131 { |
|
132 return EKeyWasNotConsumed; |
|
133 } |
|
134 |
|
135 TInt code = aKeyEvent.iCode; |
|
136 |
|
137 switch ( code ) |
|
138 { |
|
139 case EKeyEscape: |
|
140 { // emergency call support |
|
141 TryExitL( ELpdCmdEmergency ); |
|
142 return EKeyWasConsumed; |
|
143 } |
|
144 default: |
|
145 break; |
|
146 } |
|
147 return ListBox()->OfferKeyEventL( aKeyEvent, aType ); |
|
148 } |
|
149 |
|
150 // ----------------------------------------------------------------------------- |
|
151 // CLpdGlobalPluginDialog::SetHeaderTextL |
|
152 // (other items were commented in a header). |
|
153 // ----------------------------------------------------------------------------- |
|
154 // |
|
155 void CLpdGlobalPluginDialog::SetHeaderTextL( const TDesC& aText ) |
|
156 { |
|
157 CAknPopupHeadingPane* heading = NULL; |
|
158 User::LeaveIfNull( heading = QueryHeading() ); |
|
159 heading->SetTextL( aText ); |
|
160 } |
|
161 |
|
162 // ----------------------------------------------------------------------------- |
|
163 // CLpdGlobalPluginDialog::ExitDialogL |
|
164 // (other items were commented in a header). |
|
165 // ----------------------------------------------------------------------------- |
|
166 // |
|
167 void CLpdGlobalPluginDialog::ExitDialogL() |
|
168 { |
|
169 TryExitL( EEikCmdExit ); |
|
170 } |
|
171 |
|
172 // ----------------------------------------------------------------------------- |
|
173 // CLpdGlobalPluginDialog::ExitDialogL |
|
174 // (other items were commented in a header). |
|
175 // ----------------------------------------------------------------------------- |
|
176 // |
|
177 void CLpdGlobalPluginDialog::ExitDialogQuietlyL() |
|
178 { |
|
179 TryExitL( ELpdCmdQuietExit ); |
|
180 } |
|
181 |
|
182 // ----------------------------------------------------------------------------- |
|
183 // CLpdGlobalPluginDialog::OkToExitL |
|
184 // (other items were commented in a header). |
|
185 // ----------------------------------------------------------------------------- |
|
186 // |
|
187 TBool CLpdGlobalPluginDialog::OkToExitL( TInt aButtonId ) |
|
188 { |
|
189 if ( aButtonId == EAknSoftkeyCancel || aButtonId == EAknSoftkeyOk ) |
|
190 { |
|
191 TInt currentIndex = ListBox()->CurrentItemIndex(); |
|
192 const CListBoxView::CSelectionIndexArray* aSelectionIndex = |
|
193 ListBox()->View()->SelectionIndexes(); |
|
194 if ( iSelected && aSelectionIndex->Count() > 0 ) |
|
195 { // CSelectionIndexArray was given in constructor and |
|
196 // listbox view also has selection indexes. |
|
197 ListBox()->View()->GetSelectionIndexesL( iSelected ); |
|
198 } |
|
199 iCallBack.HandleDlgDismissedL( aButtonId, currentIndex ); |
|
200 } |
|
201 else if ( ( aButtonId == EEikCmdExit ) || |
|
202 ( aButtonId == ELpdCmdEmergency ) ) |
|
203 { // Dialog needs to be exited or emergency key has been pressed. |
|
204 iCallBack.HandleDlgDismissedL( aButtonId, -1 ); |
|
205 } |
|
206 else if ( aButtonId == ELpdCmdQuietExit ) |
|
207 { |
|
208 // No callback. |
|
209 } |
|
210 else |
|
211 { |
|
212 return EFalse; //dialog is not exited |
|
213 } |
|
214 |
|
215 if ( iAppSwitchSuppressed ) |
|
216 { |
|
217 TInt er = |
|
218 ((CAknNotifierAppServerAppUi *) |
|
219 iEikonEnv->EikAppUi())->SuppressAppSwitching(EFalse); |
|
220 if (!er) |
|
221 { |
|
222 iAppSwitchSuppressed = EFalse; |
|
223 } |
|
224 } |
|
225 return ETrue; // dialog is exited |
|
226 } |
|
227 |
|
228 void CLpdGlobalPluginDialog::HandleResourceChange(TInt aType) |
|
229 { |
|
230 CAknListQueryDialog::HandleResourceChange(aType); |
|
231 } |
|
232 // End of file |
|
233 |