meetingrequest/mrgui/src/cesmrfieldstorage.cpp
branchRCL_3
changeset 12 4ce476e64c59
parent 0 8466d47a6819
equal deleted inserted replaced
11:0396474f30f5 12:4ce476e64c59
     1 /*
     1 /*
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). 
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    13 *
    13 *
    14 * Description:  ESMR UI Factory implementation
    14 * Description:  ESMR UI Factory implementation
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 #include "emailtrace.h"
       
    19 #include "cesmrfieldstorage.h"
    18 #include "cesmrfieldstorage.h"
    20 #include "cesmrfield.h"
    19 #include "cesmrfield.h"
    21 #include "mesmrcalentry.h"
    20 #include "mesmrcalentry.h"
    22 #include "cesmrfieldeventqueue.h"
    21 #include "cesmrfieldeventqueue.h"
    23 // <cmail> Removed profiling. </cmail>
    22 #include "cmrsystemnotifier.h"
       
    23 
       
    24 #include <touchfeedback.h>
       
    25 
       
    26 #include "emailtrace.h"
       
    27 
    24 
    28 
    25 // ======== MEMBER FUNCTIONS ========
    29 // ======== MEMBER FUNCTIONS ========
    26 
    30 
    27 // ---------------------------------------------------------------------------
    31 // ---------------------------------------------------------------------------
    28 // CESMRFieldStorage::CESMRFieldStorage()
    32 // CESMRFieldStorage::CESMRFieldStorage()
    29 // ---------------------------------------------------------------------------
    33 // ---------------------------------------------------------------------------
    30 //
    34 //
    31 CESMRFieldStorage::CESMRFieldStorage(
    35 CESMRFieldStorage::CESMRFieldStorage(
    32 		MESMRFieldEventObserver& aEventObserver ): 
    36 		MESMRFieldEventObserver& aEventObserver ):
    33 	iEventObserver( aEventObserver )
    37 	iEventObserver( aEventObserver )
    34     {
    38     {
    35     FUNC_LOG;
    39     FUNC_LOG;
    36     // Do nothing
    40     // Do nothing
    37     }
    41     }
    38 
    42 
    39 void CESMRFieldStorage::BaseConstructL()
    43 void CESMRFieldStorage::BaseConstructL()
    40     {
    44     {
    41     FUNC_LOG;
    45     FUNC_LOG;
    42     // Add event observer to event queue
    46     // Add event observer to event queue
    43     EventQueueL().AddObserverL( &iEventObserver );
    47     EventQueueL().AddObserverL( &iEventObserver );    
    44     }
    48     iSystemNotifier = CMRSystemNotifier::NewL( EventQueueL() );
    45 		
    49     iSystemNotifier->StartL();
       
    50     }
       
    51 
    46 // ---------------------------------------------------------------------------
    52 // ---------------------------------------------------------------------------
    47 // CESMRFieldStorage::~CESMRFieldStorage()
    53 // CESMRFieldStorage::~CESMRFieldStorage()
    48 // ---------------------------------------------------------------------------
    54 // ---------------------------------------------------------------------------
    49 //
    55 //
    50 CESMRFieldStorage::~CESMRFieldStorage()
    56 CESMRFieldStorage::~CESMRFieldStorage()
    51     {
    57     {
    52     FUNC_LOG;
    58     FUNC_LOG;
    53     iArray.ResetAndDestroy();
    59     iArray.ResetAndDestroy();
    54     
    60 
    55     delete iPlugin;
    61     delete iPlugin;
    56     delete iEventQueue;
    62     delete iSystemNotifier;
       
    63     delete iEventQueue;    
    57     }
    64     }
    58 
    65 
    59 // ---------------------------------------------------------------------------
    66 // ---------------------------------------------------------------------------
    60 // CESMRFieldStorage::AddFieldL()
    67 // CESMRFieldStorage::AddFieldL()
    61 // ---------------------------------------------------------------------------
    68 // ---------------------------------------------------------------------------
   110 // ---------------------------------------------------------------------------
   117 // ---------------------------------------------------------------------------
   111 //
   118 //
   112 CESMRField* CESMRFieldStorage::FieldById( TESMREntryFieldId aId ) const
   119 CESMRField* CESMRFieldStorage::FieldById( TESMREntryFieldId aId ) const
   113     {
   120     {
   114     CESMRField* field = NULL;
   121     CESMRField* field = NULL;
   115     
   122 
   116     for ( TInt i = 0; i < iArray.Count(); ++i )
   123     for ( TInt i = 0; i < iArray.Count(); ++i )
   117         {
   124         {
   118         if ( iArray[ i ]->FieldId() == aId )
   125         if ( iArray[ i ]->FieldId() == aId )
   119             {
   126             {
   120             field = iArray[ i ];
   127             field = iArray[ i ];
   121             break;
   128             break;
   122             }
   129             }
   123         }
   130         }
   124     
   131 
   125     return field;
   132     return field;
   126     }
   133     }
   127 
   134 
   128 // ---------------------------------------------------------------------------
   135 // ---------------------------------------------------------------------------
   129 // CESMRFieldStorage::Validate()
   136 // CESMRFieldStorage::Validate()
   130 // ---------------------------------------------------------------------------
   137 // ---------------------------------------------------------------------------
   131 //
   138 //
   132 TInt CESMRFieldStorage::Validate( 
   139 TInt CESMRFieldStorage::Validate(
   133 		TESMREntryFieldId& /*aId */, 
   140 		TESMREntryFieldId& /*aId */,
   134 		TBool /*aForceValidation*/ )
   141 		TBool /*aForceValidation*/ )
   135     {
   142     {
   136     FUNC_LOG;
   143     FUNC_LOG;
   137     return KErrNone;
   144     return KErrNone;
   138     }
   145     }
   142 // ---------------------------------------------------------------------------
   149 // ---------------------------------------------------------------------------
   143 //
   150 //
   144 void CESMRFieldStorage::InternalizeL( MESMRCalEntry& aEntry )
   151 void CESMRFieldStorage::InternalizeL( MESMRCalEntry& aEntry )
   145     {
   152     {
   146     FUNC_LOG;
   153     FUNC_LOG;
       
   154 
       
   155     TInt index(0);
       
   156     while( index < iArray.Count() )
       
   157         {
       
   158         TInt fieldCount( iArray.Count() );
       
   159         iArray[ index ]->InternalizeL( aEntry );
       
   160 
       
   161         if ( fieldCount == iArray.Count() )
       
   162             {
       
   163             // Field that was internalized was not removed from list
       
   164             // We can update field index. If field is removed the next
       
   165             // field index is already the current index ...
       
   166             index++;
       
   167             }
       
   168         }
       
   169     }
       
   170 
       
   171 // ---------------------------------------------------------------------------
       
   172 // CESMRFieldStorage::ExternalizeL()
       
   173 // ---------------------------------------------------------------------------
       
   174 //
       
   175 void CESMRFieldStorage::ExternalizeL( MESMRCalEntry& aEntry )
       
   176     {
       
   177     FUNC_LOG;
   147     for ( TInt i(0); i < iArray.Count(); i++ )
   178     for ( TInt i(0); i < iArray.Count(); i++ )
   148         {
   179         {
   149         iArray[ i ]->InternalizeL( aEntry );
   180         if(iArray[ i ]->IsVisible())
   150         }
   181         	{
   151     }
   182         	iArray[ i ]->ExternalizeL( aEntry );
   152 
   183         	}
   153 // ---------------------------------------------------------------------------
       
   154 // CESMRFieldStorage::ExternalizeL()
       
   155 // ---------------------------------------------------------------------------
       
   156 //
       
   157 void CESMRFieldStorage::ExternalizeL( MESMRCalEntry& aEntry )
       
   158     {
       
   159     FUNC_LOG;
       
   160     for ( TInt i(0); i < iArray.Count(); i++ )
       
   161         {
       
   162         iArray[ i ]->ExternalizeL( aEntry );
       
   163         }
   184         }
   164     }
   185     }
   165 
   186 
   166 
   187 
   167 // -----------------------------------------------------------------------------
   188 // -----------------------------------------------------------------------------
   186     {
   207     {
   187     FUNC_LOG;
   208     FUNC_LOG;
   188     iFieldBuilder = NULL;
   209     iFieldBuilder = NULL;
   189     CESMRFieldBuilderInterface* plugin = NULL;
   210     CESMRFieldBuilderInterface* plugin = NULL;
   190 
   211 
   191 	TRAPD( error, plugin = 
   212 	TRAPD( error, plugin =
   192 		CESMRFieldBuilderInterface::CreatePluginL( 
   213 		CESMRFieldBuilderInterface::CreatePluginL(
   193 				TUid::Uid(KESMRUIFieldBuilderPluginImplUId) ) );
   214 				TUid::Uid(KESMRUIFieldBuilderPluginImplUId) ) );
   194 	
   215 
   195 	if ( error == KErrNone && plugin)
   216 	if ( error == KErrNone && plugin)
   196 		{   
   217 		{
   197 		delete iPlugin;
   218 		delete iPlugin;
   198 		iPlugin = plugin;
   219 		iPlugin = plugin;
   199 		
   220 
   200 		iFieldBuilder = iPlugin->FieldBuilderL();
   221 		iFieldBuilder = iPlugin->FieldBuilderL();
   201 		}
   222 		}
   202     }
   223     }
   203 
   224 
   204 // -----------------------------------------------------------------------------
   225 // -----------------------------------------------------------------------------
   205 // CESMRFieldStorage::CreateEditorFieldL()
   226 // CESMRFieldStorage::CreateEditorFieldL()
   206 // -----------------------------------------------------------------------------
   227 // -----------------------------------------------------------------------------
   207 //
   228 //
   208 CESMRField* CESMRFieldStorage::CreateEditorFieldL( 
   229 CESMRField* CESMRFieldStorage::CreateEditorFieldL(
   209 		MESMRFieldValidator* aValidator, 
   230 		MESMRFieldValidator* aValidator,
   210 		TESMREntryField aField )
   231 		TESMREntryField aField )
   211     {
   232     {
   212     FUNC_LOG;
   233     FUNC_LOG;
   213     CESMRField* field = NULL;
   234     CESMRField* field = NULL;
   214 
   235 
   222 
   243 
   223 // -----------------------------------------------------------------------------
   244 // -----------------------------------------------------------------------------
   224 // CESMRFieldStorage::CreateViewerFieldL()
   245 // CESMRFieldStorage::CreateViewerFieldL()
   225 // -----------------------------------------------------------------------------
   246 // -----------------------------------------------------------------------------
   226 //
   247 //
   227 CESMRField* CESMRFieldStorage::CreateViewerFieldL( 
   248 CESMRField* CESMRFieldStorage::CreateViewerFieldL(
   228 		MESMRResponseObserver* aResponseObserver, 
   249 		MESMRResponseObserver* aResponseObserver,
   229 		TESMREntryField aField, 
   250 		TESMREntryField aField,
   230 		TBool aResponseReady )
   251 		TBool aResponseReady )
   231     {
   252     {
   232     FUNC_LOG;
   253     FUNC_LOG;
   233     CESMRField* field = NULL;
   254     CESMRField* field = NULL;
   234 
   255 
   239         }
   260         }
   240     return field;
   261     return field;
   241     }
   262     }
   242 
   263 
   243 // -----------------------------------------------------------------------------
   264 // -----------------------------------------------------------------------------
       
   265 // CESMRFieldStorage::ChangePolicyL()
       
   266 // -----------------------------------------------------------------------------
       
   267 //
       
   268 void CESMRFieldStorage::ChangePolicyL(
       
   269         const CESMRPolicy& /*aNewPolicy*/,
       
   270         MESMRCalEntry& /*aEntry*/ )
       
   271     {
       
   272     ASSERT( EFalse ); // Assert for debug builds
       
   273     User::Leave( KErrNotSupported );
       
   274     }
       
   275 
       
   276 // -----------------------------------------------------------------------------
   244 // CESMRFieldStorage::EventQueueL()
   277 // CESMRFieldStorage::EventQueueL()
   245 // -----------------------------------------------------------------------------
   278 // -----------------------------------------------------------------------------
   246 //
   279 //
   247 CESMRFieldEventQueue& CESMRFieldStorage::EventQueueL()
   280 CESMRFieldEventQueue& CESMRFieldStorage::EventQueueL()
   248     {
   281     {
   252         iEventQueue = CESMRFieldEventQueue::NewL();
   285         iEventQueue = CESMRFieldEventQueue::NewL();
   253         }
   286         }
   254     return *iEventQueue;
   287     return *iEventQueue;
   255     }
   288     }
   256 
   289 
       
   290 // -----------------------------------------------------------------------------
       
   291 // CESMRFieldStorage::RemoveField()
       
   292 // -----------------------------------------------------------------------------
       
   293 //
       
   294 void CESMRFieldStorage::RemoveField( TInt aInd )
       
   295     {
       
   296     CESMRField* field = iArray[ aInd ];
       
   297     iArray.Remove( aInd );
       
   298     delete field;
       
   299     }
       
   300 
       
   301 // -----------------------------------------------------------------------------
       
   302 // CESMRFieldStorage::InsertFieldL()
       
   303 // -----------------------------------------------------------------------------
       
   304 //
       
   305 void CESMRFieldStorage::InsertFieldL( CESMRField* aField, TInt aIndex )
       
   306     {
       
   307     iArray.InsertL( aField, aIndex );
       
   308     aField->SetEventQueueL( iEventQueue );
       
   309     }
       
   310 
       
   311 // -----------------------------------------------------------------------------
       
   312 // CESMRFieldStorage::ReserveL()
       
   313 // -----------------------------------------------------------------------------
       
   314 //
       
   315 void CESMRFieldStorage::ReserveL( TInt aCount )
       
   316     {
       
   317     iArray.ReserveL( aCount );
       
   318     }
       
   319 
       
   320 // -----------------------------------------------------------------------------
       
   321 // CESMRFieldStorage::Reset()
       
   322 // -----------------------------------------------------------------------------
       
   323 //
       
   324 void CESMRFieldStorage::Reset()
       
   325     {
       
   326     iArray.ResetAndDestroy();
       
   327     }
   257 // EOF
   328 // EOF
   258 
   329