35
|
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: Show all notes on the screen
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <aknViewAppUi.h>
|
|
20 |
#include <imageprintui.rsg>
|
|
21 |
|
|
22 |
#include "imageprintui.hrh"
|
|
23 |
#include "settingsview.h"
|
|
24 |
#include <AknWaitDialog.h>
|
|
25 |
#include <aknnotedialog.h>
|
|
26 |
#include <aknprogresstimer.h>
|
|
27 |
|
|
28 |
|
|
29 |
#include <e32std.h>
|
|
30 |
#include <AknProgressDialog.h>
|
|
31 |
#include <AknInfoPopupNoteController.h>
|
|
32 |
|
|
33 |
#include <aknstaticnotedialog.h>
|
|
34 |
#include <eikprogi.h>
|
|
35 |
#include <aknnotewrappers.h>
|
|
36 |
#include <StringLoader.h>
|
|
37 |
#include <eikenv.h>
|
|
38 |
|
|
39 |
#include "settingscontainer.h"
|
|
40 |
#include "imageprintuidebug.h"
|
|
41 |
#include "imageprintuiappui.h"
|
|
42 |
#include "notes.h"
|
|
43 |
|
|
44 |
const TUint KProgressFinishValue = 100;
|
|
45 |
|
|
46 |
|
|
47 |
// ======== MEMBER FUNCTIONS ========
|
|
48 |
|
|
49 |
// ---------------------------------------------------------------------------
|
|
50 |
//
|
|
51 |
// ---------------------------------------------------------------------------
|
|
52 |
//
|
|
53 |
CNotes* CNotes::NewL(CImagePrintUiAppUi* aPrintUiAppUi)
|
|
54 |
{
|
|
55 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::NewL()"));
|
|
56 |
CNotes* self = new( ELeave ) CNotes(aPrintUiAppUi);
|
|
57 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::NewL() complete"));
|
|
58 |
return self;
|
|
59 |
}
|
|
60 |
|
|
61 |
|
|
62 |
// ---------------------------------------------------------------------------
|
|
63 |
//
|
|
64 |
// ---------------------------------------------------------------------------
|
|
65 |
//
|
|
66 |
CNotes::~CNotes()
|
|
67 |
{
|
|
68 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::Destructor"));
|
|
69 |
if(iWaitNote)
|
|
70 |
{
|
|
71 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::Delete iWaitNote"));
|
|
72 |
delete iWaitNote;
|
|
73 |
iWaitNote = NULL;
|
|
74 |
}
|
|
75 |
if ( iProgressDialog )
|
|
76 |
{
|
|
77 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::Delete iProgressDialog"));
|
|
78 |
delete iProgressDialog;
|
|
79 |
iProgressDialog = NULL;
|
|
80 |
}
|
|
81 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::Destructor complete"));
|
|
82 |
|
|
83 |
}
|
|
84 |
|
|
85 |
// ---------------------------------------------------------------------------
|
|
86 |
// Default constructor
|
|
87 |
// ---------------------------------------------------------------------------
|
|
88 |
//
|
|
89 |
CNotes::CNotes(CImagePrintUiAppUi* aPrintUiAppUi): iPrintUiAppUi(aPrintUiAppUi),
|
|
90 |
iDisconnect(EFalse ),
|
|
91 |
iCancelling(EFalse)
|
|
92 |
{
|
|
93 |
}
|
|
94 |
|
|
95 |
// ---------------------------------------------------------------------------
|
|
96 |
//
|
|
97 |
// ---------------------------------------------------------------------------
|
|
98 |
//
|
|
99 |
void CNotes::DialogDismissedL(TInt aButtonId )
|
|
100 |
{
|
|
101 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::DialogDismissedL BEGIN"));
|
|
102 |
|
|
103 |
// If user pressed cancel, cancel printing
|
|
104 |
if(iProgressDialog)
|
|
105 |
{
|
|
106 |
if(!iDisconnect)
|
|
107 |
{
|
|
108 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::DialogMissedL, not disconnect case"));
|
|
109 |
if ( aButtonId == EAknSoftkeyCancel )
|
|
110 |
{
|
|
111 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::DialogMissedL ,sotfkey cancel iProgressDialog"));
|
|
112 |
iCancelling = ETrue;
|
|
113 |
iPrintUiAppUi->CancelPrinting();
|
|
114 |
}
|
|
115 |
}
|
|
116 |
}
|
|
117 |
if(iWaitNote)
|
|
118 |
{
|
|
119 |
if(!iDisconnect)
|
|
120 |
{
|
|
121 |
if ( aButtonId == EAknSoftkeyCancel )
|
|
122 |
{
|
|
123 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::DialogMissedL ,sotfkey cancel iWaitNote"));
|
|
124 |
iPrintUiAppUi->CloseApplication(EFalse);
|
|
125 |
}
|
|
126 |
}
|
|
127 |
}
|
|
128 |
|
|
129 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::DialogDismissedL END"));
|
|
130 |
}
|
|
131 |
|
|
132 |
// ---------------------------------------------------------------------------
|
|
133 |
//
|
|
134 |
// ---------------------------------------------------------------------------
|
|
135 |
//
|
|
136 |
void CNotes::ShowNoteL(TUint aNoteType)
|
|
137 |
{
|
|
138 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::ShowNote Start"));
|
|
139 |
if(!iWaitNote)
|
|
140 |
{
|
|
141 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::Create note"));
|
|
142 |
iWaitNote = new (ELeave) CAknWaitDialog(
|
|
143 |
(REINTERPRET_CAST(CEikDialog**,&iWaitNote)), ETrue);
|
|
144 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::ShowNoteL; Note created"));
|
|
145 |
iWaitNote->SetCallback( this );
|
|
146 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::ShowNoteL; Callback set"));
|
|
147 |
iWaitNote->ExecuteLD(aNoteType);
|
|
148 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::ShowNoteL; ExecuteLD passed"));
|
|
149 |
}
|
|
150 |
}
|
|
151 |
|
|
152 |
// ---------------------------------------------------------------------------
|
|
153 |
//
|
|
154 |
// ---------------------------------------------------------------------------
|
|
155 |
//
|
|
156 |
void CNotes::StopShowNote(TUint /*aNoteType*/)
|
|
157 |
{
|
|
158 |
FLOG(_L("[IMAGEPRINTUI]\t CNotes::Stop note"));
|
|
159 |
delete iWaitNote;
|
|
160 |
iWaitNote = NULL;
|
|
161 |
}
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
// ---------------------------------------------------------------------------
|
|
166 |
//
|
|
167 |
// ---------------------------------------------------------------------------
|
|
168 |
//
|
|
169 |
void CNotes::StartPrintingNotesL()
|
|
170 |
{
|
|
171 |
FLOG(_L("[IMAGEPRINTUI]>>> CNotes::StartPrintingNotesL"));
|
|
172 |
PrepareShowProgressNoteL();
|
|
173 |
FLOG(_L("[IMAGEPRINTUI]<<< CNotes::StartPrintingNotesL"));
|
|
174 |
}
|
|
175 |
|
|
176 |
// ---------------------------------------------------------------------------
|
|
177 |
//
|
|
178 |
// ---------------------------------------------------------------------------
|
|
179 |
//
|
|
180 |
void CNotes::PrepareShowProgressNoteL()
|
|
181 |
{
|
|
182 |
FLOG(_L("[IMAGEPRINTUI]>>> CNotes::PrepareShowProgressNoteL"));
|
|
183 |
HBufC* txt;
|
|
184 |
txt = StringLoader::LoadLC( R_QTN_PRINT_PROGRESS_NOTE_TITLE );
|
|
185 |
|
|
186 |
if(!iProgressDialog)
|
|
187 |
{
|
|
188 |
iProgressDialog = new (ELeave) CAknProgressDialog(
|
|
189 |
(reinterpret_cast<CEikDialog**> (&iProgressDialog)));
|
|
190 |
}
|
|
191 |
|
|
192 |
FLOG(_L("[IMAGEPRINTUI]<<< CNotes::PrepareShowProgressNoteL; PrepareLC next"));
|
|
193 |
iProgressDialog->PrepareLC(R_PROGRESS_NOTE);
|
|
194 |
CEikProgressInfo* progressBar = iProgressDialog->GetProgressInfoL(); // not taking ownership
|
|
195 |
progressBar = iProgressDialog->GetProgressInfoL();
|
|
196 |
FLOG(_L("[IMAGEPRINTUI]<<< CNotes::PrepareShowProgressNoteL; progressinfo got"));
|
|
197 |
|
|
198 |
progressBar->SetFinalValue( KProgressFinishValue );
|
|
199 |
iProgressDialog->SetTextL( *txt );
|
|
200 |
iProgressDialog->SetCallback( this );
|
|
201 |
FLOG(_L("[IMAGEPRINTUI]<<< CNotes::PrepareShowProgressNoteL; RunLD next"));
|
|
202 |
iProgressDialog->RunLD();
|
|
203 |
CleanupStack::PopAndDestroy( txt );
|
|
204 |
FLOG(_L("[IMAGEPRINTUI]<<< CNotes::PrepareShowProgressNoteL"));
|
|
205 |
}
|
|
206 |
|
|
207 |
// ---------------------------------------------------------------------------
|
|
208 |
//
|
|
209 |
// ---------------------------------------------------------------------------
|
|
210 |
//
|
|
211 |
void CNotes::PrintProgress(TUint aProgress )
|
|
212 |
{
|
|
213 |
FLOG(_L("[IMAGEPRINTUI]<<< CNotes::PrintProgress start "));
|
|
214 |
FTRACE(FPrint(_L("[IMAGEPRINTUI]\t CNotes PrintProgress aProgress value is %d"), aProgress ));
|
|
215 |
TInt err = KErrNone;
|
|
216 |
TRAP( err, PrintProgressL( aProgress ) );
|
|
217 |
if ( err != KErrNone )
|
|
218 |
{
|
|
219 |
FTRACE(FPrint(_L("[IMAGEPRINTUI]\t CNotes PrintProgress err value is %d"), err ));
|
|
220 |
TRAP_IGNORE( CNotes::ShowErrorMsgL( err ) );
|
|
221 |
}
|
|
222 |
}
|
|
223 |
|
|
224 |
// ---------------------------------------------------------------------------
|
|
225 |
//
|
|
226 |
// ---------------------------------------------------------------------------
|
|
227 |
//
|
|
228 |
void CNotes::SetCancelState(TBool aCancel)
|
|
229 |
{
|
|
230 |
iCancelling = aCancel;
|
|
231 |
}
|
|
232 |
|
|
233 |
// ---------------------------------------------------------------------------
|
|
234 |
//
|
|
235 |
// ---------------------------------------------------------------------------
|
|
236 |
//
|
|
237 |
void CNotes::SetDisconnectState(TBool aDisconnect)
|
|
238 |
{
|
|
239 |
iDisconnect = aDisconnect;
|
|
240 |
}
|
|
241 |
|
|
242 |
|
|
243 |
// ---------------------------------------------------------------------------
|
|
244 |
// Called to update the print progress
|
|
245 |
// ---------------------------------------------------------------------------
|
|
246 |
//
|
|
247 |
void CNotes::PrintProgressL(TUint aProgress )
|
|
248 |
{
|
|
249 |
FLOG(_L("[IMAGEPRINTUI]<<< CNotes::PrintProgressL start; "));
|
|
250 |
if( !iCancelling )
|
|
251 |
{
|
|
252 |
if ( !iProgressDialog )
|
|
253 |
{
|
|
254 |
FLOG(_L("[IMAGEPRINTUI]<<< CNotes::PrintProgressL call PrepareShowProgressNoteL "));
|
|
255 |
PrepareShowProgressNoteL();
|
|
256 |
}
|
|
257 |
CEikProgressInfo* progressBar = iProgressDialog->GetProgressInfoL(); // not taking ownership
|
|
258 |
FLOG(_L("[IMAGEPRINTUI]<<< CNotes::PrintProgressL; Update progress"));
|
|
259 |
progressBar->SetAndDraw( aProgress );
|
|
260 |
if(aProgress == KProgressFinishValue )
|
|
261 |
{
|
|
262 |
FLOG(_L("[IMAGEPRINTUI]<<< CNotes::PrintProgressL; normal printing finish"));
|
|
263 |
PrintFinished();
|
|
264 |
}
|
|
265 |
}
|
|
266 |
FLOG(_L("[IMAGEPRINTUI]>>> CNotes::PrintProgressL END "));
|
|
267 |
}
|
|
268 |
|
|
269 |
// ---------------------------------------------------------------------------
|
|
270 |
//
|
|
271 |
// ---------------------------------------------------------------------------
|
|
272 |
//
|
|
273 |
void CNotes::ShowErrorMsgL(TUint aErrCode )
|
|
274 |
{
|
|
275 |
if ( aErrCode != KErrNone )
|
|
276 |
{
|
|
277 |
FLOG(_L("[IMAGEPRINTUI]>>> CNotes:Show err note "));
|
|
278 |
HBufC* str = StringLoader::LoadLC( aErrCode );
|
|
279 |
CAknErrorNote* note = new ( ELeave ) CAknErrorNote;
|
|
280 |
note->ExecuteLD( *str );
|
|
281 |
CleanupStack::PopAndDestroy( str ); // str
|
|
282 |
}
|
|
283 |
}
|
|
284 |
|
|
285 |
// ---------------------------------------------------------------------------
|
|
286 |
//
|
|
287 |
// ---------------------------------------------------------------------------
|
|
288 |
//
|
|
289 |
void CNotes::ShowInfoNoteL(TInt aResourceId )
|
|
290 |
{
|
|
291 |
HBufC* str = StringLoader::LoadLC( aResourceId );
|
|
292 |
CAknInformationNote* note = new ( ELeave ) CAknInformationNote;
|
|
293 |
note->ExecuteLD( *str );
|
|
294 |
CleanupStack::PopAndDestroy( str); // str
|
|
295 |
}
|
|
296 |
// ---------------------------------------------------------------------------
|
|
297 |
//
|
|
298 |
// ---------------------------------------------------------------------------
|
|
299 |
//
|
|
300 |
void CNotes::PrintFinished()
|
|
301 |
{
|
|
302 |
FLOG(_L("[IMAGEPRINTUI]<<< CNotes::PrintFinished; START"));
|
|
303 |
if ( iProgressDialog )
|
|
304 |
{
|
|
305 |
FLOG(_L("[IMAGEPRINTUI]<<< CNotes::PrintFinished, delete progress note"));
|
|
306 |
delete iProgressDialog;
|
|
307 |
iProgressDialog = NULL;
|
|
308 |
iCancelling = EFalse;
|
|
309 |
}
|
|
310 |
}
|
|
311 |
|
|
312 |
//End of File
|
|
313 |
|
|
314 |
|