calendarui/server/CalenSvr/inc/CalenServer.h
changeset 0 f979ecb2b13e
child 5 42814f902fe6
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:   This class represents as calendar server.
       
    15 *                Creates DB , Boot and missed alarm manager
       
    16 *                Manages IPC messages with clients.
       
    17 *
       
    18 */
       
    19 
       
    20 
       
    21 
       
    22 #ifndef CALENSERVER_H
       
    23 #define CALENSERVER_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <badesca.h>
       
    27 #include <calenmulticaluids.hrh>
       
    28 
       
    29 // INCLUDES
       
    30 #include "CalenSvrDef.h"
       
    31 #include "CalenSvrDBManager.h"
       
    32 
       
    33 // CONSTANTS
       
    34 const TInt KCalenServerMajorVN(1);
       
    35 const TInt KCalenServerMinorVN(1);
       
    36 const TInt KCalenServerBuildVN(1);
       
    37 
       
    38 // FORWARD DECLARATIONS 
       
    39 class CCalenSvrBootManager;
       
    40 class CCalenSvrDBManager;
       
    41 //class CCalenSvrAlarmManager;
       
    42 class CCalenSvrMissedAlarmManager;
       
    43 class CCalCalendarInfo;
       
    44 
       
    45 // CLASS DEFINITION
       
    46 NONSHARABLE_CLASS( CCalenServer ) : public CServer2
       
    47     {
       
    48 public:
       
    49     static CCalenServer* NewL();
       
    50     virtual ~CCalenServer();
       
    51 
       
    52     void BootReadyL();
       
    53     void PanicClient(const RMessage2& aMessage, TInt aPanic) const;
       
    54 
       
    55     void RegisterUserL(CCalenSvrDBManager::MCalenDBUser& aUser);
       
    56     void UnregisterUserL(CCalenSvrDBManager::MCalenDBUser& aUser);
       
    57 
       
    58     /**
       
    59     *   Returns the current message.
       
    60     *   @return  Current IPC message
       
    61     */
       
    62     const RMessage2 ServerMessage() const;
       
    63 
       
    64 private:
       
    65     CCalenServer(TInt aPriority);
       
    66     void ConstructL();
       
    67     
       
    68     /**
       
    69      * @brief checks for first start up by reading 
       
    70      * the information from cenrep key
       
    71      *  
       
    72      * @param aFirstStartup returns whether its first start up or not
       
    73      */
       
    74     void CheckForFirstStartUpL(TBool& aFirstStartUp);
       
    75     
       
    76     /**
       
    77      * @brief Sets first start up cenrep key
       
    78      *  
       
    79      * @param aFirstStartup holds the startup status
       
    80      */
       
    81     void SetFirstStartUpL(TBool aFirstStartUp);
       
    82     
       
    83     /**
       
    84      * @brief create default calendar files
       
    85      *  
       
    86      * @return TInt return error code 
       
    87      */
       
    88     TInt CreateCalendarFilesL();
       
    89     
       
    90     /**
       
    91      * @brief read calendar names from central repository
       
    92      * 
       
    93      * @param aCalendarNames a reference to the calendar names list
       
    94      */
       
    95     void ReadCalendarNamesFromCenrepL(CDesC16ArrayFlat& aCalendarNames);
       
    96     
       
    97     /**
       
    98      * @brief read calendar colors from central repository
       
    99      * 
       
   100      * @param aCalendarColors a reference to calendar colors list
       
   101      */
       
   102     void ReadCalendarColorsFromCenrepL(RArray<TInt>& aCalendarColors);
       
   103     
       
   104     /**
       
   105      * @brief populate calendar names list from central repository buffer
       
   106      * 
       
   107      * @param aRepositoryBuffer a reference to central repository buffer
       
   108      * @param aCalendarNames a reference to calendar names list
       
   109      */
       
   110     void PopulateCalendarNamesListL( const TDesC& aRepositoryBuffer ,
       
   111             CDesC16ArrayFlat& aCalendarNames );
       
   112     
       
   113     /**
       
   114      * @brief populate calendar colors list from central repository buffer
       
   115      * 
       
   116      * @param aRepositoryBuffer a reference to central repository buffer
       
   117      * @param aCalendarColors a reference to calendar colors list
       
   118      */
       
   119     void PopulateCalendarColorListL( const TDesC& aRepositoryBuffer,
       
   120                     RArray<TInt>& aCalendarColors );
       
   121     
       
   122     
       
   123 	/**
       
   124 	 * @brief set the calendar properties for default calendars.
       
   125 	 * @param aCalendarInfo a reference to CCalCalendarInfo. 
       
   126 	 */
       
   127     void SetCalendarAddPropertiesL(CCalCalendarInfo& aCalendarInfo);
       
   128     
       
   129 private: // From CServer2
       
   130     CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; 
       
   131     TInt RunError(TInt aErr);
       
   132 
       
   133 private: // Data
       
   134     // Own. Handles boot time tasks in asynchronous fashion
       
   135     CCalenSvrBootManager* iBootManager;
       
   136     CCalenSvrDBManager* iDBManager;
       
   137     //CCalenSvrAlarmManager* iAlarmManager;
       
   138     CCalenSvrMissedAlarmManager* iMissedAlarmHandler;
       
   139 
       
   140     };
       
   141 
       
   142 #endif // CALENSERVER_H
       
   143 
       
   144 
       
   145 // End of File