contentstorage/casrv/calocalizerscanner/src/calocalizerscannerproxy.cpp
changeset 109 e0aa398e6810
parent 103 b99b84bcd2d1
child 124 e36b2f4799c0
equal deleted inserted replaced
104:9b022b1f357c 109:e0aa398e6810
    17 
    17 
    18 #include <badesca.h>
    18 #include <badesca.h>
    19 #include <f32file.h>
    19 #include <f32file.h>
    20 #include <qtranslator.h>
    20 #include <qtranslator.h>
    21 #include <calocalizationentry.h>
    21 #include <calocalizationentry.h>
    22 #include <QLocale>
       
    23 #include <hbtextresolversymbian.h>
    22 #include <hbtextresolversymbian.h>
    24 
    23 
    25 //#include "cainternaltypes.h"
    24 //#include "cainternaltypes.h"
    26 #include "caarraycleanup.inl"
    25 #include "caarraycleanup.inl"
    27 #include "calocalizerscannerproxy.h"
    26 #include "calocalizerscannerproxy.h"
   136     for( TInt i = 0; i < locCount; i++ )
   135     for( TInt i = 0; i < locCount; i++ )
   137         {
   136         {
   138         localizedName = GetLocalizedNameLC( locals[i] );
   137         localizedName = GetLocalizedNameLC( locals[i] );
   139         
   138         
   140         if( locals[i]->GetAttributeName().Compare( KColumnEnText) == 0
   139         if( locals[i]->GetAttributeName().Compare( KColumnEnText) == 0
   141                 && !localizedName->Compare(
   140                 && localizedName->Compare(
   142                     GetEntryText( entries, locals[i]->GetRowId() ) ) == 0 
   141                     GetEntryText( entries, locals[i]->GetRowId() ) ) != 0 
   143                 ||
   142                 ||
   144             locals[i]->GetAttributeName().Compare( KColumnEnDescription) == 0
   143             locals[i]->GetAttributeName().Compare( KColumnEnDescription) == 0
   145                 && !localizedName->Compare(
   144                 && localizedName->Compare(
   146                     GetEntryDescription( entries, locals[i]->GetRowId() ) ) == 0 )
   145                     GetEntryDescription( entries, locals[i]->GetRowId() ) ) != 0
       
   146                 ||
       
   147             ( locals[i]->GetAttributeName().Compare( KShortName ) == 0
       
   148                 || locals[i]->GetAttributeName().Compare( KTitleName ) == 0 )
       
   149                 && localizedName->Compare(
       
   150                     GetAttributeName( entries,
       
   151                         locals[i]->GetRowId(),
       
   152                         locals[i]->GetAttributeName() ) ) != 0 )
   147             // translations different than text
   153             // translations different than text
   148             {
   154             {
   149             locals[i]->SetLocalizedStringL( *localizedName );
   155             locals[i]->SetLocalizedStringL( *localizedName );
   150             iStorageProxy->LocalizeEntryL( *( locals[i] ) );
   156             iStorageProxy->LocalizeEntryL( *( locals[i] ) );
   151             }
   157             }
   245             return aEntries[i]->GetDescription();
   251             return aEntries[i]->GetDescription();
   246             }
   252             }
   247         }
   253         }
   248     return KNullDesC();
   254     return KNullDesC();
   249     }
   255     }
       
   256 
       
   257 // ---------------------------------------------------------------------------
       
   258 //  
       
   259 // ---------------------------------------------------------------------------
       
   260 //
       
   261 const TPtrC CCaLocalizerScannerProxy::GetAttributeName(
       
   262         const RPointerArray<CCaInnerEntry>& aEntries,
       
   263         TInt aId,
       
   264         const TDesC& aAttrName )
       
   265     {
       
   266     TBool notFound( ETrue );
       
   267     TPtrC attrValue;
       
   268     TInt entriesCount = aEntries.Count();
       
   269     for( TInt i=0; i < entriesCount && notFound; i++ )
       
   270         {
       
   271         if( aEntries[i]->GetId() == aId &&
       
   272             aEntries[i]->GetAttributes().Find(aAttrName, attrValue) )
       
   273             {
       
   274             notFound = EFalse;
       
   275             }
       
   276         }
       
   277     return attrValue;
       
   278     }