19
|
1 |
/*
|
|
2 |
* Copyright (c) 2010 Kanrikogaku Kenkyusho, Ltd.
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of the License "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 |
* Kanrikogaku Kenkyusho, Ltd. - Initial contribution
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// INCLUDE FILES
|
|
19 |
#include <avkon.hrh>
|
|
20 |
#include <aknnotewrappers.h>
|
|
21 |
#include <akntabgrp.h>
|
|
22 |
#include <barsread.h>
|
|
23 |
#include <stringloader.h>
|
|
24 |
#include <DirectPrintApp.rsg>
|
|
25 |
#include <f32file.h>
|
|
26 |
#include <s32file.h>
|
|
27 |
#include <f32file.h>
|
|
28 |
#include <aiwmenu.h> // CAiwGenericParamList
|
|
29 |
|
|
30 |
//not use #include <featmgr.h> // FeatureManager
|
|
31 |
|
|
32 |
#include <xmlengdomparser.h> // RXmlEngDOMParser
|
|
33 |
#include <xmlengdomimplementation.h> // RXmlEngDOMImplementation
|
|
34 |
#include <xmlengerrors.h>
|
|
35 |
|
|
36 |
// Start ImagePrint Provide
|
|
37 |
#include "imageprint.h"
|
|
38 |
#include "printmessagecodes.h"
|
|
39 |
// End ImagePrint Provide
|
|
40 |
|
|
41 |
#include "clog.h"
|
|
42 |
#include "aiwprintproperty.h"
|
|
43 |
|
|
44 |
#include "directprintapp.pan"
|
|
45 |
#include "directprintappappui.h"
|
|
46 |
#include "directprintapp.hrh"
|
|
47 |
#include "directprintappdocument.h"
|
|
48 |
#include "directprintmodel.h"
|
|
49 |
|
|
50 |
#include "directprintmainview.h"
|
|
51 |
#include "directprintlistview.h"
|
|
52 |
#include "directprintsettingview.h"
|
|
53 |
#include "directprintpreviewview.h"
|
|
54 |
#include "directprintpropertyview.h"
|
|
55 |
#include "directprintsearchresultview.h"
|
|
56 |
#include "directprintengine.h"
|
|
57 |
#include "directprintbearermgr.h"
|
|
58 |
#include "directprintmsgutil.h"
|
|
59 |
#include "directprintuipluginmgr.h"
|
|
60 |
|
|
61 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
62 |
|
|
63 |
// -----------------------------------------------------------------------------
|
|
64 |
// CDirectPrintAppAppUi::ConstructL()
|
|
65 |
// Symbian 2nd phase constructor can leave.
|
|
66 |
// -----------------------------------------------------------------------------
|
|
67 |
//
|
|
68 |
void CDirectPrintAppAppUi::ConstructL()
|
|
69 |
{
|
|
70 |
LOG("CDirectPrintAppAppUi::ConstructL BEGIN");
|
|
71 |
// Initialise app UI with standard value.
|
|
72 |
//BaseConstructL( EAknEnableSkin | EAknEnableMSK );
|
|
73 |
BaseConstructL( EAknEnableSkin );
|
|
74 |
|
|
75 |
//not use FeatureManager::InitializeLibL();
|
|
76 |
|
|
77 |
iDoc = static_cast<CDirectPrintAppDocument*>( CAknAppUi::Document() );
|
|
78 |
|
|
79 |
TRAPD( err, InitializeEngineL() );
|
|
80 |
if ( err == KErrInUse )
|
|
81 |
{
|
|
82 |
LOG1("InitializeEngineL Error [%d]", err);
|
|
83 |
CDirectPrintMsgUtil::DisplayErrorNoteL(R_DIRECTPRINT_MSG_PRINT_IN_USE);
|
|
84 |
Exit();
|
|
85 |
}
|
|
86 |
else
|
|
87 |
{
|
|
88 |
User::LeaveIfError( err );
|
|
89 |
}
|
|
90 |
|
|
91 |
TRAP( err, InitializeBearerMngL() );
|
|
92 |
if ( err == KErrInUse || err == KErrAlreadyExists )
|
|
93 |
{
|
|
94 |
LOG1("InitializeBearerMngL Error [%d]", err);
|
|
95 |
CDirectPrintMsgUtil::DisplayErrorNoteL(R_DIRECTPRINT_MSG_PRINT_IN_USE);
|
|
96 |
Exit();
|
|
97 |
}
|
|
98 |
else
|
|
99 |
{
|
|
100 |
User::LeaveIfError( err );
|
|
101 |
}
|
|
102 |
|
|
103 |
InitializePluginMgrL();
|
|
104 |
|
|
105 |
LOG("CDirectPrintAppAppUi::ConstructL StatusPane...");
|
|
106 |
CEikStatusPane* statusPane = StatusPane();
|
|
107 |
CAknNavigationControlContainer* naviPane = (CAknNavigationControlContainer*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
|
|
108 |
{
|
|
109 |
TResourceReader reader;
|
|
110 |
iCoeEnv->CreateResourceReaderLC(reader, R_DIRECTPRINT_PROPERTYSETTING_NAVI_DECORATOR);
|
|
111 |
iNaviDecorator = naviPane->ConstructNavigationDecoratorFromResourceL(reader);
|
|
112 |
CleanupStack::PopAndDestroy();
|
|
113 |
}
|
|
114 |
CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>(iNaviDecorator->DecoratedControl());
|
|
115 |
tabGroup->SetObserver(this);
|
|
116 |
|
|
117 |
LOG("CDirectPrintAppAppUi::ConstructL aiw param...");
|
|
118 |
// aiw param
|
|
119 |
iAiwState = ENotAiwCall;
|
|
120 |
TInt r = iAiwCall.Attach(KPrintPropertyCat,EPrintProperty,EOwnerProcess);
|
|
121 |
if (r == KErrNone)
|
|
122 |
{
|
|
123 |
iAiwCall.Get(KPrintPropertyCat,EPrintProperty,iAiwState);
|
|
124 |
}
|
|
125 |
|
|
126 |
if ( iAiwState == EAiwPrintCall )
|
|
127 |
{
|
|
128 |
// Set the aiw call RProperty key back to default value so that
|
|
129 |
// if application for some reason crashes the value is not left for AIW mode.
|
|
130 |
iAiwCall.Set( KPrintPropertyCat,EPrintProperty, ENotAiwCall );
|
|
131 |
TRAP( err, LoadParamL() );
|
|
132 |
if ( err != KErrNone )
|
|
133 |
{
|
|
134 |
CDirectPrintMsgUtil::DisplayErrorNoteL(R_DIRECTPRINT_MSG_PARAM_INCORRECT);
|
|
135 |
Exit();
|
|
136 |
}
|
|
137 |
}
|
|
138 |
|
|
139 |
LOG("CDirectPrintAppAppUi::ConstructL InitializeViewsL...");
|
|
140 |
InitializeViewsL();
|
|
141 |
|
|
142 |
iCoeEnv->RootWin().EnableScreenChangeEvents();
|
|
143 |
|
|
144 |
LOG("CDirectPrintAppAppUi::ConstructL END");
|
|
145 |
}
|
|
146 |
|
|
147 |
// -----------------------------------------------------------------------------
|
|
148 |
// CDirectPrintAppAppUi::CDirectPrintAppAppUi()
|
|
149 |
// C++ default constructor can NOT contain any code, that might leave.
|
|
150 |
// -----------------------------------------------------------------------------
|
|
151 |
//
|
|
152 |
CDirectPrintAppAppUi::CDirectPrintAppAppUi()
|
|
153 |
{
|
|
154 |
// No implementation required
|
|
155 |
}
|
|
156 |
|
|
157 |
// -----------------------------------------------------------------------------
|
|
158 |
// CDirectPrintAppAppUi::~CDirectPrintAppAppUi()
|
|
159 |
// Destructor.
|
|
160 |
// -----------------------------------------------------------------------------
|
|
161 |
//
|
|
162 |
CDirectPrintAppAppUi::~CDirectPrintAppAppUi()
|
|
163 |
{
|
|
164 |
//not use FeatureManager::UnInitializeLib();
|
|
165 |
|
|
166 |
if (iXmlEngDoc.NotNull())
|
|
167 |
{
|
|
168 |
iXmlEngDoc.Close(); // closing all opened objects
|
|
169 |
iXmlParser.Close();
|
|
170 |
iXmlDomImpl.Close();
|
|
171 |
}
|
|
172 |
delete iXmlParam;
|
|
173 |
delete iEngine;
|
|
174 |
delete iBearerMgr;
|
|
175 |
delete iPluginMgr;
|
|
176 |
delete iNaviDecorator;
|
|
177 |
iAiwCall.Close();
|
|
178 |
}
|
|
179 |
|
|
180 |
// -----------------------------------------------------------------------------
|
|
181 |
// CDirectPrintAppAppUi::HandleCommandL()
|
|
182 |
// Takes care of command handling.
|
|
183 |
// -----------------------------------------------------------------------------
|
|
184 |
//
|
|
185 |
void CDirectPrintAppAppUi::HandleCommandL( TInt aCommand )
|
|
186 |
{
|
|
187 |
LOG1("CDirectPrintAppAppUi::HandleCommandL(%d) BEGIN", aCommand);
|
|
188 |
switch( aCommand )
|
|
189 |
{
|
|
190 |
case EEikCmdExit:
|
|
191 |
case EAknSoftkeyExit:
|
|
192 |
case EDirectPrintCmdIdMainViewExit:
|
|
193 |
{
|
|
194 |
LOG1("BearerStatu=%d", iBearerMgr->BearerStatus());
|
|
195 |
|
|
196 |
TBool isPrinting = EFalse;
|
|
197 |
switch (iBearerMgr->BearerStatus())
|
|
198 |
{
|
|
199 |
case CDirectPrintBearerMgr::EBearerMngCreatingJob:
|
|
200 |
case CDirectPrintBearerMgr::EBearerMngPrinting:
|
|
201 |
isPrinting = ETrue;
|
|
202 |
break;
|
|
203 |
case CDirectPrintBearerMgr::EBearerMngClosing:
|
|
204 |
case CDirectPrintBearerMgr::EBearerMngCanceling:
|
|
205 |
case CDirectPrintBearerMgr::EBearerMngNotConnected:
|
|
206 |
case CDirectPrintBearerMgr::EBearerMngConnected:
|
|
207 |
default:
|
|
208 |
isPrinting = EFalse;
|
|
209 |
break;
|
|
210 |
}
|
|
211 |
|
|
212 |
if (!isPrinting)
|
|
213 |
{
|
|
214 |
iDoc->Model().ExternalizeDataL();
|
|
215 |
Exit();
|
|
216 |
}
|
|
217 |
else
|
|
218 |
{
|
|
219 |
// Show information message
|
|
220 |
HBufC* textResource = StringLoader::LoadLC(R_DIRECTPRINT_MSG_NOW_PRINTING);
|
|
221 |
CAknInformationNote* informationNote;
|
|
222 |
informationNote = new (ELeave) CAknInformationNote;
|
|
223 |
informationNote->ExecuteLD(*textResource);
|
|
224 |
CleanupStack::PopAndDestroy(textResource);
|
|
225 |
}
|
|
226 |
}
|
|
227 |
break;
|
|
228 |
case EDirectPrintCmdIdMainViewPrint:
|
|
229 |
case EDirectPrintCmdIdPropertySettingViewPrint:
|
|
230 |
case EDirectPrintCmdIdPreviewViewPrint:
|
|
231 |
{
|
|
232 |
MakeNaviPaneVisibleL(EFalse);
|
|
233 |
//TInt modelcount = iEngine->ModelCount();
|
|
234 |
iEngine->SetUseModel(0);
|
|
235 |
iEngine->PrintL();
|
|
236 |
}
|
|
237 |
break;
|
|
238 |
case EDirectPrintCmdIdMainViewPreview:
|
|
239 |
case EDirectPrintCmdIdPropertySettingViewPreview:
|
|
240 |
{
|
|
241 |
TVwsViewId id;
|
|
242 |
GetActiveViewId(id);
|
|
243 |
iBackViewUid = id.iViewUid;
|
|
244 |
//MakeStatusPaneVisible(EFalse);
|
|
245 |
MakeNaviPaneVisibleL(EFalse);
|
|
246 |
ActivateLocalViewL(TUid::Uid(EDirectPrintPreviewViewId));
|
|
247 |
}
|
|
248 |
break;
|
|
249 |
case EDirectPrintCmdIdMainViewPropertySetting:
|
|
250 |
{
|
|
251 |
if (iDoc->Model().PrinterCount() > 0)
|
|
252 |
{
|
|
253 |
CAknTabGroup* tabGroup = static_cast<CAknTabGroup*>(iNaviDecorator->DecoratedControl());
|
|
254 |
tabGroup->SetActiveTabByIndex(0);
|
|
255 |
// tabGroup->SetActiveTabByIndex(1);
|
|
256 |
MakeNaviPaneVisibleL(ETrue);
|
|
257 |
// ActivateLocalViewL(TUid::Uid(EDirectPrintPropertySetting1ViewId));
|
|
258 |
// ActivateLocalViewL(TUid::Uid(EDirectPrintPropertySetting2ViewId));
|
|
259 |
ActivateLocalViewL(TUid::Uid(EDirectPrintPropertyViewId));
|
|
260 |
}
|
|
261 |
}
|
|
262 |
break;
|
|
263 |
case EDirectPrintCmdIdMainViewPrinterList:
|
|
264 |
{
|
|
265 |
MakeNaviPaneVisibleL(EFalse);
|
|
266 |
ActivateLocalViewL(TUid::Uid(EDirectPrintPrinterListViewId));
|
|
267 |
}
|
|
268 |
break;
|
|
269 |
case EDirectPrintCmdIdPrinterSettingViewBack:
|
|
270 |
{
|
|
271 |
if (iBackViewUid != TUid::Uid(0))
|
|
272 |
{
|
|
273 |
ActivateLocalViewL(iBackViewUid);
|
|
274 |
iBackViewUid = TUid::Uid(0);
|
|
275 |
}
|
|
276 |
else
|
|
277 |
{
|
|
278 |
ActivateLocalViewL(TUid::Uid(EDirectPrintPrinterListViewId));
|
|
279 |
}
|
|
280 |
}
|
|
281 |
break;
|
|
282 |
case EDirectPrintCmdIdMainViewPrinterSetting:
|
|
283 |
case EDirectPrintCmdIdPrinterListViewNew:
|
|
284 |
case EDirectPrintCmdIdPrinterListViewEdit:
|
|
285 |
{
|
|
286 |
if ((iDoc->Model().PrinterCount() > 0) || (iDoc->Model().IsNewData()))
|
|
287 |
{
|
|
288 |
TVwsViewId id;
|
|
289 |
GetActiveViewId(id);
|
|
290 |
iBackViewUid = id.iViewUid;
|
|
291 |
MakeNaviPaneVisibleL(EFalse);
|
|
292 |
ActivateLocalViewL(TUid::Uid(EDirectPrintPrinterSettingViewId));
|
|
293 |
}
|
|
294 |
}
|
|
295 |
break;
|
|
296 |
case EDirectPrintCmdIdPrinterListViewDone:
|
|
297 |
case EDirectPrintCmdIdPropertySettingViewBack:
|
|
298 |
{
|
|
299 |
MakeNaviPaneVisibleL(EFalse);
|
|
300 |
ActivateLocalViewL(TUid::Uid(EDirectPrintMainViewId));
|
|
301 |
}
|
|
302 |
break;
|
|
303 |
case EDirectPrintCmdIdPrinterListViewSearch:
|
|
304 |
{
|
|
305 |
// Start printer search
|
|
306 |
//SearchPrinterL();
|
|
307 |
ActivateLocalViewL(TUid::Uid(EDirectPrintSearchResultViewId));
|
|
308 |
}
|
|
309 |
break;
|
|
310 |
case EDirectPrintCmdIdSearchResultViewSearch:
|
|
311 |
{
|
|
312 |
// Start printer search
|
|
313 |
//SearchPrinterL();
|
|
314 |
}
|
|
315 |
break;
|
|
316 |
case EDirectPrintCmdIdSearchResultViewSelect:
|
|
317 |
case EDirectPrintCmdIdSearchResultViewCancel:
|
|
318 |
{
|
|
319 |
ActivateLocalViewL(TUid::Uid(EDirectPrintPrinterListViewId));
|
|
320 |
}
|
|
321 |
break;
|
|
322 |
case EDirectPrintCmdIdPreviewViewBack:
|
|
323 |
{
|
|
324 |
MakeStatusPaneVisible(ETrue);
|
|
325 |
if (iBackViewUid != TUid::Uid(0))
|
|
326 |
{
|
|
327 |
if (iBackViewUid != TUid::Uid(EDirectPrintMainViewId))
|
|
328 |
{
|
|
329 |
MakeNaviPaneVisibleL(ETrue);
|
|
330 |
}
|
|
331 |
ActivateLocalViewL(iBackViewUid);
|
|
332 |
iBackViewUid = TUid::Uid(0);
|
|
333 |
}
|
|
334 |
else
|
|
335 |
{
|
|
336 |
ActivateLocalViewL(TUid::Uid(EDirectPrintMainViewId));
|
|
337 |
}
|
|
338 |
}
|
|
339 |
break;
|
|
340 |
case EDirectPrintCmdIdPrinterListViewDelete:
|
|
341 |
default:
|
|
342 |
break;
|
|
343 |
}
|
|
344 |
LOG("CDirectPrintAppAppUi::HandleCommandL END");
|
|
345 |
}
|
|
346 |
|
|
347 |
void CDirectPrintAppAppUi::HandleResourceChangeL( TInt aType )
|
|
348 |
{
|
|
349 |
// base-class call also
|
|
350 |
CAknAppUi::HandleResourceChangeL(aType);
|
|
351 |
if (aType == KEikDynamicLayoutVariantSwitch)
|
|
352 |
{
|
|
353 |
}
|
|
354 |
}
|
|
355 |
|
|
356 |
void CDirectPrintAppAppUi::TabChangedL(TInt aIndex)
|
|
357 |
{
|
|
358 |
TVwsViewId id;
|
|
359 |
GetActiveViewId(id);
|
|
360 |
if (id.iViewUid.iUid == EDirectPrintPropertyViewId)
|
|
361 |
{
|
|
362 |
CDirectPrintPropertyView* view = static_cast<CDirectPrintPropertyView*>(View(id.iViewUid));
|
|
363 |
view->ChangeTabL(aIndex);
|
|
364 |
}
|
|
365 |
}
|
|
366 |
|
|
367 |
void CDirectPrintAppAppUi::MakeNaviPaneVisibleL(TBool aVisible)
|
|
368 |
{
|
|
369 |
CEikStatusPane* statusPane = StatusPane();
|
|
370 |
CAknNavigationControlContainer* naviPane = (CAknNavigationControlContainer*) statusPane->ControlL(TUid::Uid(EEikStatusPaneUidNavi));
|
|
371 |
|
|
372 |
if (aVisible)
|
|
373 |
{
|
|
374 |
naviPane->PushL(*iNaviDecorator);
|
|
375 |
}
|
|
376 |
else
|
|
377 |
{
|
|
378 |
naviPane->Pop(iNaviDecorator);
|
|
379 |
}
|
|
380 |
}
|
|
381 |
|
|
382 |
void CDirectPrintAppAppUi::MakeStatusPaneVisible(TBool aVisible)
|
|
383 |
{
|
|
384 |
CEikStatusPane* statusPane = StatusPane();
|
|
385 |
statusPane->MakeVisible(aVisible);
|
|
386 |
}
|
|
387 |
|
|
388 |
void CDirectPrintAppAppUi::InitializeViewsL()
|
|
389 |
{
|
|
390 |
LOG("CDirectPrintAppAppUi::InitializeViewsL begin");
|
|
391 |
// Create view
|
|
392 |
LOG("-->CDirectPrintMainView");
|
|
393 |
CDirectPrintMainView* view1 = CDirectPrintMainView::NewL();
|
|
394 |
CleanupStack::PushL(view1);
|
|
395 |
AddViewL(view1);
|
|
396 |
CleanupStack::Pop(view1);
|
|
397 |
|
|
398 |
LOG("-->CDirectPrintListView");
|
|
399 |
CDirectPrintListView* view2 = CDirectPrintListView::NewL();
|
|
400 |
CleanupStack::PushL(view2);
|
|
401 |
AddViewL(view2);
|
|
402 |
CleanupStack::Pop(view2);
|
|
403 |
|
|
404 |
LOG("-->CDirectPrintSearchResultView");
|
|
405 |
CDirectPrintSearchResultView* view3 = CDirectPrintSearchResultView::NewL();
|
|
406 |
AddViewL(view3);
|
|
407 |
|
|
408 |
LOG("-->CDirectPrintPrinterSettingView");
|
|
409 |
CDirectPrintPrinterSettingView* view4 = CDirectPrintPrinterSettingView::NewL();
|
|
410 |
CleanupStack::PushL(view4);
|
|
411 |
AddViewL(view4);
|
|
412 |
CleanupStack::Pop(view4);
|
|
413 |
|
|
414 |
LOG("-->CDirectPrintPreviewView");
|
|
415 |
CDirectPrintPreviewView* view5 = CDirectPrintPreviewView::NewL();
|
|
416 |
CleanupStack::PushL(view5);
|
|
417 |
AddViewL(view5);
|
|
418 |
CleanupStack::Pop(view5);
|
|
419 |
|
|
420 |
LOG("-->CDirectPrintPropertyView");
|
|
421 |
CDirectPrintPropertyView* view6 = CDirectPrintPropertyView::NewL();
|
|
422 |
CleanupStack::PushL(view6);
|
|
423 |
AddViewL(view6);
|
|
424 |
CleanupStack::Pop(view6);
|
|
425 |
|
|
426 |
// Check plugins. Create view, if extended view exists.
|
|
427 |
|
|
428 |
SetDefaultViewL( *view1 );
|
|
429 |
|
|
430 |
iBackViewUid = TUid::Uid(0);
|
|
431 |
LOG("CDirectPrintAppAppUi::InitializeViewsL end");
|
|
432 |
}
|
|
433 |
|
|
434 |
|
|
435 |
void CDirectPrintAppAppUi::LoadParamL()
|
|
436 |
{
|
|
437 |
// get the xml parameter from AIW provider
|
|
438 |
// after that iXmlEngDoc is set in the function.
|
|
439 |
GetParamFromAiwProviderL();
|
|
440 |
// set the xml param to the engine side, and
|
|
441 |
// the adapted band plugin is loaded and the xml
|
|
442 |
// parameter is sent to the plugin.
|
|
443 |
iEngine->SetParamL(&iXmlEngDoc);
|
|
444 |
}
|
|
445 |
|
|
446 |
void CDirectPrintAppAppUi::GetParamFromAiwProviderL()
|
|
447 |
{
|
|
448 |
LOG("CDirectPrintAppAppUi::GetParamFromAiwProviderL() BEGIN");
|
|
449 |
|
|
450 |
RFileReadStream readStream;
|
|
451 |
TFileName paramFile;
|
|
452 |
_LIT( KParamFile, "c:\\system\\data\\T_AIW_TEMP.DAT");
|
|
453 |
paramFile.Copy(KParamFile);
|
|
454 |
|
|
455 |
User::LeaveIfError( readStream.Open(iCoeEnv->FsSession(), paramFile, EFileRead) );
|
|
456 |
readStream.PushL();
|
|
457 |
CAiwGenericParamList* paramList = CAiwGenericParamList::NewLC(readStream);
|
|
458 |
|
|
459 |
TInt index( 0 );
|
|
460 |
const TAiwGenericParam* param = paramList->FindFirst(index,
|
|
461 |
EGenericParamPrintXMLFile,
|
|
462 |
EVariantTypeDesC8);
|
|
463 |
TPtrC8 ptrParam = param->Value().AsData();
|
|
464 |
if ( ptrParam.Length() == 0)
|
|
465 |
{
|
|
466 |
User::Leave(KErrArgument);
|
|
467 |
}
|
|
468 |
|
|
469 |
// set file name
|
|
470 |
iXmlParam = ptrParam.AllocL();
|
|
471 |
|
|
472 |
// parse XML param
|
|
473 |
// opening DOM implementation object
|
|
474 |
iXmlDomImpl.OpenL();
|
|
475 |
// opening parser object
|
|
476 |
User::LeaveIfError(iXmlParser.Open( iXmlDomImpl ));
|
|
477 |
// ParseL return KXmlEngErrParsing
|
|
478 |
iXmlEngDoc =iXmlParser.ParseL( *iXmlParam ); // parsing buffer
|
|
479 |
|
|
480 |
CleanupStack::PopAndDestroy(paramList); //paramList
|
|
481 |
readStream.Close();
|
|
482 |
readStream.Pop();
|
|
483 |
LOG("CDirectPrintAppAppUi::GetParamFromAiwProviderL() END");
|
|
484 |
}
|
|
485 |
|
|
486 |
// ---------------------------------------------------------------------------
|
|
487 |
// CDirectPrintAppAppUi::InitializeEngineL()
|
|
488 |
// Initialize print engine.
|
|
489 |
// ---------------------------------------------------------------------------
|
|
490 |
//
|
|
491 |
void CDirectPrintAppAppUi::InitializeEngineL()
|
|
492 |
{
|
|
493 |
iEngine = CDirectPrintEngine::NewL(iDoc->Model());
|
|
494 |
iEngine->SetObserver(this);
|
|
495 |
}
|
|
496 |
|
|
497 |
|
|
498 |
// ---------------------------------------------------------------------------
|
|
499 |
// CDirectPrintAppAppUi::HandlePrintEventL()
|
|
500 |
// Handle the events from engine side
|
|
501 |
// ---------------------------------------------------------------------------
|
|
502 |
//
|
|
503 |
void CDirectPrintAppAppUi::HandlePrintEventL(
|
|
504 |
TDirectPrintEngineEvents aEvent,
|
|
505 |
TInt /*aError*/,
|
|
506 |
const TDesC& /*aParam*/)
|
|
507 |
{
|
|
508 |
|
|
509 |
switch (aEvent)
|
|
510 |
{
|
|
511 |
case EDirectPrintEngineEventStartCreatePrintData:
|
|
512 |
break;
|
|
513 |
case EDirectPrintEngineEventFinishCreatePrintData:
|
|
514 |
{
|
|
515 |
//TInt msgid = R_DIRECTPRINT_MSG_BEARER_OPEN_ERR;
|
|
516 |
TRAPD(err, iBearerMgr->CreateJobL());
|
|
517 |
if (err == KErrNone)
|
|
518 |
{
|
|
519 |
//msgid = R_DIRECTPRINT_MSG_SUBMIT_PRINT_ERR;
|
|
520 |
TRAP(err, iBearerMgr->SubmitPrintJobL());
|
|
521 |
}
|
|
522 |
|
|
523 |
if (err != KErrNone)
|
|
524 |
{
|
|
525 |
// show bearer open error
|
|
526 |
CAknErrorNote* errornote = new (ELeave) CAknErrorNote( ETrue );
|
|
527 |
HBufC* format = StringLoader::LoadLC( R_DIRECTPRINT_MSG_BEARER_OPEN_ERR );
|
|
528 |
HBufC* msg = HBufC::NewLC(format->Length()+5);
|
|
529 |
TPtr ptrMsg(msg->Des());
|
|
530 |
ptrMsg.AppendFormat(*format, err);
|
|
531 |
errornote->ExecuteLD( *msg );
|
|
532 |
CleanupStack::PopAndDestroy( msg );
|
|
533 |
CleanupStack::PopAndDestroy( format );
|
|
534 |
}
|
|
535 |
}
|
|
536 |
break;
|
|
537 |
case EDirectPrintEngineEventCancelCreatePrintData:
|
|
538 |
break;
|
|
539 |
case EDirectPrintEngineEventErrorCreatePrintData:
|
|
540 |
break;
|
|
541 |
default:
|
|
542 |
break;
|
|
543 |
}
|
|
544 |
}
|
|
545 |
|
|
546 |
// ---------------------------------------------------------------------------
|
|
547 |
// CDirectPrintAppAppUi::InitializeBearerMngL()
|
|
548 |
// Initialize bearer manager.
|
|
549 |
// ---------------------------------------------------------------------------
|
|
550 |
//
|
|
551 |
void CDirectPrintAppAppUi::InitializeBearerMngL()
|
|
552 |
{
|
|
553 |
iBearerMgr = CDirectPrintBearerMgr::NewL(this, iDoc->Model());
|
|
554 |
}
|
|
555 |
|
|
556 |
// ---------------------------------------------------------------------------
|
|
557 |
// CDirectPrintAppAppUi::InitializePluginMgrL()
|
|
558 |
// Initialize plugin manager.
|
|
559 |
// ---------------------------------------------------------------------------
|
|
560 |
//
|
|
561 |
void CDirectPrintAppAppUi::InitializePluginMgrL()
|
|
562 |
{
|
|
563 |
iPluginMgr = CDirectPrintUiPluginMgr::NewL(iDoc->Model());
|
|
564 |
}
|
|
565 |
|
|
566 |
// ---------------------------------------------------------------------------
|
|
567 |
// CDirectPrintAppAppUi::HandleBearerMngEventL()
|
|
568 |
// Handle the events from engine side
|
|
569 |
// ---------------------------------------------------------------------------
|
|
570 |
//
|
|
571 |
void CDirectPrintAppAppUi::HandleBearerMngEventL(
|
|
572 |
TDirectPrintBearerMngEvents aEvent,
|
|
573 |
TInt /*aError*/,
|
|
574 |
const TDesC& /*aParam*/)
|
|
575 |
{
|
|
576 |
|
|
577 |
switch (aEvent)
|
|
578 |
{
|
|
579 |
case EDirectPrintBearerMngErrorConnectBearer:
|
|
580 |
break;
|
|
581 |
case EDirectPrintBearerMngConnectedBearer:
|
|
582 |
break;
|
|
583 |
default:
|
|
584 |
break;
|
|
585 |
}
|
|
586 |
}
|
|
587 |
|
|
588 |
void CDirectPrintAppAppUi::PrintJobProgressEvent( TInt aStatus,
|
|
589 |
TInt aPercentCompletion,
|
|
590 |
TInt aJobStateCode )
|
|
591 |
{
|
|
592 |
LOG3("Start CDirectPrintAppAppUi::PrintJobProgressEvent[%d],[%d],[%d]",
|
|
593 |
aStatus, aPercentCompletion, aJobStateCode);
|
|
594 |
if ( aStatus == EActive )
|
|
595 |
{
|
|
596 |
LOG("aStatus == EActive");
|
|
597 |
|
|
598 |
}
|
|
599 |
else
|
|
600 |
{
|
|
601 |
LOG("aStatus == EDone");
|
|
602 |
if ( aJobStateCode == ECancelling && aStatus == EDone )
|
|
603 |
{
|
|
604 |
LOG("ECancelling");
|
|
605 |
}
|
|
606 |
else if ( aJobStateCode == ECancellingNoMessage && aStatus == EDone )
|
|
607 |
{
|
|
608 |
LOG("ECancellingNoMessage");
|
|
609 |
}
|
|
610 |
else
|
|
611 |
{
|
|
612 |
LOG("Finish");
|
|
613 |
this->iBearerMgr->CloseSession();
|
|
614 |
}
|
|
615 |
}
|
|
616 |
LOG("End CDirectPrintAppAppUi::PrintJobProgressEvent");
|
|
617 |
}
|
|
618 |
|
|
619 |
void CDirectPrintAppAppUi::PrintJobErrorEvent( TInt aError,
|
|
620 |
TInt aErrorStringCode )
|
|
621 |
{
|
|
622 |
LOG2("Start CDirectPrintAppAppUi::PrintJobErrorEvent[%d], [%d]", aError, aErrorStringCode);
|
|
623 |
LOG("Finish when error happen");
|
|
624 |
this->iBearerMgr->CloseSession();
|
|
625 |
LOG("End CDirectPrintAppAppUi::PrintJobErrorEvent");
|
|
626 |
}
|
|
627 |
|
|
628 |
void CDirectPrintAppAppUi::PrinterStatusEvent( TInt aError,
|
|
629 |
TInt aErrorStringCode )
|
|
630 |
{
|
|
631 |
LOG2("Start CDirectPrintAppAppUi::PrinterStatusEvent[%d], [%d]", aError, aErrorStringCode);
|
|
632 |
LOG("End CDirectPrintAppAppUi::PrinterStatusEvent");
|
|
633 |
}
|
|
634 |
|
|
635 |
void CDirectPrintAppAppUi::PreviewImageEvent( TInt /*aFsBitmapHandle*/ )
|
|
636 |
{
|
|
637 |
LOG("Start CDirectPrintAppAppUi::PreviewImageEvent");
|
|
638 |
LOG("End CDirectPrintAppAppUi::PreviewImageEvent");
|
|
639 |
}
|
|
640 |
|
|
641 |
void CDirectPrintAppAppUi::ShowMessageL( TInt aMsgLine1Code,
|
|
642 |
TInt aMsgLine2Code )
|
|
643 |
{
|
|
644 |
LOG2("Start CDirectPrintAppAppUi::ShowMessageL[%d], [%d]", aMsgLine1Code, aMsgLine2Code);
|
|
645 |
LOG("End CDirectPrintAppAppUi::ShowMessageL");
|
|
646 |
}
|
|
647 |
|
|
648 |
TBool CDirectPrintAppAppUi::AskYesNoQuestionL( TInt aMsgLine1Code,
|
|
649 |
TInt aMsgLine2Code )
|
|
650 |
{
|
|
651 |
LOG2("Start CDirectPrintAppAppUi::AskYesNoQuestionL[%d], [%d]", aMsgLine1Code, aMsgLine2Code);
|
|
652 |
LOG("End CDirectPrintAppAppUi::AskYesNoQuestionL");
|
|
653 |
return EFalse;
|
|
654 |
}
|
|
655 |
|
|
656 |
const TDesC& CDirectPrintAppAppUi::AskForInputL( TInt aMsgLine1Code,
|
|
657 |
TInt aMsgLine2Code )
|
|
658 |
{
|
|
659 |
LOG2("Start CDirectPrintAppAppUi::AskForInputL[%d], [%d]", aMsgLine1Code, aMsgLine2Code);
|
|
660 |
LOG("End CDirectPrintAppAppUi::AskForInputL");
|
|
661 |
return KNullDesC;
|
|
662 |
}
|
|
663 |
|
|
664 |
// End of File
|
|
665 |
|