omads/omadsappui/AspSyncUtil/src/AspResHandler.cpp
branchRCL_3
changeset 67 2abf74df9cdc
parent 52 4f0867e42d62
equal deleted inserted replaced
61:57a9de0b82e8 67:2abf74df9cdc
   225 	TParse parse;
   225 	TParse parse;
   226 	parse.Set(KBitmapFileName, &KDC_APP_BITMAP_DIR, NULL);
   226 	parse.Set(KBitmapFileName, &KDC_APP_BITMAP_DIR, NULL);
   227 	TUtil::StrCopy(aText, parse.FullName());
   227 	TUtil::StrCopy(aText, parse.FullName());
   228 	}
   228 	}
   229 
   229 
   230 /* Implementation of CMCC PIM v3 begins*/
       
   231 // -----------------------------------------------------------------------------
       
   232 // CAspResHandler::ReadProgressTextLC
       
   233 //
       
   234 // -----------------------------------------------------------------------------
       
   235 //
       
   236 HBufC* CAspResHandler::ReadProgressTextLC(const TDesC& aContent, TInt aCurrent, TInt aFinal, TInt aPhase)
       
   237     {
       
   238     HBufC* hBuf = NULL;
       
   239     
       
   240     TBool isCalendar = EFalse;
       
   241     HBufC* content = ReadLC(R_ASP_CONTENT_NAME_CALENDAR);
       
   242     if ( !content->Compare(aContent) )
       
   243         {
       
   244         isCalendar = ETrue;
       
   245         }
       
   246     CleanupStack::PopAndDestroy(content); //content
       
   247     
       
   248     if (aPhase == CAspState::EPhaseSending)
       
   249         {
       
   250         if (isCalendar)
       
   251             {
       
   252             hBuf = ReadProgressTextLC(R_QTN_SML_SYNC_SENDING_XOFY_CAL, aCurrent, aFinal, aContent);
       
   253             }
       
   254         else
       
   255             {
       
   256             hBuf = ReadProgressTextLC(R_QTN_SML_SYNC_SENDING_XOFY, aCurrent, aFinal, aContent);
       
   257             }
       
   258         }
       
   259     else if (aPhase == CAspState::EPhaseReceiving)
       
   260         {
       
   261         if (isCalendar)
       
   262             {
       
   263             hBuf = ReadProgressTextLC(R_QTN_SML_SYNC_RECEIVING_XOFY_CAL, aCurrent, aFinal, aContent);
       
   264             }
       
   265         else
       
   266             {
       
   267             hBuf = ReadProgressTextLC(R_QTN_SML_SYNC_RECEIVING_XOFY, aCurrent, aFinal, aContent);
       
   268             }
       
   269         }
       
   270     else
       
   271         {
       
   272         hBuf = HBufC::NewLC(0);  // empty string
       
   273         }
       
   274 
       
   275     return hBuf;
       
   276     }
       
   277 /* Implementation of CMCC PIM v3 ends*/
       
   278 
   230 
   279 // -----------------------------------------------------------------------------
   231 // -----------------------------------------------------------------------------
   280 // CAspResHandler::ReadProgressTextL
   232 // CAspResHandler::ReadProgressTextL
   281 //
   233 //
   282 // -----------------------------------------------------------------------------
   234 // -----------------------------------------------------------------------------
   334     //HBufC* hBuf = StringLoader::LoadLC(aResourceId, aContent);
   286     //HBufC* hBuf = StringLoader::LoadLC(aResourceId, aContent);
   335    
   287    
   336     return hBuf;
   288     return hBuf;
   337 	}
   289 	}
   338 
   290 
   339 /* Implementation of CMCC PIM v3 begins*/
       
   340 // -----------------------------------------------------------------------------
       
   341 // CAspResHandler::ReadProgressTextL
       
   342 //
       
   343 // Function constructs progress dialog text that is shown with progress bar.
       
   344 // Text format is one of the following:
       
   345 // "Sending %0N of %1N %U"
       
   346 // "Receiving %0U: %0N"
       
   347 // -----------------------------------------------------------------------------
       
   348 //
       
   349 HBufC* CAspResHandler::ReadProgressTextLC(TInt aResourceId, TInt aCurrent, TInt aFinal, const TDesC& aContent)
       
   350     {
       
   351     
       
   352     if (aResourceId != iProgressTextFormatId)
       
   353         {
       
   354         delete iProgressTextFormat;
       
   355         iProgressTextFormat = NULL;
       
   356         iProgressTextFormat = StringLoader::LoadL(aResourceId, iEikEnv);
       
   357         iProgressTextFormatId = aResourceId;
       
   358         }
       
   359     
       
   360     TInt len = iProgressTextFormat->Length() + aContent.Length();// + 8;
       
   361     
       
   362     HBufC* hBuf = HBufC::NewLC(len);
       
   363     TPtr ptr = hBuf->Des();
       
   364 
       
   365     HBufC* temp = HBufC::NewLC(len);
       
   366     TPtr tempPtr = temp->Des();
       
   367     
       
   368     if (iProgressTextFormatId == R_QTN_SML_SYNC_RECEIVING_XOFY || iProgressTextFormatId == R_QTN_SML_SYNC_RECEIVING_XOFY_CAL)
       
   369         {
       
   370         // replace %0N with current item
       
   371         StringLoader::Format(tempPtr, iProgressTextFormat->Des(), 0, aCurrent);
       
   372         }
       
   373     else
       
   374         {
       
   375         // replace %0N with current item
       
   376         StringLoader::Format(ptr, iProgressTextFormat->Des(), 0, aCurrent);
       
   377         // replace %1N with total items
       
   378         StringLoader::Format(tempPtr, ptr, 1, aFinal);
       
   379         }
       
   380     if (iProgressTextFormatId == R_QTN_SML_SYNC_RECEIVING_XOFY_CAL || iProgressTextFormatId == R_QTN_SML_SYNC_SENDING_XOFY_CAL)
       
   381         {
       
   382         ptr.Copy(tempPtr);
       
   383         }
       
   384     else
       
   385         {
       
   386         // replace  %0U with content name (eg "Contacts")
       
   387         StringLoader::Format(ptr, tempPtr, 0, aContent);
       
   388         }
       
   389     CleanupStack::PopAndDestroy(temp); //temp
       
   390     
       
   391     return hBuf;
       
   392     }
       
   393 /* Implementation of CMCC PIM v3 ends*/
       
   394 
   291 
   395 // -----------------------------------------------------------------------------
   292 // -----------------------------------------------------------------------------
   396 // CAspResHandler::ReadProfileInfoTextLC
   293 // CAspResHandler::ReadProfileInfoTextLC
   397 //
   294 //
   398 // Text format: 
   295 // Text format: