epoc32/include/cmmsaccounts.h
branchSymbian2
changeset 2 2fe1408b6811
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
       
     1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #ifndef __CMMSACCOUNT_H__
       
    17 #define __CMMSACCOUNT_H__
       
    18 
       
    19 
       
    20 #include <e32base.h>
       
    21 
       
    22 class CRepository;
       
    23 class CMmsSettings;
       
    24 class TMmsAccountId;
       
    25 class MMmsSettingsObserver;
       
    26 
       
    27 
       
    28 /** 
       
    29 The maximum account name size
       
    30 
       
    31 @publishedAll
       
    32 @released
       
    33 */
       
    34 const TInt KMmsAccountNameSize = 256;
       
    35 
       
    36      
       
    37 
       
    38 /** 
       
    39 MMS account ID 
       
    40 
       
    41 @publishedAll
       
    42 @released
       
    43 */
       
    44 class TMmsAccountId 
       
    45  	{
       
    46 public:
       
    47 	/** MMS account Id */
       
    48    	TInt iMmsAccountId;
       
    49 
       
    50 	/** MMS account Name */     
       
    51    	TBuf<KMmsAccountNameSize> iMmsAccountName;
       
    52    	};
       
    53 
       
    54 
       
    55 /**
       
    56 Stores MMS settings.
       
    57 
       
    58 @publishedAll
       
    59 @released
       
    60 */
       
    61 class CMmsAccounts : public CActive
       
    62  	{
       
    63 public:
       
    64   	IMPORT_C static CMmsAccounts* NewL( );
       
    65    	IMPORT_C static CMmsAccounts* NewLC( );
       
    66     IMPORT_C virtual ~CMmsAccounts();
       
    67  
       
    68     // Observer functions
       
    69     IMPORT_C void AddObserverL(MMmsSettingsObserver & aObserver);
       
    70     IMPORT_C void RemoveObserver(MMmsSettingsObserver & aObserver);
       
    71 
       
    72     IMPORT_C TMmsAccountId CreateMMSAccountL(const TDesC& aAccountName, const CMmsSettings& aSettings);
       
    73   	IMPORT_C TInt MaxMMSAccounts();
       
    74                
       
    75     IMPORT_C void GetMMSAccountsL(RArray<TMmsAccountId>& aAccountIds) const;
       
    76     IMPORT_C void DeleteMMSAccountL(const TMmsAccountId& aAccountId);
       
    77      
       
    78     IMPORT_C void LoadSettingsL(const TMmsAccountId& aAccountId, CMmsSettings& aSettings);          
       
    79     IMPORT_C void PopulateDefaultSettingsL(CMmsSettings& aSettings);
       
    80 
       
    81     IMPORT_C void SaveSettingsL(const TMmsAccountId& aAccountId, const CMmsSettings& aSettings) const;
       
    82 
       
    83     IMPORT_C TMmsAccountId DefaultMMSAccountL( ) const;
       
    84     IMPORT_C void SetDefaultMMSAccountL(const TMmsAccountId& aAccount);
       
    85 
       
    86 private:
       
    87     CMmsAccounts();
       
    88 	void ConstructL();
       
    89 	void DoLoadSettingsL(TUint32 aAccountId, CMmsSettings& aSettings);
       
    90 	void DoSaveSettingsL(TUint32 aAccountId, const CMmsSettings& aSettings, const TDesC& aAccountName) const;
       
    91 
       
    92     void DoCancel( );
       
    93     void RunL( );
       
    94 
       
    95 	TUint GetNextEmptyAccountSlotL();
       
    96 
       
    97 private:
       
    98 	enum TMmsSettingsCenRepId
       
    99 		{
       
   100 		EMmsAccountName				= 0x00000000,
       
   101 		EMmsSettingsVersion			= 0x00000001,
       
   102 		EMmsApplicationID			= 0x00000002,
       
   103 		EMmsAddress					= 0x00000003,
       
   104 		EMmsCreationMode			= 0x00000004,
       
   105 		EMmsSettingsFlags			= 0x00000005,
       
   106 		EMmsProxyCount				= 0x00000006,
       
   107 		EMmsNapIdCount				= 0x00000007,		
       
   108 		EMmsAutomaticDownload		= 0x00000008,
       
   109 		EMmsValidityPeriod			= 0x00000009,
       
   110 		EMmsMaxDownloadSize			= 0x0000000A,
       
   111 		EMmsMaxDownloadRetries		= 0x0000000B,
       
   112 		EMmsDownloadRetryInterval	= 0x0000000C,
       
   113 		EMmsMaxSendMsgSize			= 0x0000000D,
       
   114 		EMmsDeviceContentClass		= 0x0000000E,
       
   115 		EMmsMaxImageHeight			= 0x0000000F,
       
   116 		EMmsMaxImageWidth			= 0x00000010,
       
   117 		
       
   118 		EMmsProxyList				= 0x00001000,
       
   119 		EMmsNapIdList				= 0x00002000,
       
   120 		};
       
   121 
       
   122 private:
       
   123    	CRepository* iRepository;
       
   124     RPointerArray<MMmsSettingsObserver> iObservers;
       
   125     };     
       
   126      
       
   127 #endif // __CMMSACCOUNT_H__