btobexprofiles/obexreceiveservices/mtmuiinfrared/src/irmtmuidata.cpp
changeset 40 997690c3397a
parent 37 91746b151f97
equal deleted inserted replaced
37:91746b151f97 40:997690c3397a
    27 #include <mtmdef.hrh> //kuidmtmquerymaxbodysizevalue etc
    27 #include <mtmdef.hrh> //kuidmtmquerymaxbodysizevalue etc
    28 #else
    28 #else
    29 #include <mtmdef.hrh> //kuidmtmquerymaxbodysizevalue etc
    29 #include <mtmdef.hrh> //kuidmtmquerymaxbodysizevalue etc
    30 #include <mtmuidsdef.hrh> //kuidmtmquerymaxbodysizevalue etc
    30 #include <mtmuidsdef.hrh> //kuidmtmquerymaxbodysizevalue etc
    31 #endif
    31 #endif
    32 #include <Obexutils.rsg>
       
    33 #include <obexutilsmessagehandler.h>
    32 #include <obexutilsmessagehandler.h>
    34 #include "debug.h"
    33 #include "debug.h"
    35 
    34 
    36 //CONSTANTS
    35 //CONSTANTS
    37 const TInt KIrMtmUiDataMsgEditorAppValue      = 0x00000000;
    36 const TInt KIrMtmUiDataMsgEditorAppValue      = 0x00000000;
    82 TInt CIrMtmUiData::OperationSupportedL(
    81 TInt CIrMtmUiData::OperationSupportedL(
    83     TInt /*aOperationId*/, 
    82     TInt /*aOperationId*/, 
    84     const TMsvEntry& /*aContext*/) const
    83     const TMsvEntry& /*aContext*/) const
    85 	{
    84 	{
    86     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: OperationSupportedL\t" ) );
    85     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: OperationSupportedL\t" ) );
    87 	return TObexUtilsUiLayer::OperationNotSupported();
    86     //todo: This was returning avkon resource Id of sting "This item is not available".
       
    87     return 0;
    88 	}
    88 	}
    89 
    89 
    90 // ---------------------------------------------------------
    90 // ---------------------------------------------------------
    91 // QueryCapability(...)
    91 // QueryCapability(...)
    92 // MTM query capability
    92 // MTM query capability
   145 // CBaseMtmUiData::CBitmapArray& CIrMtmUiData::ContextIcon(...)
   145 // CBaseMtmUiData::CBitmapArray& CIrMtmUiData::ContextIcon(...)
   146 // Handles received msg icon.
   146 // Handles received msg icon.
   147 // ---------------------------------------------------------
   147 // ---------------------------------------------------------
   148 //
   148 //
   149 const CBaseMtmUiData::CBitmapArray& CIrMtmUiData::ContextIcon(
   149 const CBaseMtmUiData::CBitmapArray& CIrMtmUiData::ContextIcon(
   150      const TMsvEntry& aContext, 
   150      const TMsvEntry& /*aContext*/, 
   151      TInt /*aStateFlags*/) const
   151      TInt /*aStateFlags*/) const
   152 
   152 
   153 	{
   153 	{
   154 	TInt icon = TObexUtilsUiLayer::ContextIcon( aContext, EInfrared );
   154 	TInt icon = 0;
   155 	return *iIconArrays->At( icon/2 ); 
   155 	//todo: This function will not work as iIconArrays is not populated might cause panic.
       
   156 	return *iIconArrays->At( icon ); 
   156 	}
   157 	}
   157 
   158 
   158 // ---------------------------------------------------------
   159 // ---------------------------------------------------------
   159 // PopulateArraysL()
   160 // PopulateArraysL()
   160 // Populates bitmap array 
   161 // Populates bitmap array 
   162 //
   163 //
   163 void CIrMtmUiData::PopulateArraysL()
   164 void CIrMtmUiData::PopulateArraysL()
   164 	{
   165 	{
   165     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: PopulateArraysL\t" ) );
   166     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: PopulateArraysL\t" ) );
   166 
   167 
   167 	TObexUtilsUiLayer::CreateIconsL( KUidMsgTypeIrUID, iIconArrays );
   168     //todo: Was populating iIconArrays which should be removed.
   168 	}
   169 	}
   169 
   170 
   170 // ---------------------------------------------------------
   171 // ---------------------------------------------------------
   171 // GetResourceFileName(TFileName& aFileName) const
   172 // GetResourceFileName(TFileName& aFileName) const
   172 // Gives resource filename.
   173 // Gives resource filename.
   173 // ---------------------------------------------------------
   174 // ---------------------------------------------------------
   174 //
   175 //
   175 void CIrMtmUiData::GetResourceFileName(TFileName& aFileName) const
   176 void CIrMtmUiData::GetResourceFileName(TFileName& /*aFileName*/) const
   176 	{
   177 	{
   177     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: GetResourceFileName\t" ) );
   178     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: GetResourceFileName\t" ) );
   178     aFileName = KObexUtilsFileDrive;
   179     //todo: This was returning avkon resource file, which is not required now.
   179     aFileName += KDC_RESOURCE_FILES_DIR;
       
   180     aFileName += KObexUtilsResourceFileName;
       
   181 	}
   180 	}
   182 
   181 
   183 // ---------------------------------------------------------
   182 // ---------------------------------------------------------
   184 // CanCreateEntryL(...)
   183 // CanCreateEntryL(...)
   185 // Checks if it is possible to create entry.
   184 // Checks if it is possible to create entry.
   196 		{
   195 		{
   197         // --- Can create messages in local folders ---
   196         // --- Can create messages in local folders ---
   198 		return ( aParent.iMtm.iUid == KMsvLocalServiceIndexEntryIdValue );
   197 		return ( aParent.iMtm.iUid == KMsvLocalServiceIndexEntryIdValue );
   199 		}
   198 		}
   200 	// --- Can't create other types ---
   199 	// --- Can't create other types ---
   201 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   200 	//todo: This was using avkon resource Id of sting "This item is not available".
       
   201 	aReasonResourceId = 0;
   202 	return EFalse;
   202 	return EFalse;
   203 	}
   203 	}
   204 
   204 
   205 // ---------------------------------------------------------
   205 // ---------------------------------------------------------
   206 // CanOpenEntryL(...)
   206 // CanOpenEntryL(...)
   218 			{
   218 			{
   219 			aReasonResourceId = 0;
   219 			aReasonResourceId = 0;
   220 			return ETrue;
   220 			return ETrue;
   221 			}
   221 			}
   222 		}
   222 		}
   223 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   223 	//todo: This was using avkon resource Id of sting "This item is not available".
       
   224 	aReasonResourceId = 0;
   224 	return EFalse;
   225 	return EFalse;
   225 	}
   226 	}
   226 
   227 
   227 // ---------------------------------------------------------
   228 // ---------------------------------------------------------
   228 // CanCloseEntryL(...)
   229 // CanCloseEntryL(...)
   240 			{
   241 			{
   241 			aReasonResourceId = 0;
   242 			aReasonResourceId = 0;
   242 			return ETrue;
   243 			return ETrue;
   243 			}
   244 			}
   244 		}
   245 		}
   245 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   246 	//todo: This was using avkon resource Id of sting "This item is not available".
       
   247 	aReasonResourceId = 0;
   246 	return EFalse;
   248 	return EFalse;
   247 	}
   249 	}
   248 
   250 
   249 // ---------------------------------------------------------
   251 // ---------------------------------------------------------
   250 // CanViewEntryL(...)
   252 // CanViewEntryL(...)
   262 			{
   264 			{
   263 			aReasonResourceId = 0;
   265 			aReasonResourceId = 0;
   264 			return ETrue;
   266 			return ETrue;
   265 			}
   267 			}
   266 		}
   268 		}
   267 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   269 	//todo: This was using avkon resource Id of sting "This item is not available".
       
   270 	aReasonResourceId = 0;
   268 	return EFalse;
   271 	return EFalse;
   269 	}
   272 	}
   270 
   273 
   271 // ---------------------------------------------------------
   274 // ---------------------------------------------------------
   272 // CanEditEntryL(...)
   275 // CanEditEntryL(...)
   276 TBool CIrMtmUiData::CanEditEntryL(
   279 TBool CIrMtmUiData::CanEditEntryL(
   277     const TMsvEntry& aContext, 
   280     const TMsvEntry& aContext, 
   278     TInt& aReasonResourceId ) const
   281     TInt& aReasonResourceId ) const
   279 	{
   282 	{
   280     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanEditEntryL\t" ) );
   283     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanEditEntryL\t" ) );
   281 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   284     //todo: This was using avkon resource Id of sting "This item is not available".
       
   285 	aReasonResourceId = 0;
   282 	if( CheckEntry( aContext ) )
   286 	if( CheckEntry( aContext ) )
   283 		{
   287 		{
   284 		if ( ( aContext.iType.iUid == KUidMsvMessageEntryValue ) || 
   288 		if ( ( aContext.iType.iUid == KUidMsvMessageEntryValue ) || 
   285              ( aContext.iType.iUid == KUidMsvFolderEntryValue ) )
   289              ( aContext.iType.iUid == KUidMsvFolderEntryValue ) )
   286 			{
   290 			{
   299 TBool CIrMtmUiData::CanDeleteServiceL(
   303 TBool CIrMtmUiData::CanDeleteServiceL(
   300     const TMsvEntry& /*aService*/, 
   304     const TMsvEntry& /*aService*/, 
   301     TInt& aReasonResourceId ) const
   305     TInt& aReasonResourceId ) const
   302 	{
   306 	{
   303     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanDeleteServiceL\t" ) );
   307     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: CanDeleteServiceL\t" ) );
   304 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   308     //todo: This was using avkon resource Id of sting "This item is not available".
       
   309 	aReasonResourceId = 0;
   305     return EFalse; 
   310     return EFalse; 
   306 	}
   311 	}
   307 
   312 
   308 // ---------------------------------------------------------
   313 // ---------------------------------------------------------
   309 // CanDeleteFromEntryL(...)
   314 // CanDeleteFromEntryL(...)
   312 //
   317 //
   313 TBool CIrMtmUiData::CanDeleteFromEntryL(
   318 TBool CIrMtmUiData::CanDeleteFromEntryL(
   314     const TMsvEntry& /*aContext*/, 
   319     const TMsvEntry& /*aContext*/, 
   315     TInt& aReasonResourceId ) const
   320     TInt& aReasonResourceId ) const
   316 	{
   321 	{
   317 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   322     //todo: This was using avkon resource Id of sting "This item is not available".
       
   323 	aReasonResourceId = 0;
   318 	return EFalse;
   324 	return EFalse;
   319 	}
   325 	}
   320 
   326 
   321 // ---------------------------------------------------------
   327 // ---------------------------------------------------------
   322 // CanCopyMoveToEntryL(...)
   328 // CanCopyMoveToEntryL(...)
   325 //
   331 //
   326 TBool CIrMtmUiData::CanCopyMoveToEntryL(
   332 TBool CIrMtmUiData::CanCopyMoveToEntryL(
   327     const TMsvEntry& /*aContext*/, 
   333     const TMsvEntry& /*aContext*/, 
   328     TInt& aReasonResourceId ) const
   334     TInt& aReasonResourceId ) const
   329 	{
   335 	{
   330 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   336     //todo: This was using avkon resource Id of sting "This item is not available".
       
   337 	aReasonResourceId = 0;
   331 	return EFalse;
   338 	return EFalse;
   332 	}
   339 	}
   333 
   340 
   334 // ---------------------------------------------------------
   341 // ---------------------------------------------------------
   335 // CanCopyMoveFromEntryL(...)
   342 // CanCopyMoveFromEntryL(...)
   338 //
   345 //
   339 TBool CIrMtmUiData::CanCopyMoveFromEntryL(
   346 TBool CIrMtmUiData::CanCopyMoveFromEntryL(
   340     const TMsvEntry& /*aContext*/, 
   347     const TMsvEntry& /*aContext*/, 
   341     TInt& aReasonResourceId ) const
   348     TInt& aReasonResourceId ) const
   342 	{
   349 	{
   343 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   350     //todo: This was using avkon resource Id of sting "This item is not available".
       
   351 	aReasonResourceId = 0;
   344 	return EFalse;
   352 	return EFalse;
   345 	}
   353 	}
   346 
   354 
   347 // ---------------------------------------------------------
   355 // ---------------------------------------------------------
   348 // CanReplyToEntryL(...)
   356 // CanReplyToEntryL(...)
   351 //
   359 //
   352 TBool CIrMtmUiData::CanReplyToEntryL(
   360 TBool CIrMtmUiData::CanReplyToEntryL(
   353     const TMsvEntry& /*aContext*/, 
   361     const TMsvEntry& /*aContext*/, 
   354     TInt& aReasonResourceId ) const
   362     TInt& aReasonResourceId ) const
   355 	{
   363 	{
   356 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   364     //todo: This was using avkon resource Id of sting "This item is not available".
       
   365 	aReasonResourceId = 0;
   357 	return EFalse;	// Not Ok to do
   366 	return EFalse;	// Not Ok to do
   358 	}
   367 	}
   359 
   368 
   360 // ---------------------------------------------------------
   369 // ---------------------------------------------------------
   361 // CanForwardEntryL(...)
   370 // CanForwardEntryL(...)
   364 //
   373 //
   365 TBool CIrMtmUiData::CanForwardEntryL(
   374 TBool CIrMtmUiData::CanForwardEntryL(
   366     const TMsvEntry& /*aContext*/, 
   375     const TMsvEntry& /*aContext*/, 
   367     TInt& aReasonResourceId ) const
   376     TInt& aReasonResourceId ) const
   368 	{
   377 	{
   369 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   378     //todo: This was using avkon resource Id of sting "This item is not available".
       
   379 	aReasonResourceId = 0;
   370 	return EFalse;	// Not Ok to do
   380 	return EFalse;	// Not Ok to do
   371 	}
   381 	}
   372 
   382 
   373 // ---------------------------------------------------------
   383 // ---------------------------------------------------------
   374 // CheckEntry(...)
   384 // CheckEntry(...)
   389 //
   399 //
   390 TBool CIrMtmUiData::CanCancelL(
   400 TBool CIrMtmUiData::CanCancelL(
   391     const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const
   401     const TMsvEntry& /*aContext*/, TInt& aReasonResourceId ) const
   392     {
   402     {
   393     // No way of sending a message from the outbox, so no need to cancel.
   403     // No way of sending a message from the outbox, so no need to cancel.
   394 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   404     //todo: This was using avkon resource Id of sting "This item is not available".
       
   405 	aReasonResourceId = 0;
   395 	return EFalse;
   406 	return EFalse;
   396     }
   407     }
   397 
   408 
   398 // ---------------------------------------------------------
   409 // ---------------------------------------------------------
   399 // StatusTextL(...)
   410 // StatusTextL(...)
   402 //
   413 //
   403 HBufC* CIrMtmUiData::StatusTextL( const TMsvEntry& /*aContext*/ ) const
   414 HBufC* CIrMtmUiData::StatusTextL( const TMsvEntry& /*aContext*/ ) const
   404 	{  
   415 	{  
   405     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: StatusTextL\t" ) );
   416     FLOG( _L( "[CIrMtmUiData] CIrMtmUiData: StatusTextL\t" ) );
   406     TBuf<80> buffer;
   417     TBuf<80> buffer;
   407     TInt resourceId = R_IR_SEND_PROGRESS_SENDING;
   418     //todo: Need to use localised string.
   408 	TObexUtilsUiLayer::ReadResourceL( buffer, resourceId );
   419     _LIT(KText, "Sending");
       
   420     buffer.Copy(KText);
   409     HBufC* ptr;
   421     HBufC* ptr;
   410     ptr = buffer.AllocL();
   422     ptr = buffer.AllocL();
   411     return ptr;
   423     return ptr;
   412 	}
   424 	}
   413 
   425