1 /* |
1 /* |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
38 const TUint32 KShareCrApplicationVersion = 0x01010020; |
38 const TUint32 KShareCrApplicationVersion = 0x01010020; |
39 const TInt KCamShareOnlineVersionBufLen = 12; |
39 const TInt KCamShareOnlineVersionBufLen = 12; |
40 const TVersion KShareOnlineMinimumVersion( 5, 0, 0 ); |
40 const TVersion KShareOnlineMinimumVersion( 5, 0, 0 ); |
41 const TUid KOpenModeOneClick = { 2 }; |
41 const TUid KOpenModeOneClick = { 2 }; |
42 const TUid KCmdGetOneClickToolTip = { 15 }; |
42 const TUid KCmdGetOneClickToolTip = { 15 }; |
|
43 const TUid KOpenModeShareSettings = { 11 }; |
43 |
44 |
44 const TUint32 KShareImageServiceIconFileName = 0x00000002; |
45 const TUint32 KShareImageServiceIconFileName = 0x00000002; |
45 const TUint32 KShareVideoServiceIconFileName = 0x00000003; |
46 const TUint32 KShareVideoServiceIconFileName = 0x00000003; |
46 const TUint32 KShareCommonServiceIconFileName = 0x00000004; |
47 const TUint32 KShareCommonServiceIconFileName = 0x00000004; |
47 |
48 |
181 // |
183 // |
182 const TDesC& CCamOneClickUploadUtility::ButtonTooltipL() |
184 const TDesC& CCamOneClickUploadUtility::ButtonTooltipL() |
183 { |
185 { |
184 __ASSERT_ALWAYS( iAiwServiceHandler, CamPanic( ECamPanicNullPointer ) ); |
186 __ASSERT_ALWAYS( iAiwServiceHandler, CamPanic( ECamPanicNullPointer ) ); |
185 |
187 |
|
188 if ( iTooltip ) |
|
189 { |
|
190 return *iTooltip; |
|
191 } |
|
192 |
186 CAiwGenericParamList& paramList = iAiwServiceHandler->InParamListL(); |
193 CAiwGenericParamList& paramList = iAiwServiceHandler->InParamListL(); |
187 paramList.Reset(); |
194 paramList.Reset(); |
188 |
195 |
189 TAiwVariant openVariant( KCmdGetOneClickToolTip ); |
196 TAiwVariant openVariant( KCmdGetOneClickToolTip ); |
190 TAiwGenericParam openParam( EGenericParamModeActivation, openVariant ); |
197 TAiwGenericParam openParam( EGenericParamModeActivation, openVariant ); |
210 iTooltip = NULL; |
217 iTooltip = NULL; |
211 iTooltip = res->Value().AsDes().AllocL(); |
218 iTooltip = res->Value().AsDes().AllocL(); |
212 return *iTooltip; |
219 return *iTooltip; |
213 } |
220 } |
214 |
221 |
|
222 // --------------------------------------------------------------------------- |
|
223 // Launch Share settings view |
|
224 // --------------------------------------------------------------------------- |
|
225 // |
|
226 void CCamOneClickUploadUtility::LaunchShareSettings() |
|
227 { |
|
228 PRINT( _L("Camera => CCamOneClickUploadUtility::LaunchShareSettings") ); |
|
229 |
|
230 CAiwGenericParamList& paramList = iAiwServiceHandler->InParamListL(); |
|
231 paramList.Reset(); |
|
232 |
|
233 TAiwVariant openVariant( KOpenModeShareSettings ); |
|
234 TAiwGenericParam openParam( EGenericParamModeActivation, openVariant ); |
|
235 paramList.AppendL( openParam ); |
|
236 iAiwServiceHandler->ExecuteServiceCmdL( KAiwCmdView, |
|
237 paramList, iAiwServiceHandler->OutParamListL() ); |
|
238 |
|
239 PRINT( _L("Camera <= CCamOneClickUploadUtility::LaunchShareSettings") ); |
|
240 } |
215 |
241 |
216 // --------------------------------------------------------------------------- |
242 // --------------------------------------------------------------------------- |
217 // Check Share Online version |
243 // Check Share Online version |
218 // --------------------------------------------------------------------------- |
244 // --------------------------------------------------------------------------- |
219 // |
245 // |
287 { |
313 { |
288 __ASSERT_DEBUG( !iAiwServiceHandler, CamPanic( ECamPanicResourceLeak ) ); |
314 __ASSERT_DEBUG( !iAiwServiceHandler, CamPanic( ECamPanicResourceLeak ) ); |
289 |
315 |
290 iAiwServiceHandler = CAiwServiceHandler::NewL(); |
316 iAiwServiceHandler = CAiwServiceHandler::NewL(); |
291 iAiwServiceHandler->AttachL( R_CAM_ONE_CLICK_UPLOAD_INTEREST ); |
317 iAiwServiceHandler->AttachL( R_CAM_ONE_CLICK_UPLOAD_INTEREST ); |
|
318 iAiwServiceHandler->AttachL( R_CAM_AIW_VIEW_INTEREST ); |
|
319 PRINT( _L("Camera <> CCamOneClickUploadUtility::InitializeAiwL - initialized") ); |
292 } |
320 } |
293 |
321 |
294 // --------------------------------------------------------------------------- |
322 // --------------------------------------------------------------------------- |
295 // Get the icon for Share AP item |
323 // Get the icon for Share AP item |
296 // --------------------------------------------------------------------------- |
324 // --------------------------------------------------------------------------- |
297 // |
325 // |
298 void CCamOneClickUploadUtility::CurrentIconPathL( TCamCameraMode aMode, TDes& aPath ) |
326 void CCamOneClickUploadUtility::CurrentIconPathL( TCamCameraMode aMode, TDes& aPath ) |
299 { |
327 { |
300 PRINT( _L("Camera => CCamOneClickUploadUtility::CurrentIconPathL") ); |
328 PRINT1( _L("Camera => CCamOneClickUploadUtility::CurrentIconPathL mode:%d"), aMode ); |
301 TUint32 serviceIconId = KShareCommonServiceIconFileName; |
329 TUint32 serviceIconId = KShareCommonServiceIconFileName; |
302 |
330 |
303 if ( ECamControllerVideo == aMode ) |
331 if ( ECamControllerVideo == aMode ) |
304 { |
332 { |
305 serviceIconId = KShareVideoServiceIconFileName; |
333 serviceIconId = KShareVideoServiceIconFileName; |
314 CleanupStack::PopAndDestroy( rep ); |
342 CleanupStack::PopAndDestroy( rep ); |
315 PRINT1( _L("Camera <= CCamOneClickUploadUtility::CurrentIconPathL: %S"), &aPath ); |
343 PRINT1( _L("Camera <= CCamOneClickUploadUtility::CurrentIconPathL: %S"), &aPath ); |
316 } |
344 } |
317 |
345 |
318 // ----------------------------------------------------------------------------- |
346 // ----------------------------------------------------------------------------- |
319 // CCamOneClickUploadUtility::UpdateUploadIcon |
347 // CCamOneClickUploadUtility::UpdateUploadIconL |
320 // ----------------------------------------------------------------------------- |
348 // ----------------------------------------------------------------------------- |
321 // |
349 // |
322 void CCamOneClickUploadUtility::UpdateUploadIcon( CAknToolbar *aToolbar, |
350 void CCamOneClickUploadUtility::UpdateUploadIconL( CAknToolbar *aToolbar, |
323 TCamCameraMode aMode ) |
351 TCamCameraMode aMode ) |
324 { |
352 { |
325 PRINT( _L("Camera => CCamOneClickUploadUtility::UpdateUploadIcon") ); |
353 PRINT( _L("Camera => CCamOneClickUploadUtility::UpdateUploadIconL") ); |
326 |
354 |
327 TFileName currIcon; |
355 TFileName currIcon; |
328 CurrentIconPathL( aMode, currIcon ); |
356 CurrentIconPathL( aMode, currIcon ); |
329 |
357 |
330 // If the icons are different then load the icon |
358 // If the icons are different then load the icon |
344 if ( aToolbar && iIconImage ) |
372 if ( aToolbar && iIconImage ) |
345 { |
373 { |
346 PRINT( _L("Camera <> Copying icon") ); |
374 PRINT( _L("Camera <> Copying icon") ); |
347 CAknButton* button = dynamic_cast<CAknButton*>( |
375 CAknButton* button = dynamic_cast<CAknButton*>( |
348 aToolbar->ControlOrNull( ECamCmdOneClickUpload ) ); |
376 aToolbar->ControlOrNull( ECamCmdOneClickUpload ) ); |
349 CAknButtonState* state = button->State(); |
377 if ( button ) |
350 |
378 { |
351 CGulIcon *icon = CGulIcon::NewL( iIconImage, iIconMask ); |
379 CAknButtonState* state = button->State(); |
352 state->SetIcon( icon ); |
380 |
353 icon->SetBitmapsOwnedExternally( ETrue ); |
381 CGulIcon *icon = CGulIcon::NewL( iIconImage, iIconMask ); |
354 |
382 state->SetIcon( icon ); |
355 button->SetButtonFlags( KAknButtonNoFrame | KAknButtonPressedDownFrame ); |
383 icon->SetBitmapsOwnedExternally( ETrue ); |
356 aToolbar->DrawNow(); |
384 |
357 } |
385 button->SetButtonFlags( KAknButtonNoFrame | KAknButtonPressedDownFrame ); |
358 } |
386 aToolbar->DrawNow(); |
359 PRINT( _L("Camera <= CCamOneClickUploadUtility::UpdateUploadIcon") ); |
387 } |
|
388 } |
|
389 } |
|
390 PRINT( _L("Camera <= CCamOneClickUploadUtility::UpdateUploadIconL") ); |
360 } |
391 } |
361 |
392 |
362 // ----------------------------------------------------------------------------- |
393 // ----------------------------------------------------------------------------- |
363 // CCamOneClickUploadUtility::DecodeIconL() |
394 // CCamOneClickUploadUtility::DecodeIconL() |
364 // ----------------------------------------------------------------------------- |
395 // ----------------------------------------------------------------------------- |
378 |
409 |
379 PRINT( _L("Camera <= CCamOneClickUploadUtility::DecodeIconL") ); |
410 PRINT( _L("Camera <= CCamOneClickUploadUtility::DecodeIconL") ); |
380 } |
411 } |
381 |
412 |
382 // --------------------------------------------------------------------------- |
413 // --------------------------------------------------------------------------- |
383 // Image decoding complete notification |
414 // Image decoding complete notificationL |
384 // --------------------------------------------------------------------------- |
415 // --------------------------------------------------------------------------- |
385 // |
416 // |
386 void CCamOneClickUploadUtility::ImageDecoded( TInt aStatus, const CFbsBitmap* aBitmap, const CFbsBitmap* aMask ) |
417 void CCamOneClickUploadUtility::ImageDecodedL( TInt aStatus, const CFbsBitmap* aBitmap, const CFbsBitmap* aMask ) |
387 { |
418 { |
388 PRINT( _L("Camera => CCamOneClickUploadUtility::ImageDecoded") ); |
419 PRINT( _L("Camera => CCamOneClickUploadUtility::ImageDecodedL") ); |
389 |
420 |
390 if ( aStatus == KErrNone ) |
421 if ( aStatus == KErrNone ) |
391 { |
422 { |
392 delete iIconImage; |
423 delete iIconImage; |
393 delete iIconMask; |
424 delete iIconMask; |
407 { |
438 { |
408 PRINT( _L("Displaying icon") ); |
439 PRINT( _L("Displaying icon") ); |
409 |
440 |
410 CAknButton* uploadButton = |
441 CAknButton* uploadButton = |
411 static_cast<CAknButton*> (iToolbar->ControlOrNull(ECamCmdOneClickUpload)); |
442 static_cast<CAknButton*> (iToolbar->ControlOrNull(ECamCmdOneClickUpload)); |
412 CAknButtonState* currentState = uploadButton->State(); |
443 |
413 |
444 CAknButtonState* currentState(NULL); |
414 CGulIcon *icon = CGulIcon::NewL( iIconImage, iIconMask ); |
445 if ( uploadButton ) |
|
446 { |
|
447 currentState = uploadButton->State(); |
|
448 } |
|
449 CGulIcon *icon(NULL); |
|
450 if ( iIconMask ) |
|
451 { |
|
452 icon = CGulIcon::NewL( iIconImage, iIconMask ); |
|
453 } |
|
454 else |
|
455 { |
|
456 icon = CGulIcon::NewL( iIconImage ); //Prevent freed pointer warning |
|
457 } |
415 icon->SetBitmapsOwnedExternally( ETrue ); |
458 icon->SetBitmapsOwnedExternally( ETrue ); |
416 currentState->SetIcon( icon ); |
459 if ( currentState ) |
417 |
460 { |
418 uploadButton->SetButtonFlags( KAknButtonNoFrame | KAknButtonPressedDownFrame ); |
461 currentState->SetIcon( icon ); |
|
462 } |
|
463 if ( uploadButton ) |
|
464 { |
|
465 uploadButton->SetButtonFlags( KAknButtonNoFrame | KAknButtonPressedDownFrame ); |
|
466 } |
419 iToolbar->DrawNow(); |
467 iToolbar->DrawNow(); |
420 } |
468 } |
421 } |
469 } |
422 else |
470 else |
423 { |
471 { |