63 // Register for the entry change signal when the same entry is updated |
61 // Register for the entry change signal when the same entry is updated |
64 // by other application.This is to handle the db conflict changes. |
62 // by other application.This is to handle the db conflict changes. |
65 connect( |
63 connect( |
66 mAgendaUtil, SIGNAL(entriesChanged(QList<ulong> )), |
64 mAgendaUtil, SIGNAL(entriesChanged(QList<ulong> )), |
67 this, SLOT(handleEntriesChanged(QList<ulong> ))); |
65 this, SLOT(handleEntriesChanged(QList<ulong> ))); |
68 |
66 |
69 qDebug() <<"AgendaEventViewerPrivate::AgendaEventViewerPrivate <--"; |
67 // Register for the calenInstance view creation sucessfully |
|
68 connect( |
|
69 mAgendaUtil, SIGNAL(entryViewCreationCompleted(int)), |
|
70 this, SLOT(viewCreationCompleted(int))); |
|
71 |
70 } |
72 } |
71 |
73 |
72 /*! |
74 /*! |
73 Destructor. |
75 Destructor. |
74 */ |
76 */ |
75 AgendaEventViewerPrivate::~AgendaEventViewerPrivate() |
77 AgendaEventViewerPrivate::~AgendaEventViewerPrivate() |
76 { |
78 { |
77 qDebug() <<"AgendaEventViewerPrivate::~AgendaEventViewerPrivate -->"; |
|
78 |
79 |
79 if (mViewerOwnsAgendaUtil) { |
80 if (mViewerOwnsAgendaUtil) { |
80 delete mAgendaUtil; |
81 delete mAgendaUtil; |
81 mAgendaUtil = 0; |
82 mAgendaUtil = 0; |
82 } |
83 } |
83 |
84 |
84 qDebug() <<"AgendaEventViewerPrivate::~AgendaEventViewerPrivate <--"; |
|
85 } |
85 } |
86 |
86 |
87 /*! |
87 /*! |
88 Launches the event viewer.Id is used for fetching |
88 Launches the event viewer.Id is used for fetching |
89 the calendar entry information. |
89 the calendar entry information. |
91 \param id Local Uid of the calendar entry to be viewed |
91 \param id Local Uid of the calendar entry to be viewed |
92 */ |
92 */ |
93 void AgendaEventViewerPrivate::view(const ulong id, |
93 void AgendaEventViewerPrivate::view(const ulong id, |
94 AgendaEventViewer::Actions action) |
94 AgendaEventViewer::Actions action) |
95 { |
95 { |
96 qDebug() <<"AgendaEventViewerPrivate::view(id) -->"; |
|
97 |
96 |
98 AgendaEntry entry = mAgendaUtil->fetchById(id); |
97 AgendaEntry entry = mAgendaUtil->fetchById(id); |
99 |
98 |
100 if (entry.isNull()) { |
99 if (entry.isNull()) { |
|
100 // save the entries , to show the entry once instances are created |
|
101 // if entry is null exit ,later call back comes in viewCreationCompleted |
|
102 mAction = action; |
|
103 mId =id; |
|
104 //to avoid view creation multiple times |
|
105 mShowEventViewById = true; |
101 return; |
106 return; |
102 } |
107 } |
103 // Construct the agenda event view |
108 // Construct the agenda event view |
104 mAgendaEventView = new AgendaEventView(this); |
109 mAgendaEventView = new AgendaEventView(this); |
105 mAgendaEventView->execute(entry, action); |
110 mAgendaEventView->execute(entry, action); |
106 |
111 |
107 qDebug() <<"AgendaEventViewerPrivate::view(id) <--"; |
|
108 } |
112 } |
109 |
113 |
110 /*! |
114 /*! |
111 Launches the event viewer.File handle of any vcs/ics |
115 Launches the event viewer.File handle of any vcs/ics |
112 file can be given as input to view the calendar entry information. |
116 file can be given as input to view the calendar entry information. |
114 \param fileHandle reference to the file handle of vcs/ics file |
118 \param fileHandle reference to the file handle of vcs/ics file |
115 */ |
119 */ |
116 void AgendaEventViewerPrivate::view(const QFile &fileHandle, |
120 void AgendaEventViewerPrivate::view(const QFile &fileHandle, |
117 AgendaEventViewer::Actions action) |
121 AgendaEventViewer::Actions action) |
118 { |
122 { |
119 qDebug() <<"AgendaEventViewerPrivate::view(fileHandle) -->"; |
|
120 |
123 |
121 // Using calendar importer read the filehandle and generate agenda entry |
124 // Using calendar importer read the filehandle and generate agenda entry |
122 QString filePath = fileHandle.fileName(); |
125 QString filePath = fileHandle.fileName(); |
123 QString nativeFilePath = QDir::toNativeSeparators(filePath); |
126 QString nativeFilePath = QDir::toNativeSeparators(filePath); |
124 AgendaEntry entry; |
127 AgendaEntry entry; |
125 mAgendaUtil->importvCalendar(nativeFilePath, entry); |
128 mAgendaUtil->importvCalendar(nativeFilePath, entry); |
126 if (!entry.isNull()) { |
129 if (!entry.isNull()) { |
127 mAgendaEventView = new AgendaEventView(this); |
130 mAgendaEventView = new AgendaEventView(this); |
128 mAgendaEventView->execute(entry, action); |
131 mAgendaEventView->execute(entry, action); |
129 } else { |
132 } else { |
130 q_ptr->viewingCompleted(QDateTime::currentDateTime().date()); |
133 //store the file name |
131 } |
134 mFileName = filePath ; |
132 qDebug() <<"AgendaEventViewerPrivate::view(fileHandle) <--"; |
135 mAction = action ; |
|
136 mShowEventViewByFileHandle = true; |
|
137 q_ptr->viewingCompleted(QDateTime::currentDateTime().date()); |
|
138 } |
133 } |
139 } |
134 |
140 |
135 /*! |
141 /*! |
136 Launches the event viewer.AgendaEntry can be given as input to view the |
142 Launches the event viewer.AgendaEntry can be given as input to view the |
137 calendar entry information |
143 calendar entry information |
138 */ |
144 */ |
139 void AgendaEventViewerPrivate::view(AgendaEntry entry, |
145 void AgendaEventViewerPrivate::view(AgendaEntry entry, |
140 AgendaEventViewer::Actions action) |
146 AgendaEventViewer::Actions action) |
141 { |
147 { |
142 qDebug() <<"AgendaEventViewerPrivate::view(entry) -->"; |
|
143 |
148 |
144 if (entry.isNull()) { |
149 if (entry.isNull()) { |
145 return; |
150 return; |
146 } |
151 } |
147 // Construct the agenda event view |
152 // Construct the agenda event view |
148 mAgendaEventView = new AgendaEventView(this); |
153 mAgendaEventView = new AgendaEventView(this); |
149 mAgendaEventView->execute(entry, action); |
154 mAgendaEventView->execute(entry, action); |
150 |
155 |
151 qDebug() <<"AgendaEventViewerPrivate::view(entry) <--"; |
|
152 } |
156 } |
153 |
157 |
154 /*! |
158 /*! |
155 Emits the signal viewing completed to the clients |
159 Emits the signal viewing completed to the clients |
156 |
160 |
157 \param status true if viewing completed otherwise false. |
161 \param status true if viewing completed otherwise false. |
158 */ |
162 */ |
159 void AgendaEventViewerPrivate::viewingCompleted(const QDate date) |
163 void AgendaEventViewerPrivate::viewingCompleted(const QDate date) |
160 { |
164 { |
161 qDebug() <<"AgendaEventViewerPrivate::viewingCompleted -->"; |
|
162 |
165 |
163 emit q_ptr->viewingCompleted(date); |
166 emit q_ptr->viewingCompleted(date); |
164 |
167 |
165 // Cleanup viewer. |
168 // Cleanup viewer. |
166 if (mAgendaEventView) { |
169 if (mAgendaEventView) { |
167 mAgendaEventView->deleteLater(); |
170 mAgendaEventView->deleteLater(); |
168 } |
171 } |
169 |
172 |
170 qDebug() <<"AgendaEventViewerPrivate::viewingCompleted -->"; |
|
171 } |
173 } |
172 |
174 |
173 /*! |
175 /*! |
174 Emits the signal editing started to the clients |
176 Emits the signal editing started to the clients |
175 */ |
177 */ |
176 void AgendaEventViewerPrivate::editingStarted() |
178 void AgendaEventViewerPrivate::editingStarted() |
177 { |
179 { |
178 qDebug() <<"AgendaEventViewerPrivate::editingStarted -->"; |
|
179 |
180 |
180 emit q_ptr->editingStarted(); |
181 emit q_ptr->editingStarted(); |
181 |
182 |
182 qDebug() <<"AgendaEventViewerPrivate::editingStarted -->"; |
|
183 } |
183 } |
184 |
184 |
185 /*! |
185 /*! |
186 Emits the signal editing completed to the clients |
186 Emits the signal editing completed to the clients |
187 */ |
187 */ |
188 void AgendaEventViewerPrivate::editingCompleted() |
188 void AgendaEventViewerPrivate::editingCompleted() |
189 { |
189 { |
190 qDebug() <<"AgendaEventViewerPrivate::editingCompleted -->"; |
|
191 |
190 |
192 emit q_ptr->editingCompleted(); |
191 emit q_ptr->editingCompleted(); |
193 |
192 |
194 qDebug() <<"AgendaEventViewerPrivate::editingCompleted -->"; |
|
195 } |
193 } |
196 |
194 |
197 /*! |
195 /*! |
198 Emits the signal deleting started to the clients |
196 Emits the signal deleting started to the clients |
199 */ |
197 */ |
200 void AgendaEventViewerPrivate::deletingStarted() |
198 void AgendaEventViewerPrivate::deletingStarted() |
201 { |
199 { |
202 qDebug() <<"AgendaEventViewerPrivate::deletingStarted -->"; |
|
203 |
200 |
204 emit q_ptr->deletingStarted(); |
201 emit q_ptr->deletingStarted(); |
205 |
202 |
206 qDebug() <<"AgendaEventViewerPrivate::deletingStarted -->"; |
|
207 } |
203 } |
208 |
204 |
209 /*! |
205 /*! |
210 Emits the signal deleting completed to the clients |
206 Emits the signal deleting completed to the clients |
211 */ |
207 */ |
212 void AgendaEventViewerPrivate::deletingCompleted() |
208 void AgendaEventViewerPrivate::deletingCompleted() |
213 { |
209 { |
214 qDebug() <<"AgendaEventViewerPrivate::deletingCompleted -->"; |
|
215 |
210 |
216 emit q_ptr->deletingCompleted(); |
211 emit q_ptr->deletingCompleted(); |
217 |
212 |
218 qDebug() <<"AgendaEventViewerPrivate::deletingCompleted -->"; |
213 } |
219 } |
214 |
220 |
215 |
|
216 /*! |
|
217 calls when instances of calenInstanceview and |
|
218 entryInstanceview is created successfully |
|
219 */ |
|
220 void AgendaEventViewerPrivate::viewCreationCompleted(int error) |
|
221 { |
|
222 |
|
223 if((KErrNone == error)) |
|
224 { |
|
225 AgendaEntry entry; |
|
226 if (mShowEventViewById) |
|
227 { |
|
228 entry = mAgendaUtil->fetchById(mId); |
|
229 } |
|
230 else if(mShowEventViewByFileHandle) |
|
231 { |
|
232 QString nativeFilePath = QDir::toNativeSeparators(mFileName); |
|
233 mAgendaUtil->importvCalendar(nativeFilePath, entry); |
|
234 } |
|
235 //if entry is there , then show the view |
|
236 if (!entry.isNull()) |
|
237 { |
|
238 mAgendaEventView = new AgendaEventView(this); |
|
239 mAgendaEventView->execute(entry, mAction); |
|
240 } |
|
241 } |
|
242 //reset the variables |
|
243 mId = 0; |
|
244 mFileName.clear(); |
|
245 mShowEventViewById = false; |
|
246 mShowEventViewByFileHandle = false; |
|
247 mAction = AgendaEventViewer::ActionNothing; |
|
248 } |
221 // End of file |
249 // End of file |