1 /* |
|
2 * Copyright (c) 2004-2007 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <imageprintapp.rsg> |
|
20 #include <aknlists.h> |
|
21 #include <aknPopup.h> |
|
22 #include <StringLoader.h> |
|
23 #include <AknQueryDialog.h> |
|
24 #include <aknPopupHeadingPane.h> |
|
25 #include <badesca.h> |
|
26 #include <eikenv.h> |
|
27 #include <StringLoader.h> |
|
28 #include <AknWaitDialog.h> |
|
29 #include <AknIconUtils.h> |
|
30 #include <AknGlobalMsgQuery.h> // global message query |
|
31 #include <apgcli.h> // rapalssession |
|
32 #include <centralrepository.h> // repository |
|
33 #include <aknmessagequerydialog.h> |
|
34 #include <bluetooth/hci/hcierrors.h> |
|
35 #include <imgprintbitmaps.mbg> |
|
36 #include <upnpsettings.h> |
|
37 #include <upnprunsetupcommand.h> |
|
38 #include <upnpshowcommand.h> |
|
39 |
|
40 #include "cdiscoverydlgmanager.h" |
|
41 #include "imageprint.h" |
|
42 #include "mdiscovery.h" |
|
43 #include "mprintsettings.h" |
|
44 #include "ciffactory.h" |
|
45 #include "mprintsettings.h" |
|
46 #include "imgpprintapputil.h" |
|
47 #include "cimageprintappui.h" |
|
48 #include "imageprintconsts.h" |
|
49 #include "cimageprintdoc.h" |
|
50 #include "cimageprintengine.h" |
|
51 #include "tprinter.h" |
|
52 #include "clog.h" |
|
53 |
|
54 const TInt KArrayGranularity( 5 ); |
|
55 const TInt KSearchAgainUID ( -1 ); |
|
56 |
|
57 _LIT( KEmptyIconIndex, "0" ); |
|
58 _LIT( KCachedIconIndex, "1" ); |
|
59 _LIT( KBTIconIndex, "2" ); |
|
60 _LIT( KKioskIconIndex, "3" ); |
|
61 _LIT( KMMCIconIndex, "4" ); |
|
62 _LIT( KUSBIconIndex, "5" ); |
|
63 _LIT( KIconFile, "z:\\resource\\apps\\imgprintbitmaps.mif" ); |
|
64 |
|
65 const TUint KSpaceForSingleIcon( 2 ); // icon index + tab = 2 chars |
|
66 const TUint KSpaceForBothIcons( 4 ); // icon index + tab + cache index + tab = 4 chars |
|
67 |
|
68 const TInt KNumberOfIcons( 7 ); |
|
69 _LIT( KWLANIconIndex, "6" ); |
|
70 |
|
71 void CleanUpResetAndDestroy(TAny* aArray) |
|
72 { |
|
73 if(aArray) |
|
74 { |
|
75 CArrayPtrFlat<TDesC>* array=(CArrayPtrFlat<TDesC>*)aArray; |
|
76 array->ResetAndDestroy(); |
|
77 delete array; |
|
78 } |
|
79 } |
|
80 // CONSTRUCTION |
|
81 CDiscoveryDlgManager* CDiscoveryDlgManager::NewL( |
|
82 CIFFactory& aIFFactory ) |
|
83 { |
|
84 CDiscoveryDlgManager* self = NewLC( aIFFactory ); |
|
85 CleanupStack::Pop(self); |
|
86 return self; |
|
87 } |
|
88 |
|
89 CDiscoveryDlgManager* CDiscoveryDlgManager::NewLC( |
|
90 CIFFactory& aIFFactory ) |
|
91 { |
|
92 CDiscoveryDlgManager* self = |
|
93 new (ELeave) CDiscoveryDlgManager (); |
|
94 CleanupStack::PushL(self); |
|
95 self->ConstructL( aIFFactory ); |
|
96 return self; |
|
97 } |
|
98 |
|
99 // Constructor |
|
100 CDiscoveryDlgManager::CDiscoveryDlgManager() |
|
101 { |
|
102 } |
|
103 |
|
104 // 2nd phase constructor |
|
105 void CDiscoveryDlgManager::ConstructL( CIFFactory& aIFFactory ) |
|
106 { |
|
107 iUidArray = new ( ELeave ) CArrayFixFlat<TInt>( KArrayGranularity ); |
|
108 iBrandArray = new ( ELeave ) CArrayFixFlat<TUint>( KArrayGranularity ); |
|
109 iProtocolArray = new ( ELeave ) CArrayFixFlat<TPrinterType>( KArrayGranularity ); |
|
110 iListOfDeviceNames = new ( ELeave ) CDesCArrayFlat( KArrayGranularity ); |
|
111 iActivePopup = EFalse; // Popuplist is not activated |
|
112 iNameArray = new (ELeave) CDesCArrayFlat( KArrayGranularity ); |
|
113 iDiscovery = aIFFactory.DiscoveryIF(); |
|
114 iSettings = aIFFactory.SettingsIF(); |
|
115 iSelectDeviceText = StringLoader::LoadL( R_QTN_POPUP_LIST_TITLE ); |
|
116 iSearchingText = StringLoader::LoadL( R_QTN_POPUP_LIST_TITLE2 ); |
|
117 iActiveTitleText.Set( iSearchingText->Des() ); |
|
118 } |
|
119 |
|
120 // Destructor |
|
121 CDiscoveryDlgManager::~CDiscoveryDlgManager() |
|
122 { |
|
123 if ( iDiscovery ) |
|
124 { |
|
125 iDiscovery->RemoveDiscoveryObserver(); |
|
126 } |
|
127 if ( iActivePopup ) |
|
128 { |
|
129 if ( iPopupList ) |
|
130 { |
|
131 iPopupList->CancelPopup(); |
|
132 } |
|
133 } |
|
134 delete iListBox; |
|
135 delete iUidArray; |
|
136 delete iBrandArray; |
|
137 delete iProtocolArray; |
|
138 delete iListOfDeviceNames; |
|
139 if ( iNameArray ) |
|
140 { |
|
141 iNameArray->Reset(); |
|
142 } |
|
143 delete iNameArray; |
|
144 delete iPrinterName; |
|
145 delete iSearchingText; |
|
146 delete iSelectDeviceText; |
|
147 } |
|
148 |
|
149 // Called when new device is found |
|
150 void CDiscoveryDlgManager::NotifyNewPrintDeviceL( |
|
151 HBufC* aText, |
|
152 TInt aUid, |
|
153 TBool aCached, |
|
154 TPrinterType aType, |
|
155 TUint aVendor ) |
|
156 { |
|
157 LOG("CDiscoveryDlgManager::NotifyNewPrintDevice BEGIN"); |
|
158 if( iHiddenDiscovery ) |
|
159 { |
|
160 // multi-device hidden discovery (bt/wlan) handled differently |
|
161 if ( iMultiDiscovery ) |
|
162 { |
|
163 LOG("CDiscoveryDlgManager::NotifyNewPrintDevice doing hidden multi-discovery"); |
|
164 TInt uid = iSettings->GetDefaultPrintID(); |
|
165 LOG2("CDiscoveryDlgManager::NotifyNewPrintDevice found: %d default: %d", aUid, uid); |
|
166 if ( uid == aUid ) |
|
167 { |
|
168 if( iHiddenDiscoveryDialog ) |
|
169 { |
|
170 TRAP_IGNORE( iHiddenDiscoveryDialog->ProcessFinishedL() ); |
|
171 iHiddenDiscoveryDialog = NULL; |
|
172 } |
|
173 |
|
174 TInt printerErrorCode(0); |
|
175 printerErrorCode = iDiscovery->ChoosePrinterL( aUid ); |
|
176 iSettings->SetCurrentPrinterProtocol( aType ); |
|
177 iSettings->SetCurrentPrinterVendor( aVendor ); |
|
178 iSettings->SetCurrentPrinterName( *aText ); |
|
179 if( printerErrorCode == 0 ) |
|
180 { |
|
181 iPrinterFound = ETrue; |
|
182 iDiscoveryCompleted = ETrue; |
|
183 delete iPrinterName; |
|
184 iPrinterName = NULL; |
|
185 // Cancel the discovery when device is found printjob is done. |
|
186 iDiscovery->CancelDeviceDiscoveryL(); |
|
187 iPrinterName = aText->AllocL(); |
|
188 } |
|
189 else |
|
190 { |
|
191 iPrinterFound = EFalse; |
|
192 } |
|
193 } |
|
194 } |
|
195 // USB and MMC hidden discovery only find one printer or not a printer at all |
|
196 else |
|
197 { |
|
198 if( iHiddenDiscoveryDialog ) |
|
199 { |
|
200 iHiddenDiscoveryDialog->ProcessFinishedL(); |
|
201 iHiddenDiscoveryDialog = NULL; |
|
202 } |
|
203 |
|
204 TInt printerErrorCode(0); |
|
205 printerErrorCode = iDiscovery->ChoosePrinterL( aUid ); |
|
206 iSettings->SetCurrentPrinterProtocol( aType ); |
|
207 iSettings->SetCurrentPrinterVendor( aVendor ); |
|
208 if( printerErrorCode == 0 ) |
|
209 { |
|
210 iPrinterFound = ETrue; |
|
211 iDiscoveryCompleted = ETrue; |
|
212 delete iPrinterName; |
|
213 iPrinterName = 0; |
|
214 if( aType == MDiscoveryObserver::EMMC ) |
|
215 { |
|
216 HBufC* memoryCard = 0; |
|
217 memoryCard = StringLoader::LoadLC |
|
218 ( R_QTN_PRINT_MEMORY_CARD ); |
|
219 |
|
220 iSettings->SetCurrentPrinterName( *memoryCard ); |
|
221 iPrinterName = memoryCard->AllocL(); |
|
222 CleanupStack::PopAndDestroy( memoryCard ); |
|
223 } |
|
224 else |
|
225 { |
|
226 iSettings->SetCurrentPrinterName( *aText ); |
|
227 iPrinterName = aText->AllocL(); |
|
228 } |
|
229 } |
|
230 else |
|
231 { |
|
232 iPrinterFound = EFalse; |
|
233 } |
|
234 } |
|
235 } |
|
236 else |
|
237 { |
|
238 if ( aType == MDiscoveryObserver::EUSB ) |
|
239 { |
|
240 iUsbPrinterID = aUid; |
|
241 } |
|
242 |
|
243 TRAPD( err, AddNewDeviceToListL( aText, aUid, aCached, aType, aVendor ) ); |
|
244 if ( err ) |
|
245 { |
|
246 LOG1("CDiscoveryDlgManager::NotifyNewPrintDevice device adding leaved with: %d", err ); |
|
247 // Nothing to do with the error code coming from ShowErrorMsgL |
|
248 TRAP_IGNORE( IMGPPrintAppUtil::ShowErrorMsgL( err ) ); |
|
249 } |
|
250 } |
|
251 LOG("CDiscoveryDlgManager::NotifyNewPrintDevice END"); |
|
252 } |
|
253 |
|
254 // Called when error is found |
|
255 void CDiscoveryDlgManager::DiscoveryError( |
|
256 TInt aErrCode ) |
|
257 { |
|
258 if ( aErrCode == ENoConnection ) |
|
259 { |
|
260 CancelDiscovery(); |
|
261 } |
|
262 } |
|
263 |
|
264 // Called when process completed |
|
265 void CDiscoveryDlgManager::DeviceDiscoveryCompleted() |
|
266 { |
|
267 // // Added this to avoid multiple "Search Again" texts, because server sends DeviceDiscoveryCompleted() more than once |
|
268 if( iDiscoveryCompleted ) |
|
269 { |
|
270 return; |
|
271 } |
|
272 |
|
273 LOG1("[CDiscoveryDlgManager::DeviceDiscoveryCompleted]\t Before dissmissing the process/wait dialog, iDiscoveryCompleted has value of %d", iDiscoveryCompleted); |
|
274 |
|
275 // Searching over, flag is essential |
|
276 iSearchingCancelled = ETrue; |
|
277 |
|
278 iActiveTitleText.Set( iSelectDeviceText->Des() ); |
|
279 // Set the title of the pop-up list |
|
280 if ( iPopupList ) |
|
281 { |
|
282 TRAP_IGNORE( iPopupList->SetTitleL( iActiveTitleText ) ); |
|
283 } |
|
284 LOG("CDiscoveryDlgManager::DeviceDiscoveryCompleted BEGIN"); |
|
285 if( iHiddenDiscoveryDialog ) |
|
286 { |
|
287 TRAP_IGNORE( iHiddenDiscoveryDialog->ProcessFinishedL() ); |
|
288 iHiddenDiscoveryDialog = NULL; |
|
289 } |
|
290 |
|
291 iDiscoveryCompleted = ETrue; |
|
292 if ((iActivePopup) && (iPopupList)) |
|
293 { |
|
294 iPopupList->Heading()->CancelAnimation(); |
|
295 |
|
296 TRAP_IGNORE( RemoveCachedIconsL() ); |
|
297 TRAP_IGNORE( AddSearchAgainTextL() ); |
|
298 |
|
299 if ( iPopupList ) |
|
300 { |
|
301 TRAP_IGNORE( iPopupList->ButtonGroupContainer()->SetCommandSetL( |
|
302 R_AVKON_SOFTKEYS_SELECT_CANCEL ); |
|
303 iPopupList->ButtonGroupContainer()->DrawNow() ); |
|
304 } |
|
305 } |
|
306 if ( iCancelling ) |
|
307 { |
|
308 iCancelling = EFalse; |
|
309 TRAP_IGNORE( iCancellingDialog->ProcessFinishedL() ); |
|
310 iCancellingDialog = NULL; |
|
311 } |
|
312 LOG("CDiscoveryDlgManager::DeviceDiscoveryCompleted END"); |
|
313 } |
|
314 |
|
315 // Displays the printer devices |
|
316 TBool CDiscoveryDlgManager::StartDlgManagerL( TInt aProtocol, TBool aHidden ) |
|
317 { |
|
318 LOG2("CDiscoveryDlgManager::StartDlgManagerL BEGIN: protocol %d, hidden: %d", aProtocol, aHidden); |
|
319 iDiscoveryCompleted = EFalse; |
|
320 TBool okToContinue( ETrue ); |
|
321 iHiddenDiscovery = aHidden; |
|
322 |
|
323 // Start the device discovery with all the supported protocols |
|
324 if( aProtocol == 0 ) |
|
325 { |
|
326 iSupportedProtocols = iDiscovery->SupportedProtocols(); |
|
327 |
|
328 // If discovering WLAN, AP must be defined before continuing |
|
329 if ( iSupportedProtocols & KImagePrint_PrinterProtocol_UPnP ) |
|
330 { |
|
331 LOG("CDiscoveryDlgManager::StartDlgManagerL: TryWlanDiscoveryL"); |
|
332 TryDeviceDiscoveryL( iSupportedProtocols, EFalse ); |
|
333 } |
|
334 // Discovery without WLAN |
|
335 else |
|
336 { |
|
337 LOG("CDiscoveryDlgManager::StartDlgManagerL: StartDeviceDiscoveryL"); |
|
338 iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); |
|
339 } |
|
340 } |
|
341 else |
|
342 { |
|
343 iSupportedProtocols = aProtocol; |
|
344 |
|
345 // If discovering WLAN |
|
346 if ( iSupportedProtocols & KImagePrint_PrinterProtocol_UPnP ) |
|
347 { |
|
348 LOG("CDiscoveryDlgManager::StartDlgManagerL - discovering WLAN"); |
|
349 if ( !TryDeviceDiscoveryL( aProtocol, ETrue ) ) |
|
350 { |
|
351 LOG("CDiscoveryDlgManager::StartDlgManagerL - discovering WLAN failed"); |
|
352 // If discovering failed, do not continue |
|
353 okToContinue = EFalse; |
|
354 return okToContinue; |
|
355 } |
|
356 } |
|
357 else |
|
358 { |
|
359 LOG("iDiscovery->StartDeviceDiscoveryL START"); |
|
360 iDiscovery->StartDeviceDiscoveryL( this, aProtocol ); |
|
361 } |
|
362 |
|
363 LOG("iDiscovery->StartDeviceDiscoveryL END"); |
|
364 } |
|
365 |
|
366 // BT & WLAN cases can find multiple devices which has to be handled |
|
367 if ( aProtocol & KImagePrint_PrinterProtocol_BPP || |
|
368 aProtocol & KImagePrint_PrinterProtocol_BIP || |
|
369 aProtocol & KImagePrint_PrinterProtocol_OPP_Printer || |
|
370 aProtocol & KImagePrint_PrinterProtocol_OPP_PC || |
|
371 aProtocol & KImagePrint_PrinterProtocol_UPnP ) |
|
372 { |
|
373 iMultiDiscovery = ETrue; |
|
374 } |
|
375 |
|
376 if( iHiddenDiscovery ) |
|
377 { |
|
378 okToContinue = StartHiddenDiscoveryL(); |
|
379 } |
|
380 else |
|
381 { |
|
382 okToContinue = StartNormalDiscoveryL(); |
|
383 } |
|
384 |
|
385 LOG1("CDiscoveryDlgManager::StartDlgManagerL END return: %d", okToContinue); |
|
386 return okToContinue; |
|
387 } |
|
388 |
|
389 TBool CDiscoveryDlgManager::StartNormalDiscoveryL() |
|
390 { |
|
391 iActiveTitleText.Set( iSearchingText->Des() ); |
|
392 LOG("CDiscoveryDlgManager::StartNormalDiscoveryL BEGIN"); |
|
393 TInt printerErrorCode = 0; |
|
394 TBool continueSearch( ETrue ); |
|
395 TBool okToContinue( ETrue ); |
|
396 iSearchingCancelled = EFalse; // ADDED |
|
397 TInt uid; // Printer uid |
|
398 // Loop until printer is selected or user decides to exit |
|
399 while ( continueSearch ) |
|
400 { |
|
401 // Create pop-up list |
|
402 if ( !iPopupList ) |
|
403 { |
|
404 iPopupList = CreatePopupListL(); |
|
405 } |
|
406 |
|
407 // Show the pop-up list |
|
408 if ( iListOfDeviceNames->Count() > 0 ) |
|
409 { |
|
410 iPopupList->ButtonGroupContainer()->SetCommandSetL( |
|
411 R_AVKON_SOFTKEYS_STOP |
|
412 ); |
|
413 } |
|
414 |
|
415 // Launch the pop-up list for found devices |
|
416 LOG("CDiscoveryDlgManager::StartNormalDiscoveryL before launch popuplist"); |
|
417 TBool selected = iPopupList->ExecuteLD(); |
|
418 LOG1("CDiscoveryDlgManager::StartNormalDiscoveryL after popupList, selected: %d", selected); |
|
419 iPopupList = NULL; |
|
420 iActivePopup = EFalse; |
|
421 LOG("CDiscoveryDlgManager::StartNormalDiscoveryL returned from popup"); |
|
422 TInt index = iListBox->CurrentItemIndex(); |
|
423 |
|
424 // Search again was selected |
|
425 if ( selected && iUidArray->At( index ) == KSearchAgainUID ) |
|
426 { |
|
427 RestartDiscoveryL(); |
|
428 } |
|
429 // Device was selected |
|
430 else if ( selected ) |
|
431 { |
|
432 uid = iUidArray->At( index ); |
|
433 if ( uid == iUsbPrinterID ) |
|
434 { |
|
435 iUSBPrinterSelected = ETrue ; |
|
436 } |
|
437 else |
|
438 { |
|
439 iUSBPrinterSelected = EFalse; |
|
440 } |
|
441 |
|
442 iCurrentPrinterUid = uid; |
|
443 printerErrorCode = iDiscovery->ChoosePrinterL( uid ); |
|
444 if ( printerErrorCode != KErrNone ) |
|
445 { |
|
446 IMGPPrintAppUtil::ShowErrorMsgL( printerErrorCode ); |
|
447 User::Leave( printerErrorCode ); |
|
448 } |
|
449 else |
|
450 { |
|
451 if ( iUidArray->At( 0 ) == KSearchAgainUID ) |
|
452 { |
|
453 iSettings->SetCurrentPrinterProtocol( iProtocolArray->At( index - 1 ) ); |
|
454 iSettings->SetCurrentPrinterVendor( iBrandArray->At( index - 1 ) ); |
|
455 iSettings->SetCurrentPrinterName( (*iNameArray)[index-1] ); |
|
456 } |
|
457 else |
|
458 { |
|
459 iSettings->SetCurrentPrinterProtocol( iProtocolArray->At( index ) ); |
|
460 iSettings->SetCurrentPrinterVendor( iBrandArray->At( index )); |
|
461 iSettings->SetCurrentPrinterName( (*iNameArray)[index] ); |
|
462 } |
|
463 |
|
464 continueSearch = EFalse; |
|
465 // If there wasn't default protocol then set selected printer and protocol as default |
|
466 if ( iSettings->GetDefaultPrinterProtocol() == KErrNotFound ) |
|
467 { |
|
468 LOG1("CDiscoveryDlgManager::StartNormalDiscoveryL default protocol wasn't set, setting uid: %d", uid ); |
|
469 iSettings->SetDefaultPrinterID( uid ); |
|
470 // Discovery has completed and 'Search again' was added as a first item |
|
471 // access protocol array with index-1 |
|
472 if ( iUidArray->At( 0 ) == KSearchAgainUID ) |
|
473 { |
|
474 iSettings->SetDefaultPrinterProtocol( iProtocolArray->At( index-1 ) ); |
|
475 iSettings->SetDefaultPrinterNameL( (*iNameArray)[index-1] ); |
|
476 } |
|
477 else |
|
478 { |
|
479 iSettings->SetDefaultPrinterProtocol( iProtocolArray->At( index ) ); |
|
480 iSettings->SetDefaultPrinterNameL( (*iNameArray)[index] ); |
|
481 } |
|
482 } |
|
483 else |
|
484 { |
|
485 LOG("CDiscoveryDlgManager::StartNormalDiscoveryL default protocol was already set" ); |
|
486 } |
|
487 } |
|
488 |
|
489 TPtrC name = iListOfDeviceNames->MdcaPoint( index ); |
|
490 delete iPrinterName; |
|
491 iPrinterName = NULL; |
|
492 iPrinterName = name.AllocL(); |
|
493 } |
|
494 // Stop/Cancel was selected |
|
495 else |
|
496 { |
|
497 LOG("CDiscoveryDlgManager::StartNormalDiscoveryL Stop/Cancel was selected" ); |
|
498 // Searching cancelled by user, cancel device discovery |
|
499 if ( !iSearchingCancelled ) |
|
500 { |
|
501 LOG("CDiscoveryDlgManager::StartNormalDiscoveryL iSearchingCancelled EFalse" ); |
|
502 iSearchingCancelled = ETrue; |
|
503 iDiscovery->CancelDeviceDiscoveryL(); |
|
504 } |
|
505 |
|
506 // User cancelled the whole discovery dialog |
|
507 else |
|
508 { |
|
509 LOG("CDiscoveryDlgManager::StartNormalDiscoveryL iSearchingCancelled ETrue" ); |
|
510 continueSearch = EFalse; |
|
511 okToContinue = EFalse; |
|
512 iCancelling = ETrue; |
|
513 |
|
514 // User cancelled the discovery dialog before all the printers were found |
|
515 if ( !iDiscoveryCompleted ) |
|
516 { |
|
517 //ShowCancelWaitNoteL(); |
|
518 } |
|
519 } |
|
520 } |
|
521 } |
|
522 LOG("CDiscoveryDlgManager::StartNormalDiscoveryL END"); |
|
523 return okToContinue; |
|
524 } |
|
525 |
|
526 TBool CDiscoveryDlgManager::StartHiddenDiscoveryL() |
|
527 { |
|
528 LOG("CDiscoveryDlgManager::StartHiddenDiscoveryL BEGIN"); |
|
529 iHiddenDiscoveryDialog = |
|
530 new (ELeave)CAknWaitDialog( |
|
531 (REINTERPRET_CAST(CEikDialog**,&iHiddenDiscoveryDialog))); |
|
532 LOG("iHiddenDiscoveryDialog->ExecuteLD( R_HIDDEN_DIALOG ) BEGIN"); |
|
533 iHiddenDiscoveryDialog->ExecuteLD( R_HIDDEN_DIALOG ); |
|
534 LOG("iHiddenDiscoveryDialog->ExecuteLD( R_HIDDEN_DIALOG ) END"); |
|
535 LOG1("iPrinterFound = %d", iPrinterFound); |
|
536 LOG("CDiscoveryDlgManager::StartHiddenDiscoveryL END"); |
|
537 return iPrinterFound; |
|
538 } |
|
539 |
|
540 void CDiscoveryDlgManager::DialogDismissedL( TInt /*aButtonId*/ ) |
|
541 { |
|
542 LOG("CDiscoveryDlgManager::DialogDismissedL BEGIN"); |
|
543 // This is called only if hidden discovery is cancelled |
|
544 // start cancelling operation and put cancelling note on. |
|
545 iPrinterFound = EFalse; |
|
546 iCancelling = ETrue; |
|
547 iDiscovery->CancelDeviceDiscoveryL(); |
|
548 // User cancelled the discovery dialog before all the printers were found |
|
549 if ( !iDiscoveryCompleted ) |
|
550 { |
|
551 ShowCancelWaitNoteL(); |
|
552 } |
|
553 LOG("CDiscoveryDlgManager::DialogDismissedL END"); |
|
554 } |
|
555 |
|
556 void CDiscoveryDlgManager::ShowCancelWaitNoteL() |
|
557 { |
|
558 iCancellingDialog = |
|
559 new ( ELeave ) CAknWaitDialog( |
|
560 (REINTERPRET_CAST(CEikDialog**,&iCancellingDialog))); |
|
561 iCancellingDialog->PrepareLC(R_CANCEL_PRINTING_DIALOG); |
|
562 HBufC* text = StringLoader::LoadLC( R_QTN_PRINT_PROGRESS_PROMPT_CANCEL ); |
|
563 iCancellingDialog->SetTextL( *text ); |
|
564 CleanupStack::PopAndDestroy(text); |
|
565 |
|
566 iCancellingDialog->SetTone( CAknNoteDialog::ENoTone ); |
|
567 iCancellingDialog->RunLD(); |
|
568 } |
|
569 |
|
570 // Creates and initializees the popup list |
|
571 CAknPopupList* CDiscoveryDlgManager::CreatePopupListL() |
|
572 { |
|
573 LOG("CDiscoveryDlgManager::CreatePopupListL BEGIN"); |
|
574 if ( iListBox ) |
|
575 { |
|
576 delete iListBox; |
|
577 iListBox = 0; |
|
578 } |
|
579 // Creates list box for the pop-up list |
|
580 iListBox = new ( ELeave ) CAknSingleGraphicPopupMenuStyleListBox;//CAknSingleGraphicPopupMenuStyleListBox; |
|
581 |
|
582 // Create and initialize the popup list |
|
583 iPopupList = CAknPopupList::NewL( |
|
584 iListBox, |
|
585 /*R_AVKON_SOFTKEYS_CANCEL,*/ |
|
586 R_AVKON_SOFTKEYS_STOP, |
|
587 AknPopupLayouts::EDynMenuWindow ); |
|
588 |
|
589 // Set the title of the pop-up list |
|
590 iPopupList->SetTitleL( iActiveTitleText ); |
|
591 |
|
592 // Initialize list box |
|
593 iListBox->ConstructL( iPopupList, |
|
594 EAknListBoxSelectionList ); // EAknListBoxMenuList |
|
595 iListBox->CreateScrollBarFrameL( ETrue ); |
|
596 iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( |
|
597 CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); |
|
598 HBufC* text = StringLoader::LoadLC( R_QTN_PRINT_NO_PRINTERS ); |
|
599 iListBox->View()->SetListEmptyTextL( *text ); |
|
600 CleanupStack::PopAndDestroy( text ); |
|
601 |
|
602 //Array of icons to show in the pop-up list |
|
603 CArrayPtrFlat< CGulIcon >* icons = |
|
604 new( ELeave ) CArrayPtrFlat< CGulIcon >( KNumberOfIcons ); |
|
605 |
|
606 //Push to ClenupStack. Array and all of items added to it |
|
607 //are deleted if leave occurs |
|
608 CleanupStack::PushL(TCleanupItem(CleanUpResetAndDestroy, icons)); |
|
609 icons->SetReserveL( KNumberOfIcons ); |
|
610 |
|
611 CFbsBitmap* bitmap = NULL; |
|
612 CFbsBitmap* mask = NULL; |
|
613 |
|
614 bitmap = new( ELeave ) CFbsBitmap(); |
|
615 User::LeaveIfError( bitmap->Create( TSize(0,0), EColor256 ) ); |
|
616 CleanupStack::PushL( bitmap ); |
|
617 CGulIcon* icon = CGulIcon::NewL( bitmap ); |
|
618 CleanupStack::Pop( bitmap ); |
|
619 CleanupStack::PushL( icon ); |
|
620 icons->AppendL( icon ); |
|
621 CleanupStack::Pop( icon ); |
|
622 |
|
623 AknIconUtils::CreateIconLC( bitmap, mask, KIconFile, |
|
624 EMbmImgprintbitmapsQgn_indi_print_cached, |
|
625 EMbmImgprintbitmapsQgn_indi_print_cached_mask ); |
|
626 icon = CGulIcon::NewL(bitmap,mask); |
|
627 CleanupStack::Pop( 2 ); // bitmap, mask |
|
628 CleanupStack::PushL( icon ); |
|
629 icons->AppendL( icon ); |
|
630 CleanupStack::Pop( icon ); |
|
631 |
|
632 AknIconUtils::CreateIconLC( bitmap, mask, KIconFile, |
|
633 EMbmImgprintbitmapsQgn_prop_print_bt, |
|
634 EMbmImgprintbitmapsQgn_prop_print_bt_mask ); |
|
635 icon = CGulIcon::NewL( bitmap, mask ); |
|
636 CleanupStack::Pop( 2 ); // bitmap, mask |
|
637 CleanupStack::PushL( icon ); |
|
638 icons->AppendL( icon ); |
|
639 CleanupStack::Pop( icon ); |
|
640 |
|
641 AknIconUtils::CreateIconLC( bitmap, mask, KIconFile, |
|
642 EMbmImgprintbitmapsQgn_prop_print_kiosk, |
|
643 EMbmImgprintbitmapsQgn_prop_print_kiosk_mask ); |
|
644 icon = CGulIcon::NewL( bitmap, mask ); |
|
645 CleanupStack::Pop( 2 ); // bitmap, mask |
|
646 CleanupStack::PushL( icon ); |
|
647 icons->AppendL( icon ); |
|
648 CleanupStack::Pop( icon ); |
|
649 |
|
650 AknIconUtils::CreateIconLC( bitmap, mask, KIconFile, |
|
651 EMbmImgprintbitmapsQgn_prop_print_mmc, |
|
652 EMbmImgprintbitmapsQgn_prop_print_mmc_mask ); |
|
653 icon = CGulIcon::NewL( bitmap, mask ); |
|
654 CleanupStack::Pop( 2 ); // bitmap, mask |
|
655 CleanupStack::PushL( icon ); |
|
656 icons->AppendL( icon ); |
|
657 CleanupStack::Pop( icon ); |
|
658 |
|
659 AknIconUtils::CreateIconLC( bitmap, mask, KIconFile, |
|
660 EMbmImgprintbitmapsQgn_prop_print_usb, |
|
661 EMbmImgprintbitmapsQgn_prop_print_usb_mask ); |
|
662 icon = CGulIcon::NewL( bitmap, mask ); |
|
663 CleanupStack::Pop( 2 ); // bitmap, mask |
|
664 CleanupStack::PushL( icon ); |
|
665 icons->AppendL( icon ); |
|
666 CleanupStack::Pop( icon ); |
|
667 |
|
668 AknIconUtils::CreateIconLC( bitmap, mask, KIconFile, |
|
669 EMbmImgprintbitmapsQgn_prop_print_wlan, |
|
670 EMbmImgprintbitmapsQgn_prop_print_wlan_mask ); |
|
671 icon = CGulIcon::NewL( bitmap, mask ); |
|
672 CleanupStack::Pop( 2 ); // bitmap, mask |
|
673 CleanupStack::PushL( icon ); |
|
674 icons->AppendL( icon ); |
|
675 CleanupStack::Pop( icon ); |
|
676 |
|
677 CleanupStack::Pop( icons ); |
|
678 iListBox->ItemDrawer()->FormattedCellData()->SetIconArray( icons ); |
|
679 iListBox->Model()->SetItemTextArray( iListOfDeviceNames ); |
|
680 iListBox->Model()->SetOwnershipType( ELbmDoesNotOwnItemArray ); |
|
681 |
|
682 // Set the animation |
|
683 iPopupList->Heading()->SetHeaderAnimationL( R_IMAGEPRINT_ANIMATION ); |
|
684 iActivePopup = ETrue; |
|
685 |
|
686 LOG("CDiscoveryDlgManager::CreatePopupListL END"); |
|
687 return iPopupList; |
|
688 } |
|
689 |
|
690 // Adds new device to list, updates popup list |
|
691 void CDiscoveryDlgManager::AddNewDeviceToListL( |
|
692 HBufC* aText, |
|
693 TInt aUid, |
|
694 TBool aCached, |
|
695 TPrinterType aType, |
|
696 TUint aVendor ) |
|
697 { |
|
698 LOG("CDiscoveryDlgManager::AddNewDeviceToListL BEGIN"); |
|
699 HBufC* buf; |
|
700 |
|
701 // if the device is memory card |
|
702 if( aType == MDiscoveryObserver::EMMC ) |
|
703 { |
|
704 HBufC* stringholdercopy = StringLoader::LoadLC |
|
705 ( R_QTN_PRINT_MEMORY_CARD ); |
|
706 buf = HBufC::NewLC( stringholdercopy->Size() + KSpaceForSingleIcon ); |
|
707 TPtr ptr = buf->Des(); |
|
708 ptr.Append( KMMCIconIndex ); |
|
709 ptr.Append( KTabChar ); |
|
710 ptr.Append( stringholdercopy->Des() ); |
|
711 |
|
712 // Add new device into array |
|
713 iListOfDeviceNames->InsertL( 0, *buf ); |
|
714 iNameArray->InsertL( 0, *stringholdercopy ); |
|
715 CleanupStack::PopAndDestroy( 2, stringholdercopy ); //buf, stringholdercopy |
|
716 } |
|
717 else // any other device |
|
718 { |
|
719 if ( aCached ) |
|
720 { |
|
721 buf = HBufC::NewLC( aText->Size() + KSpaceForBothIcons ); |
|
722 } |
|
723 else |
|
724 { |
|
725 buf = HBufC::NewLC( aText->Size() + KSpaceForSingleIcon ); |
|
726 } |
|
727 TPtr ptr = buf->Des(); |
|
728 if( aType == MDiscoveryObserver::EBPP ) |
|
729 { |
|
730 ptr.Append( KBTIconIndex ); |
|
731 } |
|
732 else if( aType == MDiscoveryObserver::EOPP ) |
|
733 { |
|
734 ptr.Append( KKioskIconIndex ); |
|
735 } |
|
736 else if( aType == MDiscoveryObserver::EUSB ) |
|
737 { |
|
738 ptr.Append( KUSBIconIndex ); |
|
739 } |
|
740 else if( aType == MDiscoveryObserver::EWLAN ) |
|
741 { |
|
742 ptr.Append( KWLANIconIndex ); |
|
743 } |
|
744 else |
|
745 { |
|
746 ptr.Append( KEmptyIconIndex ); |
|
747 } |
|
748 ptr.Append( KTabChar ); |
|
749 ptr.Append( aText->Des() ); |
|
750 |
|
751 if ( aCached ) |
|
752 { |
|
753 ptr.Append( KTabChar ); |
|
754 ptr.Append( KCachedIconIndex ); |
|
755 } |
|
756 |
|
757 // Add new device into array |
|
758 iListOfDeviceNames->InsertL( 0, *buf ); |
|
759 CleanupStack::PopAndDestroy( buf ); |
|
760 } |
|
761 |
|
762 // Add Uid of the device into array |
|
763 iUidArray->InsertL( 0, aUid ); |
|
764 |
|
765 aVendor = TPrinter::EVendorNone; |
|
766 |
|
767 iBrandArray->InsertL( 0, aVendor ); |
|
768 iProtocolArray->InsertL( 0, aType ); |
|
769 if( aType != MDiscoveryObserver::EMMC ) |
|
770 { |
|
771 iNameArray->InsertL( 0, *aText ); |
|
772 } |
|
773 |
|
774 if ( iActivePopup ) |
|
775 { |
|
776 LOG("CDiscoveryDlgManager::AddNewDeviceToListL popup update"); |
|
777 iListBox->HandleItemAdditionL(); |
|
778 iPopupList->DrawNow(); |
|
779 |
|
780 if ( iListOfDeviceNames->MdcaCount() == 1 ) |
|
781 { |
|
782 // First item to appear, change CBA |
|
783 iPopupList->ButtonGroupContainer()->SetCommandSetL( |
|
784 R_AVKON_SOFTKEYS_STOP |
|
785 ); |
|
786 iPopupList->ButtonGroupContainer()->DrawNow(); |
|
787 } |
|
788 } |
|
789 LOG("CDiscoveryDlgManager::AddNewDeviceToListL END"); |
|
790 } |
|
791 |
|
792 // Returns the name of the chosen printer |
|
793 TInt CDiscoveryDlgManager::PrinterUid() const |
|
794 { |
|
795 return iCurrentPrinterUid; |
|
796 } |
|
797 |
|
798 // Returns the name of the chosen printer |
|
799 const TDesC& CDiscoveryDlgManager::PrinterName() const |
|
800 { |
|
801 LOG("CDiscoveryDlgManager::PrinterName() BEGIN"); |
|
802 if ( !iPrinterName ) |
|
803 { |
|
804 return KNullDesC(); |
|
805 } |
|
806 else |
|
807 { |
|
808 return *iPrinterName; |
|
809 } |
|
810 } |
|
811 |
|
812 TBool CDiscoveryDlgManager::USBPrinterSelected() const |
|
813 { |
|
814 return iUSBPrinterSelected; |
|
815 } |
|
816 |
|
817 // Resets the popup list and starts the device discovery again |
|
818 void CDiscoveryDlgManager::RestartDiscoveryL() |
|
819 { |
|
820 iSearchingCancelled = EFalse; |
|
821 |
|
822 iListOfDeviceNames->Reset(); |
|
823 iUidArray->Reset(); |
|
824 iBrandArray->Reset(); |
|
825 iProtocolArray->Reset(); |
|
826 iActiveTitleText.Set( iSearchingText->Des() ); |
|
827 iPopupList = CreatePopupListL(); |
|
828 iDiscoveryCompleted = EFalse; |
|
829 iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); |
|
830 } |
|
831 |
|
832 // Removes cached printer from the list |
|
833 void CDiscoveryDlgManager::RemoveCachedPrinterL( |
|
834 TInt aUid ) |
|
835 { |
|
836 TInt i( 0 ); |
|
837 TBool found( EFalse ); |
|
838 for ( i = 0; i < iUidArray->Count() && !found; i++ ) |
|
839 { |
|
840 if ( aUid == iUidArray->At( i ) ) |
|
841 { |
|
842 TInt curIndex = iListBox->CurrentItemIndex(); |
|
843 if ( curIndex >= i && |
|
844 iListOfDeviceNames->MdcaCount() > 1 && curIndex > 0 ) |
|
845 { |
|
846 iListBox->SetCurrentItemIndexAndDraw( curIndex - 1 ); |
|
847 } |
|
848 |
|
849 iUidArray->Delete( i ); |
|
850 iBrandArray->Delete( i ); |
|
851 iProtocolArray->Delete( i ); |
|
852 iNameArray->Delete( i ); |
|
853 iListOfDeviceNames->Delete( i ); |
|
854 iListBox->HandleItemRemovalL(); |
|
855 iPopupList->DrawNow(); |
|
856 |
|
857 if ( iListOfDeviceNames->MdcaCount() == 0 ) |
|
858 { |
|
859 // Zero items, change softkeys |
|
860 if ( iActivePopup ) |
|
861 { |
|
862 iPopupList->ButtonGroupContainer()->SetCommandSetL( |
|
863 R_AVKON_SOFTKEYS_CANCEL ); |
|
864 iPopupList->ButtonGroupContainer()->DrawNow(); |
|
865 } |
|
866 } |
|
867 found = ETrue; |
|
868 } |
|
869 } |
|
870 } |
|
871 |
|
872 // Removes cached printer icons from the list |
|
873 void CDiscoveryDlgManager::RemoveCachedIconsL() |
|
874 { |
|
875 TInt counter = iListOfDeviceNames->MdcaCount(); |
|
876 TChar KTabChar( 0x0009 ); |
|
877 for ( TInt i = 0 ; i < counter; i++ ) |
|
878 { |
|
879 TPtrC tmp( iListOfDeviceNames->MdcaPoint( i ) ); |
|
880 //locate the rightmost tab |
|
881 TInt tabPosition = tmp.LocateReverse( KTabChar ); |
|
882 if ( tabPosition != KErrNotFound && |
|
883 tabPosition > 1 ) //don't remove the pre-text tab |
|
884 { |
|
885 iListOfDeviceNames->InsertL( i, tmp.Left( tabPosition ) ); |
|
886 iListOfDeviceNames->Delete( i + 1 ); |
|
887 } |
|
888 } |
|
889 iListBox->HandleItemAdditionL(); |
|
890 iPopupList->DrawNow(); |
|
891 } |
|
892 |
|
893 // Adds serarch again text to list |
|
894 void CDiscoveryDlgManager::AddSearchAgainTextL() |
|
895 { |
|
896 HBufC* str = StringLoader::LoadLC |
|
897 ( R_QTN_SEARCH_AGAIN ); |
|
898 HBufC* buf = HBufC::NewLC( str->Size() + KSpaceForSingleIcon ); |
|
899 TPtr ptr = buf->Des(); |
|
900 ptr.Append( KEmptyIconIndex ); |
|
901 ptr.Append( KTabChar ); |
|
902 ptr.Append( str->Des() ); |
|
903 |
|
904 iListOfDeviceNames->InsertL( 0, *buf ); |
|
905 |
|
906 CleanupStack::PopAndDestroy( 2, str ); //buf, str |
|
907 |
|
908 iUidArray->InsertL( 0, KSearchAgainUID ); |
|
909 iListBox->HandleItemAdditionL(); |
|
910 iPopupList->DrawNow(); |
|
911 } |
|
912 |
|
913 //-------------------------------------------------------------------------------------------- |
|
914 // |
|
915 // CDiscoveryDlgManager::WlanAccessPointExists |
|
916 // |
|
917 //-------------------------------------------------------------------------------------------- |
|
918 TBool CDiscoveryDlgManager::WlanAccessPointExistsL() |
|
919 { |
|
920 LOG("[CDiscoveryDlgManager::WlanAccessPointExists] BEGIN"); |
|
921 TBool accessPointExists( EFalse ); |
|
922 CUpnpShowCommand* upnpShowCommand = NULL; |
|
923 TRAPD ( error, upnpShowCommand = CUpnpShowCommand::NewL() ); |
|
924 if ( error != KErrNone ) |
|
925 { |
|
926 LOG1("[CDiscoveryDlgManager::WlanAccessPointExists] CUpnpShowCommand::NewL leaves, with: %d", error); |
|
927 return accessPointExists; |
|
928 } |
|
929 CleanupStack::PushL( upnpShowCommand ); |
|
930 accessPointExists = upnpShowCommand->IsAvailableL(); |
|
931 CleanupStack::PopAndDestroy(); // upnpShowCommand |
|
932 LOG1("[CDiscoveryDlgManager::WlanAccessPointExists]\t END, AccessPointExists: %d", accessPointExists); |
|
933 return accessPointExists; |
|
934 } |
|
935 |
|
936 //-------------------------------------------------------------------------------------------- |
|
937 // |
|
938 // CDiscoveryDlgManager::TryDeviceDiscoveryL() |
|
939 // |
|
940 //-------------------------------------------------------------------------------------------- |
|
941 TBool CDiscoveryDlgManager::TryDeviceDiscoveryL( TUint aProtocols, TBool aSingleDiscovery ) |
|
942 { |
|
943 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL"); |
|
944 |
|
945 // WLAN access point not defined |
|
946 if ( !WlanAccessPointExistsL() ) |
|
947 { |
|
948 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - AP not defined, launch WLAN wizard query"); |
|
949 |
|
950 // Launch WLAN wizard query |
|
951 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - CAknMessageQueryDialog"); |
|
952 CAknMessageQueryDialog* dlg = new (ELeave) CAknMessageQueryDialog; |
|
953 |
|
954 // User pressed OK |
|
955 if ( dlg->ExecuteLD( R_LAUNCH_WLAN_WIZARD_QUERY ) ) |
|
956 { |
|
957 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Launch WLAN wizard"); |
|
958 |
|
959 // Launch WLAN wizard |
|
960 CUpnpRunSetupCommand* runSetupCommand = CUpnpRunSetupCommand::NewL(); |
|
961 CleanupStack::PushL(runSetupCommand); |
|
962 runSetupCommand->RunSetupL(); |
|
963 CleanupStack::PopAndDestroy(runSetupCommand); |
|
964 |
|
965 |
|
966 // If access point defined by the WLAN wizard |
|
967 if ( WlanAccessPointExistsL() ) |
|
968 { |
|
969 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - AP defined in WLAN wizard"); |
|
970 |
|
971 if ( aSingleDiscovery ) |
|
972 { |
|
973 // Start discovery |
|
974 // Continues to StartDeviceDiscoveryL |
|
975 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start discovery with single protocol"); |
|
976 iDiscovery->StartDeviceDiscoveryL( this, aProtocols ); |
|
977 } |
|
978 else |
|
979 { |
|
980 // Start discovery |
|
981 // Continues to StartDeviceDiscoveryL |
|
982 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start discovery with all prots"); |
|
983 iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); |
|
984 } |
|
985 } |
|
986 |
|
987 // Access point not defined by the WLAN wizard |
|
988 else |
|
989 { |
|
990 // Thus, WLAN discovery not supported |
|
991 iSupportedProtocols = iSupportedProtocols - KImagePrint_PrinterProtocol_UPnP; |
|
992 |
|
993 if ( aSingleDiscovery ) |
|
994 { |
|
995 // Do nothing |
|
996 // WLAN not supported |
|
997 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Launch WLAN wizard canceled"); |
|
998 return EFalse; |
|
999 } |
|
1000 else |
|
1001 { |
|
1002 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start discovery without WLAN"); |
|
1003 iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); |
|
1004 } |
|
1005 |
|
1006 iSupportedProtocols = iSupportedProtocols - KImagePrint_PrinterProtocol_UPnP; |
|
1007 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start discovery without WLAN"); |
|
1008 iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); |
|
1009 } |
|
1010 } |
|
1011 |
|
1012 // User pressed cancel |
|
1013 else |
|
1014 { |
|
1015 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - User pressed cancel"); |
|
1016 |
|
1017 // WLAN discovery not supported |
|
1018 iSupportedProtocols = iSupportedProtocols - KImagePrint_PrinterProtocol_UPnP; |
|
1019 |
|
1020 if ( aSingleDiscovery ) |
|
1021 { |
|
1022 // Do nothing |
|
1023 // WLAN not supported |
|
1024 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Launch WLAN wizard canceled"); |
|
1025 return EFalse; |
|
1026 } |
|
1027 else |
|
1028 { |
|
1029 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start discovery without WLAN"); |
|
1030 iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); |
|
1031 } |
|
1032 } |
|
1033 |
|
1034 return ETrue; |
|
1035 } |
|
1036 |
|
1037 // If WLAN access point is defined |
|
1038 else |
|
1039 { |
|
1040 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - AP is defined"); |
|
1041 |
|
1042 // Start discovery |
|
1043 // Continues to StartDeviceDiscoveryL |
|
1044 |
|
1045 if ( aSingleDiscovery ) |
|
1046 { |
|
1047 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start WLAN discovery"); |
|
1048 iDiscovery->StartDeviceDiscoveryL( this, aProtocols ); |
|
1049 } |
|
1050 else |
|
1051 { |
|
1052 LOG("[CUPnPPrintingDevice]\t TryDeviceDiscoveryL - Start discovery with all prots"); |
|
1053 iDiscovery->StartDeviceDiscoveryL( this, iSupportedProtocols ); |
|
1054 } |
|
1055 |
|
1056 return ETrue; |
|
1057 } |
|
1058 } |
|
1059 |
|
1060 //-------------------------------------------------------------------------------------------- |
|
1061 // |
|
1062 // CDiscoveryDlgManager::CancelDiscovery() |
|
1063 // |
|
1064 //-------------------------------------------------------------------------------------------- |
|
1065 void CDiscoveryDlgManager::CancelDiscovery() |
|
1066 { |
|
1067 LOG("CDiscoveryDlgManager::CancelDiscovery begin"); |
|
1068 if(iPopupList) |
|
1069 { |
|
1070 LOG("CDiscoveryDlgManager::CancelDiscovery canceling popup device list."); |
|
1071 iSearchingCancelled = ETrue; |
|
1072 |
|
1073 TInt error ( KErrNone ); |
|
1074 TRAP( error, iDiscovery->CancelDeviceDiscoveryL()); |
|
1075 |
|
1076 |
|
1077 iPopupList->CancelPopup(); |
|
1078 } |
|
1079 LOG("CDiscoveryDlgManager::CancelDiscovery end"); |
|
1080 } |
|
1081 |
|
1082 // End of File |
|