browserutilities/feedsengine/FeedsServer/Server/inc/UpdateAllFeedsTask.h
changeset 0 dd21522fd290
child 25 0ed94ceaa377
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2005 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 the License "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:  A task to update all Feeds.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef UPDATE_ALL_FEEDS_TASK_H
       
    20 #define UPDATE_ALL_FEEDS_TASK_H
       
    21 
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 #include "LeakTracker.h"
       
    27 #include "UpdateFeedTask.h"
       
    28 #include "Task.h"
       
    29 #include "f32file.h"
       
    30 
       
    31 // CONSTANTS
       
    32 
       
    33 // MACROS
       
    34 
       
    35 // DATA TYPES
       
    36 
       
    37 // FUNCTION PROTOTYPES
       
    38 
       
    39 // FORWARD DECLARATIONS
       
    40 class CPackedFeed;
       
    41 class CUpdateFeedTask;
       
    42 class CCheckDiskSpace;
       
    43 
       
    44 // CLASS DECLARATION
       
    45 
       
    46 
       
    47 /**
       
    48 *  The UpdateAllFeedsTask's observer.
       
    49 *
       
    50 *  \b Library: FeedsEngine.lib
       
    51 *
       
    52 *  @since 3.1
       
    53 */
       
    54 class MUpdateAllFeedsTaskObserver
       
    55     {
       
    56     public: 
       
    57         /**
       
    58         * Notifies the observer that the task is about to start a lengthy 
       
    59         * operation.  In response the observer could display somekind of 
       
    60         * status indicator.
       
    61         *
       
    62         * @since 3.1
       
    63         * @return void.
       
    64         */
       
    65         //virtual void StartWait() = 0;
       
    66 
       
    67         /**
       
    68         * Called to notify the obsever how many feeds remain to be updated.
       
    69         *
       
    70         * @since 3.1
       
    71         * @param aStatusCode The completion status of the request.
       
    72         * @return Void
       
    73         */
       
    74         virtual void UpdateAllFeedsProgress(TInt aMaxCount, TInt aRemaining) = 0;
       
    75 
       
    76         /**
       
    77         * Called upon completion of the task.
       
    78         *
       
    79         * @since 3.1
       
    80         * @param aStatusCode The completion status of the request.
       
    81         * @return Void
       
    82         */
       
    83         virtual void UpdateAllFeedsCompleted(TInt aStatusCode) = 0;
       
    84 
       
    85         /**
       
    86         * Called upon start of the task.
       
    87         *
       
    88         * @since 3.1
       
    89         * @param .
       
    90         * @return connection
       
    91         */
       
    92         virtual CHttpConnection& HttpConnection() = 0;
       
    93     };
       
    94 
       
    95 
       
    96 /**
       
    97 *  A task to update a Feed.
       
    98 *
       
    99 *  \b Library: FeedsEngine.lib
       
   100 *
       
   101 *  @since 3.1
       
   102 */
       
   103 class CUpdateAllFeedsTask: public CTask, public MUpdateFeedTaskObserver
       
   104     {
       
   105     public:  // Constructors and destructor
       
   106         /**
       
   107         * Two-phased constructor.
       
   108         */
       
   109         static CUpdateAllFeedsTask* NewL(CFeedsServer& aFeedsServer, 
       
   110                 TInt aFolderListId, MUpdateAllFeedsTaskObserver& aObserver);
       
   111         
       
   112         /**
       
   113         * Two-phased constructor.
       
   114         * For a folder list, only update selected feeds
       
   115         */
       
   116         static CUpdateAllFeedsTask* NewL(CFeedsServer& aFeedsServer,
       
   117                 TInt aFolderListId, const RArray<TInt>& aFeedIds, MUpdateAllFeedsTaskObserver& aObserver);
       
   118         
       
   119         /**
       
   120         * Destructor.
       
   121         */        
       
   122         virtual ~CUpdateAllFeedsTask();
       
   123         
       
   124         
       
   125     public:  // From CTask
       
   126         /**
       
   127         * Starts the task.
       
   128         *
       
   129         * @since 3.1
       
   130         * @return Void
       
   131         */
       
   132         virtual void StartTaskL();
       
   133         
       
   134 
       
   135     public:  // From MUpdateFeedTaskObserver
       
   136         /**
       
   137         * Notifies the observer that the task is about to start a lengthy 
       
   138         * operation.  In response the observer could display somekind of 
       
   139         * status indicator.
       
   140         *
       
   141         * @since 3.1
       
   142         * @return void.
       
   143         */
       
   144         virtual void StartWait();
       
   145 
       
   146         /**
       
   147         * Called upon completion of the task.
       
   148         *
       
   149         * @since 3.1
       
   150         * @param aPackedFeed The resulting feed.  aPackedFeed is adopted by the 
       
   151         *                    implementing class.
       
   152         * @param aFeedUrl The feed's url.
       
   153         * @param aFeedId feed id
       
   154         * @param aStatusCode The completion status of the request.
       
   155         * @return Void
       
   156         */
       
   157         virtual void Completed(CPackedFeed* aPackedFeed, const TDesC& aFeedUrl,TInt aFeedId, TInt aStatusCode);
       
   158 
       
   159         /**
       
   160         * Called upon start of the task.
       
   161         *
       
   162         * @since 3.1
       
   163         * @param .
       
   164         * @return connection
       
   165         */
       
   166         virtual CHttpConnection& HttpConnection();
       
   167         
       
   168     public:
       
   169         /**
       
   170         * Adding the FeedIDs for updation .
       
   171         *
       
   172         * @since 7.1
       
   173         * @param aFeedIds.
       
   174         * @return Integer
       
   175         */
       
   176         TInt AddFeedL( RArray<TInt> aFeedIds);
       
   177 
       
   178         /**
       
   179         * Called upon completion of the task.
       
   180         *
       
   181         * @since 7.1
       
   182         * @param aStatusCode The completion status of the request.
       
   183         * @return Void
       
   184         */
       
   185         void UpdateAllFeedsCompleted(TInt aStatusCode);
       
   186 
       
   187     private:
       
   188         /**
       
   189         * C++ default constructor.
       
   190         */
       
   191         CUpdateAllFeedsTask(CFeedsServer& aFeedsServer, TInt aFolderListId, 
       
   192                 MUpdateAllFeedsTaskObserver& aObserver, TBool aSelected);
       
   193         
       
   194         /**
       
   195         * By default Symbian 2nd phase constructor is private.
       
   196         */
       
   197         void ConstructL();
       
   198 
       
   199         /**
       
   200         * Starts the update of the next feed.
       
   201         *
       
   202         * @since 3.1
       
   203         * @return void.
       
   204         */
       
   205         void UpdateNextFeedL();
       
   206 
       
   207     private:
       
   208         TLeakTracker                  iLeakTracker;
       
   209         
       
   210         MUpdateAllFeedsTaskObserver&  iObserver;
       
   211         
       
   212         TInt                          iFolderListId;
       
   213         RArray<TInt>                  iFeedIds;
       
   214         TInt                          iNextFeedIndex;
       
   215         CUpdateFeedTask*              iUpdateFeedTask;
       
   216         TBool                         iSelected;
       
   217         CCheckDiskSpace*              iCheckDiskSpace ;
       
   218     };
       
   219 
       
   220 /**
       
   221 *  Checks disk space.
       
   222 *
       
   223 *  \b Library: FeedsEngine.lib
       
   224 *
       
   225 *  @since 7.1
       
   226 */
       
   227 // CLASS DECLARATION
       
   228 class CCheckDiskSpace : public CActive
       
   229     {
       
   230     public:	// Constructors and destructor
       
   231 
       
   232         /**
       
   233         * Two-phased constructor.
       
   234         */
       
   235         static CCheckDiskSpace* NewL(CUpdateAllFeedsTask*);
       
   236 
       
   237         /**
       
   238         * Destructor.
       
   239         */
       
   240         ~CCheckDiskSpace();
       
   241 
       
   242      private://	Constructor
       
   243 
       
   244         /**
       
   245         * C++ default constructor.
       
   246         */ 	
       
   247         CCheckDiskSpace();
       
   248 
       
   249         /**
       
   250         * By default Symbian 2nd phase constructor is private.
       
   251         *
       
   252         * @param pointer to CFeedsServer class,This pointer will be used to make server sleep and to wake up server
       
   253         *
       
   254         */
       
   255         void ConstructL(CUpdateAllFeedsTask*);
       
   256 
       
   257     public:	//Functions from CActive Class
       
   258         /**
       
   259         * Handles an active object's request completion event.
       
   260         *
       
   261         * @since 7.1
       
   262         * @return void.
       
   263         */
       
   264         void RunL();
       
   265 
       
   266         /**
       
   267         * Called by CActiveScheduler when RunL() Method leaves.
       
   268         *
       
   269         * @since 7.1
       
   270         * @return void.
       
   271         */
       
   272         void RunError();
       
   273 
       
   274         /**
       
   275         * Called by CActiveScheduler when Cancel() Method is called.
       
   276         *
       
   277         * @since 7.1
       
   278         * @return void.
       
   279         */
       
   280         void DoCancel();
       
   281 
       
   282         /**
       
   283         * This method subscribe to receive event when OS level
       
   284         * when the memory in the C: drive falls below a certain level
       
   285         *
       
   286         * @since 7.1
       
   287         * @return void.
       
   288         */
       
   289         void StartListening();
       
   290 
       
   291     private:
       
   292 
       
   293         CUpdateAllFeedsTask* iUpdateAllFeedsTask;
       
   294         RFs                 iRfs;
       
   295         TBool               iIsListening;
       
   296 
       
   297     };
       
   298 
       
   299 #endif      // UPDATE_ALL_FEEDS_TASK_H
       
   300             
       
   301 // End of File