btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmuidata.cpp
branchRCL_3
changeset 23 9386f31cc85b
parent 22 613943a21004
child 24 269724087bed
equal deleted inserted replaced
22:613943a21004 23:9386f31cc85b
     1 /*
       
     2 * Copyright (c) 2002 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 *     Class CIrMtmUiData
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include "irmtmuidata.h"
       
    22 #include "irmtmui.h"
       
    23 #include <app/irmsgtypeuid.h>
       
    24 #include <mtclbase.h>
       
    25 #include <msvuids.h>
       
    26 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS
       
    27 #include <mtmdef.hrh> //kuidmtmquerymaxbodysizevalue etc
       
    28 #else
       
    29 #include <mtmdef.hrh> //kuidmtmquerymaxbodysizevalue etc
       
    30 #include <mtmuidsdef.hrh> //kuidmtmquerymaxbodysizevalue etc
       
    31 #endif
       
    32 #include <obexutilsmessagehandler.h>
       
    33 #include "debug.h"
       
    34 
       
    35 //CONSTANTS
       
    36 const TInt KIrMtmUiDataMsgEditorAppValue      = 0x00000000;
       
    37 
       
    38 // ================= MEMBER FUNCTIONS =======================
       
    39 
       
    40 // Two-phased constructor.
       
    41 CIrMtmUiData* CIrMtmUiData::NewL(CRegisteredMtmDll& aRegisteredDll)
       
    42 	{
       
    43     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CIrMtmUiData\t" ) );
       
    44 	CIrMtmUiData* self=new(ELeave) CIrMtmUiData(aRegisteredDll);
       
    45 	CleanupStack::PushL(self);
       
    46 	self->ConstructL();
       
    47 	CleanupStack::Pop(self);
       
    48 	return self;
       
    49 	}
       
    50 
       
    51 // Symbian OS default constructor can leave.
       
    52 void CIrMtmUiData::ConstructL()
       
    53 	{
       
    54     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: ConstructL\t" ) );
       
    55     CBaseMtmUiData::ConstructL();
       
    56     TObexUtilsMessageHandler::CreateDefaultMtmServiceL(KUidMsgTypeIrUID);
       
    57     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: ConstructL done\t" ) );
       
    58 	}
       
    59 
       
    60 // C++ default constructor can NOT contain any code, that
       
    61 // might leave.
       
    62 //
       
    63 CIrMtmUiData::CIrMtmUiData(CRegisteredMtmDll& aRegisteredDll)
       
    64 	:       CBaseMtmUiData(aRegisteredDll)
       
    65 	{   
       
    66 	}
       
    67 
       
    68 
       
    69 // Destructor
       
    70 CIrMtmUiData::~CIrMtmUiData()
       
    71 	{ 
       
    72     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: ~CIrMtmUiData\t" ) );
       
    73 	}
       
    74 
       
    75 
       
    76 // ---------------------------------------------------------
       
    77 // OperationSupportedL(...)
       
    78 // No Ir-specific operations added to MS menu.
       
    79 // ---------------------------------------------------------
       
    80 //
       
    81 TInt CIrMtmUiData::OperationSupportedL(
       
    82     TInt /*aOperationId*/, 
       
    83     const TMsvEntry& /*aContext*/) const
       
    84 	{
       
    85     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: OperationSupportedL\t" ) );
       
    86     //todo: This was returning avkon resource Id of sting "This item is not available".
       
    87     return 0;
       
    88 	}
       
    89 
       
    90 // ---------------------------------------------------------
       
    91 // QueryCapability(...)
       
    92 // MTM query capability
       
    93 // ---------------------------------------------------------
       
    94 //
       
    95 TInt CIrMtmUiData::QueryCapability(
       
    96     TUid aCapability, 
       
    97     TInt& aResponse ) const
       
    98 	{
       
    99     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: QueryCapability\t" ) );
       
   100 	switch( aCapability.iUid )
       
   101 		{
       
   102 	    // --- Supported valued capabilities ---
       
   103 	    case KUidMtmQueryMaxBodySizeValue:
       
   104             {
       
   105 		    aResponse = KMaxTInt;
       
   106 		    break;
       
   107             }
       
   108 	    case KUidMtmQueryMaxTotalMsgSizeValue:
       
   109             {
       
   110 		    aResponse = KMaxTInt;
       
   111 		    break;
       
   112             }
       
   113 	    case KUidMsvMtmQueryEditorUidValue:
       
   114             {
       
   115 		    aResponse = KIrMtmUiDataMsgEditorAppValue;
       
   116 		    break;
       
   117             }
       
   118         /* Infrared is not supported anymore. Implementation for sending over Infrared is left for reference:
       
   119         ( add #include <app/extendedmtmids.hrh> to the included files )
       
   120         code starts here:
       
   121 
       
   122         case KUidMsvMtmQuerySupportLinks:
       
   123             {
       
   124             aResponse = ETrue;
       
   125             break;
       
   126             }
       
   127 
       
   128         End of reference implementation for sending over Infrared:
       
   129         */
       
   130 	    case KUidMtmQuerySupportAttachmentsValue:
       
   131 	    case KUidMtmQueryCanSendMsgValue:
       
   132             {
       
   133 		    break;
       
   134             }
       
   135 	    case KUidMtmQuerySupportedBodyValue:    
       
   136 	    default:
       
   137             {
       
   138 		    return KErrNotSupported;
       
   139             }
       
   140 		}
       
   141 	return KErrNone;
       
   142 	}
       
   143 
       
   144 // ---------------------------------------------------------
       
   145 // CBaseMtmUiData::CBitmapArray& CIrMtmUiData::ContextIcon(...)
       
   146 // Handles received msg icon.
       
   147 // ---------------------------------------------------------
       
   148 //
       
   149 const CBaseMtmUiData::CBitmapArray& CIrMtmUiData::ContextIcon(
       
   150      const TMsvEntry& /*aContext*/, 
       
   151      TInt /*aStateFlags*/) const
       
   152 
       
   153 	{
       
   154 	TInt icon = 0;
       
   155 	//todo: This function will not work as iIconArrays is not populated might cause panic.
       
   156 	return *iIconArrays->At( icon ); 
       
   157 	}
       
   158 
       
   159 // ---------------------------------------------------------
       
   160 // PopulateArraysL()
       
   161 // Populates bitmap array 
       
   162 // ---------------------------------------------------------
       
   163 //
       
   164 void CIrMtmUiData::PopulateArraysL()
       
   165 	{
       
   166     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: PopulateArraysL\t" ) );
       
   167 
       
   168     //todo: Was populating iIconArrays which should be removed.
       
   169 	}
       
   170 
       
   171 // ---------------------------------------------------------
       
   172 // GetResourceFileName(TFileName& aFileName) const
       
   173 // Gives resource filename.
       
   174 // ---------------------------------------------------------
       
   175 //
       
   176 void CIrMtmUiData::GetResourceFileName(TFileName& /*aFileName*/) const
       
   177 	{
       
   178     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: GetResourceFileName\t" ) );
       
   179     //todo: This was returning avkon resource file, which is not required now.
       
   180 	}
       
   181 
       
   182 // ---------------------------------------------------------
       
   183 // CanCreateEntryL(...)
       
   184 // Checks if it is possible to create entry.
       
   185 // ---------------------------------------------------------
       
   186 //
       
   187 TBool CIrMtmUiData::CanCreateEntryL(
       
   188     const TMsvEntry& aParent, 
       
   189     TMsvEntry& aNewEntry, 
       
   190     TInt& aReasonResourceId ) const
       
   191 	{
       
   192     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanCreateEntryL\t" ) );
       
   193 	aReasonResourceId = 0;
       
   194 	if( CheckEntry( aNewEntry ) )
       
   195 		{
       
   196         // --- Can create messages in local folders ---
       
   197 		return ( aParent.iMtm.iUid == KMsvLocalServiceIndexEntryIdValue );
       
   198 		}
       
   199 	// --- Can't create other types ---
       
   200 	//todo: This was using avkon resource Id of sting "This item is not available".
       
   201 	aReasonResourceId = 0;
       
   202 	return EFalse;
       
   203 	}
       
   204 
       
   205 // ---------------------------------------------------------
       
   206 // CanOpenEntryL(...)
       
   207 // Checks if it is possible to open entry.
       
   208 // ---------------------------------------------------------
       
   209 //
       
   210 TBool CIrMtmUiData::CanOpenEntryL(
       
   211     const TMsvEntry& aContext, 
       
   212     TInt& aReasonResourceId ) const
       
   213 	{
       
   214     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanOpenEntryL\t" ) );
       
   215 	if( CheckEntry( aContext ) )
       
   216 		{
       
   217 		if( aContext.iType.iUid == KUidMsvMessageEntryValue )
       
   218 			{
       
   219 			aReasonResourceId = 0;
       
   220 			return ETrue;
       
   221 			}
       
   222 		}
       
   223 	//todo: This was using avkon resource Id of sting "This item is not available".
       
   224 	aReasonResourceId = 0;
       
   225 	return EFalse;
       
   226 	}
       
   227 
       
   228 // ---------------------------------------------------------
       
   229 // CanCloseEntryL(...)
       
   230 // Checks if it is possible to close entry.
       
   231 // ---------------------------------------------------------
       
   232 //
       
   233 TBool CIrMtmUiData::CanCloseEntryL(
       
   234     const TMsvEntry& aContext, 
       
   235     TInt& aReasonResourceId ) const
       
   236 	{
       
   237     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanCloseEntryL\t" ) );
       
   238 	if( CheckEntry( aContext ) )
       
   239 		{
       
   240 		if( aContext.iType.iUid == KUidMsvServiceEntryValue )
       
   241 			{
       
   242 			aReasonResourceId = 0;
       
   243 			return ETrue;
       
   244 			}
       
   245 		}
       
   246 	//todo: This was using avkon resource Id of sting "This item is not available".
       
   247 	aReasonResourceId = 0;
       
   248 	return EFalse;
       
   249 	}
       
   250 
       
   251 // ---------------------------------------------------------
       
   252 // CanViewEntryL(...)
       
   253 // Checks if it is possible to view entry.
       
   254 // ---------------------------------------------------------
       
   255 //
       
   256 TBool CIrMtmUiData::CanViewEntryL(
       
   257     const TMsvEntry& aContext, 
       
   258     TInt& aReasonResourceId ) const
       
   259 	{
       
   260     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanViewEntryL\t" ) );
       
   261 	if( CheckEntry( aContext ) )
       
   262 		{
       
   263 		if( aContext.iType.iUid == KUidMsvMessageEntryValue )
       
   264 			{
       
   265 			aReasonResourceId = 0;
       
   266 			return ETrue;
       
   267 			}
       
   268 		}
       
   269 	//todo: This was using avkon resource Id of sting "This item is not available".
       
   270 	aReasonResourceId = 0;
       
   271 	return EFalse;
       
   272 	}
       
   273 
       
   274 // ---------------------------------------------------------
       
   275 // CanEditEntryL(...)
       
   276 // Checks if it is possible to edit entry.
       
   277 // ---------------------------------------------------------
       
   278 //
       
   279 TBool CIrMtmUiData::CanEditEntryL(
       
   280     const TMsvEntry& aContext, 
       
   281     TInt& aReasonResourceId ) const
       
   282 	{
       
   283     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanEditEntryL\t" ) );
       
   284     //todo: This was using avkon resource Id of sting "This item is not available".
       
   285 	aReasonResourceId = 0;
       
   286 	if( CheckEntry( aContext ) )
       
   287 		{
       
   288 		if ( ( aContext.iType.iUid == KUidMsvMessageEntryValue ) || 
       
   289              ( aContext.iType.iUid == KUidMsvFolderEntryValue ) )
       
   290 			{
       
   291 			aReasonResourceId=0;
       
   292 			return ETrue;
       
   293 			}
       
   294 		}
       
   295 	return EFalse;
       
   296 	}
       
   297 
       
   298 // ---------------------------------------------------------
       
   299 // CanDeleteServiceL(...)
       
   300 // Checks if it is possible to delete service.
       
   301 // ---------------------------------------------------------
       
   302 //
       
   303 TBool CIrMtmUiData::CanDeleteServiceL(
       
   304     const TMsvEntry& /*aService*/, 
       
   305     TInt& aReasonResourceId ) const
       
   306 	{
       
   307     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanDeleteServiceL\t" ) );
       
   308     //todo: This was using avkon resource Id of sting "This item is not available".
       
   309 	aReasonResourceId = 0;
       
   310     return EFalse; 
       
   311 	}
       
   312 
       
   313 // ---------------------------------------------------------
       
   314 // CanDeleteFromEntryL(...)
       
   315 // Checks if it is possible to delete from entry.
       
   316 // ---------------------------------------------------------
       
   317 //
       
   318 TBool CIrMtmUiData::CanDeleteFromEntryL(
       
   319     const TMsvEntry& /*aContext*/, 
       
   320     TInt& aReasonResourceId ) const
       
   321 	{
       
   322     //todo: This was using avkon resource Id of sting "This item is not available".
       
   323 	aReasonResourceId = 0;
       
   324 	return EFalse;
       
   325 	}
       
   326 
       
   327 // ---------------------------------------------------------
       
   328 // CanCopyMoveToEntryL(...)
       
   329 // Checks if it is possible to move to entry.
       
   330 // ---------------------------------------------------------
       
   331 //
       
   332 TBool CIrMtmUiData::CanCopyMoveToEntryL(
       
   333     const TMsvEntry& /*aContext*/, 
       
   334     TInt& aReasonResourceId ) const
       
   335 	{
       
   336     //todo: This was using avkon resource Id of sting "This item is not available".
       
   337 	aReasonResourceId = 0;
       
   338 	return EFalse;
       
   339 	}
       
   340 
       
   341 // ---------------------------------------------------------
       
   342 // CanCopyMoveFromEntryL(...)
       
   343 // Checks if it is possible to move from entry.
       
   344 // ---------------------------------------------------------
       
   345 //
       
   346 TBool CIrMtmUiData::CanCopyMoveFromEntryL(
       
   347     const TMsvEntry& /*aContext*/, 
       
   348     TInt& aReasonResourceId ) const
       
   349 	{
       
   350     //todo: This was using avkon resource Id of sting "This item is not available".
       
   351 	aReasonResourceId = 0;
       
   352 	return EFalse;
       
   353 	}
       
   354 
       
   355 // ---------------------------------------------------------
       
   356 // CanReplyToEntryL(...)
       
   357 // Checks if it is possible to reply to entry.
       
   358 // ---------------------------------------------------------
       
   359 //
       
   360 TBool CIrMtmUiData::CanReplyToEntryL(
       
   361     const TMsvEntry& /*aContext*/, 
       
   362     TInt& aReasonResourceId ) const
       
   363 	{
       
   364     //todo: This was using avkon resource Id of sting "This item is not available".
       
   365 	aReasonResourceId = 0;
       
   366 	return EFalse;	// Not Ok to do
       
   367 	}
       
   368 
       
   369 // ---------------------------------------------------------
       
   370 // CanForwardEntryL(...)
       
   371 // Checks if it is possible to forward entry.
       
   372 // ---------------------------------------------------------
       
   373 //
       
   374 TBool CIrMtmUiData::CanForwardEntryL(
       
   375     const TMsvEntry& /*aContext*/, 
       
   376     TInt& aReasonResourceId ) const
       
   377 	{
       
   378     //todo: This was using avkon resource Id of sting "This item is not available".
       
   379 	aReasonResourceId = 0;
       
   380 	return EFalse;	// Not Ok to do
       
   381 	}
       
   382 
       
   383 // ---------------------------------------------------------
       
   384 // CheckEntry(...)
       
   385 // Checks is the entry valid.
       
   386 // ---------------------------------------------------------
       
   387 //
       
   388 TBool CIrMtmUiData::CheckEntry(const TMsvEntry& aContext) const
       
   389 	{
       
   390     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CheckEntry\t" ) );
       
   391 	return( ( aContext.iType.iUid == KUidMsvMessageEntryValue ) && 
       
   392             ( aContext.iMtm       == KUidMsgTypeIrUID ) );
       
   393 	}
       
   394 
       
   395 // ---------------------------------------------------------
       
   396 // CanCancelL(...)
       
   397 // Checks if it is possible to cancel entry.
       
   398 // ---------------------------------------------------------
       
   399 //
       
   400 TBool CIrMtmUiData::CanCancelL(
       
   401     const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const
       
   402     {
       
   403     // No way of sending a message from the outbox, so no need to cancel.
       
   404     //todo: This was using avkon resource Id of sting "This item is not available".
       
   405 	aReasonResourceId = 0;
       
   406 	return EFalse;
       
   407     }
       
   408 
       
   409 // ---------------------------------------------------------
       
   410 // StatusTextL(...)
       
   411 // Returns status text when sending message(outbox).
       
   412 // ---------------------------------------------------------
       
   413 //
       
   414 HBufC* CIrMtmUiData::StatusTextL( const TMsvEntry& /*aContext*/ ) const
       
   415 	{  
       
   416     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: StatusTextL\t" ) );
       
   417     TBuf<80> buffer;
       
   418     //todo: Need to use localised string.
       
   419     _LIT(KText, "Sending");
       
   420     buffer.Copy(KText);
       
   421     HBufC* ptr;
       
   422     ptr = buffer.AllocL();
       
   423     return ptr;
       
   424 	}
       
   425 
       
   426 //  End of File