|
1 /* |
|
2 * Copyright (c) 2008 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 is the header file for the CClockDocument class. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __CLOCK_DOCUMENT_H__ |
|
19 #define __CLOCK_DOCUMENT_H__ |
|
20 |
|
21 // System includes |
|
22 #include <AknDoc.h> |
|
23 #include <eikapp.h> |
|
24 #include <s32file.h> |
|
25 #include <tz.h> |
|
26 |
|
27 // User includes |
|
28 #include "clockworldview.h" |
|
29 |
|
30 // Forward declarations |
|
31 class CClkUiAlarmModel; |
|
32 class CTzLocalizer; |
|
33 |
|
34 // Constants |
|
35 const TInt KHomeCityLength( 64 ); |
|
36 |
|
37 // Class declaration |
|
38 /** |
|
39 * @class CClockDocument |
|
40 * @brief The CAknDocument inheriting class. |
|
41 * @exe clock.exe |
|
42 */ |
|
43 class CClockDocument : public CAknDocument |
|
44 { |
|
45 public: // Constructor and destructor |
|
46 |
|
47 /** |
|
48 * @brief Performs the first phase of 2-phase construction. |
|
49 * @param aApp CEikApplication& |
|
50 * @return CClockDocument* Pointer to the object of the document |
|
51 */ |
|
52 static CClockDocument* NewL( CEikApplication& aApp ); |
|
53 |
|
54 /** |
|
55 * @brief Destructor. |
|
56 */ |
|
57 ~CClockDocument(); |
|
58 |
|
59 public: // New functions |
|
60 |
|
61 /** |
|
62 * @brief Reads the data from the document file. |
|
63 */ |
|
64 void ReadDataL(); |
|
65 |
|
66 /** |
|
67 * @brief Stores the data to the document file. |
|
68 */ |
|
69 void StoreDataL(); |
|
70 |
|
71 /** |
|
72 * @brief Returns the alarm model. |
|
73 * @return CClkUiAlarmModel* Pointer to the alarm model. |
|
74 */ |
|
75 CClkUiAlarmModel* AlarmModel(); |
|
76 |
|
77 /** |
|
78 * @brief Returns the previous alarm time. |
|
79 * @return TTime The previous alarm time. |
|
80 */ |
|
81 TTime GetPrevAlarmTime(); |
|
82 |
|
83 /** |
|
84 * @brief Sets the new alarm time value as the previous alarm time. |
|
85 * @param aPrevAlarmTime The new alarm time. |
|
86 */ |
|
87 void SetPrevAlarmTime( TTime aPrevAlarmTime ); |
|
88 |
|
89 /** |
|
90 * @brief Retrieves list of cities shown in world clock view. |
|
91 * @return CArrayPakFlat< TCityInfo >* Pointer to the list of items. |
|
92 */ |
|
93 CArrayPakFlat< TCityInfo >* GetWorldClockList(); |
|
94 |
|
95 /** |
|
96 * @brief Returns the current home city. |
|
97 * @return TBuf A buffer containing the current home city. |
|
98 */ |
|
99 const TBuf< KHomeCityLength > GetHomeCity(); |
|
100 |
|
101 /** |
|
102 * @brief Sets and updates the home city. |
|
103 * @param aCityInfo The new home city information. |
|
104 */ |
|
105 void SetHomeCityL( TCityInfo& aCityInfo ); |
|
106 |
|
107 /** |
|
108 * @brief Updates the home city. |
|
109 */ |
|
110 void UpdateHomeCityL(); |
|
111 |
|
112 /** |
|
113 * @brief Gets wether homecity item is added to the world clock view or not. |
|
114 * @return TBool ETrue if homecity item is added to the list else EFalse. |
|
115 */ |
|
116 inline TBool IsHomeCityItemAdded(); |
|
117 |
|
118 /** |
|
119 * @brief |
|
120 * @param aAddHomeCityItem |
|
121 */ |
|
122 inline void SetHomeCityItemAdded( TBool aAddHomeCityItem ); |
|
123 |
|
124 private: // New functions |
|
125 |
|
126 /** |
|
127 * @brief C++ default Constructor. |
|
128 * @param aApp CEikApplication& |
|
129 */ |
|
130 CClockDocument( CEikApplication& aApp ); |
|
131 |
|
132 /** |
|
133 * @brief Performs the second phase of 2-phase construction. May leave. |
|
134 */ |
|
135 void ConstructL(); |
|
136 |
|
137 /** |
|
138 * @brief Reads city data from stream. |
|
139 * @param aStream The stream from which data has to be read. |
|
140 * @param aCityInfo The city info read from the stream. |
|
141 * @param aTzHandle Handle to the tzserver. |
|
142 */ |
|
143 void ReadCityL( RFileReadStream& aStream, TCityInfo& aCityInfo, RTz& aTzHandle ); |
|
144 |
|
145 private: // Functions from base classes. |
|
146 |
|
147 /** |
|
148 * @brief From CEikCocument. Creates application UI class. |
|
149 */ |
|
150 CEikAppUi* CreateAppUiL(); |
|
151 |
|
152 private: // Data |
|
153 |
|
154 /** |
|
155 * @var iAlarmModel |
|
156 * @brief The alarm model object. |
|
157 */ |
|
158 CClkUiAlarmModel* iAlarmModel; |
|
159 |
|
160 /** |
|
161 * @var iPrevAlarmTime |
|
162 * @brief Holds the previous value of alarm time or 09:00 if no alarms are set. |
|
163 */ |
|
164 TInt64 iPrevAlarmTime; |
|
165 |
|
166 /** |
|
167 * @var iWorldClockList |
|
168 * @brief Contains the list of cities added in world clock view. |
|
169 */ |
|
170 CArrayPakFlat< TCityInfo >* iWorldClockList; |
|
171 |
|
172 /** |
|
173 * @var iTzLocalizer |
|
174 * @brief Pointer to CTzLocalizer class. |
|
175 */ |
|
176 CTzLocalizer* iTzLocalizer; |
|
177 |
|
178 /** |
|
179 * @var iHomeCity |
|
180 * @brief Holds the current home city. |
|
181 */ |
|
182 TBuf< KHomeCityLength > iHomeCity; |
|
183 |
|
184 /** |
|
185 * @var iHomeCityItemAdded |
|
186 * @brief Is ETrue if the homecity item is added to world clock view |
|
187 * else is EFalse. |
|
188 */ |
|
189 TBool iHomeCityItemAdded; |
|
190 }; |
|
191 |
|
192 #include "clockdocument.inl" |
|
193 |
|
194 #endif // __CLOCK_DOCUMENT_H__ |
|
195 |
|
196 // End of file |