photosgallery/viewframework/commandhandlers/commoncommandhandlers/src/glxcommandhandlersend.cpp
branchRCL_3
changeset 25 191387a8b767
parent 14 ce1c7ad1f18b
child 35 420f6808bf21
equal deleted inserted replaced
22:2dac0fdba72b 25:191387a8b767
    22 #include "glxcommandhandlersend.h"
    22 #include "glxcommandhandlersend.h"
    23 
    23 
    24 //  EXTERNAL INCLUDES
    24 //  EXTERNAL INCLUDES
    25 #include <utf.h>							// for CnvUtfConverter
    25 #include <utf.h>							// for CnvUtfConverter
    26 #include <sendui.h>							// for CSendui
    26 #include <sendui.h>							// for CSendui
    27 #include <Sendnorm.rsg>						// for CSendui resources
    27 #include <sendnorm.rsg>						// for CSendui resources
    28 #include <SendUiConsts.h>					// for CSendui plugin type constants
    28 #include <SendUiConsts.h>					// for CSendui plugin type constants
    29 #include <CMessageData.h>					// for CMessageData
    29 #include <CMessageData.h>					// for CMessageData
    30 #include <coemain.h>						// for CCoeEnv
    30 #include <coemain.h>						// for CCoeEnv
    31 #include <StringLoader.h>					// for CStringLoader
    31 #include <StringLoader.h>					// for CStringLoader
    32 #include <bautils.h>						// for BaflUtils
    32 #include <bautils.h>						// for BaflUtils
    61 
    61 
    62 // ----------------------------------------------------------------------------
    62 // ----------------------------------------------------------------------------
    63 // Two-phased constructor.
    63 // Two-phased constructor.
    64 // ----------------------------------------------------------------------------
    64 // ----------------------------------------------------------------------------
    65 EXPORT_C CGlxCommandHandlerSend* CGlxCommandHandlerSend::NewL(
    65 EXPORT_C CGlxCommandHandlerSend* CGlxCommandHandlerSend::NewL(
    66 										MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem)
    66 		MGlxMediaListProvider* aMediaListProvider, TBool aHasToolbarItem,
       
    67 		const TDesC& aFileName)
    67 	{
    68 	{
    68 	GLX_FUNC("CGlxCommandHandlerSend::NewL");
    69 	GLX_FUNC("CGlxCommandHandlerSend::NewL");
    69 	CGlxCommandHandlerSend* self = 
    70 	CGlxCommandHandlerSend* self = new (ELeave) CGlxCommandHandlerSend(
    70 			new (ELeave) CGlxCommandHandlerSend(aMediaListProvider, aHasToolbarItem);
    71 			aMediaListProvider, aHasToolbarItem);
    71 	CleanupStack::PushL(self);
    72 	CleanupStack::PushL(self);
    72 	self->ConstructL();
    73 	self->ConstructL(aFileName);
    73 	CleanupStack::Pop(self);
    74 	CleanupStack::Pop(self);
    74 	return self;
    75 	return self;
    75 	}
    76 	}
    76 
    77 
    77 
    78 
    82 					   :CGlxMediaListCommandHandler(aMediaListProvider, aHasToolbarItem)
    83 					   :CGlxMediaListCommandHandler(aMediaListProvider, aHasToolbarItem)
    83 	{
    84 	{
    84 	// nothing to do
    85 	// nothing to do
    85 	}			
    86 	}			
    86 
    87 
       
    88 
       
    89 
    87 // ----------------------------------------------------------------------------
    90 // ----------------------------------------------------------------------------
    88 // Symbian 2nd phase constructor can leave.
    91 // Symbian 2nd phase constructor can leave.
    89 // ----------------------------------------------------------------------------
    92 // ----------------------------------------------------------------------------
    90 void CGlxCommandHandlerSend::ConstructL()
    93 void CGlxCommandHandlerSend::ConstructL(const TDesC& aFileName)
    91 	{
    94 	{
    92 	GLX_FUNC("CGlxCommandHandlerSend::ConstructL");
    95 	GLX_FUNC("CGlxCommandHandlerSend::ConstructL");
    93 	
    96 
    94 	iUiUtility = CGlxUiUtility::UtilityL();
    97 	iUiUtility = CGlxUiUtility::UtilityL();
    95 	iSendUi = CSendUi::NewL();
    98 	iSendUi = CSendUi::NewL();
    96 	
    99 
    97 	LoadRscFileL();
   100 	LoadRscFileL(aFileName);
    98 	
   101 
    99 	// add the Send command
   102 	// add the Send command
   100    	TCommandInfo info(EGlxCmdSend);
   103 	TCommandInfo info(EGlxCmdSend);
   101     info.iMinSelectionLength = 1;
   104 	info.iMinSelectionLength = 1;
   102     info.iMaxSelectionLength = KMaxTInt;
   105 	info.iMaxSelectionLength = KMaxTInt;
   103    	AddCommandL(info);
   106 	AddCommandL(info);
   104 	
   107 
   105    	TCommandInfo singleclickinfo(EGlxCmdSingleClickSend);
   108 	TCommandInfo singleclickinfo(EGlxCmdSingleClickSend);
   106    	singleclickinfo.iMinSelectionLength = 1;
   109 	singleclickinfo.iMinSelectionLength = 1;
   107    	singleclickinfo.iMaxSelectionLength = KMaxTInt;
   110 	singleclickinfo.iMaxSelectionLength = KMaxTInt;
   108     AddCommandL(singleclickinfo);
   111 	AddCommandL(singleclickinfo);
   109 	}	
   112 	}	
   110 	
   113 	
   111 
   114 
   112 // ----------------------------------------------------------------------------
   115 // ----------------------------------------------------------------------------
   113 // Destructor
   116 // Destructor
   361 	CleanupStack::PopAndDestroy(msgData);
   364 	CleanupStack::PopAndDestroy(msgData);
   362 	}
   365 	}
   363 	
   366 	
   364 
   367 
   365 
   368 
       
   369 
   366 // ----------------------------------------------------------------------------
   370 // ----------------------------------------------------------------------------
   367 // LoadRscFileL
   371 // LoadRscFileL
   368 // ----------------------------------------------------------------------------
   372 // ----------------------------------------------------------------------------
   369 void CGlxCommandHandlerSend::LoadRscFileL()
   373 void CGlxCommandHandlerSend::LoadRscFileL(const TDesC& aFileName)
   370 	{
   374 	{
   371 	GLX_FUNC("CGlxCommandHandlerSend::LoadRscFileL");
   375 	GLX_FUNC("CGlxCommandHandlerSend::LoadRscFileL");
   372 
   376 	CCoeEnv* env = CCoeEnv::Static();
   373 	TParse parse;
   377 	iResourceOffset = env->AddResourceFileL(aFileName);
   374     parse.Set(KGlxUiUtilitiesResource, &KDC_APP_RESOURCE_DIR, NULL);
       
   375     TFileName resourceFile;
       
   376     resourceFile.Append(parse.FullName());
       
   377     CGlxResourceUtilities::GetResourceFilenameL(resourceFile);  
       
   378     CCoeEnv* env = CCoeEnv::Static(); 
       
   379    	iResourceOffset = env->AddResourceFileL(resourceFile);
       
   380 	}
   378 	}
   381 
   379 
   382 
   380 
   383 // ----------------------------------------------------------------------------
   381 // ----------------------------------------------------------------------------
   384 // Capabilities
   382 // Capabilities
   421         return EFalse;
   419         return EFalse;
   422         }
   420         }
   423     
   421     
   424     return ETrue;
   422     return ETrue;
   425     }
   423     }
       
   424 
       
   425 // ----------------------------------------------------------------------------
       
   426 // HandleItemSelectedL
       
   427 // ----------------------------------------------------------------------------
       
   428 //
       
   429 void CGlxCommandHandlerSend::HandleItemSelectedL(TInt /*aIndex*/,
       
   430         TBool /*aSelected*/, MGlxMediaList* aList)
       
   431     {
       
   432     GLX_FUNC("CGlxCommandHandlerSend::HandleItemSelectedL");
       
   433     if (aList->SelectionCount() > 0 && iUiUtility->GetGridToolBar())
       
   434         {
       
   435         iUiUtility->GetGridToolBar()->SetItemDimmed(EGlxCmdSend, EFalse,
       
   436                 ETrue);
       
   437         }
       
   438     else
       
   439         {
       
   440         iUiUtility->GetGridToolBar()->SetItemDimmed(EGlxCmdSend, ETrue, ETrue);
       
   441         }
       
   442     }
       
   443 
   426 // End of file		
   444 // End of file