ipsservices/ipssossettings/inc/ipssetdataapi.h
branchRCL_3
changeset 64 3533d4323edc
equal deleted inserted replaced
63:d189ee25cf9d 64:3533d4323edc
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Class which decleares the Settings API.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef IPSSETDATAAPI_H
       
    20 #define IPSSETDATAAPI_H
       
    21 
       
    22 
       
    23 #include <msvstd.h>
       
    24 #include <imapset.h>
       
    25 
       
    26 const TInt KIpsSetDataMaxPhoneIdLength      = 50;
       
    27 
       
    28 class CMsvSession;
       
    29 class CMsvEntry;
       
    30 class CIpsSetDataExtension;
       
    31 class TIpsSetDataStorerParams;
       
    32 class CEmailAccounts;
       
    33 
       
    34 /**
       
    35  * Settings API for accessing mailbox settings.
       
    36  *
       
    37  * @lib IpsSosSettings.lib
       
    38  * @since FS v1.0
       
    39  */
       
    40 class CIpsSetDataApi : public CBase
       
    41     {
       
    42 public:
       
    43 
       
    44     /**
       
    45      * 2-phase constructor.
       
    46      *
       
    47      * @param aSession Messaging framework session
       
    48      * @return Api object with client ownership.
       
    49      */
       
    50     IMPORT_C static CIpsSetDataApi* NewL( CMsvSession& aSession );
       
    51 
       
    52     /**
       
    53      * Destructor.
       
    54      */
       
    55     virtual ~CIpsSetDataApi();
       
    56 
       
    57     /**
       
    58      * Sets new password.
       
    59      *
       
    60      * @param aService Mailbox service Id.
       
    61      * @param aPassword New password.
       
    62     */
       
    63     IMPORT_C void SetNewPasswordL(
       
    64         CMsvEntry& aService,
       
    65         const TDesC& aPassword );
       
    66     
       
    67     //<cmail>
       
    68     //This method is not used anywhere
       
    69     /**
       
    70     *
       
    71     */
       
    72     /*IMPORT_C TBool IsSmtpAllowedToConnectL( 
       
    73         TMsvId aSmtpService, 
       
    74         TBool aIsRoaming,
       
    75         CMsvSession& aSession );*/
       
    76     //</cmail>
       
    77     
       
    78     /**
       
    79     *
       
    80     */
       
    81     IMPORT_C TDesC& GetServerAddressL( const CMsvEntry& aEntry );
       
    82     
       
    83     /**
       
    84     *
       
    85     */
       
    86     IMPORT_C void GoOnlineL( TMsvEntry aMailbox );
       
    87     
       
    88     /**
       
    89     * Creates mailbox
       
    90     *
       
    91     * @param aUid uid of the caller plugin
       
    92     * @param aSession msv session reference
       
    93     * @return KErrNone if mailbox created successfully. 
       
    94     *         KErrNotSupported if uid not match for the wizard data cenrep. 
       
    95     *         KErrGeneral in any type of other errors.
       
    96     */
       
    97     IMPORT_C TInt HandleMailboxCreation( 
       
    98         const TUid aUid, 
       
    99         CMsvSession& aSession );
       
   100     
       
   101     
       
   102     /**
       
   103     *
       
   104     */
       
   105     IMPORT_C void GoOfflineL( TMsvEntry aMailbox );
       
   106     
       
   107     /**
       
   108     *
       
   109     */
       
   110     IMPORT_C void RemoveAccountL( 
       
   111         const TMsvEntry& aMailbox, 
       
   112         CMsvSession& aSession );
       
   113     
       
   114     /**
       
   115     *
       
   116     */
       
   117     IMPORT_C static TInt LaunchSettingsL( const TMsvId aMailboxId );
       
   118 
       
   119     /**
       
   120     * Creates cenrep key from given parameters
       
   121     *
       
   122     * @param aAccountId id of used account
       
   123     * @param aProtocol account's protocol
       
   124     * @param aSettingKey specific setting item to create this key for
       
   125     * @return key generated from the parameters
       
   126     */
       
   127     IMPORT_C TUint32 CreateCenRepKeyL( 
       
   128         const TUint32 aAccountId,
       
   129         const TUid& aProtocol,
       
   130         const TUint32 aSettingKey );
       
   131     
       
   132     /**
       
   133      * Reads the address of the mailbox (i.e. the 'own' address).
       
   134      * @param aMailboxEntry The service entry of the mailbox
       
   135      * @param aMailboxAddress The address string buffer. The ownership
       
   136      *     is moved to the client.
       
   137      */
       
   138     IMPORT_C void GetMailboxAddressL(
       
   139         const TMsvEntry& aMailboxEntry,
       
   140         HBufC*& aMailboxAddress);
       
   141     
       
   142     
       
   143     /**
       
   144     *
       
   145     */    
       
   146     IMPORT_C void SaveSyncStatusL( TMsvEntry aMailbox, TInt aState );
       
   147     
       
   148     IMPORT_C TInt GetLastSyncStatusL( TMsvEntry aMailboxId );
       
   149     
       
   150     IMPORT_C void GetIMEIFromThePhoneL( TBuf<KIpsSetDataMaxPhoneIdLength> &aIMEI );
       
   151     
       
   152 
       
   153     IMPORT_C void LoadExtendedSettingsL( 
       
   154             TMsvId aServiceId,
       
   155             CIpsSetDataExtension& aExtendedSettings );
       
   156     
       
   157     IMPORT_C void SaveExtendedSettingsL(
       
   158             const CIpsSetDataExtension& aExtendedSettings );
       
   159     
       
   160     IMPORT_C void GetSubscribedImapFoldersL( 
       
   161             TMsvId aServiceId, RArray<TMsvId>& aFoldersArray );
       
   162     
       
   163     IMPORT_C static void ConstructImapPartialFetchInfo( 
       
   164             TImImap4GetPartialMailInfo& aInfo, CImImap4Settings& aImap4Settings );
       
   165     
       
   166     IMPORT_C void SetMailboxNameL( 
       
   167             TMsvEntry& aService, 
       
   168             const TDesC& aMailboxName );
       
   169     
       
   170     /**
       
   171      * Returns pointer to descriptor containing signature text if signature
       
   172      * has been set to be added to outgoing mails. Otherwise returns NULL
       
   173      * pointer.
       
   174      * Ownership of the descriptor is passed to the caller.
       
   175      * @param aService Service entry for which signature text setting is 
       
   176      * *               resolved.
       
   177      * @return Pointer to descriptor containing the signature text.
       
   178      */
       
   179     IMPORT_C HBufC* SignatureTextL( const TMsvEntry& aService );
       
   180     
       
   181 private:
       
   182 
       
   183     /**
       
   184      * 2nd phase of construction.
       
   185      */
       
   186     void ConstructL();
       
   187 
       
   188     /**
       
   189      * Constructor
       
   190      */
       
   191     CIpsSetDataApi( CMsvSession& aSession );
       
   192 
       
   193     /**
       
   194      * Sets Imap4 password.
       
   195      *
       
   196      * @param aService Mailbox service Id.
       
   197      * @param aPassword New password.
       
   198      */
       
   199     void SetNewImap4PasswordL(
       
   200         CMsvEntry& aService,
       
   201         const TDesC& aPassword );
       
   202 
       
   203     /**
       
   204      * Sets Pop3 password.
       
   205      *
       
   206      * @param aService Mailbox service Id.
       
   207      * @param aPassword New password.
       
   208      */
       
   209     void SetNewPop3PasswordL(
       
   210         CMsvEntry& aService,
       
   211         const TDesC& aPassword );
       
   212     
       
   213     static void GetImapChildFoldersL(
       
   214             CMsvSession& aSession,
       
   215             const CMsvEntrySelection& aRootFolders, 
       
   216             RArray<TMsvId>& aFillArray );
       
   217 
       
   218     /**
       
   219      * Checks whether outgoing settings is set as "same as incoming"
       
   220      * @param aParams contains account id and mtm id
       
   221      */
       
   222     TBool IsOutgoingLoginSameAsIncomingL( const TIpsSetDataStorerParams& aParams );
       
   223 
       
   224     /**
       
   225      * Sets outgoing (smtp) password settings
       
   226      * @param aSmtpServiceId specifies the service entry in messagestore
       
   227      *        (i.e. mailbox in question), where the settings are saved
       
   228      * @param aPassword new password
       
   229      * @param aEmailAccounts reference to helper class instance that is needed
       
   230      */
       
   231     void SetNewSmtpPasswordL(
       
   232         const TMsvId aSmtpServiceId,
       
   233         const TDesC8& aPassword,
       
   234         CEmailAccounts& aEmailAccounts );
       
   235 
       
   236 private:
       
   237     
       
   238     CMsvSession& iSession;
       
   239     
       
   240     HBufC* iServerAddress;
       
   241     };
       
   242 
       
   243 #endif /* IPSSETDATAAPI_H*/
       
   244 
       
   245 // End of File