1 /* |
|
2 * Copyright (c) 2006 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: Global query dialog handling |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 // INCLUDE FILES |
|
21 #include <StringLoader.h> |
|
22 #include <AknGlobalConfirmationQuery.h> |
|
23 #include "CFileManagerGlobalQueryDlg.h" |
|
24 #include "CFileManagerGlobalDlg.h" |
|
25 #include "MFileManagerGlobalDlgObserver.h" |
|
26 |
|
27 |
|
28 // ======== MEMBER FUNCTIONS ======== |
|
29 |
|
30 // ---------------------------------------------------------------------------- |
|
31 // CFileManagerGlobalQueryDlg::CFileManagerGlobalQueryDlg |
|
32 // ---------------------------------------------------------------------------- |
|
33 // |
|
34 CFileManagerGlobalQueryDlg::CFileManagerGlobalQueryDlg() : |
|
35 CActive( EPriorityUserInput ) |
|
36 { |
|
37 } |
|
38 |
|
39 // ---------------------------------------------------------------------------- |
|
40 // CFileManagerGlobalQueryDlg::NewL |
|
41 // ---------------------------------------------------------------------------- |
|
42 // |
|
43 CFileManagerGlobalQueryDlg* CFileManagerGlobalQueryDlg::NewL() |
|
44 { |
|
45 CFileManagerGlobalQueryDlg* self = |
|
46 new( ELeave ) CFileManagerGlobalQueryDlg(); |
|
47 CleanupStack::PushL( self ); |
|
48 self->ConstructL(); |
|
49 CleanupStack::Pop( self ); |
|
50 return self; |
|
51 } |
|
52 |
|
53 // ---------------------------------------------------------------------------- |
|
54 // CFileManagerGlobalQueryDlg::ConstructL |
|
55 // ---------------------------------------------------------------------------- |
|
56 // |
|
57 void CFileManagerGlobalQueryDlg::ConstructL() |
|
58 { |
|
59 CActiveScheduler::Add( this ); |
|
60 } |
|
61 |
|
62 // ---------------------------------------------------------------------------- |
|
63 // CFileManagerGlobalQueryDlg::~CFileManagerGlobalQueryDlg |
|
64 // ---------------------------------------------------------------------------- |
|
65 // |
|
66 CFileManagerGlobalQueryDlg::~CFileManagerGlobalQueryDlg() |
|
67 { |
|
68 Cancel(); |
|
69 delete iQueryDialog; |
|
70 } |
|
71 |
|
72 // ---------------------------------------------------------------------------- |
|
73 // CFileManagerGlobalQueryDlg::CancelDialog |
|
74 // ---------------------------------------------------------------------------- |
|
75 // |
|
76 void CFileManagerGlobalQueryDlg::CancelDialog() |
|
77 { |
|
78 if ( iQueryDialog ) |
|
79 { |
|
80 iQueryDialog->CancelConfirmationQuery(); |
|
81 delete iQueryDialog; |
|
82 iQueryDialog = NULL; |
|
83 } |
|
84 Cancel(); |
|
85 } |
|
86 |
|
87 // ---------------------------------------------------------------------------- |
|
88 // CFileManagerGlobalQueryDlg::ShowDialogL |
|
89 // ---------------------------------------------------------------------------- |
|
90 // |
|
91 void CFileManagerGlobalQueryDlg::ShowDialogL( |
|
92 const TDesC& aText, |
|
93 const TInt aSkId ) |
|
94 { |
|
95 CancelDialog(); |
|
96 |
|
97 iQueryDialog = CAknGlobalConfirmationQuery::NewL(); |
|
98 iQueryDialog->ShowConfirmationQueryL( |
|
99 iStatus, aText, aSkId ); |
|
100 SetActive(); |
|
101 } |
|
102 |
|
103 // ---------------------------------------------------------------------------- |
|
104 // CFileManagerGlobalQueryDlg::ShowDialogL |
|
105 // ---------------------------------------------------------------------------- |
|
106 // |
|
107 void CFileManagerGlobalQueryDlg::ShowDialogL( |
|
108 const TDesC& aText, |
|
109 const TInt aSkId, |
|
110 const TDesC& aBitmapFile, |
|
111 const TInt aImageId, |
|
112 const TInt aMaskId ) |
|
113 { |
|
114 CancelDialog(); |
|
115 |
|
116 iQueryDialog = CAknGlobalConfirmationQuery::NewL(); |
|
117 iQueryDialog->ShowConfirmationQueryL( |
|
118 iStatus, |
|
119 aText, |
|
120 aSkId, |
|
121 0, |
|
122 aBitmapFile, |
|
123 aImageId, |
|
124 aMaskId |
|
125 ); |
|
126 SetActive(); |
|
127 } |
|
128 |
|
129 // ---------------------------------------------------------------------------- |
|
130 // CFileManagerGlobalQueryDlg::ShowDialogL |
|
131 // ---------------------------------------------------------------------------- |
|
132 // |
|
133 void CFileManagerGlobalQueryDlg::ShowDialogL( |
|
134 const TInt aTextId, |
|
135 const TInt aSkId ) |
|
136 { |
|
137 HBufC* text = StringLoader::LoadLC( aTextId ); |
|
138 ShowDialogL( *text, aSkId ); |
|
139 CleanupStack::PopAndDestroy( text ); |
|
140 } |
|
141 |
|
142 // ---------------------------------------------------------------------------- |
|
143 // CFileManagerGlobalQueryDlg::DoCancel |
|
144 // ---------------------------------------------------------------------------- |
|
145 // |
|
146 void CFileManagerGlobalQueryDlg::DoCancel() |
|
147 { |
|
148 if ( iQueryDialog ) |
|
149 { |
|
150 iQueryDialog->CancelConfirmationQuery(); |
|
151 } |
|
152 } |
|
153 |
|
154 // ---------------------------------------------------------------------------- |
|
155 // CFileManagerGlobalQueryDlg::RunL |
|
156 // ---------------------------------------------------------------------------- |
|
157 // |
|
158 void CFileManagerGlobalQueryDlg::RunL() |
|
159 { |
|
160 CancelDialog(); |
|
161 NotifyObserver( iStatus.Int() ); |
|
162 } |
|
163 |
|
164 // ---------------------------------------------------------------------------- |
|
165 // CFileManagerGlobalQueryDlg::SetObserver |
|
166 // ---------------------------------------------------------------------------- |
|
167 // |
|
168 void CFileManagerGlobalQueryDlg::SetObserver( |
|
169 MFileManagerGlobalDlgObserver* aObserver ) |
|
170 { |
|
171 iObserver = aObserver; |
|
172 } |
|
173 |
|
174 // ---------------------------------------------------------------------------- |
|
175 // CFileManagerGlobalQueryDlg::NotifyObserver |
|
176 // ---------------------------------------------------------------------------- |
|
177 // |
|
178 void CFileManagerGlobalQueryDlg::NotifyObserver( const TInt aValue ) |
|
179 { |
|
180 if ( iObserver ) |
|
181 { |
|
182 iObserver->HandleGlobalDlgResult( |
|
183 CFileManagerGlobalDlg::EQuery, |
|
184 aValue ); |
|
185 } |
|
186 } |
|
187 |
|
188 // End of File |
|