|
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 #include <calfilechangenotification.h> // MCalFileChangeObserver |
|
29 |
|
30 // INCLUDES |
|
31 #include "CalenSvrDef.h" |
|
32 #include "CalenSvrDBManager.h" |
|
33 |
|
34 // CONSTANTS |
|
35 const TInt KCalenServerMajorVN(1); |
|
36 const TInt KCalenServerMinorVN(1); |
|
37 const TInt KCalenServerBuildVN(1); |
|
38 |
|
39 // FORWARD DECLARATIONS |
|
40 class CCalenSvrBootManager; |
|
41 class CCalenSvrDBManager; |
|
42 //class CCalenSvrAlarmManager; |
|
43 class CCalenSvrMissedAlarmManager; |
|
44 class CCalCalendarInfo; |
|
45 class CCalFileChangeInfo; |
|
46 class CCalSession; |
|
47 |
|
48 // CLASS DEFINITION |
|
49 NONSHARABLE_CLASS( CCalenServer ) : public CServer2, |
|
50 public MCalFileChangeObserver |
|
51 { |
|
52 public: |
|
53 static CCalenServer* NewL(); |
|
54 virtual ~CCalenServer(); |
|
55 |
|
56 void BootReadyL(); |
|
57 void PanicClient(const RMessage2& aMessage, TInt aPanic) const; |
|
58 |
|
59 void RegisterUserL(CCalenSvrDBManager::MCalenDBUser& aUser); |
|
60 void UnregisterUserL(CCalenSvrDBManager::MCalenDBUser& aUser); |
|
61 |
|
62 /** |
|
63 * Returns the current message. |
|
64 * @return Current IPC message |
|
65 */ |
|
66 const RMessage2 ServerMessage() const; |
|
67 |
|
68 public: |
|
69 /** |
|
70 * @brief From MCalFileChangeObserver |
|
71 * The callback that will recieve 1 or more file change notifications |
|
72 * |
|
73 * @param aCalendarInfoChangeEntries Holds the information about the |
|
74 * calendar info changes |
|
75 */ |
|
76 void CalendarInfoChangeNotificationL( |
|
77 RPointerArray<CCalFileChangeInfo>& aCalendarInfoChangeEntries); |
|
78 |
|
79 |
|
80 private: |
|
81 CCalenServer(TInt aPriority); |
|
82 void ConstructL(); |
|
83 |
|
84 /** |
|
85 * @brief checks for first start up by reading |
|
86 * the information from cenrep key |
|
87 * |
|
88 * @param aFirstStartup returns whether its first start up or not |
|
89 */ |
|
90 void CheckForFirstStartUpL(TBool& aFirstStartUp); |
|
91 |
|
92 /** |
|
93 * @brief Sets first start up cenrep key |
|
94 * |
|
95 * @param aFirstStartup holds the startup status |
|
96 */ |
|
97 void SetFirstStartUpL(TBool aFirstStartUp); |
|
98 |
|
99 /** |
|
100 * @brief create default calendar files |
|
101 * |
|
102 * @return TInt return error code |
|
103 */ |
|
104 TInt CreateCalendarFilesL(); |
|
105 |
|
106 /** |
|
107 * @brief read calendar names from central repository |
|
108 * |
|
109 * @param aCalendarNames a reference to the calendar names list |
|
110 */ |
|
111 void ReadCalendarNamesFromResourceL(CDesC16ArrayFlat& aCalendarNames); |
|
112 |
|
113 /** |
|
114 * @brief read calendar colors from central repository |
|
115 * |
|
116 * @param aCalendarColors a reference to calendar colors list |
|
117 */ |
|
118 void ReadCalendarColorsFromCenrepL(RArray<TInt>& aCalendarColors); |
|
119 |
|
120 /** |
|
121 * @brief populate calendar colors list from central repository buffer |
|
122 * |
|
123 * @param aRepositoryBuffer a reference to central repository buffer |
|
124 * @param aCalendarColors a reference to calendar colors list |
|
125 */ |
|
126 void PopulateCalendarColorListL( const TDesC& aRepositoryBuffer, |
|
127 RArray<TInt>& aCalendarColors ); |
|
128 |
|
129 |
|
130 /** |
|
131 * @brief set the calendar properties for default calendars. |
|
132 * @param aCalendarInfo a reference to CCalCalendarInfo. |
|
133 */ |
|
134 void SetCalendarAddPropertiesL(CCalCalendarInfo& aCalendarInfo); |
|
135 |
|
136 private: // From CServer2 |
|
137 CSession2* NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const; |
|
138 TInt RunError(TInt aErr); |
|
139 |
|
140 private: // Data |
|
141 // Own. Handles boot time tasks in asynchronous fashion |
|
142 CCalenSvrBootManager* iBootManager; |
|
143 CCalenSvrDBManager* iDBManager; |
|
144 //CCalenSvrAlarmManager* iAlarmManager; |
|
145 CCalenSvrMissedAlarmManager* iMissedAlarmHandler; |
|
146 |
|
147 //session used for listening the file change notifications. |
|
148 CCalSession* iSession; |
|
149 |
|
150 }; |
|
151 |
|
152 #endif // CALENSERVER_H |
|
153 |
|
154 |
|
155 // End of File |