btobexprofiles/obexreceiveservices/mtmuibluetooth/src/btmtmuidata.cpp
changeset 42 b72428996822
parent 32 19bd632b5100
equal deleted inserted replaced
32:19bd632b5100 42:b72428996822
    25 #else
    25 #else
    26 #include <mtmdef.hrh>       //kuidmtmquerymaxbodysizevalue etc
    26 #include <mtmdef.hrh>       //kuidmtmquerymaxbodysizevalue etc
    27 #include <mtmuidsdef.hrh>       //kuidmtmquerymaxbodysizevalue etc
    27 #include <mtmuidsdef.hrh>       //kuidmtmquerymaxbodysizevalue etc
    28 #endif
    28 #endif
    29 #include <msvuids.h>
    29 #include <msvuids.h>
    30 #include <Obexutils.rsg> 
       
    31 #include <obexutilsmessagehandler.h>
    30 #include <obexutilsmessagehandler.h>
    32 
    31 
    33 
    32 
    34 const TInt KBtMtmUiNfcContext       = 2;
    33 // todo @ QT migration: take official definition from Messaging at app layer (btmsgtypeuid.h)
       
    34 const TUid KUidMsgTypeBt = {0x10009ED5};
    35 
    35 
    36 // ================= MEMBER FUNCTIONS =======================
    36 // ================= MEMBER FUNCTIONS =======================
    37 
    37 
    38 // Two-phased constructor.
    38 // Two-phased constructor.
    39 CBtMtmUiData* CBtMtmUiData::NewL( CRegisteredMtmDll& aRegisteredDll )
    39 CBtMtmUiData* CBtMtmUiData::NewL( CRegisteredMtmDll& aRegisteredDll )
    76 // ---------------------------------------------------------
    76 // ---------------------------------------------------------
    77 //
    77 //
    78 TInt CBtMtmUiData::OperationSupportedL( TInt /*aOperationId*/, 
    78 TInt CBtMtmUiData::OperationSupportedL( TInt /*aOperationId*/, 
    79                                        const TMsvEntry& /*aContext*/) const
    79                                        const TMsvEntry& /*aContext*/) const
    80 	{
    80 	{
    81     FLOG( _L( " CBtMtmUiData: OperationSupportedL\t" ) );    
    81     FLOG( _L( " CBtMtmUiData: OperationSupportedL\t" ) );
    82 	return TObexUtilsUiLayer::OperationNotSupported(); 
    82     
       
    83     //todo: This was returning avkon resource Id of sting "This item is not available".
       
    84     return 0;
    83 	}
    85 	}
    84 
    86 
    85 // ---------------------------------------------------------
    87 // ---------------------------------------------------------
    86 // QueryCapability(...)
    88 // QueryCapability(...)
    87 // MTM query capability
    89 // MTM query capability
   126 // ---------------------------------------------------------
   128 // ---------------------------------------------------------
   127 // CBitmapArray& CBtMtmUiData::ContextIcon(...)
   129 // CBitmapArray& CBtMtmUiData::ContextIcon(...)
   128 // Handles received msg icon.
   130 // Handles received msg icon.
   129 // ---------------------------------------------------------
   131 // ---------------------------------------------------------
   130 //
   132 //
   131 const CBaseMtmUiData::CBitmapArray& CBtMtmUiData::ContextIcon( const TMsvEntry& aContext, 
   133 const CBaseMtmUiData::CBitmapArray& CBtMtmUiData::ContextIcon( const TMsvEntry& /*aContext*/, 
   132                                                               TInt /*aStateFlags*/) const
   134                                                               TInt /*aStateFlags*/) const
   133 	{
   135 	{
   134 	// Check if NFC context
   136 	// Check if NFC context
   135 	TInt icon = 0;
   137 	TInt icon = 0;
   136 	if ( aContext.MtmData1() == KBtMtmUiNfcContext )
   138 	//todo: This function will not work as iIconArrays is not populated might cause panic.
   137 	    {
   139 	return *iIconArrays->At(icon); 
   138       icon = TObexUtilsUiLayer::ContextIcon( aContext, ENfc );
       
   139 	    }
       
   140 	else
       
   141 	    {
       
   142 	    icon = TObexUtilsUiLayer::ContextIcon( aContext, EBluetooth );
       
   143 	    }
       
   144 
       
   145 	return *iIconArrays->At( icon/2 ); 
       
   146 	}
   140 	}
   147 
   141 
   148 // ---------------------------------------------------------
   142 // ---------------------------------------------------------
   149 // PopulateArraysL()
   143 // PopulateArraysL()
   150 // Populates bitmap array 
   144 // Populates bitmap array 
   151 // ---------------------------------------------------------
   145 // ---------------------------------------------------------
   152 //
   146 //
   153 void CBtMtmUiData::PopulateArraysL()
   147 void CBtMtmUiData::PopulateArraysL()
   154 	{
   148 	{
   155     FLOG( _L( " CBtMtmUiData: PopulateArraysL\t" ) );
   149     FLOG( _L( " CBtMtmUiData: PopulateArraysL\t" ) );
   156 	TObexUtilsUiLayer::CreateIconsL( KUidMsgTypeBt, iIconArrays );
   150 	//todo: Was populating iIconArrays which should be removed.
   157 	}
   151 	}
   158 
   152 
   159 // ---------------------------------------------------------
   153 // ---------------------------------------------------------
   160 // GetResourceFileName(TFileName& aFileName) const
   154 // GetResourceFileName(TFileName& aFileName) const
   161 // Gives resource filename.
   155 // Gives resource filename.
   162 // ---------------------------------------------------------
   156 // ---------------------------------------------------------
   163 //
   157 //
   164 void CBtMtmUiData::GetResourceFileName( TFileName& aFileName ) const
   158 void CBtMtmUiData::GetResourceFileName( TFileName& /*aFileName*/ ) const
   165 	{ 
   159 	{ 
   166     FLOG( _L( " CBtMtmUiData: GetResourceFileName\t" ) );
   160     FLOG( _L( " CBtMtmUiData: GetResourceFileName\t" ) );
   167     aFileName = KObexUtilsFileDrive;
   161     //todo: This was returning avkon resource file, which is not required now.
   168     aFileName += KDC_RESOURCE_FILES_DIR;
       
   169     aFileName += KObexUtilsResourceFileName;
       
   170 	}
   162 	}
   171 
   163 
   172 // ---------------------------------------------------------
   164 // ---------------------------------------------------------
   173 // CanCreateEntryL(...)
   165 // CanCreateEntryL(...)
   174 // Checks if it is possible to create entry.
   166 // Checks if it is possible to create entry.
   184 		{
   176 		{
   185         // --- Can create messages in local folders ---
   177         // --- Can create messages in local folders ---
   186 		return ( aParent.iMtm.iUid == KMsvLocalServiceIndexEntryIdValue );
   178 		return ( aParent.iMtm.iUid == KMsvLocalServiceIndexEntryIdValue );
   187 		}
   179 		}
   188 	// --- Can't create other types ---
   180 	// --- Can't create other types ---
   189 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); 
   181 	//todo: This was using avkon resource Id of sting "This item is not available".
       
   182 	aReasonResourceId = 0; 
   190 	return EFalse;
   183 	return EFalse;
   191 	}
   184 	}
   192 
   185 
   193 // ---------------------------------------------------------
   186 // ---------------------------------------------------------
   194 // CanOpenEntryL(...)
   187 // CanOpenEntryL(...)
   205 			{
   198 			{
   206 			aReasonResourceId = 0;
   199 			aReasonResourceId = 0;
   207 			return ETrue;
   200 			return ETrue;
   208 			}
   201 			}
   209 		}
   202 		}
   210 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); 
   203 	//todo: This was using avkon resource Id of sting "This item is not available".
       
   204 	aReasonResourceId = 0; 
   211 	return EFalse;
   205 	return EFalse;
   212 	}
   206 	}
   213 
   207 
   214 // ---------------------------------------------------------
   208 // ---------------------------------------------------------
   215 // CanCloseEntryL(...)
   209 // CanCloseEntryL(...)
   226 			{
   220 			{
   227 			aReasonResourceId = 0;
   221 			aReasonResourceId = 0;
   228 			return ETrue;
   222 			return ETrue;
   229 			}
   223 			}
   230 		}
   224 		}
   231 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); 
   225 	//todo: This was using avkon resource Id of sting "This item is not available".
       
   226 	aReasonResourceId = 0; 
   232 	return EFalse;
   227 	return EFalse;
   233 	}
   228 	}
   234 
   229 
   235 // ---------------------------------------------------------
   230 // ---------------------------------------------------------
   236 // CanViewEntryL(...)
   231 // CanViewEntryL(...)
   246 		if( aContext.iType.iUid == KUidMsvMessageEntryValue )
   241 		if( aContext.iType.iUid == KUidMsvMessageEntryValue )
   247 			{
   242 			{
   248 			aReasonResourceId = 0;
   243 			aReasonResourceId = 0;
   249 			return ETrue;
   244 			return ETrue;
   250 			}
   245 			}
   251 		}   
   246 		}
   252 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); 
   247 	//todo: This was using avkon resource Id of sting "This item is not available".
       
   248 	aReasonResourceId = 0; 
   253 	return EFalse;
   249 	return EFalse;
   254 	}
   250 	}
   255 
   251 
   256 // ---------------------------------------------------------
   252 // ---------------------------------------------------------
   257 // CanEditEntryL(...)
   253 // CanEditEntryL(...)
   260 //
   256 //
   261 TBool CBtMtmUiData::CanEditEntryL( const TMsvEntry& aContext, 
   257 TBool CBtMtmUiData::CanEditEntryL( const TMsvEntry& aContext, 
   262                                   TInt& aReasonResourceId ) const
   258                                   TInt& aReasonResourceId ) const
   263 	{
   259 	{
   264     FLOG( _L( " CBtMtmUiData: CanEditEntryL\t" ) );
   260     FLOG( _L( " CBtMtmUiData: CanEditEntryL\t" ) );
   265 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); 
   261     //todo: This was using avkon resource Id of sting "This item is not available".
       
   262 	aReasonResourceId = 0; 
   266 	if( CheckEntry( aContext ) )
   263 	if( CheckEntry( aContext ) )
   267 		{
   264 		{
   268 		if ( ( aContext.iType.iUid == KUidMsvMessageEntryValue ) || 
   265 		if ( ( aContext.iType.iUid == KUidMsvMessageEntryValue ) || 
   269              ( aContext.iType.iUid == KUidMsvFolderEntryValue ) )
   266              ( aContext.iType.iUid == KUidMsvFolderEntryValue ) )
   270 			{
   267 			{
   281 // ---------------------------------------------------------
   278 // ---------------------------------------------------------
   282 //
   279 //
   283 TBool CBtMtmUiData::CanDeleteServiceL( const TMsvEntry& /*aService*/, 
   280 TBool CBtMtmUiData::CanDeleteServiceL( const TMsvEntry& /*aService*/, 
   284                                       TInt& aReasonResourceId ) const
   281                                       TInt& aReasonResourceId ) const
   285 	{
   282 	{
   286     FLOG( _L( " CBtMtmUiData: CanDeleteServiceL\t" ) );   
   283     FLOG( _L( " CBtMtmUiData: CanDeleteServiceL\t" ) );
   287 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); 
   284     //todo: This was using avkon resource Id of sting "This item is not available".
       
   285 	aReasonResourceId = 0; 
   288     return EFalse; 
   286     return EFalse; 
   289 	}
   287 	}
   290 
   288 
   291 // ---------------------------------------------------------
   289 // ---------------------------------------------------------
   292 // CanDeleteFromEntryL(...)
   290 // CanDeleteFromEntryL(...)
   294 // ---------------------------------------------------------
   292 // ---------------------------------------------------------
   295 //
   293 //
   296 TBool CBtMtmUiData::CanDeleteFromEntryL( const TMsvEntry& /*aContext*/, 
   294 TBool CBtMtmUiData::CanDeleteFromEntryL( const TMsvEntry& /*aContext*/, 
   297                                         TInt& aReasonResourceId ) const
   295                                         TInt& aReasonResourceId ) const
   298 	{
   296 	{
   299 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   297     //todo: This was using avkon resource Id of sting "This item is not available".
       
   298 	aReasonResourceId = 0;
   300 	return EFalse;
   299 	return EFalse;
   301 	}
   300 	}
   302 
   301 
   303 // ---------------------------------------------------------
   302 // ---------------------------------------------------------
   304 // CanCopyMoveToEntryL(...)
   303 // CanCopyMoveToEntryL(...)
   306 // ---------------------------------------------------------
   305 // ---------------------------------------------------------
   307 //
   306 //
   308 TBool CBtMtmUiData::CanCopyMoveToEntryL( const TMsvEntry& /*aContext*/, 
   307 TBool CBtMtmUiData::CanCopyMoveToEntryL( const TMsvEntry& /*aContext*/, 
   309                                         TInt& aReasonResourceId ) const
   308                                         TInt& aReasonResourceId ) const
   310 	{
   309 	{
   311 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); 
   310     //todo: This was using avkon resource Id of sting "This item is not available".
       
   311 	aReasonResourceId = 0; 
   312 	return EFalse;
   312 	return EFalse;
   313 	}
   313 	}
   314 
   314 
   315 // ---------------------------------------------------------
   315 // ---------------------------------------------------------
   316 // CanCopyMoveFromEntryL(...)
   316 // CanCopyMoveFromEntryL(...)
   318 // ---------------------------------------------------------
   318 // ---------------------------------------------------------
   319 //
   319 //
   320 TBool CBtMtmUiData::CanCopyMoveFromEntryL( const TMsvEntry& /*aContext*/,
   320 TBool CBtMtmUiData::CanCopyMoveFromEntryL( const TMsvEntry& /*aContext*/,
   321                                           TInt& aReasonResourceId ) const
   321                                           TInt& aReasonResourceId ) const
   322 	{
   322 	{
   323 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported(); 
   323     //todo: This was using avkon resource Id of sting "This item is not available".
       
   324 	aReasonResourceId = 0; 
   324 	return EFalse;
   325 	return EFalse;
   325 	}
   326 	}
   326 
   327 
   327 // ---------------------------------------------------------
   328 // ---------------------------------------------------------
   328 // CanReplyToEntryL(...)
   329 // CanReplyToEntryL(...)
   330 // ---------------------------------------------------------
   331 // ---------------------------------------------------------
   331 //
   332 //
   332 TBool CBtMtmUiData::CanReplyToEntryL( const TMsvEntry& /*aContext*/, 
   333 TBool CBtMtmUiData::CanReplyToEntryL( const TMsvEntry& /*aContext*/, 
   333                                      TInt& aReasonResourceId ) const
   334                                      TInt& aReasonResourceId ) const
   334 	{
   335 	{
   335 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   336     //todo: This was using avkon resource Id of sting "This item is not available".
       
   337 	aReasonResourceId = 0;
   336 	return EFalse;	// Not Ok to do
   338 	return EFalse;	// Not Ok to do
   337 	}
   339 	}
   338 
   340 
   339 // ---------------------------------------------------------
   341 // ---------------------------------------------------------
   340 // CanForwardEntryL(...)
   342 // CanForwardEntryL(...)
   342 // ---------------------------------------------------------
   344 // ---------------------------------------------------------
   343 //
   345 //
   344 TBool CBtMtmUiData::CanForwardEntryL( const TMsvEntry& /*aContext*/, 
   346 TBool CBtMtmUiData::CanForwardEntryL( const TMsvEntry& /*aContext*/, 
   345                                      TInt& aReasonResourceId ) const
   347                                      TInt& aReasonResourceId ) const
   346 	{
   348 	{
   347 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   349     //todo: This was using avkon resource Id of sting "This item is not available".
       
   350 	aReasonResourceId = 0;
   348 	return EFalse;	// Not Ok to do
   351 	return EFalse;	// Not Ok to do
   349 	}
   352 	}
   350 
   353 
   351 // ---------------------------------------------------------
   354 // ---------------------------------------------------------
   352 // CheckEntry(...)
   355 // CheckEntry(...)
   366 //
   369 //
   367 TBool CBtMtmUiData::CanCancelL( const TMsvEntry& /*aContext*/,
   370 TBool CBtMtmUiData::CanCancelL( const TMsvEntry& /*aContext*/,
   368                                TInt& aReasonResourceId ) const
   371                                TInt& aReasonResourceId ) const
   369     {
   372     {
   370     // No way of sending a message from the outbox, so no need to cancel.
   373     // No way of sending a message from the outbox, so no need to cancel.
   371 	aReasonResourceId = TObexUtilsUiLayer::OperationNotSupported();
   374     //todo: This was using avkon resource Id of sting "This item is not available".
       
   375 	aReasonResourceId = 0;
   372 	return EFalse;
   376 	return EFalse;
   373     }
   377     }
   374 
   378 
   375 // ---------------------------------------------------------
   379 // ---------------------------------------------------------
   376 // StatusTextL(...)
   380 // StatusTextL(...)
   379 //
   383 //
   380 HBufC* CBtMtmUiData::StatusTextL( const TMsvEntry& /*aContext*/ ) const
   384 HBufC* CBtMtmUiData::StatusTextL( const TMsvEntry& /*aContext*/ ) const
   381     {  
   385     {  
   382     FLOG( _L( " CBtMtmUiData: StatusTextL\t" ) );
   386     FLOG( _L( " CBtMtmUiData: StatusTextL\t" ) );
   383     TBuf<80> buffer;
   387     TBuf<80> buffer;
   384     TInt resourceId = R_BT_SEND_PROGRESS_SENDING;
   388     //todo: Need to use localised string.
   385     TObexUtilsUiLayer::ReadResourceL( buffer, resourceId );
   389     _LIT(KText, "Sending");
       
   390     buffer.Copy(KText);
   386     return buffer.AllocL();
   391     return buffer.AllocL();
   387     }
   392     }
   388 
   393 
   389 //  End of File  
   394 //  End of File