email/imum/Utils/Inc/ImumMboxScheduler.h
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 /*
       
     2 * Copyright (c) 2002 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 *		Alwaysonline email scheduler class.
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef CImumMboxScheduler_H
       
    21 #define CImumMboxScheduler_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <muiuflags.h>          // TMuiuFlags
       
    26 #include <ImumInMailboxUtilities.h>
       
    27 
       
    28 // CONSTANTS   
       
    29 // MACROS
       
    30 // DATA TYPES
       
    31 // FUNCTION PROTOTYPES
       
    32 // FORWARD DECLARATIONS
       
    33 class CImumInternalApiImpl;
       
    34 
       
    35 // CLASS DECLARATION
       
    36 
       
    37 /**
       
    38 *
       
    39 *  @lib
       
    40 *  @since S60 v3.2
       
    41 */
       
    42 NONSHARABLE_CLASS( CImumMboxScheduler ) : public CBase
       
    43     {       
       
    44     
       
    45     private:
       
    46     
       
    47         /** */                
       
    48         enum TValidConnectionDay
       
    49             {
       
    50             ENoConnection = 0,
       
    51             EConnectionAnyDay,
       
    52             EConnectionCurrentDay,
       
    53             EConnectionPreviousDayOnly
       
    54             };
       
    55                                   
       
    56     public:  // Constructors and destructor
       
    57 
       
    58         /**
       
    59         * Creates object from CImumMboxScheduler and leaves it to cleanup stack
       
    60         * @since S60 v3.2
       
    61         * @return, Constructed object
       
    62         */
       
    63         static CImumMboxScheduler* NewLC( 
       
    64             CImumInternalApiImpl& aMailboxApi,
       
    65             const TMsvId aMailboxId );
       
    66 
       
    67         /**
       
    68         * Create object from CImumMboxScheduler
       
    69         * @since S60 v3.2
       
    70         * @return, Constructed object
       
    71         */
       
    72         static CImumMboxScheduler* NewL( 
       
    73             CImumInternalApiImpl& aMailboxApi,
       
    74             const TMsvId aMailboxId );
       
    75 
       
    76         /**
       
    77         * Destructor
       
    78         * @since S60 v3.2
       
    79         */
       
    80         virtual ~CImumMboxScheduler();
       
    81 
       
    82     public: // New functions
       
    83             
       
    84         /**
       
    85          * Check whether the always online is on or off
       
    86          *
       
    87          * @since S60 v3.2
       
    88          * @return Online status (ETrue/EFalse)
       
    89          */
       
    90         TInt64 QueryAlwaysOnlineStateL();
       
    91             
       
    92         /**
       
    93          *
       
    94          *
       
    95          * @since S60 v3.2
       
    96          */
       
    97         TInt64 SecondsToNextMark( TTimeIntervalSeconds& aSeconds );
       
    98         
       
    99     public: // Functions from base classes
       
   100 
       
   101     protected:  // Constructors
       
   102 
       
   103         /**
       
   104         * Default constructor for classCImumMboxScheduler
       
   105         * @since S60 v3.2
       
   106         * @return, Constructed object
       
   107         */
       
   108         CImumMboxScheduler( 
       
   109             CImumInternalApiImpl& aMailboxApi,
       
   110             const TMsvId aMailboxId );
       
   111 
       
   112         /**
       
   113         * Symbian 2-phase constructor
       
   114         * @since S60 v3.2
       
   115         */
       
   116         void ConstructL();
       
   117 
       
   118     protected:  // New virtual functions
       
   119     protected:  // New functions
       
   120     protected:  // Functions from base classes
       
   121 
       
   122     private:  // New virtual functions
       
   123     private:  // New functions
       
   124 
       
   125         /**
       
   126         *
       
   127         * @since S60 v3.2
       
   128         */
       
   129         void PrepareScheduling(
       
   130             TTime& aClock,
       
   131             TTimeIntervalSeconds& aHome,
       
   132             TTimeIntervalSeconds& aStart,
       
   133             TTimeIntervalSeconds& aStop );
       
   134     
       
   135         /**
       
   136         *
       
   137         * @since S60 v3.2
       
   138         */
       
   139         TBool AlwaysOnlineOn(
       
   140             const TTime& aClock,
       
   141             TTimeIntervalSeconds& aHome,
       
   142             TTimeIntervalSeconds& aStart,
       
   143             TTimeIntervalSeconds& aStop );
       
   144                             
       
   145         /**
       
   146         *
       
   147         * @since S60 v3.2
       
   148         */
       
   149         TValidConnectionDay GetValidConnectionDay( 
       
   150             const TTime& aClock );
       
   151             
       
   152         /**
       
   153         *
       
   154         * @since S60 v3.2
       
   155         */
       
   156         TDay GetNextDay( 
       
   157             const TDay aToday, 
       
   158             const TInt aNth = 1 );
       
   159                   
       
   160         /**
       
   161         *
       
   162         * @since S60 v3.2
       
   163         */
       
   164         TDay GetPrevDay( 
       
   165             const TDay aToday, 
       
   166             const TInt aNth = 1 );
       
   167             
       
   168         /**
       
   169         *
       
   170         * @since S60 v3.2
       
   171         */
       
   172         TBool IsValidTimeToConnect( 
       
   173             const TValidConnectionDay aValidDay,
       
   174             TTimeIntervalSeconds& aHome,
       
   175             TTimeIntervalSeconds& aStart,
       
   176             TTimeIntervalSeconds& aStop );
       
   177 
       
   178         /**
       
   179         *
       
   180         * @since S60 v3.2
       
   181         */
       
   182         TDateTime AdjustHomeTime( 
       
   183             const TTime& aClock );
       
   184                 
       
   185         /**
       
   186         *
       
   187         * @since S60 v3.2
       
   188         */
       
   189         void Times2Seconds(
       
   190             const TTime& aClock,
       
   191             TTimeIntervalSeconds& aHome,
       
   192             TTimeIntervalSeconds& aStart,
       
   193             TTimeIntervalSeconds& aStop );
       
   194                     
       
   195         /**
       
   196         *
       
   197         * @since S60 v3.2
       
   198         */
       
   199         void OrganizeStartAndStopTimes(
       
   200             TTimeIntervalSeconds& aHome,
       
   201             TTimeIntervalSeconds& aStart,
       
   202             TTimeIntervalSeconds& aStop );
       
   203                         
       
   204         /**
       
   205         *
       
   206         * @since S60 v3.2
       
   207         */
       
   208         void CalculateSecondsToNextMark(
       
   209             const TInt64 aConnectionStatus,
       
   210             TTimeIntervalSeconds& aSeconds,
       
   211             const TTime& aClock,
       
   212             const TTimeIntervalSeconds& aHome,
       
   213             const TTimeIntervalSeconds& aStart,
       
   214             const TTimeIntervalSeconds& aStop );
       
   215 
       
   216         /**
       
   217         *
       
   218         * @since S60 v3.2
       
   219         */
       
   220         TTimeIntervalSeconds CalcSecsToNextScheduledDay(
       
   221             const TTime& aClock, 
       
   222             const TTimeIntervalSeconds& aHome,
       
   223             const TBool aScheduledDay );
       
   224 
       
   225         /**
       
   226         *
       
   227         * @since S60 v3.2
       
   228         */
       
   229         void CalcSecsToMark(
       
   230             TTimeIntervalSeconds& aSeconds,
       
   231             const TTime& aClock,
       
   232             const TTimeIntervalSeconds& aHome,
       
   233             const TTimeIntervalSeconds& aBonus,
       
   234             const TBool aScheduledDay );
       
   235             
       
   236     private:  // Functions from base classes
       
   237 
       
   238     public:     // Data
       
   239     protected:  // Data
       
   240     private:    // Data
       
   241 
       
   242         //
       
   243         CImumInternalApiImpl&   iMailboxApi;
       
   244         // Flags
       
   245         TMuiuFlags              iDays;
       
   246         // 
       
   247         TInt64                  iStartTime;
       
   248         //
       
   249         TInt64                  iStopTime;      
       
   250         // 
       
   251         TInt                    iActive;
       
   252         //
       
   253         TMsvId                  iMailboxId;
       
   254     };
       
   255 
       
   256 #endif //  CImumMboxScheduler_H
       
   257 
       
   258 // End of File