phoneapp/phonestringloader/src/stringloader.cpp
changeset 78 baacf668fe89
parent 21 92ab7f8d0eab
equal deleted inserted replaced
76:cfea66083b62 78:baacf668fe89
    16 */
    16 */
    17 
    17 
    18 #include <exception> // must be before e32base.h so uncaught_exception gets defined
    18 #include <exception> // must be before e32base.h so uncaught_exception gets defined
    19 #include <StringLoader.h>
    19 #include <StringLoader.h>
    20 #include "phoneresourceadapter.h"
    20 #include "phoneresourceadapter.h"
    21 #include "phoneaction.h"
       
    22 
    21 
    23 // ============================ MEMBER FUNCTIONS ===============================
    22 // ============================ MEMBER FUNCTIONS ===============================
    24 
       
    25 // -----------------------------------------------------------------------------
       
    26 // StringLoader::StringLoader
       
    27 // -----------------------------------------------------------------------------
       
    28 //
       
    29 /*
       
    30 StringLoader::StringLoader(  )
       
    31     {
       
    32     
       
    33     }
       
    34 */
       
    35 
    23 
    36 // -----------------------------------------------------------------------------
    24 // -----------------------------------------------------------------------------
    37 // StringLoader::Load
    25 // StringLoader::Load
    38 // -----------------------------------------------------------------------------
    26 // -----------------------------------------------------------------------------
    39 //
    27 //
    41         TDes & aDest,
    29         TDes & aDest,
    42         TInt aResourceId,
    30         TInt aResourceId,
    43         CCoeEnv * aLoaderEnv )
    31         CCoeEnv * aLoaderEnv )
    44     {
    32     {
    45     Q_UNUSED (aLoaderEnv);
    33     Q_UNUSED (aLoaderEnv);
    46     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId);
    34     QString text = PhoneResourceAdapter::Instance()->convert(aResourceId);
    47     if (map.contains (PhoneAction::Text)) {
    35     aDest.Copy(text.utf16());
    48         PhoneAction *text = map [PhoneAction::Text];
    36     }
    49         aDest.Copy (text->text ().utf16 ());
    37 
    50         delete text;        
    38 // -----------------------------------------------------------------------------
    51         }
    39 // StringLoader::LoadL
    52     }
    40 // -----------------------------------------------------------------------------
    53 
    41 //
    54 // -----------------------------------------------------------------------------
    42 EXPORT_C HBufC * StringLoader::LoadL( 
    55 // StringLoader::LoadL
    43         TInt aResourceId,
    56 // -----------------------------------------------------------------------------
    44         CCoeEnv * aLoaderEnv )
    57 //
    45     {
    58 EXPORT_C HBufC * StringLoader::LoadL( 
    46     HBufC *buf = LoadLC(aResourceId, aLoaderEnv);
    59         TInt aResourceId,
    47     CleanupStack::Pop(buf);
    60         CCoeEnv * aLoaderEnv )
    48     return buf;
    61     {
    49     }
    62     Q_UNUSED (aLoaderEnv);
    50 
    63     HBufC *buf;
    51 
    64     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId);
    52 // -----------------------------------------------------------------------------
    65     if (map.contains (PhoneAction::Text)) {
    53 // StringLoader::LoadL
    66         PhoneAction *text = map [PhoneAction::Text];
    54 // -----------------------------------------------------------------------------
    67         buf = HBufC::NewL (text->text ().size ());
    55 //
    68         *buf = text->text ().utf16 ();
    56 EXPORT_C HBufC * StringLoader::LoadL( 
    69         delete text;
    57         TInt aResourceId,
    70     } else {
    58         TInt aInt,
    71         // TODO: this else branch MUST be removed after all strings are localized!
    59         CCoeEnv * aLoaderEnv )
    72         //       now here only to prevent crashing
    60     {
    73         buf = HBufC::New (1);
    61     HBufC *buf = LoadLC(aResourceId, aInt, aLoaderEnv);
    74     }
    62     CleanupStack::Pop(buf);
    75     return buf;
    63     return buf;
    76     }
    64     }
    77 
    65 
    78 
    66 
    79 // -----------------------------------------------------------------------------
    67 // -----------------------------------------------------------------------------
    80 // StringLoader::LoadL
    68 // StringLoader::LoadL
    81 // -----------------------------------------------------------------------------
    69 // -----------------------------------------------------------------------------
    82 //
    70 //
    83 EXPORT_C HBufC * StringLoader::LoadL( 
    71 EXPORT_C HBufC * StringLoader::LoadL( 
    84         TInt aResourceId,
    72         TInt aResourceId,
    85         TInt aInt,
    73         const TDesC & aString,
    86         CCoeEnv * aLoaderEnv )
    74         CCoeEnv * aLoaderEnv )
    87     {
    75     {
    88     Q_UNUSED (aLoaderEnv);
    76     HBufC *buf = LoadLC(aResourceId, aString, aLoaderEnv);
    89     HBufC *buf;
    77     CleanupStack::Pop(buf);
    90     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId, aInt);
    78     return buf;
    91     if (map.contains (PhoneAction::Text)) {
    79     }
    92         PhoneAction *text = map [PhoneAction::Text];
    80 
    93         buf = HBufC::NewL (text->text ().size ());
    81 
    94         *buf = text->text ().utf16 ();
    82 // -----------------------------------------------------------------------------
    95         delete text;
    83 // StringLoader::LoadL
    96     } else {
    84 // -----------------------------------------------------------------------------
    97         // TODO: this else branch MUST be removed after all strings are localized!
    85 //
    98         //       now here only to prevent crashing
    86 EXPORT_C HBufC * StringLoader::LoadL( 
    99         buf = HBufC::New (1);
    87         TInt aResourceId,
   100     }
    88         const TDesC & aString,
   101     return buf;
    89         TInt aInt,
   102     }
    90         CCoeEnv * aLoaderEnv )
   103 
    91     {
   104 
    92     HBufC *buf = LoadLC(aResourceId, aString, aInt, aLoaderEnv);
   105 // -----------------------------------------------------------------------------
    93     CleanupStack::Pop(buf);
   106 // StringLoader::LoadL
    94     return buf;
   107 // -----------------------------------------------------------------------------
    95     }
   108 //
    96 
   109 EXPORT_C HBufC * StringLoader::LoadL( 
    97 
   110         TInt aResourceId,
    98 // -----------------------------------------------------------------------------
   111         const TDesC & aString,
    99 // StringLoader::LoadL
   112         CCoeEnv * aLoaderEnv )
   100 // -----------------------------------------------------------------------------
   113     {
   101 //
   114     Q_UNUSED (aLoaderEnv);
   102 EXPORT_C HBufC * StringLoader::LoadL( 
   115     HBufC *buf;
   103         TInt aResourceId,
   116     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId, &aString);
   104         const CArrayFix<TInt> & aInts,
   117     if (map.contains (PhoneAction::Text)) {
   105         CCoeEnv * aLoaderEnv )
   118         PhoneAction *text = map [PhoneAction::Text];
   106     {
   119         buf = HBufC::NewL (text->text ().size ());
   107     HBufC *buf = LoadLC(aResourceId, aInts, aLoaderEnv);
   120         *buf = text->text ().utf16 ();
   108     CleanupStack::Pop(buf);
   121         delete text;
   109     return buf;
   122     } else {
   110     }
   123         // TODO: this else branch MUST be removed after all strings are localized!
   111 
   124         //       now here only to prevent crashing
   112 
   125         buf = HBufC::New (1);
   113 // -----------------------------------------------------------------------------
   126     }
   114 // StringLoader::LoadL
   127     return buf;
   115 // -----------------------------------------------------------------------------
   128     }
   116 //
   129 
   117 EXPORT_C HBufC * StringLoader::LoadL( 
   130 
   118         TInt aResourceId,
   131 // -----------------------------------------------------------------------------
   119         const MDesCArray & aStrings,
   132 // StringLoader::LoadL
   120         CCoeEnv * aLoaderEnv )
   133 // -----------------------------------------------------------------------------
   121     {
   134 //
   122     HBufC *buf = LoadLC(aResourceId, aStrings, aLoaderEnv);
   135 EXPORT_C HBufC * StringLoader::LoadL( 
   123     CleanupStack::Pop(buf);
   136         TInt aResourceId,
   124     return buf;
   137         const TDesC & aString,
   125     }
   138         TInt aInt,
   126 
   139         CCoeEnv * aLoaderEnv )
   127 
   140     {
   128 // -----------------------------------------------------------------------------
   141     Q_UNUSED (aLoaderEnv);
   129 // StringLoader::LoadL
   142     HBufC *buf;
   130 // -----------------------------------------------------------------------------
   143     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId, &aString, aInt);
   131 //
   144     if (map.contains (PhoneAction::Text)) {
   132 EXPORT_C HBufC * StringLoader::LoadL( 
   145         PhoneAction *text = map [PhoneAction::Text];
   133         TInt aResourceId,
   146         buf = HBufC::NewL (text->text ().size ());
   134         const MDesCArray & aStrings,
   147         *buf = text->text ().utf16 ();
   135         const CArrayFix<TInt> & aInts,
   148         delete text;
   136         CCoeEnv * aLoaderEnv )
   149     } else {
   137     {
   150         // TODO: this else branch MUST be removed after all strings are localized!
   138     HBufC *buf = LoadLC(aResourceId, aStrings, aInts, aLoaderEnv);
   151         //       now here only to prevent crashing
   139     CleanupStack::Pop(buf);
   152         buf = HBufC::New (1);
   140     return buf;
   153     }
   141     }
   154     return buf;
   142 
   155     }
   143 
   156 
   144 // -----------------------------------------------------------------------------
   157 
   145 // StringLoader::LoadLC
   158 // -----------------------------------------------------------------------------
   146 // -----------------------------------------------------------------------------
   159 // StringLoader::LoadL
   147 //
   160 // -----------------------------------------------------------------------------
   148 EXPORT_C HBufC * StringLoader::LoadLC( 
   161 //
   149         TInt aResourceId,
   162 EXPORT_C HBufC * StringLoader::LoadL( 
   150         CCoeEnv * aLoaderEnv )
   163         TInt aResourceId,
   151     {
   164         const CArrayFix<TInt> & aInts,
   152     Q_UNUSED (aLoaderEnv);
   165         CCoeEnv * aLoaderEnv )
   153     HBufC *buf;
   166     {
   154     QString text = PhoneResourceAdapter::Instance()->convert(aResourceId);
   167     Q_UNUSED (aLoaderEnv);
   155     buf = HBufC::NewLC(text.size());
   168     HBufC *buf;
   156     *buf = text.utf16();
   169     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId, &aInts);
   157     return buf;
   170     if (map.contains (PhoneAction::Text)) {
   158     }
   171         PhoneAction *text = map [PhoneAction::Text];
   159 
   172         buf = HBufC::NewL (text->text ().size ());
   160 
   173         *buf = text->text ().utf16 ();
   161 // -----------------------------------------------------------------------------
   174         delete text;
   162 // StringLoader::LoadLC
   175     } else {
   163 // -----------------------------------------------------------------------------
   176         // TODO: this else branch MUST be removed after all strings are localized!
   164 //
   177         //       now here only to prevent crashing
   165 EXPORT_C HBufC * StringLoader::LoadLC( 
   178         buf = HBufC::New (1);
   166         TInt aResourceId,
   179     }
   167         TInt aInt,
   180     return buf;
   168         CCoeEnv * aLoaderEnv )
   181     }
   169     {
   182 
   170     Q_UNUSED (aLoaderEnv);
   183 
   171     HBufC *buf;
   184 // -----------------------------------------------------------------------------
   172     QString text = PhoneResourceAdapter::Instance()->convert(aResourceId, aInt);
   185 // StringLoader::LoadL
   173     buf = HBufC::NewLC(text.size());
   186 // -----------------------------------------------------------------------------
   174     *buf = text.utf16();
   187 //
   175     return buf;
   188 EXPORT_C HBufC * StringLoader::LoadL( 
   176     }
   189         TInt aResourceId,
   177 
   190         const MDesCArray & aStrings,
   178 
   191         CCoeEnv * aLoaderEnv )
   179 // -----------------------------------------------------------------------------
   192     {
   180 // StringLoader::LoadLC
   193     Q_UNUSED (aLoaderEnv);
   181 // -----------------------------------------------------------------------------
   194     HBufC *buf;
   182 //
   195     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId, &aStrings);
   183 EXPORT_C HBufC * StringLoader::LoadLC( 
   196     if (map.contains (PhoneAction::Text)) {
   184         TInt aResourceId,
   197         PhoneAction *text = map [PhoneAction::Text];
   185         const TDesC & aString,
   198         buf = HBufC::NewL (text->text ().size ());
   186         CCoeEnv * aLoaderEnv )
   199         *buf = text->text ().utf16 ();
   187     {
   200         delete text;
   188     Q_UNUSED (aLoaderEnv);
   201     } else {
   189     HBufC *buf;
   202         // TODO: this else branch MUST be removed after all strings are localized!
   190     QString text = PhoneResourceAdapter::Instance()->convert(aResourceId, &aString);
   203         //       now here only to prevent crashing
   191     buf = HBufC::NewLC(text.size());
   204         buf = HBufC::New (1);
   192     *buf = text.utf16();
   205     }
   193     return buf;
   206     return buf;
   194     }
   207     }
   195 
   208 
   196 
   209 
   197 // -----------------------------------------------------------------------------
   210 // -----------------------------------------------------------------------------
   198 // StringLoader::LoadLC
   211 // StringLoader::LoadL
   199 // -----------------------------------------------------------------------------
   212 // -----------------------------------------------------------------------------
   200 //
   213 //
   201 EXPORT_C HBufC * StringLoader::LoadLC( 
   214 EXPORT_C HBufC * StringLoader::LoadL( 
   202         TInt aResourceId,
   215         TInt aResourceId,
   203         const TDesC & aString,
   216         const MDesCArray & aStrings,
   204         TInt aInt,
   217         const CArrayFix<TInt> & aInts,
   205         CCoeEnv * aLoaderEnv )
   218         CCoeEnv * aLoaderEnv )
   206     {
   219     {
   207     Q_UNUSED (aLoaderEnv);
   220     Q_UNUSED (aLoaderEnv);
   208     HBufC *buf;
   221     HBufC *buf;
   209     QString text = PhoneResourceAdapter::Instance()->convert(aResourceId, &aString, aInt);
   222     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId, &aStrings, &aInts);
   210     buf = HBufC::NewLC(text.size());
   223     if (map.contains (PhoneAction::Text)) {
   211     *buf = text.utf16();
   224         PhoneAction *text = map [PhoneAction::Text];
   212     return buf;
   225         buf = HBufC::NewL (text->text ().size ());
   213     }
   226         *buf = text->text ().utf16 ();
   214 
   227         delete text;
   215 
   228     } else {
   216 
   229         // TODO: this else branch MUST be removed after all strings are localized!
   217 // -----------------------------------------------------------------------------
   230         //       now here only to prevent crashing
   218 // StringLoader::LoadLC
   231         buf = HBufC::New (1);
   219 // -----------------------------------------------------------------------------
   232     }
   220 //
   233     return buf;
   221 EXPORT_C HBufC * StringLoader::LoadLC( 
   234     }
   222         TInt aResourceId,
   235 
   223         const CArrayFix<TInt> & aInts,
   236 
   224         CCoeEnv * aLoaderEnv )
   237 // -----------------------------------------------------------------------------
   225     {
   238 // StringLoader::LoadLC
   226     Q_UNUSED (aLoaderEnv);
   239 // -----------------------------------------------------------------------------
   227     HBufC *buf;
   240 //
   228     QString text = PhoneResourceAdapter::Instance()->convert(aResourceId, &aInts);
   241 EXPORT_C HBufC * StringLoader::LoadLC( 
   229     buf = HBufC::NewLC(text.size());
   242         TInt aResourceId,
   230     *buf = text.utf16();
   243         CCoeEnv * aLoaderEnv )
   231     return buf;
   244     {
   232     }
   245     Q_UNUSED (aLoaderEnv);
   233 
   246     HBufC *buf;
   234 
   247     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId);
   235 // -----------------------------------------------------------------------------
   248     if (map.contains (PhoneAction::Text)) {
   236 // StringLoader::LoadLC
   249         PhoneAction *text = map [PhoneAction::Text];
   237 // -----------------------------------------------------------------------------
   250         buf = HBufC::NewLC (text->text ().size ());
   238 //
   251         *buf = text->text ().utf16 ();
   239 EXPORT_C HBufC * StringLoader::LoadLC( 
   252         delete text;
   240         TInt aResourceId,
   253     } else {
   241         const MDesCArray & aStrings,
   254         // TODO: this else branch MUST be removed after all strings are localized!
   242         CCoeEnv * aLoaderEnv )
   255         //       now here only to prevent crashing
   243     {
   256         buf = HBufC::NewLC (1);
   244     Q_UNUSED (aLoaderEnv);
   257     }
   245     HBufC *buf;
   258     return buf;
   246     QString text = PhoneResourceAdapter::Instance()->convert(aResourceId, &aStrings);
   259     }
   247     buf = HBufC::NewLC(text.size());
   260 
   248     *buf = text.utf16();
   261 
   249     return buf;
   262 // -----------------------------------------------------------------------------
   250     }
   263 // StringLoader::LoadLC
   251 
   264 // -----------------------------------------------------------------------------
   252 
   265 //
   253 // -----------------------------------------------------------------------------
   266 EXPORT_C HBufC * StringLoader::LoadLC( 
   254 // StringLoader::LoadLC
   267         TInt aResourceId,
   255 // -----------------------------------------------------------------------------
   268         TInt aInt,
   256 //
   269         CCoeEnv * aLoaderEnv )
   257 EXPORT_C HBufC * StringLoader::LoadLC( 
   270     {
   258         TInt aResourceId,
   271     Q_UNUSED (aLoaderEnv);
   259         const MDesCArray & aStrings,
   272     HBufC *buf;
   260         const CArrayFix<TInt> & aInts,
   273     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId, aInt);
   261         CCoeEnv * aLoaderEnv )
   274     if (map.contains (PhoneAction::Text)) {
   262     {
   275         PhoneAction *text = map [PhoneAction::Text];
   263     Q_UNUSED (aLoaderEnv);
   276         buf = HBufC::NewLC (text->text ().size ());
   264     HBufC *buf;
   277         *buf = text->text ().utf16 ();
   265     QString text = PhoneResourceAdapter::Instance()->convert(aResourceId, &aStrings, &aInts);
   278         delete text;
   266     buf = HBufC::NewLC(text.size());
   279     } else {
   267     *buf = text.utf16();
   280         // TODO: this else branch MUST be removed after all strings are localized!
   268     return buf;
   281         //       now here only to prevent crashing
   269     }
   282         buf = HBufC::NewLC (1);
       
   283     }
       
   284     return buf;
       
   285     }
       
   286 
       
   287 
       
   288 // -----------------------------------------------------------------------------
       
   289 // StringLoader::LoadLC
       
   290 // -----------------------------------------------------------------------------
       
   291 //
       
   292 EXPORT_C HBufC * StringLoader::LoadLC( 
       
   293         TInt aResourceId,
       
   294         const TDesC & aString,
       
   295         CCoeEnv * aLoaderEnv )
       
   296     {
       
   297     Q_UNUSED (aLoaderEnv);
       
   298     HBufC *buf;
       
   299     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId, &aString);
       
   300     if (map.contains (PhoneAction::Text)) {
       
   301         PhoneAction *text = map [PhoneAction::Text];
       
   302         buf = HBufC::NewLC (text->text ().size ());
       
   303         *buf = text->text ().utf16 ();
       
   304         delete text;
       
   305     } else {
       
   306         // TODO: this else branch MUST be removed after all strings are localized!
       
   307         //       now here only to prevent crashing
       
   308         buf = HBufC::NewLC (1);
       
   309     }
       
   310     return buf;
       
   311     }
       
   312 
       
   313 
       
   314 // -----------------------------------------------------------------------------
       
   315 // StringLoader::LoadLC
       
   316 // -----------------------------------------------------------------------------
       
   317 //
       
   318 EXPORT_C HBufC * StringLoader::LoadLC( 
       
   319         TInt aResourceId,
       
   320         const TDesC & aString,
       
   321         TInt aInt,
       
   322         CCoeEnv * aLoaderEnv )
       
   323     {
       
   324     Q_UNUSED (aLoaderEnv);
       
   325     HBufC *buf;
       
   326     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId, &aString, aInt);
       
   327     if (map.contains (PhoneAction::Text)) {
       
   328         PhoneAction *text = map [PhoneAction::Text];
       
   329         buf = HBufC::NewLC (text->text ().size ());
       
   330         *buf = text->text ().utf16 ();
       
   331         delete text;
       
   332     } else {
       
   333         // TODO: this else branch MUST be removed after all strings are localized!
       
   334         //       now here only to prevent crashing
       
   335         buf = HBufC::NewLC (1);
       
   336     }
       
   337     return buf;
       
   338     }
       
   339 
       
   340 
       
   341 
       
   342 // -----------------------------------------------------------------------------
       
   343 // StringLoader::LoadLC
       
   344 // -----------------------------------------------------------------------------
       
   345 //
       
   346 EXPORT_C HBufC * StringLoader::LoadLC( 
       
   347         TInt aResourceId,
       
   348         const CArrayFix<TInt> & aInts,
       
   349         CCoeEnv * aLoaderEnv )
       
   350     {
       
   351     Q_UNUSED (aLoaderEnv);
       
   352     HBufC *buf;
       
   353     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId, &aInts);
       
   354     if (map.contains (PhoneAction::Text)) {
       
   355         PhoneAction *text = map [PhoneAction::Text];
       
   356         buf = HBufC::NewLC (text->text ().size ());
       
   357         *buf = text->text ().utf16 ();
       
   358         delete text;
       
   359     } else {
       
   360         // TODO: this else branch MUST be removed after all strings are localized!
       
   361         //       now here only to prevent crashing
       
   362         buf = HBufC::NewLC (1);
       
   363     }
       
   364     return buf;
       
   365     }
       
   366 
       
   367 
       
   368 // -----------------------------------------------------------------------------
       
   369 // StringLoader::LoadLC
       
   370 // -----------------------------------------------------------------------------
       
   371 //
       
   372 EXPORT_C HBufC * StringLoader::LoadLC( 
       
   373         TInt aResourceId,
       
   374         const MDesCArray & aStrings,
       
   375         CCoeEnv * aLoaderEnv )
       
   376     {
       
   377     Q_UNUSED (aLoaderEnv);
       
   378     HBufC *buf;
       
   379     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId, &aStrings);
       
   380     if (map.contains (PhoneAction::Text)) {
       
   381         PhoneAction *text = map [PhoneAction::Text];
       
   382         buf = HBufC::NewLC (text->text ().size ());
       
   383         *buf = text->text ().utf16 ();
       
   384         delete text;
       
   385     } else {
       
   386         // TODO: this else branch MUST be removed after all strings are localized!
       
   387         //       now here only to prevent crashing
       
   388         buf = HBufC::NewLC (1);
       
   389     }
       
   390     return buf;
       
   391     }
       
   392 
       
   393 
       
   394 // -----------------------------------------------------------------------------
       
   395 // StringLoader::LoadLC
       
   396 // -----------------------------------------------------------------------------
       
   397 //
       
   398 EXPORT_C HBufC * StringLoader::LoadLC( 
       
   399         TInt aResourceId,
       
   400         const MDesCArray & aStrings,
       
   401         const CArrayFix<TInt> & aInts,
       
   402         CCoeEnv * aLoaderEnv )
       
   403     {
       
   404     Q_UNUSED (aLoaderEnv);
       
   405     HBufC *buf;
       
   406     QMap<PhoneAction::ActionType, PhoneAction *> map = PhoneResourceAdapter::Instance ()->convert (aResourceId, &aStrings, &aInts);
       
   407     if (map.contains (PhoneAction::Text)) {
       
   408         PhoneAction *text = map [PhoneAction::Text];
       
   409         buf = HBufC::NewLC (text->text ().size ());
       
   410         *buf = text->text ().utf16 ();
       
   411         delete text;
       
   412     } else {
       
   413         // TODO: this else branch MUST be removed after all strings are localized!
       
   414         //       now here only to prevent crashing
       
   415         buf = HBufC::NewLC (1);
       
   416     }
       
   417     return buf;
       
   418     }