uiservicetab/vimpstui/src/cvimpstuiavatarselectionhandler.cpp
branchRCL_3
changeset 9 9fdee5e1da30
parent 0 5e5d6b214f4f
equal deleted inserted replaced
8:796276a1bdcc 9:9fdee5e1da30
    35 #include	<aknnavi.h>
    35 #include	<aknnavi.h>
    36 #include	<aknappui.h>
    36 #include	<aknappui.h>
    37 #include    <avkon.rsg>
    37 #include    <avkon.rsg>
    38 #include    <caf/content.h>
    38 #include    <caf/content.h>
    39 #include    <caf/manager.h> // content access
    39 #include    <caf/manager.h> // content access
    40 
    40 #include "uiservicetabtracer.h"
    41 
    41 
    42 // ============================ MEMBER FUNCTIONS ===============================
    42 // ============================ MEMBER FUNCTIONS ===============================
    43 
    43 
    44 // -----------------------------------------------------------------------------
    44 // -----------------------------------------------------------------------------
    45 // CAvatarSelectionHandler::CAvatarSelectionHandler
    45 // CAvatarSelectionHandler::CAvatarSelectionHandler
    58 // Symbian 2nd phase constructor can leave.
    58 // Symbian 2nd phase constructor can leave.
    59 // -----------------------------------------------------------------------------
    59 // -----------------------------------------------------------------------------
    60 //
    60 //
    61 void CAvatarSelectionHandler::ConstructL()
    61 void CAvatarSelectionHandler::ConstructL()
    62     {
    62     {
       
    63 	TRACER_AUTO;
    63     User::LeaveIfError(iApaSession.Connect() );
    64     User::LeaveIfError(iApaSession.Connect() );
    64 
    65 
    65     // create dochandler
    66     // create dochandler
    66     iDocHandler = CDocumentHandler::NewL();
    67     iDocHandler = CDocumentHandler::NewL();
    67     iDocHandler->SetExitObserver( this);
    68     iDocHandler->SetExitObserver( this);
    73 // -----------------------------------------------------------------------------
    74 // -----------------------------------------------------------------------------
    74 //
    75 //
    75 CAvatarSelectionHandler* CAvatarSelectionHandler::NewLC()
    76 CAvatarSelectionHandler* CAvatarSelectionHandler::NewLC()
    76 
    77 
    77     {
    78     {
       
    79 	TRACER_AUTO;
    78     CAvatarSelectionHandler* self = new( ELeave ) CAvatarSelectionHandler();
    80     CAvatarSelectionHandler* self = new( ELeave ) CAvatarSelectionHandler();
    79 
    81 
    80     CleanupStack::PushL(self);
    82     CleanupStack::PushL(self);
    81     self->ConstructL();
    83     self->ConstructL();
    82 
    84 
   148 // (other items were commented in a header).
   150 // (other items were commented in a header).
   149 // ---------------------------------------------------------
   151 // ---------------------------------------------------------
   150 //
   152 //
   151 void CAvatarSelectionHandler::HandleServerAppExit(TInt aReason)
   153 void CAvatarSelectionHandler::HandleServerAppExit(TInt aReason)
   152     {
   154     {
       
   155 	TRACER_AUTO;
   153     iServerAppExitReason = aReason;
   156     iServerAppExitReason = aReason;
   154     if (iWait.IsStarted() )
   157     if (iWait.IsStarted() )
   155         {
   158         {
   156         iWait.AsyncStop();
   159         iWait.AsyncStop();
   157         }
   160         }
   163 // ---------------------------------------------------------
   166 // ---------------------------------------------------------
   164 //
   167 //
   165 TBool CAvatarSelectionHandler::VerifySelectedFilesL( const MDesCArray* aSelectedFiles )
   168 TBool CAvatarSelectionHandler::VerifySelectedFilesL( const MDesCArray* aSelectedFiles )
   166 
   169 
   167     {
   170     {
       
   171 	TRACER_AUTO;
   168     if( aSelectedFiles && aSelectedFiles->MdcaCount() )
   172     if( aSelectedFiles && aSelectedFiles->MdcaCount() )
   169         {
   173         {
   170         TPtrC filename( aSelectedFiles->MdcaPoint(0) ); // since muliselection is not allowed
   174         TPtrC filename( aSelectedFiles->MdcaPoint(0) ); // since muliselection is not allowed
   171         //take the only file in the array 
   175         //take the only file in the array 
   172         TInt value( KErrNone ); 
   176         TInt value( KErrNone ); 
   247 // (other items were commented in a header).
   251 // (other items were commented in a header).
   248 // ---------------------------------------------------------
   252 // ---------------------------------------------------------
   249 //
   253 //
   250 TSize CAvatarSelectionHandler::DecodeSize(const TSize& aSize)
   254 TSize CAvatarSelectionHandler::DecodeSize(const TSize& aSize)
   251     {
   255     {
       
   256 	TRACER_AUTO;
   252     // 1:1 is always valid ratio for decode scaling
   257     // 1:1 is always valid ratio for decode scaling
   253     TInt lastValidRatio( 1);
   258     TInt lastValidRatio( 1);
   254     for (TInt ratio(KDecodeScaleRatioMin); ratio <= KDecodeScaleRatioMax; ratio<<= 1)
   259     for (TInt ratio(KDecodeScaleRatioMin); ratio <= KDecodeScaleRatioMax; ratio<<= 1)
   255         {
   260         {
   256         if (aSize.iWidth % ratio + aSize.iHeight % ratio == 0)
   261         if (aSize.iWidth % ratio + aSize.iHeight % ratio == 0)
   270 // (other items were commented in a header).
   275 // (other items were commented in a header).
   271 // ---------------------------------------------------------
   276 // ---------------------------------------------------------
   272 //
   277 //
   273 HBufC*  CAvatarSelectionHandler::HandleAvatarSelectionL(TInt aCommand )
   278 HBufC*  CAvatarSelectionHandler::HandleAvatarSelectionL(TInt aCommand )
   274     {
   279     {
       
   280 	TRACER_AUTO;
   275     HBufC* selectedFile = NULL;
   281     HBufC* selectedFile = NULL;
   276     switch (aCommand)
   282     switch (aCommand)
   277         {
   283         {
   278         case ECmdAvatarGallery:
   284         case ECmdAvatarGallery:
   279             {
   285             {
   350 // (other items were commented in a header).
   356 // (other items were commented in a header).
   351 // ---------------------------------------------------------
   357 // ---------------------------------------------------------
   352 //
   358 //
   353 void CAvatarSelectionHandler::ShowErrorL(TErrorType aErrorType)
   359 void CAvatarSelectionHandler::ShowErrorL(TErrorType aErrorType)
   354     {
   360     {
   355 
   361 	TRACER_AUTO;
   356     switch( aErrorType )
   362     switch( aErrorType )
   357         {  
   363         {  
   358         case EProtected:
   364         case EProtected:
   359             {
   365             {
   360             HBufC* prompt = StringLoader::LoadLC( R_QTN_SERVTAB_GALLERY_ERROR_DRMFILE );
   366             HBufC* prompt = StringLoader::LoadLC( R_QTN_SERVTAB_GALLERY_ERROR_DRMFILE );
   378 // (other items were commented in a header).
   384 // (other items were commented in a header).
   379 // ---------------------------------------------------------
   385 // ---------------------------------------------------------
   380 //
   386 //
   381 void CAvatarSelectionHandler::StoreMimeTypeL(const TDesC& aFilename)
   387 void CAvatarSelectionHandler::StoreMimeTypeL(const TDesC& aFilename)
   382     {
   388     {
       
   389 	TRACER_AUTO;
   383     TUid dummyUid( KNullUid );
   390     TUid dummyUid( KNullUid );
   384     TDataType dataType;
   391     TDataType dataType;
   385     User::LeaveIfError( iApaSession.AppForDocument(
   392     User::LeaveIfError( iApaSession.AppForDocument(
   386             aFilename,
   393             aFilename,
   387             dummyUid, dataType ) );
   394             dummyUid, dataType ) );