equal
deleted
inserted
replaced
23 #include <AiwServiceHandler.h> |
23 #include <AiwServiceHandler.h> |
24 #include <cameraapp.rsg> |
24 #include <cameraapp.rsg> |
25 #include <vgacamsettings.rsg> |
25 #include <vgacamsettings.rsg> |
26 #include <centralrepository.h> |
26 #include <centralrepository.h> |
27 |
27 |
28 |
|
29 #include "camoneclickuploadutility.h" |
28 #include "camoneclickuploadutility.h" |
30 #include "camlogging.h" |
29 #include "camlogging.h" |
31 #include "CamPanic.h" |
30 #include "CamPanic.h" |
32 #include "Cam.hrh" |
31 #include "Cam.hrh" |
33 |
32 |
360 if ( currIcon.Compare(iIconFileName) != 0 ) |
359 if ( currIcon.Compare(iIconFileName) != 0 ) |
361 { |
360 { |
362 PRINT( _L("Camera <> Decoding icon") ); |
361 PRINT( _L("Camera <> Decoding icon") ); |
363 iToolbar = aToolbar; |
362 iToolbar = aToolbar; |
364 TRAPD( err, DecodeIconL( &currIcon ) ); |
363 TRAPD( err, DecodeIconL( &currIcon ) ); |
365 if (err) |
364 if ( err ) |
366 { |
365 { |
367 PRINT1( _L("Camera <> CamOneClickUploadUtility - Icon decoding failed: %d"), err ); |
366 PRINT1( _L("Camera <> CamOneClickUploadUtility - Icon decoding failed: %d"), err ); |
368 } |
367 } |
369 } |
368 } |
370 else |
369 else |
375 CAknButton* button = dynamic_cast<CAknButton*>( |
374 CAknButton* button = dynamic_cast<CAknButton*>( |
376 aToolbar->ControlOrNull( ECamCmdOneClickUpload ) ); |
375 aToolbar->ControlOrNull( ECamCmdOneClickUpload ) ); |
377 if ( button ) |
376 if ( button ) |
378 { |
377 { |
379 CAknButtonState* state = button->State(); |
378 CAknButtonState* state = button->State(); |
380 |
379 CGulIcon *icon; |
381 CGulIcon *icon = CGulIcon::NewL( iIconImage, iIconMask ); |
380 if ( iIconMask ) |
|
381 { |
|
382 PRINT( _L("Camera <> Mask available") ); |
|
383 icon = CGulIcon::NewL( iIconImage, iIconMask ); |
|
384 } |
|
385 else |
|
386 { |
|
387 icon = CGulIcon::NewL( iIconImage ); |
|
388 } |
382 state->SetIcon( icon ); |
389 state->SetIcon( icon ); |
383 icon->SetBitmapsOwnedExternally( ETrue ); |
390 icon->SetBitmapsOwnedExternally( ETrue ); |
384 |
391 |
385 button->SetButtonFlags( KAknButtonNoFrame | KAknButtonPressedDownFrame ); |
|
386 aToolbar->DrawNow(); |
392 aToolbar->DrawNow(); |
387 } |
393 } |
388 } |
394 } |
389 } |
395 } |
390 PRINT( _L("Camera <= CCamOneClickUploadUtility::UpdateUploadIconL") ); |
396 PRINT( _L("Camera <= CCamOneClickUploadUtility::UpdateUploadIconL") ); |
400 |
406 |
401 if ( !iDecoder ) |
407 if ( !iDecoder ) |
402 { |
408 { |
403 iDecoder = CCamImageDecoder::NewL( *this ); |
409 iDecoder = CCamImageDecoder::NewL( *this ); |
404 } |
410 } |
405 iDecoder->StartIconConversionL( aPath ); |
411 |
|
412 TSize size( 44, 44 ); |
|
413 CAknButton* button = dynamic_cast<CAknButton*>( |
|
414 iToolbar->ControlOrNull( ECamCmdDelete ) ); |
|
415 if ( button ) |
|
416 { |
|
417 CAknButtonState* state = button->State(); |
|
418 if ( state ) |
|
419 { |
|
420 const CGulIcon* icon = state->Icon(); |
|
421 if ( icon ) |
|
422 { |
|
423 CFbsBitmap* bitmap = icon->Bitmap(); |
|
424 if ( bitmap ) |
|
425 { |
|
426 if ( bitmap->SizeInPixels().iHeight > 0 ) |
|
427 { |
|
428 size = bitmap->SizeInPixels(); |
|
429 } |
|
430 } |
|
431 } |
|
432 } |
|
433 } |
|
434 iDecoder->StartIconConversionL( aPath, size ); |
406 |
435 |
407 // Mark the given file as the icon in use when decoding has started |
436 // Mark the given file as the icon in use when decoding has started |
408 iIconFileName.Copy( *aPath ); |
437 iIconFileName.Copy( *aPath ); |
409 |
438 |
410 PRINT( _L("Camera <= CCamOneClickUploadUtility::DecodeIconL") ); |
439 PRINT( _L("Camera <= CCamOneClickUploadUtility::DecodeIconL") ); |
434 iIconMask->Duplicate( aMask->Handle() ); |
463 iIconMask->Duplicate( aMask->Handle() ); |
435 } |
464 } |
436 |
465 |
437 if ( iToolbar ) |
466 if ( iToolbar ) |
438 { |
467 { |
439 PRINT( _L("Displaying icon") ); |
468 PRINT( _L("Camera <> Ready to add icon to toolbar") ); |
440 |
469 |
441 CAknButton* uploadButton = |
470 CAknButton* uploadButton = |
442 static_cast<CAknButton*> (iToolbar->ControlOrNull(ECamCmdOneClickUpload)); |
471 static_cast<CAknButton*> (iToolbar->ControlOrNull(ECamCmdOneClickUpload)); |
443 |
472 |
444 CAknButtonState* currentState(NULL); |
|
445 if ( uploadButton ) |
473 if ( uploadButton ) |
446 { |
474 { |
447 currentState = uploadButton->State(); |
475 PRINT( _L("Camera <> Creating new icon") ); |
448 } |
476 CGulIcon *icon(NULL); |
449 CGulIcon *icon(NULL); |
477 if ( iIconMask ) |
450 if ( iIconMask ) |
478 { |
451 { |
479 PRINT( _L("Camera <> Mask available") ); |
452 icon = CGulIcon::NewL( iIconImage, iIconMask ); |
480 icon = CGulIcon::NewL( iIconImage, iIconMask ); |
453 } |
481 } |
454 else |
482 else |
455 { |
483 { |
456 icon = CGulIcon::NewL( iIconImage ); //Prevent freed pointer warning |
484 icon = CGulIcon::NewL( iIconImage ); |
457 } |
485 } |
458 icon->SetBitmapsOwnedExternally( ETrue ); |
486 |
459 if ( currentState ) |
487 icon->SetBitmapsOwnedExternally( ETrue ); |
460 { |
488 uploadButton->State()->SetIcon( icon ); |
461 currentState->SetIcon( icon ); |
|
462 } |
|
463 if ( uploadButton ) |
|
464 { |
|
465 uploadButton->SetButtonFlags( KAknButtonNoFrame | KAknButtonPressedDownFrame ); |
|
466 } |
489 } |
467 iToolbar->DrawNow(); |
490 iToolbar->DrawNow(); |
468 } |
491 } |
469 } |
492 } |
470 else |
493 else |