calendarui/organizerplugin/aiagendapluginengine/inc/CalenAsyncCommands.h
changeset 0 f979ecb2b13e
equal deleted inserted replaced
-1:000000000000 0:f979ecb2b13e
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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 *
       
    16 */
       
    17 
       
    18 #ifndef CALENASYNCCOMMANDS_H
       
    19 #define CALENASYNCCOMMANDS_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <calprogresscallback.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class CCalInstance;
       
    27 class CCalenEngine;
       
    28 
       
    29 
       
    30 // CLASS DEFINITION
       
    31 /**
       
    32 *  ?one_line_short_description.
       
    33 *  ?other_description_lines
       
    34 *
       
    35 *  @lib ?library
       
    36 *  @since Series ?XX ?SeriesXX_version
       
    37 **/
       
    38 NONSHARABLE_CLASS( CMultistepCommandBase ) : public CActive
       
    39 {
       
    40 public:
       
    41     virtual ~CMultistepCommandBase();
       
    42     void Start();
       
    43 
       
    44 protected:
       
    45     CMultistepCommandBase(CCalenEngine& aEngine);
       
    46     void CompleteSelf();
       
    47     virtual void Panic(TInt aReason) = 0;
       
    48 
       
    49 protected:
       
    50     CCalenEngine& iEngine;
       
    51 
       
    52     enum TPanic
       
    53     {
       
    54         EInvalidState = 0
       
    55     };
       
    56 };
       
    57 
       
    58 
       
    59 // CLASS DEFINITION
       
    60 /**
       
    61 *  ?one_line_short_description.
       
    62 *  ?other_description_lines
       
    63 *
       
    64 *  @lib ?library
       
    65 *  @since Series ?XX ?SeriesXX_version
       
    66 **/
       
    67 NONSHARABLE_CLASS( COpenCommand )
       
    68     : public CMultistepCommandBase,
       
    69       public MCalProgressCallBack
       
    70 {
       
    71 public:
       
    72     COpenCommand(CCalenEngine& aEngine);
       
    73     virtual ~COpenCommand();
       
    74 
       
    75 private: // From CActive
       
    76     void RunL();
       
    77     void DoCancel();
       
    78     TInt RunError(TInt aError);
       
    79     void Panic(TInt aReason);
       
    80 
       
    81 private: // From MCalProgressCallBack
       
    82     void Completed(TInt aError);
       
    83     void Progress(TInt /*aPercentageCompleted*/);
       
    84     virtual TBool NotifyProgress();
       
    85 
       
    86 private:
       
    87     enum TState
       
    88     {
       
    89         ECreateSession = 1,
       
    90         ECreateView,
       
    91         ESignalCaller, 
       
    92         EReady
       
    93     } iState;
       
    94 
       
    95     TInt iAgendaError;
       
    96 };
       
    97 
       
    98 
       
    99 // CLASS DEFINITION
       
   100 /**
       
   101 *  ?one_line_short_description.
       
   102 *  ?other_description_lines
       
   103 *
       
   104 *  @lib ?library
       
   105 *  @since Series ?XX ?SeriesXX_version
       
   106 **/
       
   107 NONSHARABLE_CLASS( CGetEntriesCommand ) : public CMultistepCommandBase
       
   108 {
       
   109 public:
       
   110     static CGetEntriesCommand* NewL( CCalenEngine& aEngine, 
       
   111                                      const TTime& aDay, 
       
   112                                      RPointerArray<CCalInstance>& aInstanceArray );
       
   113     virtual ~CGetEntriesCommand();
       
   114 
       
   115 private: 
       
   116     void RunL();
       
   117     void DoCancel();
       
   118     TInt RunError(TInt aError);
       
   119     void Panic(TInt aReason);
       
   120 
       
   121 private: // constructors 
       
   122     CGetEntriesCommand( CCalenEngine& aEngine, 
       
   123                         const TTime& aDay, 
       
   124                         RPointerArray<CCalInstance>& aInstanceArray );
       
   125 private:
       
   126     enum TState
       
   127     {
       
   128         EFetch = 1,
       
   129         EFinalize,
       
   130         ESignalCaller,
       
   131         EReady
       
   132     } iState;
       
   133 
       
   134     TTime iDay;
       
   135     RPointerArray<CCalInstance>& iInstanceArray;  // not owned - only append allowed!
       
   136 
       
   137 };
       
   138 
       
   139 
       
   140 // CLASS DEFINITION
       
   141 /**
       
   142 *  ?one_line_short_description.
       
   143 *  ?other_description_lines
       
   144 *
       
   145 *  @lib ?library
       
   146 *  @since Series ?XX ?SeriesXX_version
       
   147 **/
       
   148 NONSHARABLE_CLASS( CGetNextEventCommand ) : public CMultistepCommandBase
       
   149 {
       
   150 public:
       
   151     static CGetNextEventCommand* NewL( CCalenEngine& aEngine, 
       
   152                                        const TTime& aStartDay, 
       
   153                                        const TInt aDaysToSearch, 
       
   154                                        RPointerArray<CCalInstance>& aInstanceArray );
       
   155     virtual ~CGetNextEventCommand(void);
       
   156 
       
   157 private:
       
   158     void RunL(void);
       
   159     void DoCancel(void);
       
   160     TInt RunError(TInt aError);
       
   161     void Panic(TInt aReason);
       
   162 
       
   163 private: // constructors
       
   164     CGetNextEventCommand( CCalenEngine& aEngine, 
       
   165                           const TTime& aStartDay, 
       
   166                           const TInt aDaysToSearch, 
       
   167                           RPointerArray<CCalInstance>& aInstanceArray );
       
   168 
       
   169 private:
       
   170     enum TState
       
   171     {
       
   172         EFetch = 1,
       
   173         EFinalize,
       
   174         ESignalCaller,
       
   175         EReady
       
   176     } iState;
       
   177 
       
   178     TTime iStartDay;
       
   179     TInt iDaysToSearch;
       
   180 
       
   181     RPointerArray<CCalInstance>& iInstanceArray;  // not owned - only append allowed!
       
   182     RPointerArray<CCalInstance> iTmpArray;
       
   183 
       
   184 };
       
   185 
       
   186 
       
   187 // CLASS DEFINITION
       
   188 /**
       
   189 *  ?one_line_short_description.
       
   190 *  ?other_description_lines
       
   191 *
       
   192 *  @lib ?library
       
   193 *  @since Series ?XX ?SeriesXX_version
       
   194 **/
       
   195 NONSHARABLE_CLASS( CGetTodosCommand ) : public CMultistepCommandBase
       
   196 {
       
   197 public:
       
   198     static CGetTodosCommand* NewL( CCalenEngine& aEngine,
       
   199                                    RPointerArray<CCalInstance>& aInstanceArray );
       
   200     virtual ~CGetTodosCommand();
       
   201 
       
   202 private: 
       
   203     void RunL();
       
   204     void DoCancel();
       
   205     TInt RunError(TInt aError);
       
   206     void Panic(TInt aReason);
       
   207 
       
   208 private: // constructors 
       
   209     CGetTodosCommand(CCalenEngine& aEngine, RPointerArray<CCalInstance>& aInstanceArray); 
       
   210 
       
   211 private:
       
   212     enum TState
       
   213     {
       
   214         EFetchInstances = 1,
       
   215         ESignalCaller,
       
   216         EReady
       
   217     } iState;
       
   218 
       
   219     RPointerArray<CCalInstance>& iInstanceArray;  // not owned - only append allowed!
       
   220 
       
   221 };
       
   222 
       
   223 // CLASS DEFINITION
       
   224 /**
       
   225 *  ?one_line_short_description.
       
   226 *  ?other_description_lines
       
   227 *
       
   228 *  @lib ?library
       
   229 *  @since S60 3.1
       
   230 **/
       
   231 NONSHARABLE_CLASS( CGetEntriesForDaysCommand ) : public CMultistepCommandBase
       
   232 {
       
   233 public:
       
   234     static CGetEntriesForDaysCommand* NewL( CCalenEngine& aEngine, 
       
   235                                             RPointerArray<CCalInstance>& aInstanceArray,
       
   236                                             const TTime& aDay, 
       
   237                                             TInt aDaysToSearch );
       
   238     virtual ~CGetEntriesForDaysCommand();
       
   239 
       
   240 private: 
       
   241     void RunL();
       
   242     void DoCancel();
       
   243     TInt RunError(TInt aError);
       
   244     void Panic(TInt aReason);
       
   245 
       
   246 private: // constructors 
       
   247     CGetEntriesForDaysCommand( CCalenEngine& aEngine, 
       
   248                                RPointerArray<CCalInstance>& aInstanceArray,
       
   249                                const TTime& aDay, 
       
   250                                TInt aDaysToSearch );
       
   251 private:
       
   252     enum TState
       
   253     {
       
   254         EFetch = 1,
       
   255         EFinalize,
       
   256         ESignalCaller,
       
   257         EReady
       
   258     } iState;
       
   259 
       
   260     RPointerArray<CCalInstance>& iInstanceArray;  // not owned - only append allowed!
       
   261     TTime iDay;
       
   262     TInt iDaysToSearch;
       
   263 
       
   264 };
       
   265 
       
   266 #endif // CALENASYNCCOMMANDS_H
       
   267 
       
   268 
       
   269 // End of File