66
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-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: Global Data for Calendar application
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
#include "calendarui_debug.h"
|
|
18 |
#include "calenfilemapping.h"
|
|
19 |
#include "calendbchangenotifier.h" // MCalenDBChangeObserver
|
|
20 |
|
|
21 |
#include <calsession.h>
|
|
22 |
#include <calentryview.h> // Calendar Entry view
|
|
23 |
|
|
24 |
// -----------------------------------------------------------------------------
|
|
25 |
// CCalenFileMapping::CCalenFileMapping
|
|
26 |
// -----------------------------------------------------------------------------
|
|
27 |
CCalenFileMapping::CCalenFileMapping( )
|
|
28 |
{
|
|
29 |
TRACE_ENTRY_POINT
|
|
30 |
TRACE_EXIT_POINT
|
|
31 |
}
|
|
32 |
|
|
33 |
// -----------------------------------------------------------------------------
|
|
34 |
// CCalenFileMapping::NewL
|
|
35 |
// -----------------------------------------------------------------------------
|
|
36 |
CCalenFileMapping* CCalenFileMapping::NewL()
|
|
37 |
{
|
|
38 |
TRACE_ENTRY_POINT
|
|
39 |
CCalenFileMapping* selfPtr = new(ELeave) CCalenFileMapping();
|
|
40 |
CleanupStack::PushL(selfPtr);
|
|
41 |
selfPtr->ConstructL();
|
|
42 |
CleanupStack::Pop(selfPtr);
|
|
43 |
TRACE_EXIT_POINT
|
|
44 |
return selfPtr;
|
|
45 |
}
|
|
46 |
|
|
47 |
// -----------------------------------------------------------------------------
|
|
48 |
// CCalenFileMapping::ConstructL
|
|
49 |
// -----------------------------------------------------------------------------
|
|
50 |
void CCalenFileMapping::ConstructL() // second-phase constructor
|
|
51 |
{
|
|
52 |
TRACE_ENTRY_POINT
|
|
53 |
iStatus = EFalse;
|
|
54 |
iSessionPtr = NULL;
|
|
55 |
iEntryView = NULL;
|
|
56 |
|
|
57 |
if(iCalendarFileName)
|
|
58 |
{
|
|
59 |
delete iCalendarFileName;
|
|
60 |
iCalendarFileName = NULL;
|
|
61 |
}
|
|
62 |
TRACE_EXIT_POINT
|
|
63 |
}
|
|
64 |
|
|
65 |
// -----------------------------------------------------------------------------
|
|
66 |
// CCalenFileMapping::~CCalenFileMapping
|
|
67 |
// -----------------------------------------------------------------------------
|
|
68 |
CCalenFileMapping::~CCalenFileMapping()
|
|
69 |
{
|
|
70 |
TRACE_ENTRY_POINT
|
|
71 |
|
|
72 |
if( iDBChangeNotifier )
|
|
73 |
{
|
|
74 |
delete iDBChangeNotifier;
|
|
75 |
iDBChangeNotifier = NULL;
|
|
76 |
}
|
|
77 |
|
|
78 |
if(iEntryView)
|
|
79 |
{
|
|
80 |
delete iEntryView;
|
|
81 |
iEntryView = NULL;
|
|
82 |
}
|
|
83 |
|
|
84 |
if(iSessionPtr)
|
|
85 |
{
|
|
86 |
delete iSessionPtr;
|
|
87 |
iSessionPtr = NULL;
|
|
88 |
}
|
|
89 |
|
|
90 |
if(iCalendarFileName)
|
|
91 |
{
|
|
92 |
delete iCalendarFileName;
|
|
93 |
iCalendarFileName = NULL;
|
|
94 |
}
|
|
95 |
|
|
96 |
TRACE_EXIT_POINT
|
|
97 |
}
|
|
98 |
|
|
99 |
|
|
100 |
// -----------------------------------------------------------------------------
|
|
101 |
// CCalenFileMapping::GetCalendarFileName
|
|
102 |
// -----------------------------------------------------------------------------
|
|
103 |
const TDesC& CCalenFileMapping::GetCalendarFileName() const
|
|
104 |
{
|
|
105 |
TRACE_ENTRY_POINT
|
|
106 |
TRACE_EXIT_POINT
|
|
107 |
return *iCalendarFileName;
|
|
108 |
}
|
|
109 |
|
|
110 |
// -----------------------------------------------------------------------------
|
|
111 |
// CCalenFileMapping::SetCalendarFileNameL
|
|
112 |
// -----------------------------------------------------------------------------
|
|
113 |
void CCalenFileMapping::SetCalendarFileNameL(const TDesC& aCalendarFilename)
|
|
114 |
{
|
|
115 |
TRACE_ENTRY_POINT
|
|
116 |
if(iCalendarFileName)
|
|
117 |
{
|
|
118 |
delete iCalendarFileName;
|
|
119 |
iCalendarFileName = NULL;
|
|
120 |
}
|
|
121 |
iCalendarFileName = aCalendarFilename.AllocL();
|
|
122 |
TRACE_EXIT_POINT
|
|
123 |
}
|
|
124 |
|
|
125 |
// -----------------------------------------------------------------------------
|
|
126 |
// CCalenFileMapping::SetCollectionId
|
|
127 |
// -----------------------------------------------------------------------------
|
|
128 |
void CCalenFileMapping::SetCollectionId(TCalCollectionId aColId)
|
|
129 |
{
|
|
130 |
TRACE_ENTRY_POINT
|
|
131 |
iColId = aColId;
|
|
132 |
TRACE_EXIT_POINT
|
|
133 |
}
|
|
134 |
|
|
135 |
// -----------------------------------------------------------------------------
|
|
136 |
// CCalenFileMapping::GetCollectionId
|
|
137 |
// -----------------------------------------------------------------------------
|
|
138 |
TCalCollectionId CCalenFileMapping::GetCollectionId() const
|
|
139 |
{
|
|
140 |
TRACE_ENTRY_POINT
|
|
141 |
TRACE_EXIT_POINT
|
|
142 |
return iColId;
|
|
143 |
}
|
|
144 |
|
|
145 |
// -----------------------------------------------------------------------------
|
|
146 |
// CCalenFileMapping::GetStatus
|
|
147 |
// -----------------------------------------------------------------------------
|
|
148 |
TBool CCalenFileMapping::GetStatus()
|
|
149 |
{
|
|
150 |
TRACE_ENTRY_POINT
|
|
151 |
TRACE_EXIT_POINT
|
|
152 |
return iStatus;
|
|
153 |
}
|
|
154 |
|
|
155 |
// -----------------------------------------------------------------------------
|
|
156 |
// CCalenFileMapping::SetStatus
|
|
157 |
// -----------------------------------------------------------------------------
|
|
158 |
void CCalenFileMapping::SetStatus(TBool aStatus)
|
|
159 |
{
|
|
160 |
TRACE_ENTRY_POINT
|
|
161 |
iStatus = aStatus;
|
|
162 |
TRACE_EXIT_POINT
|
|
163 |
}
|
|
164 |
|
|
165 |
// -----------------------------------------------------------------------------
|
|
166 |
// CCalenFileMapping::SetEntryView
|
|
167 |
// -----------------------------------------------------------------------------
|
|
168 |
void CCalenFileMapping::SetEntryView(CCalEntryView* aEntryView)
|
|
169 |
{
|
|
170 |
TRACE_ENTRY_POINT
|
|
171 |
iEntryView = aEntryView;
|
|
172 |
TRACE_EXIT_POINT
|
|
173 |
}
|
|
174 |
|
|
175 |
// -----------------------------------------------------------------------------
|
|
176 |
// CCalenFileMapping::GetEntryView
|
|
177 |
// -----------------------------------------------------------------------------
|
|
178 |
CCalEntryView* CCalenFileMapping::GetEntryView()
|
|
179 |
{
|
|
180 |
TRACE_ENTRY_POINT
|
|
181 |
TRACE_EXIT_POINT
|
|
182 |
return iEntryView;
|
|
183 |
}
|
|
184 |
|
|
185 |
// -----------------------------------------------------------------------------
|
|
186 |
// CCalenFileMapping::SetSessionPtr
|
|
187 |
// -----------------------------------------------------------------------------
|
|
188 |
void CCalenFileMapping::SetSessionPtr(CCalSession* aSessionPtr)
|
|
189 |
{
|
|
190 |
TRACE_ENTRY_POINT
|
|
191 |
iSessionPtr = aSessionPtr;
|
|
192 |
TRACE_EXIT_POINT
|
|
193 |
}
|
|
194 |
|
|
195 |
// -----------------------------------------------------------------------------
|
|
196 |
// CCalenFileMapping::GetSessionPtr
|
|
197 |
// -----------------------------------------------------------------------------
|
|
198 |
CCalSession* CCalenFileMapping::GetSessionPtr()
|
|
199 |
{
|
|
200 |
TRACE_ENTRY_POINT
|
|
201 |
TRACE_EXIT_POINT
|
|
202 |
return iSessionPtr;
|
|
203 |
}
|
|
204 |
|
|
205 |
/*
|
|
206 |
* Set the dbchangenotifier observer
|
|
207 |
* @param CCalSession pointer to a session
|
|
208 |
*/
|
|
209 |
void CCalenFileMapping::SetDBChangeNotifier(CCalenDbChangeNotifier* aDBChangeNotifier )
|
|
210 |
{
|
|
211 |
TRACE_ENTRY_POINT;
|
|
212 |
|
|
213 |
iDBChangeNotifier = aDBChangeNotifier;
|
|
214 |
TRACE_EXIT_POINT;
|
|
215 |
}
|
|
216 |
|
|
217 |
/*
|
|
218 |
* Get the dbchangenotifier observer.
|
|
219 |
* @return CCalSession pointer to session.
|
|
220 |
*/
|
|
221 |
CCalenDbChangeNotifier *CCalenFileMapping::GetDBChangeNotifier()
|
|
222 |
{
|
|
223 |
TRACE_ENTRY_POINT;
|
|
224 |
TRACE_EXIT_POINT;
|
|
225 |
return iDBChangeNotifier;
|
|
226 |
}
|
|
227 |
|
|
228 |
//End
|