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