wvuing/ImUtils/Inc/IMUtils.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2006 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:  General utitity services for IM UI
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef IMUTILS_H
       
    21 #define IMUTILS_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include    <badesca.h>
       
    25 #include    "impsbuilddefinitions.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CEikMenuPane;
       
    29 class CGulIcon;
       
    30 // The settings can be in Cenrep/Resource file, we need
       
    31 // to have an instance of CRepository Class
       
    32 class CRepository;
       
    33 
       
    34 
       
    35 // CLASS DECLARATION
       
    36 // 401-1815 Ease of Instant Messaging branding
       
    37 // Code added for the above requirment
       
    38 
       
    39 /**
       
    40 * IM Utils internal implementation.
       
    41 * This object is stored in TLS.
       
    42 *
       
    43 * @lib imutilsng.lib
       
    44 * @since -
       
    45 */
       
    46 
       
    47 class CIMUtilsTlsData : public CBase
       
    48     {
       
    49 
       
    50 
       
    51     private:
       
    52         /**
       
    53          * 401-1815 Ease of Instant Messaging branding
       
    54          * Code added for the above requirment
       
    55          *Default Constructor
       
    56          */
       
    57         CIMUtilsTlsData();
       
    58 
       
    59         /**
       
    60         * Symbian 2nd phase constructor can leave.
       
    61         */
       
    62         void ConstructL();
       
    63 
       
    64 
       
    65     public:  // Constructors and destructor
       
    66 
       
    67         /**
       
    68         * Code added for the above requirment
       
    69 
       
    70         * Two-phased constructor.
       
    71         * NewL
       
    72         */
       
    73         static CIMUtilsTlsData* NewL();
       
    74 
       
    75         /**
       
    76         * Code added for the above requirment
       
    77         * Destructor.
       
    78         */
       
    79         virtual ~CIMUtilsTlsData();
       
    80 
       
    81 
       
    82         /**
       
    83         * Returns the CRepository instance
       
    84         * @retrun CRepository - Returns reference of CRep
       
    85         */
       
    86         CRepository& RepositoryInstance() ;
       
    87 
       
    88     private:
       
    89 
       
    90         //Instance that holds the iRepository
       
    91         CRepository *iRepository;
       
    92     };
       
    93 // End of code 401-1815 Ease of Instant Messaging branding
       
    94 
       
    95 
       
    96 
       
    97 /**
       
    98  *  General utitity services for IM UI
       
    99  *
       
   100  *  @lib imutilsng.lib
       
   101  *  @since
       
   102  */
       
   103 class IMUtils
       
   104     {
       
   105     public:
       
   106         enum TIgnoreOfflineStatus
       
   107             {
       
   108             EVariationDoesNotAllow = -3, // -2 equals to EAknSoftkeyOk constant,
       
   109             // that's why -3 is used here
       
   110             EUserCanceled = -1,
       
   111             EIgnoredByUser = 1,
       
   112             EContactOnline = 2
       
   113             };
       
   114     public:
       
   115 
       
   116         /**
       
   117          * Formats then given raw online-list to be compatible with list query
       
   118          * dialogs
       
   119          * @param aRawOnlineList Raw data (source)
       
   120          * @param aFormattedOnlineList Formatted data (target)
       
   121          */
       
   122         IMPORT_C static void PopulateFormattedOnlineListL(
       
   123             const MDesCArray& aRawOnlineList,
       
   124             CDesCArray& aFormattedOnlineList );
       
   125 
       
   126         /**
       
   127          * Globally used help launcher method.
       
   128          * @param aContext The help context
       
   129          */
       
   130         IMPORT_C static void LaunchHelpL( const TDesC& aContext );
       
   131 
       
   132         /**
       
   133          * Gets Chat login value from shared data
       
   134          * @return chat login type value in wvsettings shared data
       
   135          */
       
   136         IMPORT_C static TInt WVSettingsChatLoginValue();
       
   137 
       
   138         /**
       
   139          * Find if user is on userlist using NeutralCompare
       
   140          * @param aUserList list of wvid's
       
   141          * @param aUserId   user id to find
       
   142          * @return position of founding, KErrNotFound if not found
       
   143          */
       
   144         IMPORT_C static TInt NeutralFind( const MDesCArray& aUserList, const TDesC& aUserId );
       
   145 
       
   146         /**
       
   147          * 401-1815 Ease of Instant Messaging branding
       
   148          * Code added for the above requirment
       
   149          * Reads integer resource value from resources from Cenrep / Resource file
       
   150          * This function should be used if the caller is not sure if the setting
       
   151          * requested for is in cenrep/resource file.
       
   152          * @param aResourceId resource id which is read
       
   153          * @return value of wanted integer resource flag
       
   154          */
       
   155         IMPORT_C static TInt IntResourceValueL( TInt aResourceId );
       
   156 
       
   157 
       
   158         /**
       
   159          * 401-1815 Ease of Instant Messaging branding
       
   160          * Code added for the above requirment
       
   161          * Reads integer resource value only from resource file.
       
   162          * This function should be used only if the caller is sure that
       
   163          * the resource is present only in Resource file and not in Cenrep.
       
   164          * @param aResourceId resource id which is read
       
   165          * @return value of wanted integer resource flag
       
   166          */
       
   167         IMPORT_C static TInt IntResourceValueFromRssL( TInt aResourceId );
       
   168 
       
   169         /**
       
   170          * @return The maximum length for one message in characters
       
   171          */
       
   172         IMPORT_C static TInt MaxMsgLength();
       
   173 
       
   174         /**
       
   175          * @param aUid Uid for cenrep
       
   176          * @param aKey Central repository key
       
   177          * @return Value for key
       
   178          */
       
   179         IMPORT_C static TUint32 CRKeyL( TUid aUid, TUint32 aKey );
       
   180 
       
   181         /**
       
   182          * Adds menu item dynamically to menupane
       
   183          * @param aAdd If EFalse, this method doesn't add anything
       
   184          * @param aMenuPane Menu pane
       
   185          * @param aTextResourceId Resource id for menu item text
       
   186          * @param aCommandId Command id for menu item
       
   187          * @param aCascadeId Cascade menu resource id
       
   188          */
       
   189         IMPORT_C static void AddMenuItemL( TBool aAdd, CEikMenuPane& aMenuPane, TInt aTextResourceId,
       
   190                                            TInt aCommandId, TInt aCascadeId = 0 );
       
   191 
       
   192         /**
       
   193          * Sets bitmap/mask from source to target and set externality too
       
   194          * @param aTarget target for icon
       
   195          * @param aSource source for icon
       
   196          */
       
   197         IMPORT_C static void SetIcon( CGulIcon& aTarget, CGulIcon& aSource );
       
   198 
       
   199         /**
       
   200          * It assigns source as a target if target is NULL or
       
   201          * set target like source and delete source
       
   202          * WARNING source is expected on the top of the CleanupStack
       
   203          * source is removed from the Cleanupstack
       
   204          *
       
   205          * @param aTarget target for icon
       
   206          * @param aSource source for icon
       
   207          */
       
   208         IMPORT_C static void UpdateIcon( CGulIcon*& aTarget, CGulIcon* aSource );
       
   209 
       
   210         /**
       
   211          * Shows needed notes about offline status accordign to variation.
       
   212          * @precond aContactIdentification is identification of an offline contact.
       
   213          * @param aContactIdentification Contact identification.
       
   214          * @return Integer value, negative if offline status is not ignored or
       
   215          *              allowed by variation, positive if contact is online
       
   216          *              or user decides to ignore offline status. See possible
       
   217          *              return values from IMUtils::TIgnoreOfflineStatus enum.
       
   218          */
       
   219         IMPORT_C static TInt IgnoreOfflineStatusL( const TDesC& aContactIdentification );
       
   220 
       
   221         /**
       
   222          * Checks flash memory level. Leaves with KErrDiskFull if
       
   223          * memory level below critical level.
       
   224          * @since
       
   225          * @param aRequestedSpace Needed memory estimate. Default 0 checks
       
   226          *        if memory level is already below critical level.
       
   227          * @param aEmulateMemOut Can be used in DEBUG BUILDS to emulate memory
       
   228          *        out situation, ETrue causes the method to leave
       
   229          *        with KErrDiskfull.
       
   230          */
       
   231         IMPORT_C static void FFSSpaceBelowCriticalLevelL( TInt aRequestedSpace = 0
       
   232                                                                                  , TBool
       
   233 #ifdef _DEBUG
       
   234                                                           aEmulateMemOut
       
   235 #endif // _DEBUG
       
   236                                                           = EFalse
       
   237                                                         );
       
   238 
       
   239         /**
       
   240          * Checks if the file is DRM protected or not
       
   241          * @since
       
   242          * @param aFileName Name of the file to be checked
       
   243          */
       
   244         IMPORT_C static TBool FileProtectedL( const TFileName& aFileName );
       
   245 
       
   246         /**
       
   247          * Checks if the content is DRM protected or not
       
   248          *
       
   249          * Note that this method might be quite slow and should
       
   250          * not be used often!
       
   251          *
       
   252          * @since
       
   253          * @param aContent Content to be checked
       
   254          */
       
   255         IMPORT_C static TBool ContentProtectedL( const TDesC8& aContent );
       
   256 
       
   257 
       
   258         /**
       
   259          * Combines two strings given resource ids.
       
   260          *
       
   261          *
       
   262          * The caller is responsible to delete the string
       
   263          *
       
   264          * @since 3.2
       
   265          * @param TInt aResourceId1
       
   266          * @param TInt aResourceId2
       
   267          * @return HBufC*
       
   268          */
       
   269         IMPORT_C static HBufC* CombineStringFromResourceLC( TInt aResourceId1, TInt aResourceId2 );
       
   270 
       
   271         /**
       
   272          * 401-1815 Ease of Instant Messaging branding
       
   273          * Code added for the above requirment
       
   274          * This function is used to initialize the Central repository instance
       
   275          * it can be called during the init of the application. As the settings
       
   276          * are now moved to cenrep, the function IntResourceValueL will be using
       
   277          * the Cenrep instance to get the values.
       
   278          */
       
   279         IMPORT_C static void InitializeLibL();
       
   280 
       
   281         /**
       
   282          * 401-1815 Ease of Instant Messaging branding
       
   283          * Code added for the above requirment
       
   284          * This function is used to delete the CRepository instance, instantiated by
       
   285          * the InitializeLibL.
       
   286          */
       
   287         IMPORT_C static void UnInitializeLib();
       
   288 
       
   289     private:
       
   290         /* 401-1815 Ease of Instant Messaging branding
       
   291          * Code added for the above requirment
       
   292          */
       
   293         static CIMUtilsTlsData* TlsData();
       
   294 
       
   295     };
       
   296 
       
   297 
       
   298 
       
   299 
       
   300 #endif      // IMUTILS_H
       
   301 
       
   302 // End of File