ipsservices/ipssossettings/inc/ipssetdata.h
changeset 0 8466d47a6819
child 4 e7aa27f58ae1
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:  Decleares email data class.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CIPSSETDATA_H
       
    19 #define CIPSSETDATA_H
       
    20 
       
    21 
       
    22 #include <iapprefs.h>
       
    23 #include <cemailaccounts.h>
       
    24 
       
    25 class CIpsSetDataExtension;
       
    26 class CIpsSetDataSignature;
       
    27 class CMsvSession;
       
    28 class CImBaseEmailSettings;
       
    29 
       
    30 // These are related to synchronisation times
       
    31 // NOTE: these are not defaults when mailbox is created,
       
    32 // when mailbox is created all time are set to zero means "all day"
       
    33 const TInt64 KIpsSetDataTimeDialogDefault         = MAKE_TINT64( 0x00000000, 0x00000000 );
       
    34 const TInt64 KIpsSetDataTimeDialogDefaultStart    = MAKE_TINT64( 0x00000006, 0xB49D2000 ); // 08:00
       
    35 const TInt64 KIpsSetDataTimeDialogDefaultStop     = MAKE_TINT64( 0x0000000F, 0x16618800 ); // 18:00
       
    36 
       
    37 /**
       
    38  * Container for email settings
       
    39  *
       
    40  * @lib IpsSossetting.lib
       
    41  * @since FS v1.0
       
    42  */
       
    43 class CIpsSetData : public CBase
       
    44     {
       
    45 public:
       
    46 
       
    47 // Datatypes
       
    48 
       
    49     /** Security types */
       
    50     enum TSecurityType
       
    51         {
       
    52         EStartTls = 0,
       
    53         ESslTls,
       
    54         ESecurityOff
       
    55         };
       
    56 
       
    57     /** */
       
    58     enum TRetrieveLimitButtons
       
    59         {
       
    60         EAll = 0,
       
    61         EUserDefined
       
    62         };
       
    63 
       
    64     /** */
       
    65     enum TRetrieveLimit
       
    66         {
       
    67         EPop3Limit = 0,
       
    68         EImap4Inbox,
       
    69         EImap4Folders
       
    70         };
       
    71 
       
    72     /** */
       
    73     enum TUserAuthentication
       
    74         {
       
    75         ENoAuth = 0,
       
    76         EUseIncoming,
       
    77         EOwnOutgoing
       
    78         };
       
    79 
       
    80     /***/
       
    81     enum THoursSetting
       
    82         {
       
    83         EAllDay = 0,
       
    84         ECustomHours
       
    85         };
       
    86 
       
    87 
       
    88     /** */
       
    89     enum TSyncInterval
       
    90         {
       
    91         E5Mins = 0,
       
    92         E10Mins,
       
    93         E15Mins,
       
    94         E30Mins,
       
    95         E1Hour,
       
    96         E4Hours,
       
    97         E12Hours,
       
    98         E1Day,
       
    99         ENotification,
       
   100         EManual
       
   101         };
       
   102 
       
   103     /** */
       
   104     enum TDownloadButtons
       
   105         {
       
   106         EHeaders = 0,
       
   107         EHeadersPlus,
       
   108         EWholeBody
       
   109         };
       
   110 
       
   111 public:
       
   112 
       
   113 // Constructors and destructor
       
   114 
       
   115     /**
       
   116      * Creates object from CIpsSetData and leaves it to cleanup stack
       
   117      * @return, Constructed object
       
   118      */
       
   119     static CIpsSetData* NewLC();
       
   120 
       
   121     /**
       
   122      * Create object from CIpsSetData
       
   123      * @return, Constructed object
       
   124      */
       
   125     static CIpsSetData* NewL();
       
   126 
       
   127     /**
       
   128      * Destructor
       
   129      */
       
   130     virtual ~CIpsSetData();
       
   131 
       
   132 public: // New functions
       
   133 
       
   134     /**
       
   135      * @return Pointer to Imap4 settings for modification
       
   136      */
       
   137     CImImap4Settings* Imap4Settings();
       
   138 
       
   139     /**
       
   140      * @return Pointer to Pop3 settings for modification
       
   141      */
       
   142     CImPop3Settings* Pop3Settings();
       
   143 
       
   144     /**
       
   145      * @return Pointer to Smtp settings for modification
       
   146      */
       
   147     CImSmtpSettings* SmtpSettings();
       
   148 
       
   149     /**
       
   150      * @return Pointer to Extended settings for modification
       
   151      */
       
   152     CIpsSetDataExtension* ExtendedSettings();
       
   153 
       
   154     /**
       
   155      * @return Pointer to incoming Access Point settings for modification
       
   156      */
       
   157     CImIAPPreferences* IncomingIapPref() const;
       
   158 
       
   159     /**
       
   160      * @return Pointer to outgoing Access Point settings for modification
       
   161      */
       
   162     CImIAPPreferences* OutgoingIapPref() const;
       
   163 
       
   164     /**
       
   165      * Loads the settings from message store and central repository.
       
   166      *
       
   167      * @param aMailboxId Id of the mailbox
       
   168      * @param aSession Message Server session
       
   169      */
       
   170     void LoadL( const TMsvId aMailboxId, CMsvSession& aSession );
       
   171 
       
   172     /**
       
   173      * @param aSession Message Server session
       
   174      */
       
   175     void SaveL( CMsvSession& aSession );
       
   176 
       
   177     /**
       
   178      * @return ETrue, when settings are valid
       
   179      */
       
   180     TBool IsOk();
       
   181 
       
   182     /**
       
   183      * @return Protocol of the settings
       
   184      */
       
   185     const TUid& Protocol() const;
       
   186 
       
   187     /**
       
   188      * @return Reference to Imap4 account ID
       
   189      */
       
   190     TImapAccount& ImapAccount();
       
   191 
       
   192     /**
       
   193      * @return Constant reference to Imap4 account ID
       
   194      */
       
   195     const TImapAccount& ImapAccount() const;
       
   196 
       
   197     /**
       
   198      * @return Reference to Pop3 account ID
       
   199      */
       
   200     TPopAccount& PopAccount();
       
   201 
       
   202     /**
       
   203      * @return Constant reference to Pop3 account ID
       
   204      */
       
   205     const TPopAccount& PopAccount() const;
       
   206 
       
   207     /**
       
   208      * @return Reference to Smtp account ID
       
   209      */
       
   210     TSmtpAccount& SmtpAccount();
       
   211 
       
   212     /**
       
   213      * @return Constant reference to Smtp account ID
       
   214      */
       
   215     const TSmtpAccount& SmtpAccount() const;
       
   216 
       
   217     /**
       
   218      * @return Read-only reference to email address setting.
       
   219      */
       
   220     const TDesC& EmailAddress() const;
       
   221 
       
   222     /**
       
   223      * @return Read-only reference to reply-to address setting.
       
   224      */
       
   225     const TDesC& ReplyToAddress() const;
       
   226 
       
   227     /**
       
   228      * @return Read-only reference to mailbox name setting.
       
   229      */
       
   230     const TDesC& MailboxName() const;
       
   231 
       
   232     /**
       
   233      * @return Read-only reference to own name setting.
       
   234      */
       
   235     const TDesC& MyName() const;
       
   236 
       
   237     /**
       
   238      * @return Include signature setting.
       
   239      */
       
   240     TBool IncludeSignature() const;
       
   241 
       
   242     /**
       
   243      * @return Write access to signature setting.
       
   244      */
       
   245     CIpsSetDataSignature& Signature();
       
   246 
       
   247     /**
       
   248      * @return Read-only reference to signature setting.
       
   249      */
       
   250     const CIpsSetDataSignature& Signature() const;
       
   251 
       
   252     /**
       
   253      * @param aIncoming Retireve incoming or outgoing setting.
       
   254      * @return Read-only reference to username setting.
       
   255      */
       
   256     const TDesC& UserName( const TBool aIncoming ) const;
       
   257 
       
   258     /**
       
   259      * @param aIncoming Retireve incoming or outgoing setting.
       
   260      * @return Read-only reference to password setting.
       
   261      */
       
   262     const TDesC& UserPwd( const TBool aIncoming ) const;
       
   263 
       
   264     /**
       
   265      * @param aIncoming Retireve incoming or outgoing setting.
       
   266      * @return Read-only reference to server address setting.
       
   267      */
       
   268     const TDesC& MailServer( const TBool aIncoming ) const;
       
   269 
       
   270     /**
       
   271      * @param aIncoming Retireve incoming or outgoing setting.
       
   272      * @return Access point setting.
       
   273      */
       
   274     TImIAPChoice Iap( const TBool aIncoming ) const;
       
   275 
       
   276     /**
       
   277      * @param aIncoming Retireve incoming or outgoing setting.
       
   278      * @return Current security setting.
       
   279      */
       
   280     TInt Security( const TBool aIncoming ) const;
       
   281 
       
   282     /**
       
   283      * @param aIncoming Retireve incoming or outgoing setting.
       
   284      * @return Value from port setting.
       
   285      */
       
   286     TInt Port( const TBool aIncoming ) const;
       
   287 
       
   288     /**
       
   289      * @return Returns APOP setting value.
       
   290      */
       
   291     TInt APop() const;
       
   292 
       
   293     /**
       
   294      * @return User authentication setting
       
   295      */
       
   296     TInt UserAuthentication() const;
       
   297 
       
   298     /**
       
   299      * @return Read-only reference to Imap folder path
       
   300      */
       
   301     const TDesC& ImapPath() const;
       
   302 
       
   303     /**
       
   304      * @return Email download size
       
   305      */
       
   306     TInt DownloadSize() const;
       
   307 
       
   308     /**
       
   309      * @return Remove older -setting status
       
   310      */
       
   311     TInt RetrieveLimit( const TRetrieveLimit aType ) const;
       
   312 
       
   313     /**
       
   314      * @return Scheduling interval setting
       
   315      */
       
   316     TInt Schedule() const;
       
   317 
       
   318     /**
       
   319      * @return Checked days as flag mask
       
   320      */
       
   321     TInt Days() const;
       
   322 
       
   323     /**
       
   324      * Retrieves peak start time or stop time
       
   325      *
       
   326      * @param aStartTime When ETrue, start time is retrieved
       
   327      * @return Returns time based on the parameter
       
   328      */
       
   329     TTime Hours( const TBool aStartTime ) const;
       
   330 
       
   331     /**
       
   332      * @return Roaming setting
       
   333      */
       
   334     TBool Roaming() const;
       
   335 
       
   336     /**
       
   337      * @param aProtocol Protocol MTM ID for settings
       
   338      */
       
   339     void SetProtocol( const TUid& aProtocol );
       
   340 
       
   341     /**
       
   342      * @param aEmailAddress Address to be stored.
       
   343      */
       
   344     void SetEmailAddressL( const TDesC& aEmailAddress );
       
   345 
       
   346     /**
       
   347      * @param aReplyToAddress Address to be stored.
       
   348      */
       
   349     void SetReplyToAddressL( const TDesC& aReplyToAddress );
       
   350 
       
   351     /**
       
   352      * @param aMailboxName Mailboxes name to be stored.
       
   353      */
       
   354     void SetMailboxName( const TDesC& aMailboxName );
       
   355 
       
   356     /**
       
   357      * @param aMyName User alias to be stored.
       
   358      */
       
   359     void SetMyNameL( const TDesC& aMyName );
       
   360 
       
   361     /**
       
   362      * @param aIncludeSignature Signature status to be stored.
       
   363      */
       
   364     void SetIncludeSignature( TBool aIncludeSignature );
       
   365 
       
   366     /**
       
   367      * @param aSignature Signature text to be stored.
       
   368      */
       
   369     void SetSignatureL( const TDesC& aSignature );
       
   370 
       
   371     /**
       
   372      * @param aIncomingUserName Incoming name to be stored.
       
   373      * @param aOutgoingUserName Outgoing username to be store.
       
   374      */
       
   375     void SetUserNameL(
       
   376         const TDesC& aIncomingUserName,
       
   377         const TDesC& aOutgoingUserName );
       
   378 
       
   379     /**
       
   380      * @param aIncomingUserPwd Incoming password to be stored.
       
   381      * @param aOutgoingUserPwd Outgoing password to be stored.
       
   382      */
       
   383     void SetUserPwdL(
       
   384         const TDesC& aIncomingUserPwd,
       
   385         const TDesC& aOutgoingUserPwd );
       
   386 
       
   387     /**
       
   388      * @param aIncomingMailServer Incoming mail server to be stored.
       
   389      * @param aOutgoingMailServer Outgoing mail server to be stored.
       
   390      */
       
   391     void SetMailServerL(
       
   392         const TDesC& aIncomingMailServer,
       
   393         const TDesC& aOutgoingMailServer );
       
   394 
       
   395     /**
       
   396      * @param aIncomingIap Incoming access point to be stored.
       
   397      * @param aOutgoingIap Outgoing access point to be stored.
       
   398      */
       
   399     void SetIapL(
       
   400         TImIAPChoice aIncomingIap,
       
   401         TImIAPChoice aOutgoingIap );
       
   402 
       
   403     /**
       
   404      * @param aIncomingSecurity Incoming security to be stored.
       
   405      * @param aOutgoingSecurity Outgoing security to be stored.
       
   406      */
       
   407     void SetSecurity(
       
   408         TInt aIncomingSecurity,
       
   409         TInt aOutgoingSecurity );
       
   410 
       
   411     /**
       
   412      * @param aIncomingPort Incoming Port to be stored.
       
   413      * @param aOutgoingPort Outgoing Port to be stored.
       
   414      */
       
   415     void SetPort(
       
   416         TInt aIncomingPort,
       
   417         TInt aOutgoingPort );
       
   418 
       
   419     /**
       
   420      * @param aAPop APOP status to be stored.
       
   421      */
       
   422     void SetAPop( TInt aAPop );
       
   423 
       
   424     /**
       
   425      * @param aUserAuthentication Outgoing authentication status to be stored.
       
   426      */
       
   427     void SetUserAuthentication( TInt aUserAuthentication );
       
   428 
       
   429     /**
       
   430      * @param aImapPath Imap4 inbox path to be stored.
       
   431      */
       
   432     void SetImapPathL( const TDesC& aImapPath );
       
   433 
       
   434     /**
       
   435      * @param aDownloadControl Download control state for saving.
       
   436      * @param aDownloadSize Download size for saving.
       
   437      */
       
   438     void SetDownloadSizeL(
       
   439         const TInt aDownloadControl,
       
   440         const TInt aDownloadSize );
       
   441 
       
   442     /**
       
   443      * @param aRetrieveLimitPop Pop retrieval limit for storing.
       
   444      * @param aRetrieveLimitImapInbox Imap inbox retrieval limit for storing.
       
   445      * @param aRetrieveLimitImapFolders Imap folder retrieval limit for storing.
       
   446      */
       
   447     void SetRetrieveLimit(
       
   448         TInt aRetrieveLimitPop,
       
   449         TInt aRetrieveLimitImapInbox,
       
   450         TInt aRetrieveLimitImapFolders );
       
   451 
       
   452     /**
       
   453      * @param aSchedule Scheduling status to be stored.
       
   454      * @param aRoaming Roaming status for saving.
       
   455      */
       
   456     void SetSchedule(
       
   457         const TInt aSchedule,
       
   458         const TBool aRoaming );
       
   459 
       
   460     /**
       
   461      * @param aDays Retrieval days setting to be stored.
       
   462      */
       
   463     void SetDays( TInt aDays );
       
   464 
       
   465     /**
       
   466      * @param aStartHour Sync start time to be stored.
       
   467      * @param aStopHour Sync stop time to be stored.
       
   468      */
       
   469     void SetHours(
       
   470         const TInt64 aStartHour,
       
   471         const TInt64 aStopHour );
       
   472 
       
   473     /**
       
   474      * @param aHoursCustom to be stored.
       
   475      */
       
   476     void SetHoursCustom( TInt64 aHoursCustom );
       
   477     
       
   478     //<cmail>
       
   479     /**
       
   480      * @param aHideData ETrue if there are some field to hide.
       
   481      */
       
   482     void SetDataHide( TBool aHideData );
       
   483     //</cmail>
       
   484 
       
   485 protected:
       
   486 
       
   487 // Constructors
       
   488 
       
   489     /**
       
   490      * Default constructor for classCIpsSetData
       
   491      * @return, Constructed object
       
   492      */
       
   493     CIpsSetData();
       
   494 
       
   495     /**
       
   496      * Symbian 2-phase constructor
       
   497      */
       
   498     void ConstructL();
       
   499 
       
   500 private:
       
   501 
       
   502 // New functions
       
   503 
       
   504     /**
       
   505      * Sets the security settings for the protocols.
       
   506      *
       
   507      * @param aSecurity Current security setting.
       
   508      * @param aSettings Settings object for storing the security setting.
       
   509      */
       
   510     void DoSetSecurity(
       
   511         const TInt aSecurity,
       
   512         CImBaseEmailSettings& aSettings );
       
   513 
       
   514     /**
       
   515      * Sets default data values to all settings
       
   516      *
       
   517      */
       
   518     void SetDefaultDataL();
       
   519 
       
   520 private:    // Data
       
   521 
       
   522     /**
       
   523      * Settings data protocol.
       
   524      */
       
   525     TUid                        iProtocol;
       
   526 
       
   527     /**
       
   528      * Name of the mailbox.
       
   529      */
       
   530     RBuf                        iName;
       
   531 
       
   532     /**
       
   533      * Signature object.
       
   534      * Owned.
       
   535      */
       
   536     CIpsSetDataSignature*       iSignature;
       
   537 
       
   538     /**
       
   539      * Default account Id.
       
   540      */
       
   541     TMsvId                      iDefaultAccountId;
       
   542 
       
   543     /**
       
   544      * Imap4 settings data object.
       
   545      * Owned.
       
   546      */
       
   547     CImImap4Settings*           iImap4Settings;
       
   548 
       
   549     /**
       
   550      * Imap4 account Id.
       
   551      */
       
   552     TImapAccount                iImap4AccountId;
       
   553 
       
   554     /**
       
   555      * Pop3 settings data object.
       
   556      * Owned.
       
   557      */
       
   558     CImPop3Settings*            iPop3Settings;
       
   559 
       
   560     /**
       
   561      * Pop3 account id.
       
   562      */
       
   563     TPopAccount                 iPop3AccountId;
       
   564 
       
   565     /**
       
   566      * Smtp account id.
       
   567      */
       
   568     TSmtpAccount                iSmtpAccountId;
       
   569 
       
   570     /**
       
   571      * Smtp settings data object.
       
   572      * Owned.
       
   573      */
       
   574     CImSmtpSettings*            iSmtpSettings;
       
   575 
       
   576     /**
       
   577      * Extended settings data object.
       
   578      * Owned.
       
   579      */
       
   580     CIpsSetDataExtension*       iExtendedSettings;
       
   581 
       
   582     /**
       
   583      * Outgoing access point preferences.
       
   584      * Owned.
       
   585      */
       
   586     CImIAPPreferences*          iIncomingIapPref;
       
   587 
       
   588     /**
       
   589      * Outgoing access point preferences.
       
   590      * Owned.
       
   591      */
       
   592     CImIAPPreferences*          iOutgoingIapPref;
       
   593 
       
   594     /**
       
   595      * Temporary text store.
       
   596      */
       
   597     RBuf                        iTempStore;
       
   598     };
       
   599 
       
   600 #endif // CIPSSETDATA_H
       
   601 
       
   602 // End of File