ipsservices/ipssosaoplugin/inc/IpsSosAOSettingsHandler.h
branchRCL_3
changeset 63 d189ee25cf9d
equal deleted inserted replaced
61:dcf0eedfc1a3 63:d189ee25cf9d
       
     1 /*
       
     2 * Copyright (c) 2010 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: 
       
    15 *     Class to handle imap/pop/smtp settings & cenrep
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef IPSSOSAOSETTINGSHANDLER_H_
       
    21 #define IPSSOSAOSETTINGSHANDLER_H_
       
    22 
       
    23 #include <e32base.h> 
       
    24 
       
    25 #include "ipsplgcommon.h"
       
    26 #include "nmipssettingitems.h"
       
    27 
       
    28 
       
    29 class CMsvSession;
       
    30 class TMsvEntry;
       
    31 class NmId;
       
    32 class QVariant;
       
    33 
       
    34 
       
    35 const TInt KIpsHeadersOnly           = -2;
       
    36 const TInt KIpsFullBodyAndAttas      = -1;
       
    37 const TInt KIpsFullBodyOnly          = -3;
       
    38 
       
    39 class NmIpsSosAoExtendedSettingsManager;
       
    40 /**
       
    41 * class CIpsSosAOSettingsHandler
       
    42 *
       
    43 * @lib ipssosaoplugin.lib
       
    44 */
       
    45 NONSHARABLE_CLASS (CIpsSosAOSettingsHandler) : public CBase
       
    46     {
       
    47     
       
    48 public:
       
    49     
       
    50     /*
       
    51      * NewL
       
    52      */
       
    53     static CIpsSosAOSettingsHandler* NewL( 
       
    54             CMsvSession& aSession, TMsvId aMailboxId );
       
    55     
       
    56     /*
       
    57      * Destructor
       
    58      */
       
    59     virtual ~CIpsSosAOSettingsHandler();
       
    60     
       
    61     /**
       
    62      * List folders subscribed to be synced.
       
    63      * Not supported.
       
    64      */
       
    65     void GetSubscribedImapFoldersL( 
       
    66             TMsvId aServiceId, 
       
    67             RArray<TMsvId>& aFoldersArray );
       
    68     
       
    69     /**
       
    70      * Reads TImImap4GetPartialMailInfo data from settings
       
    71      * @param aInfo return parameter
       
    72      * @param aImap4Settings reference to settings 
       
    73      */
       
    74     void ConstructImapPartialFetchInfo( 
       
    75             TImImap4GetPartialMailInfo& aInfo, 
       
    76             CImImap4Settings& aImap4Settings );
       
    77     
       
    78     /**
       
    79      * @return state of alwaysonline
       
    80      */
       
    81     IpsServices::TIpsSetDataAoStates AlwaysOnlineState() const;
       
    82     
       
    83     /**
       
    84      * @param aAlwaysOnlineState, new state for alwaysonline
       
    85      */
       
    86     void SetAlwaysOnlineState(
       
    87         const IpsServices::TIpsSetDataAoStates aAlwaysOnlineState );
       
    88     
       
    89     /**
       
    90      * Fetches the state of email notification -flag
       
    91      * @return ETrue or EFalse, according to flag state
       
    92      */
       
    93     IpsServices::TIpsSetDataEmnStates EmailNotificationState() const;
       
    94     
       
    95     /**
       
    96      * Sets the state of email notification -flag
       
    97      */
       
    98     void SetEmailNotificationState(
       
    99         const IpsServices::TIpsSetDataEmnStates aEmnState );
       
   100         
       
   101     /**
       
   102      * Returns flag which indicates has mailbox received 
       
   103      * it's first OMA EMN. 
       
   104      */
       
   105     TBool FirstEmnReceived() const;
       
   106     
       
   107     /**
       
   108      * Sets a flag when mailbox receives it's first OMA EMN.
       
   109      * (email notification)
       
   110      * @param flag value
       
   111      */
       
   112     void SetFirstEmnReceived( TBool aValue );
       
   113     
       
   114     /**
       
   115     * returns value of this flag
       
   116     * @return is flag set
       
   117     */
       
   118     TBool EmnReceivedButNotSyncedFlag() const;
       
   119         
       
   120     /**
       
   121     * sets flag value
       
   122     * @param flag value
       
   123     */
       
   124     void SetEmnReceivedButNotSyncedFlag( TBool aFlag );
       
   125     
       
   126     /**
       
   127      * @return week days selected when sync is active
       
   128      */
       
   129     TUint SelectedWeekDays() const;
       
   130     
       
   131     /**
       
   132      * @return start time 
       
   133      */
       
   134     TTime SelectedTimeStart() const;
       
   135     
       
   136     /**
       
   137      * @return stop time
       
   138      */
       
   139     TTime SelectedTimeStop() const;
       
   140     
       
   141     /**
       
   142      * @param aLastUpdateInfo
       
   143      */
       
   144     void SetLastUpdateInfo( const IpsServices::TAOInfo& aLastUpdateInfo );
       
   145 
       
   146     /**
       
   147      * @return info about last update
       
   148      */
       
   149     IpsServices::TAOInfo LastUpdateInfo() const;
       
   150     
       
   151     /**
       
   152      * @return refresh interval
       
   153      */
       
   154     TInt InboxRefreshTime() const;
       
   155     
       
   156     
       
   157     /**
       
   158      * Gets email address from smtp settings.
       
   159      * @return pointer to emailaddress. ownership is transferred.
       
   160      */
       
   161     HBufC* EmailAddressL();
       
   162     
       
   163 private:
       
   164     
       
   165     /*
       
   166      * Constructor 
       
   167      */
       
   168     CIpsSosAOSettingsHandler(CMsvSession& aSession);
       
   169         
       
   170 private:
       
   171     
       
   172     /*
       
   173      * 2nd phase constructor 
       
   174      */
       
   175     void ConstructL( TMsvId aMailboxId );
       
   176     
       
   177     
       
   178     /**
       
   179      * Gets FS plugin id related to protocol
       
   180      * @return FS plugin id
       
   181      */
       
   182     TInt GetFSPluginId() const;
       
   183     
       
   184     /**
       
   185      * Constructs NmId type mailbox id from TMsvId and plugin's id.
       
   186      */
       
   187     NmId MboxId() const;
       
   188     
       
   189     /**
       
   190      * Reads values from extended settings
       
   191      * @param aItem wanted item id
       
   192      * @param aValue return parameter
       
   193      * @return did succeed
       
   194      */
       
   195     TBool GetSettingValue(IpsServices::SettingItem aItem, QVariant& aValue) const;
       
   196     
       
   197     /**
       
   198      * Sets setting value into extended settings
       
   199      * @param aItem item which to set
       
   200      * @param items data
       
   201      * @return did succeed
       
   202      */
       
   203     TBool SetSettingValue(
       
   204             const IpsServices::SettingItem aItem, 
       
   205             const QVariant& aData);
       
   206     
       
   207     /**
       
   208      * Creates a new key-value pair into cenrep
       
   209      * @param aKey key to be created
       
   210      * @aValue initial value for the key
       
   211      * @return did succeed
       
   212      */
       
   213     TBool CreateKeyValuePair(
       
   214             const IpsServices::SettingItem aKey, 
       
   215             const QVariant& aValue);
       
   216     
       
   217     /**
       
   218      * method to determine daytime and "other" time
       
   219      */
       
   220     TBool IsDaytime() const;
       
   221     
       
   222     /**
       
   223      * Maps TIPsSetProfiles into TIpsSetDataAoStates 
       
   224      */
       
   225     IpsServices::TIpsSetDataAoStates ProfileIntoAOState(
       
   226             const TInt aProfile) const;
       
   227     
       
   228     
       
   229 private:
       
   230     NmIpsSosAoExtendedSettingsManager* iExtMgr;//owned
       
   231     TPckgBuf<TIpsPlgPropertyEvent>  iPropertyBuf;
       
   232     TMsvEntry                       iEntry;
       
   233     CMsvSession&                    iSession;
       
   234     };
       
   235 
       
   236 #endif /*IPSSOSAOSETTINGSHANDLER_H_*/