ipsservices/ipssossettings/inc/ipssetdataapi.h
changeset 0 8466d47a6819
child 16 b5fbb9b25d57
equal deleted inserted replaced
-1:000000000000 0:8466d47a6819
       
     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 private:
       
   171 
       
   172     /**
       
   173      * 2nd phase of construction.
       
   174      */
       
   175     void ConstructL();
       
   176 
       
   177     /**
       
   178      * Constructor
       
   179      */
       
   180     CIpsSetDataApi( CMsvSession& aSession );
       
   181 
       
   182     /**
       
   183      * Sets Imap4 password.
       
   184      *
       
   185      * @param aService Mailbox service Id.
       
   186      * @param aPassword New password.
       
   187      */
       
   188     void SetNewImap4PasswordL(
       
   189         CMsvEntry& aService,
       
   190         const TDesC& aPassword );
       
   191 
       
   192     /**
       
   193      * Sets Pop3 password.
       
   194      *
       
   195      * @param aService Mailbox service Id.
       
   196      * @param aPassword New password.
       
   197      */
       
   198     void SetNewPop3PasswordL(
       
   199         CMsvEntry& aService,
       
   200         const TDesC& aPassword );
       
   201     
       
   202     static void GetImapChildFoldersL(
       
   203             CMsvSession& aSession,
       
   204             const CMsvEntrySelection& aRootFolders, 
       
   205             RArray<TMsvId>& aFillArray );
       
   206 
       
   207     /**
       
   208      * Checks whether outgoing settings is set as "same as incoming"
       
   209      * @param aParams contains account id and mtm id
       
   210      */
       
   211     TBool IsOutgoingLoginSameAsIncomingL( const TIpsSetDataStorerParams& aParams );
       
   212 
       
   213     /**
       
   214      * Sets outgoing (smtp) password settings
       
   215      * @param aSmtpServiceId specifies the service entry in messagestore
       
   216      *        (i.e. mailbox in question), where the settings are saved
       
   217      * @param aPassword new password
       
   218      * @param aEmailAccounts reference to helper class instance that is needed
       
   219      */
       
   220     void SetNewSmtpPasswordL(
       
   221         const TMsvId aSmtpServiceId,
       
   222         const TDesC8& aPassword,
       
   223         CEmailAccounts& aEmailAccounts );
       
   224 
       
   225 private:
       
   226     
       
   227     CMsvSession& iSession;
       
   228     
       
   229     HBufC* iServerAddress;
       
   230     };
       
   231 
       
   232 #endif /* IPSSETDATAAPI_H*/
       
   233 
       
   234 // End of File