omads/omadsappui/AspSyncUtil/inc/AspResHandler.h
branchRCL_3
changeset 24 8e7494275d3a
parent 23 2bb96f4ecad8
child 25 4f0867e42d62
equal deleted inserted replaced
23:2bb96f4ecad8 24:8e7494275d3a
     1 /*
       
     2 * Copyright (c) 2005 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: Utility methods to handle resources 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef ASPRESHANDLER_H
       
    20 #define ASPRESHANDLER_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <eikenv.h>
       
    26 #include <aknenv.h>
       
    27 #include <StringLoader.h>
       
    28 
       
    29 #include "AspDefines.h"
       
    30 #include <AspSyncUtil.rsg>
       
    31 
       
    32 
       
    33 
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 
       
    38 
       
    39 /**
       
    40 * CAspResHandler
       
    41 *
       
    42 * This class is used for reading aspsyncutil resources.
       
    43 */
       
    44 NONSHARABLE_CLASS (CAspResHandler) : public CBase
       
    45     {
       
    46     public:
       
    47         /**
       
    48         * Two-phased constructor.
       
    49         */
       
    50         static CAspResHandler* NewL();
       
    51 
       
    52 	    /**
       
    53         * Destructor.
       
    54         */
       
    55         ~CAspResHandler();
       
    56 
       
    57     private:
       
    58         /**
       
    59         * C++ default constructor.
       
    60         */
       
    61 	    CAspResHandler();
       
    62 
       
    63         /**
       
    64         * By default Symbian 2nd phase constructor is private.
       
    65         */
       
    66 	    void ConstructL();
       
    67 
       
    68 	
       
    69     public:
       
    70 	   /**
       
    71         * Finds out aspsyncutil resource file name.
       
    72         * @param aText.
       
    73 		* @return None.
       
    74         */
       
    75         static void GetResFileName(TDes& aText);
       
    76 
       
    77 	   /**
       
    78         * Finds out aspsyncutil bitmap file name.
       
    79         * @param aText.
       
    80 		* @return None.
       
    81         */
       
    82         static void GetBitmapFileName(TDes& aText);
       
    83         
       
    84 	   /**
       
    85         * Reads string from resource file.
       
    86         * @param aText Text read from resource file.
       
    87 		* @param aResourceId Resource id.
       
    88 		* @return None.
       
    89         */
       
    90 		static void ReadL(TDes& aText, TInt aResourceId);
       
    91 
       
    92 	   /**
       
    93         * Reads string from resource file.
       
    94         * @param aText Text read from resource file.
       
    95 		* @param aResourceId Resource id.
       
    96 		* @param aSubString Substring that is added into read resource.
       
    97 		* @return None.
       
    98         */
       
    99 		static void ReadL(TDes& aText, TInt aResourceId, const TDesC& aSubString);
       
   100 
       
   101 	   /**
       
   102         * Reads string from resource file.
       
   103     	* @param aResourceId Resource id.
       
   104 		* @return Text read from resource file.
       
   105         */
       
   106 		static HBufC* ReadLC(TInt aResourceId);
       
   107 
       
   108 	   /**
       
   109         * Reads string from resource file.
       
   110     	* @param aResourceId Resource id.
       
   111 		* @return Text read from resource file.
       
   112         */
       
   113 		static HBufC* ReadL(TInt aResourceId);
       
   114 
       
   115 	   /**
       
   116         * Reads string from resource file.
       
   117 		* @param aResourceId Resource id.
       
   118 		* @param aSubString Substring that is added into read resource.
       
   119 		* @return Text read from resource file.
       
   120         */
       
   121 		static HBufC* ReadLC(TInt aResourceId, const TDesC& aSubString);
       
   122 
       
   123 	   /**
       
   124         * Reads string from resource file.
       
   125 		* @param aResourceId Resource id.
       
   126 		* @param aNumber Number that is added into read resource.
       
   127 		* @return Text read from resource file.
       
   128         */
       
   129 		static HBufC* ReadLC(TInt aResourceId, TInt aNumber);
       
   130 		
       
   131 	   /**
       
   132         * Reads array of strings from resource file.
       
   133     	* @param aResourceId Resource id.
       
   134 		* @return String array.
       
   135         */
       
   136 		CDesCArrayFlat* ReadDesArrayLC(TInt aResourceId);
       
   137 
       
   138 	   /**
       
   139         * Reads array of strings from resource file.
       
   140     	* @param aResourceId Resource id.
       
   141 		* @return String array.
       
   142         */
       
   143 		CDesCArrayFlat* ReadDesArrayL(TInt aResourceId);
       
   144 
       
   145 	   /**
       
   146         * Reads array of strings from resource file.
       
   147     	* @param aResourceId Resource id.
       
   148 		* @return String array.
       
   149         */
       
   150 		static CDesCArrayFlat* ReadDesArrayStaticLC(TInt aResourceId);
       
   151 
       
   152 		/* Implementation of CMCC PIM v3 begins*/ 
       
   153 	   /**
       
   154         * Reads progress dialog progress text from resource file.
       
   155 		* @param aContent Content name.
       
   156 		* @param aCurrent Currently processed sync item.
       
   157     	* @param aFinal Number of sync items.
       
   158 		* @param aPhase Phase of synchronization.
       
   159 		* @return Progress text.
       
   160         */
       
   161 		HBufC* ReadProgressTextLC(const TDesC& aContent, TInt aCurrent, TInt aFinal, TInt aPhase);
       
   162 		/* Implementation of CMCC PIM v3 ends*/
       
   163 		
       
   164 	   /**
       
   165         * Reads progress dialog progress text from resource file.
       
   166 		* @param aContent.
       
   167 		* @param aPhase.
       
   168 		* @return Progress text.
       
   169         */
       
   170 		HBufC* ReadProgressTextLC(const TDesC& aContent, TInt aPhase);
       
   171 		
       
   172 	   /**
       
   173         * Reads progress dialog progress text from resource file.
       
   174         * Buffers the last aResource to minimize file operations.
       
   175         * @param aResourceId Resource id.
       
   176 		* @param aContent Content name.
       
   177 		* @return Progress text.
       
   178         */
       
   179 		HBufC* ReadProgressTextLC(TInt aResourceId, const TDesC& aContent);
       
   180 
       
   181 		/* Implementation of CMCC PIM v3 begins*/ 
       
   182 	   /**
       
   183 	    * Reads progress dialog progress text from resource file.
       
   184 	    * Buffers the last aResource to minimize file operations.
       
   185 	    * @param aResourceId Resource id.
       
   186 	    * @param aCurrent Currently processed sync item.
       
   187         * @param aFinal Number of sync items.
       
   188         * @param aContent Content name.
       
   189 	    * @return Progress text.
       
   190 	    */
       
   191 		HBufC* ReadProgressTextLC(TInt aResourceId, TInt aCurrent, TInt aFinal, const TDesC& aContent);
       
   192 		/* Implementation of CMCC PIM v3 ends*/
       
   193 		
       
   194 	   /**
       
   195         * Reads default profile name from resource file.
       
   196 		* @param aIndex Number that is added to proile name (eg. "New Profile(1)").
       
   197 		* @param aApplicationId.
       
   198 		* @return Profile name.
       
   199         */
       
   200 		static HBufC* GetNewProfileNameLC(TInt aIndex, TInt aApplicationId);
       
   201 		
       
   202 	   /**
       
   203         * Reads sync content name.
       
   204 		* @param aDataProviderId.
       
   205 		* @param aDefaultText.
       
   206 		* @return Content name.
       
   207         */
       
   208 		static HBufC* GetContentNameLC(TInt aDataProviderId, const TDesC& aDefaultText);
       
   209 		
       
   210 	   /**
       
   211         * Reads sync content title.
       
   212 		* @param aDataProviderId.
       
   213 		* @param aDefaultText.
       
   214 		* @return Content title.
       
   215         */
       
   216 		static HBufC* GetContentTitleLC(TInt aDataProviderId, const TDesC& aDefaultText);
       
   217 
       
   218 	   /**
       
   219         * Reads sync content setting text.
       
   220 		* @param aDataProviderId.
       
   221 		* @param aDefaultText.
       
   222 		* @return Content title.
       
   223         */
       
   224 		static HBufC* GetContentSettingLC(TInt aDataProviderId, const TDesC& aDefaultText);
       
   225 		
       
   226 	   /**
       
   227         * Reads remote database setting header rersource id.
       
   228 		* @param aDataProviderId.
       
   229 		* @return Resource id.
       
   230         */
       
   231 		static TInt RemoteDatabaseHeaderId(TInt aDataProviderId);
       
   232 		
       
   233 	   /**
       
   234         * Reads profile info text.
       
   235 		* @param aProfile.
       
   236 		* @param aBearer.
       
   237 		* @return Profile info text.
       
   238         */
       
   239 		static HBufC* ReadProfileInfoTextLC(const TDesC& aProfile, const TDesC& aBearer);
       
   240 
       
   241 	   /**
       
   242         * Reads profile info text.
       
   243 		* @param aProfile.
       
   244 		* @param aBearer.
       
   245 		* @param aHours.
       
   246 		* @param aMinutes.
       
   247 		* @return Profile info text.
       
   248         */
       
   249 		static HBufC* ReadProfileInfoTextLC(const TDesC& aProfile, const TDesC& aBearer,
       
   250 		                                    TInt aHours, TInt aMinutes);
       
   251 
       
   252 		  /**
       
   253         * Reads profile info text.
       
   254 		* @param aProfile.
       
   255 		* @param aTime.
       
   256 			*/
       
   257 		static HBufC* ReadAutoSyncInfoTextLC(const TDesC& aProfile, TTime aTIme);
       
   258 		
       
   259     private:
       
   260 		//  sync app resource file id
       
   261 		TInt iResId;
       
   262 
       
   263 		// pointer to CEikonEnv
       
   264 		CEikonEnv* iEikEnv;
       
   265 
       
   266 		// progress text format (from resource file)
       
   267 		HBufC* iProgressTextFormat;
       
   268 		
       
   269 		// progress text format id
       
   270 		TInt iProgressTextFormatId;
       
   271     };
       
   272 
       
   273 
       
   274 
       
   275 #endif  // ASPRESHANDLER_H