35 #include <hbi18ndef.h> |
37 #include <hbi18ndef.h> |
36 #include <HbRadioButtonList> |
38 #include <HbRadioButtonList> |
37 #include <HbMessageBox> |
39 #include <HbMessageBox> |
38 #include <HbDialog> |
40 #include <HbDialog> |
39 #include <HbLabel> |
41 #include <HbLabel> |
40 #include <QFile> |
42 #include <HbTranslator> |
41 #include <QString> |
43 |
42 #include <QIcon> |
|
43 #include <QPainter> |
|
44 #include <QPixmap> |
|
45 // User includes |
44 // User includes |
|
45 #include <maptileservice.h>//maptile service |
46 #include <agendautil.h> |
46 #include <agendautil.h> |
47 #include <noteseditor.h> |
47 #include <NotesEditorInterface> |
48 #include <caleneditor.h> |
48 #include <caleneditor.h> |
49 #include "agendaeventview.h" |
49 #include "agendaeventview.h" |
50 #include "agendaeventviewerdocloader.h" |
50 #include "agendaeventviewerdocloader.h" |
51 #include "agendaeventviewercommon.h" |
51 #include "agendaeventviewercommon.h" |
52 #include "agendaeventviewer_p.h" |
52 #include "agendaeventviewer_p.h" |
53 #include "agendaeventvieweritem.h" |
53 #include "agendaeventvieweritem.h" |
54 #include "calendateutils.h" |
54 #include "calendateutils.h" |
55 |
|
56 //maptile service |
|
57 #include <maptileservice.h> |
|
58 // Constants |
55 // Constants |
59 #define CHARACTER_HYPHEN "-" |
56 #define CHARACTER_HYPHEN "-" |
60 #define CHARACTER_SPACE " " |
57 #define CHARACTER_SPACE " " |
61 #define CHARACTER_NEW_LINE "\n" |
58 #define CHARACTER_NEW_LINE "\n" |
62 |
59 |
63 // This is used to set the maptile image height and width , |
60 //This Property is use for setting a primary left icon |
64 //because HbLabel by default not displaying the actual size of image |
61 static const char *primaryLeftIconItem("leftPrimaryIconItem"); |
65 const int height = 128; |
62 |
66 const int width = 330; |
|
67 /*! |
63 /*! |
68 \class AgendaEventView. |
64 \class AgendaEventView. |
69 |
65 |
70 Responsible for viewing viewing agenda entries. This is friend of |
66 Responsible for viewing viewing agenda entries. This is friend of |
71 AgendaEventViewerPrivate and it handles all the cases |
67 AgendaEventViewerPrivate and it handles all the cases |
137 mDocLoader->findWidget(AGENDA_EVENT_VIEWER_SCROLLAREA_CONTENTS)); |
133 mDocLoader->findWidget(AGENDA_EVENT_VIEWER_SCROLLAREA_CONTENTS)); |
138 |
134 |
139 mLinearLayout = |
135 mLinearLayout = |
140 static_cast<QGraphicsLinearLayout *> (scrollAreaWidget->layout()); |
136 static_cast<QGraphicsLinearLayout *> (scrollAreaWidget->layout()); |
141 |
137 |
142 MapTileService::AppType appType; |
138 |
143 appType = MapTileService::AppTypeCalendar; |
139 //maptile service object , to retrive maptile path from database. |
144 mLocationFeatureEnabled = MapTileService::isLocationFeatureEnabled(appType); |
140 mMaptileService= new MapTileService(); |
145 |
141 mLocationFeatureEnabled = mMaptileService->isLocationFeatureEnabled( |
|
142 MapTileService::AppTypeCalendar); |
|
143 if (mLocationFeatureEnabled) { |
|
144 //timer to run progress indicator icon. |
|
145 mProgressTimer = new QTimer(this); |
|
146 mProgressTimer->setSingleShot(true); |
|
147 connect(mProgressTimer, SIGNAL(timeout()), this, SLOT(updateProgressIndicator())); |
|
148 } |
146 |
149 |
147 qDebug() << "AgendaEventViewer: AgendaEventView::AgendaEventView <--"; |
|
148 |
150 |
149 } |
151 } |
150 |
152 |
151 /*! |
153 /*! |
152 Destructor. |
154 Destructor. |
153 */ |
155 */ |
154 AgendaEventView::~AgendaEventView() |
156 AgendaEventView::~AgendaEventView() |
155 { |
157 { |
156 qDebug() << "AgendaEventViewer: AgendaEventView::~AgendaEventView -->"; |
|
157 |
158 |
158 // Remove the translator |
159 // Remove the translator |
159 HbApplication::instance()->removeTranslator(mTranslator); |
|
160 if (mTranslator) { |
160 if (mTranslator) { |
161 delete mTranslator; |
161 delete mTranslator; |
162 mTranslator = 0; |
162 mTranslator = 0; |
163 } |
163 } |
164 |
164 |
165 mDocLoader->reset(); |
165 mDocLoader->reset(); |
166 delete mDocLoader; |
166 delete mDocLoader; |
167 |
167 |
|
168 // Unload notes editor if loaded. |
|
169 if (mNotesEditorPluginLoader) { |
|
170 mNotesEditorPluginLoader->unload(); |
|
171 delete mNotesEditorPluginLoader; |
|
172 mNotesEditorPluginLoader = 0; |
|
173 } |
|
174 |
168 // Delete the mainwindow if we have created any |
175 // Delete the mainwindow if we have created any |
169 if (mMainWindow) { |
176 if (mMainWindow) { |
170 delete mMainWindow; |
177 delete mMainWindow; |
171 mMainWindow = NULL; |
178 mMainWindow = NULL; |
172 } |
179 } |
173 |
180 |
174 qDebug() << "AgendaEventViewer: AgendaEventView::~AgendaEventView <--"; |
181 if (mMaptileService) { |
|
182 delete mMaptileService; |
|
183 mMaptileService = NULL; |
|
184 } |
|
185 |
|
186 if (mProgressTimer) { |
|
187 delete mProgressTimer; |
|
188 mProgressTimer = NULL; |
|
189 } |
|
190 |
175 } |
191 } |
176 |
192 |
177 /*! |
193 /*! |
178 Displays the to-do viewer and populates the to-do entry attributes. |
194 Displays the to-do viewer and populates the to-do entry attributes. |
179 |
195 |
180 \param entry Agenda entry from which attributes have to be read. |
196 \param entry Agenda entry from which attributes have to be read. |
181 */ |
197 */ |
182 void AgendaEventView::execute(AgendaEntry entry, |
198 void AgendaEventView::execute(AgendaEntry entry, |
183 AgendaEventViewer::Actions action) |
199 AgendaEventViewer::Actions action) |
184 { |
200 { |
185 qDebug() << "AgendaEventViewer: AgendaEventView::execute -->"; |
|
186 |
201 |
187 mOriginalAgendaEntry = entry; |
202 mOriginalAgendaEntry = entry; |
188 mAgendaEntry = entry; |
203 mAgendaEntry = entry; |
189 |
204 |
190 // Add the viewer data reading from the agenda entry. |
205 // Add the viewer data reading from the agenda entry. |
220 // Might be some non-ui based app called us |
232 // Might be some non-ui based app called us |
221 // so create mainwindow now |
233 // so create mainwindow now |
222 mMainWindow = new HbMainWindow(); |
234 mMainWindow = new HbMainWindow(); |
223 mMainWindow->addView(mViewer); |
235 mMainWindow->addView(mViewer); |
224 mMainWindow->setCurrentView(mViewer); |
236 mMainWindow->setCurrentView(mViewer); |
|
237 connect(mMainWindow,SIGNAL(orientationChanged(Qt::Orientation)),this,SLOT(changedOrientation(Qt::Orientation))); |
225 } else { |
238 } else { |
226 window->addView(mViewer); |
239 window->addView(mViewer); |
227 window->setCurrentView(mViewer); |
240 window->setCurrentView(mViewer); |
|
241 connect(window,SIGNAL(orientationChanged(Qt::Orientation)),this,SLOT(changedOrientation(Qt::Orientation))); |
228 } |
242 } |
229 |
243 |
230 // Add softkey after adding view on window |
244 // Add softkey after adding view on window |
231 mBackAction = new HbAction(Hb::BackAction); |
245 mBackAction = new HbAction(Hb::BackNaviAction); |
232 mViewer->setNavigationAction(mBackAction); |
246 mViewer->setNavigationAction(mBackAction); |
233 |
247 |
234 connect(mBackAction, SIGNAL(triggered()), this, SLOT(close())); |
248 connect(mBackAction, SIGNAL(triggered()), this, SLOT(close())); |
235 |
249 |
236 qDebug() << "AgendaEventViewer: AgendaEventView::execute <--"; |
|
237 } |
250 } |
238 |
251 |
239 /*! |
252 /*! |
240 Refreshes the to-do viewer after the to-do editor is closed. |
253 Refreshes the to-do viewer after the to-do editor is closed. |
241 */ |
254 */ |
242 void AgendaEventView::addViewerData() |
255 void AgendaEventView::addViewerData() |
243 { |
256 { |
244 qDebug() << "AgendaEventViewer: AgendaEventView::addViewerData -->"; |
257 |
|
258 // Add the title to event viewer. |
|
259 addGroupBoxData(); |
245 |
260 |
246 // Set the summary & priority to viewer. |
261 // Set the summary & priority to viewer. |
247 addSubjectAndPriorityData(); |
262 addSubjectAndPriorityData(); |
248 |
263 |
249 // Set Date & Time to viewer. |
264 // Set Date & Time to viewer. |
337 saveAction->setIcon(HbIcon("qtg_mono_add_to_calendar")); |
348 saveAction->setIcon(HbIcon("qtg_mono_add_to_calendar")); |
338 connect(saveAction, SIGNAL(triggered()), this, SLOT(saveAgendaEntry())); |
349 connect(saveAction, SIGNAL(triggered()), this, SLOT(saveAgendaEntry())); |
339 toolBar->addAction(saveAction); |
350 toolBar->addAction(saveAction); |
340 } |
351 } |
341 |
352 |
342 qDebug() << "AgendaEventViewer: AgendaEventView::addToolBarItem <--"; |
|
343 } |
353 } |
344 |
354 |
345 /*! |
355 /*! |
346 Add the groupbox data depends up on entry type |
356 Add the groupbox data depends up on entry type |
347 */ |
357 */ |
348 void AgendaEventView::addGroupBoxData() |
358 void AgendaEventView::addGroupBoxData() |
349 { |
359 { |
350 qDebug() << "AgendaEventViewer: AgendaEventView::addGroupBoxData -->"; |
|
351 |
360 |
352 HbGroupBox *groupBox = qobject_cast<HbGroupBox *> ( |
361 HbGroupBox *groupBox = qobject_cast<HbGroupBox *> ( |
353 mDocLoader->findWidget(AGENDA_EVENT_VIEWER_GROUPBOX)); |
362 mDocLoader->findWidget(AGENDA_EVENT_VIEWER_GROUPBOX)); |
354 |
363 |
355 if (mAgendaEntry.type() == AgendaEntry::TypeTodo) { |
364 AgendaEntry::Type entryType = mAgendaEntry.type(); |
|
365 if (entryType == AgendaEntry::TypeTodo) { |
356 groupBox->setHeading(hbTrId("txt_calendar_subhead_to_do")); |
366 groupBox->setHeading(hbTrId("txt_calendar_subhead_to_do")); |
357 } else if (mAgendaEntry.type() == AgendaEntry::TypeNote) { |
367 } else if (entryType == AgendaEntry::TypeAppoinment) { |
358 groupBox->setHeading(tr("Note")); |
368 groupBox->setHeading(hbTrId("txt_calendar_subhead_meeting")); |
359 } else { |
369 }else if (entryType == AgendaEntry::TypeEvent) { |
360 // TODO: Add the text id based on the entry type Anniversary or meeting |
370 //TODO: Add text id once available |
361 groupBox->setHeading(hbTrId("txt_calendar_subhead_event")); |
371 groupBox->setHeading(hbTrId("All day event")); |
362 } |
372 } |
363 |
373 |
364 qDebug() << "AgendaEventViewer: AgendaEventView::addGroupBoxData <--"; |
|
365 } |
374 } |
366 |
375 |
367 /*! |
376 /*! |
368 Add subject and priority data to Event viewer |
377 Add subject and priority data to Event viewer |
369 */ |
378 */ |
370 void AgendaEventView::addSubjectAndPriorityData() |
379 void AgendaEventView::addSubjectAndPriorityData() |
371 { |
380 { |
372 qDebug() |
|
373 << "AgendaEventViewer: AgendaEventView::addSubjectAndPriorityData -->"; |
|
374 |
381 |
375 QStringList itemList; |
382 QStringList itemList; |
376 itemList.append(hbTrId("txt_calendar_dblist_subject")); |
383 itemList.append(hbTrId("txt_calendar_dblist_subject")); |
377 if (mAgendaEntry.summary().isEmpty()) { |
384 if (mAgendaEntry.summary().isEmpty()) { |
378 itemList.append(hbTrId("txt_calendar_dblist_val_unnamed")); |
385 itemList.append(hbTrId("txt_calendar_dblist_val_unnamed")); |
381 } |
388 } |
382 |
389 |
383 |
390 |
384 mSubjectWidget->setEventViewerItemData(itemList, Qt::DisplayRole); |
391 mSubjectWidget->setEventViewerItemData(itemList, Qt::DisplayRole); |
385 |
392 |
386 itemList.clear(); |
393 itemList.clear(); |
387 QString priorityIcon(QString::null); |
394 QString priorityIcon(QString::null); |
388 getPriorityIcon(mAgendaEntry.priority(), priorityIcon); |
395 QString subjectIcon(QString::null); |
389 itemList.append(priorityIcon); |
396 getPriorityIcon(mAgendaEntry.priority(), priorityIcon); |
390 itemList.append(QString::null); |
397 getSubjectIcon(mAgendaEntry.type(),subjectIcon); |
|
398 itemList.append(subjectIcon); |
|
399 itemList.append(priorityIcon); |
|
400 itemList.append(QString::null); |
391 |
401 |
392 mSubjectWidget->setEventViewerItemData(itemList, Qt::DecorationRole); |
402 mSubjectWidget->setEventViewerItemData(itemList, Qt::DecorationRole); |
393 |
403 |
394 qDebug() |
|
395 << "AgendaEventViewer: AgendaEventView::addSubjectAndPriorityData <--"; |
|
396 } |
404 } |
397 |
405 |
398 /*! |
406 /*! |
399 Add date & time data to Event viewer |
407 Add date & time data to Event viewer |
400 */ |
408 */ |
401 void AgendaEventView::addDateTimeData() |
409 void AgendaEventView::addDateTimeData() |
402 { |
410 { |
403 qDebug() |
|
404 << "AgendaEventViewer: AgendaEventView::addDateTimeData -->"; |
|
405 |
|
406 |
411 |
407 QStringList itemData; |
412 QStringList itemData; |
408 HbExtendedLocale systemLocale = HbExtendedLocale::system(); |
413 HbExtendedLocale systemLocale = HbExtendedLocale::system(); |
409 QDateTime startDateTime = mAgendaEntry.startTime(); |
414 QDateTime startDateTime = mAgendaEntry.startTime(); |
410 QDateTime endDateTime = mAgendaEntry.endTime(); |
415 QDateTime endDateTime = mAgendaEntry.endTime(); |
411 |
416 |
412 itemData.append(QString::null); |
417 itemData.append(QString::null); |
|
418 itemData.append(QString::null); |
413 itemData.append("qtg_small_calendar"); |
419 itemData.append("qtg_small_calendar"); |
|
420 |
|
421 mDateTimeWidget->setProperty(primaryLeftIconItem, false); |
|
422 |
414 mDateTimeWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
423 mDateTimeWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
415 itemData.clear(); |
424 itemData.clear(); |
416 itemData.append(QString::null); |
425 itemData.append(QString::null); |
417 |
426 |
418 QString startTimeText; |
427 QString startTimeText; |
478 break; |
486 break; |
479 } |
487 } |
480 itemData.append(data); |
488 itemData.append(data); |
481 mDateTimeWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
489 mDateTimeWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
482 |
490 |
483 qDebug() |
|
484 << "AgendaEventViewer: AgendaEventView::addDateTimeData <--"; |
|
485 } |
491 } |
486 |
492 |
487 /*! |
493 /*! |
488 Add location data to Event viewer |
494 Add location data to Event viewer |
489 */ |
495 */ |
490 void AgendaEventView::addLocationData() |
496 void AgendaEventView::addLocationData() |
491 { |
497 { |
492 qDebug() << "AgendaEventViewer: AgendaEventView::addLocationData -->"; |
|
493 QStringList itemData; |
498 QStringList itemData; |
494 itemData.append(QString::null); |
499 QString progressIcon(QString::null); |
495 itemData.append("qtg_small_location"); |
500 if ( mLocationFeatureEnabled ) { |
|
501 getProgressIndicatorstatus(progressIcon); |
|
502 } |
|
503 if( progressIcon.isNull() ) { |
|
504 itemData.append(QString::null); |
|
505 itemData.append(QString::null); |
|
506 itemData.append("qtg_small_location"); |
|
507 mLocationWidget->setProperty(primaryLeftIconItem, false); |
|
508 } |
|
509 else { |
|
510 itemData.append("qtg_small_location"); |
|
511 itemData.append( progressIcon ); |
|
512 itemData.append(QString::null); |
|
513 mLocationWidget->setProperty(primaryLeftIconItem, true); |
|
514 } |
496 mLocationWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
515 mLocationWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
497 itemData.clear(); |
516 itemData.clear(); |
498 itemData.append(QString::null); |
517 itemData.append(QString::null); |
499 itemData.append(mAgendaEntry.location()); |
518 itemData.append(mAgendaEntry.location()); |
500 mLocationWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
519 mLocationWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
501 qDebug() << "AgendaEventViewer: AgendaEventView::addLocationData <--"; |
|
502 } |
520 } |
503 |
521 |
504 /*! |
522 /*! |
505 Add maptile image to Event viewer |
523 Add maptile image to Event viewer |
506 */ |
524 */ |
507 void AgendaEventView::addMapTileImage() |
525 void AgendaEventView::addMapTileImage() |
508 { |
526 { |
509 |
527 if (mLocationFeatureEnabled && !mAgendaEntry.location().isEmpty() && !mMaptilePath.isEmpty()) { |
510 qDebug() << "AgendaEventViewer: AgendaEventView::addMapTileImage -->"; |
528 |
511 |
529 HbIcon maptile(mMaptilePath); |
512 if (!mAgendaEntry.location().isEmpty() && mLocationFeatureEnabled){ |
530 mMaptileLabel->setIcon(maptile); |
513 MapTileService::AddressType addressType; |
531 mMaptileLabel->setPreferredSize(QSizeF(maptile.width(), maptile.height())); |
514 addressType = MapTileService::AddressPlain; |
532 } |
515 int eventId = mAgendaEntry.id(); |
|
516 mMaptilePath = MapTileService::getMapTileImage(eventId, addressType); |
|
517 if (!mMaptilePath.isNull()) |
|
518 { |
|
519 QIcon mapTileIcon(mMaptilePath); |
|
520 QPainter painter; |
|
521 QPixmap baloon(HbIcon("qtg_small_location.svg").pixmap()); |
|
522 QPixmap map (mapTileIcon.pixmap(width,height)); |
|
523 //Display pin image in the center of maptile image |
|
524 painter.begin( &map ); |
|
525 painter.drawPixmap( (width/2)-(baloon.width()/2), |
|
526 (height/2)-baloon.height(), baloon ); |
|
527 painter.end(); |
|
528 mapTileIcon.addPixmap( map ); |
|
529 |
|
530 HbIcon maptile(mapTileIcon); |
|
531 mMaptileLabel->setIcon(maptile); |
|
532 |
|
533 mMaptileLabel->setPreferredSize(QSizeF(width, height)); |
|
534 mMaptileLabel->setMinimumSize(QSizeF(width, height)); |
|
535 mMaptileLabel->setMaximumSize(QSizeF(width, height)); |
|
536 mMaptileLabel->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, |
|
537 QSizePolicy::Fixed)); |
|
538 |
|
539 } |
|
540 } |
|
541 |
|
542 qDebug() << "AgendaEventViewer: AgendaEventView::addMapTileImage <--"; |
|
543 } |
533 } |
544 /*! |
534 /*! |
545 Add reminder data to Event viewer |
535 Add reminder data to Event viewer |
546 */ |
536 */ |
547 void AgendaEventView::addReminderData() |
537 void AgendaEventView::addReminderData() |
548 { |
538 { |
549 qDebug() << "AgendaEventViewer: AgendaEventView::addReminderData -->"; |
|
550 QStringList itemData; |
539 QStringList itemData; |
551 itemData.append(QString::null); |
540 itemData.append(QString::null); |
552 itemData.append("qtg_small_reminder"); |
541 itemData.append(QString::null); |
|
542 itemData.append("qtg_small_reminder"); |
|
543 mReminderWidget->setProperty(primaryLeftIconItem, false); |
553 mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
544 mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
554 itemData.clear(); |
545 itemData.clear(); |
555 itemData.append(QString::null); |
546 itemData.append(QString::null); |
556 itemData.append(alarmTimeText()); |
547 itemData.append(alarmTimeText()); |
557 mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
548 mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
558 qDebug() << "AgendaEventViewer: AgendaEventView::addReminderData <--"; |
549 } |
559 } |
|
560 |
550 |
561 /*! |
551 /*! |
562 Add completed to-do data to Event viewer |
552 Add completed to-do data to Event viewer |
563 */ |
553 */ |
564 void AgendaEventView::addCompletedTodoData() |
554 void AgendaEventView::addCompletedTodoData() |
565 { |
555 { |
566 qDebug() << "AgendaEventViewer: AgendaEventView::addCompletedTodoData -->"; |
|
567 QStringList itemData; |
556 QStringList itemData; |
568 QString completedText; |
557 QString completedText; |
569 HbExtendedLocale systemLocale = HbExtendedLocale::system();; |
558 HbExtendedLocale systemLocale = HbExtendedLocale::system();; |
570 |
559 itemData.append(QString::null); |
571 itemData.append(QString::null); |
560 itemData.append(QString::null); |
572 itemData.append(QString::null); |
561 itemData.append(QString::null); |
|
562 mReminderWidget->setProperty(primaryLeftIconItem, false); |
573 mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
563 mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
574 itemData.clear(); |
564 itemData.clear(); |
575 completedText = systemLocale.format(mAgendaEntry.completedDateTime().date(), |
565 completedText = systemLocale.format(mAgendaEntry.completedDateTime().date(), |
576 r_qtn_date_usual_with_zero); |
566 r_qtn_date_usual_with_zero); |
577 itemData.append(hbTrId("txt_calendar_dblist_completed_date")); |
567 itemData.append(hbTrId("txt_calendar_dblist_completed_date")); |
578 itemData.append(completedText); |
568 itemData.append(completedText); |
579 mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
569 mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
580 qDebug() << "AgendaEventViewer: AgendaEventView::addCompletedTodoData <--"; |
|
581 } |
570 } |
582 |
571 |
583 /*! |
572 /*! |
584 Add repeat data to Event viewer |
573 Add repeat data to Event viewer |
585 */ |
574 */ |
586 void AgendaEventView::addRepeatData() |
575 void AgendaEventView::addRepeatData() |
587 { |
576 { |
588 qDebug() << "AgendaEventViewer: AgendaEventView::addRepeatData -->"; |
|
589 QStringList itemData; |
577 QStringList itemData; |
590 itemData.append(QString::null); |
578 itemData.append(QString::null); |
591 itemData.append("qtg_mono_repeat.svg"); |
579 itemData.append(QString::null); |
|
580 itemData.append("qtg_small_repeat"); |
|
581 mRepeatWidget->setProperty(primaryLeftIconItem, false); |
592 mRepeatWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
582 mRepeatWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
593 itemData.clear(); |
583 itemData.clear(); |
594 itemData.append(QString::null); |
584 itemData.append(QString::null); |
595 itemData.append(repeatRule()); |
585 itemData.append(repeatRule()); |
596 mRepeatWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
586 mRepeatWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
597 qDebug() << "AgendaEventViewer: AgendaEventView::addRepeatData <--"; |
|
598 } |
587 } |
599 |
588 |
600 /*! |
589 /*! |
601 Add description data to Event viewer |
590 Add description data to Event viewer |
602 */ |
591 */ |
603 void AgendaEventView::addDescriptionData() |
592 void AgendaEventView::addDescriptionData() |
604 { |
593 { |
605 qDebug() << "AgendaEventViewer: AgendaEventView::addDiscriptionData -->"; |
|
606 QStringList itemData; |
594 QStringList itemData; |
607 itemData.append(QString::null); |
595 itemData.append(QString::null); |
608 itemData.append(QString::null); |
596 itemData.append(QString::null); |
|
597 itemData.append(QString::null); |
|
598 mDescriptionWidget->setProperty(primaryLeftIconItem, false); |
609 mDescriptionWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
599 mDescriptionWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
610 itemData.clear(); |
600 itemData.clear(); |
611 itemData.append(hbTrId("txt_calendar_dblist_description")); |
601 itemData.append(hbTrId("txt_calendar_dblist_description")); |
612 itemData.append(mAgendaEntry.description()); |
602 itemData.append(mAgendaEntry.description()); |
613 mDescriptionWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
603 mDescriptionWidget->setEventViewerItemData(itemData, Qt::DisplayRole); |
614 qDebug() << "AgendaEventViewer: AgendaEventView::addDiscriptionData <--"; |
|
615 } |
604 } |
616 |
605 |
617 /*! |
606 /*! |
618 Returns priority icon |
607 Returns priority icon |
619 */ |
608 */ |
620 void AgendaEventView::getPriorityIcon(int priority, QString &priorityIcon) |
609 void AgendaEventView::getPriorityIcon(int priority, QString &priorityIcon) |
621 { |
610 { |
622 qDebug() << "AgendaEventViewer: AgendaEventView::getPriorityIcon -->"; |
|
623 |
611 |
624 switch(priority) { |
612 switch(priority) { |
625 case 1:priorityIcon.append("qtg_small_priority_high"); |
613 case 1:priorityIcon.append("qtg_small_priority_high"); |
626 break; |
614 break; |
627 case 3:priorityIcon.append("qtg_small_priority_low"); |
615 case 3:priorityIcon.append("qtg_small_priority_low"); |
628 break; |
616 break; |
629 default: |
617 default: |
630 break; |
618 break; |
631 } |
619 } |
632 |
620 |
633 qDebug() << "AgendaEventViewer: AgendaEventView::getPriorityIcon <--"; |
|
634 } |
621 } |
635 |
622 |
636 /*! |
623 /*! |
637 Returns repeat rule |
624 Returns repeat rule |
638 */ |
625 */ |
639 QString AgendaEventView::repeatRule() const |
626 QString AgendaEventView::repeatRule() const |
640 { |
627 { |
641 qDebug() << "AgendaEventViewer: AgendaEventView::repeatRule -->"; |
|
642 |
628 |
643 QString repeatRule; |
629 QString repeatRule; |
644 AgendaRepeatRule agendaRepeatRule = mAgendaEntry.repeatRule(); |
630 AgendaRepeatRule agendaRepeatRule = mAgendaEntry.repeatRule(); |
645 if (agendaRepeatRule.type() != AgendaRepeatRule::InvalidRule) |
631 if (agendaRepeatRule.type() != AgendaRepeatRule::InvalidRule) |
646 { |
632 { |
848 mDescriptionWidget->show(); |
822 mDescriptionWidget->show(); |
849 |
823 |
850 mLinearLayout->invalidate(); |
824 mLinearLayout->invalidate(); |
851 mLinearLayout->activate(); |
825 mLinearLayout->activate(); |
852 |
826 |
853 qDebug() << "AgendaEventViewer: AgendaEventView::addAllWidgets <--"; |
|
854 } |
827 } |
855 |
828 |
856 /*! |
829 /*! |
857 Queries user whether to delete whole series or just this single occurence |
830 Queries user whether to delete whole series or just this single occurence |
858 */ |
831 */ |
859 void AgendaEventView::showDeleteOccurencePopup() |
832 void AgendaEventView::showDeleteOccurencePopup() |
860 { |
833 { |
861 qDebug() |
834 HbDialog *popUp = new HbDialog(); |
862 << "AgendaEventViewer: AgendaEventView::showDeleteOccurencePopup -->"; |
835 popUp->setDismissPolicy(HbDialog::NoDismiss); |
863 HbDialog popUp; |
836 popUp->setTimeout(HbDialog::NoTimeout); |
864 popUp.setDismissPolicy(HbDialog::NoDismiss); |
837 popUp->setAttribute( Qt::WA_DeleteOnClose, true ); |
865 popUp.setTimeout(HbDialog::NoTimeout); |
|
866 |
838 |
867 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); |
839 QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); |
868 HbWidget *deleteWidget = new HbWidget(mViewer); |
840 HbWidget *deleteWidget = new HbWidget(mViewer); |
869 deleteWidget->setLayout(layout); |
841 deleteWidget->setLayout(layout); |
870 |
842 |
871 HbRadioButtonList *deleteButtonList = new HbRadioButtonList(mViewer); |
843 HbRadioButtonList *deleteButtonList = new HbRadioButtonList(mViewer); |
872 |
844 |
873 QStringList list; |
845 QStringList list; |
874 list << hbTrId("txt_calendar_info_this_occurrence_only") |
846 list << hbTrId("txt_calendar_info_this_occurrence_only") |
875 << hbTrId("txt_calendar_info_all_occurences"); |
847 << hbTrId("txt_calendar_info_all_occurences"); |
876 |
848 |
877 deleteButtonList->setItems(list); |
849 deleteButtonList->setItems(list); |
878 |
850 |
879 layout->addItem(deleteButtonList); |
851 layout->addItem(deleteButtonList); |
880 |
852 |
881 popUp.setContentWidget(deleteWidget); |
853 popUp->setContentWidget(deleteWidget); |
882 popUp.setHeadingWidget(new HbLabel( |
854 popUp->setHeadingWidget(new HbLabel( |
883 hbTrId("txt_calendar_title_delete_repeated_entry"))); |
855 hbTrId("txt_calendar_title_delete_repeated_entry"))); |
884 |
856 |
885 connect(deleteButtonList, SIGNAL(itemSelected(int)), this, |
857 connect(deleteButtonList, SIGNAL(itemSelected(int)), this, |
886 SLOT(handleDeleteOccurence(int))); |
858 SLOT(handleDeleteOccurence(int))); |
887 connect(deleteButtonList, SIGNAL(itemSelected(int)), &popUp, SLOT(close())); |
859 connect(deleteButtonList, SIGNAL(itemSelected(int)), popUp, SLOT(close())); |
888 |
860 |
889 // Create secondary action |
861 popUp->addAction(new HbAction( |
890 HbAction *cancelAction = new HbAction( |
862 hbTrId("txt_calendar_button_softkey1_cancel"))); |
891 hbTrId("txt_calendar_button_softkey1_cancel")); |
|
892 popUp.setSecondaryAction(cancelAction); |
|
893 connect(cancelAction, SIGNAL(triggered()), &popUp, SLOT(close())); |
|
894 |
863 |
895 // Show the popup |
864 // Show the popup |
896 popUp.exec(); |
865 popUp->open(); |
897 |
866 |
898 qDebug() |
867 } |
899 << "AgendaEventViewer: AgendaEventView::showDeleteOccurencePopup <--"; |
868 |
900 } |
869 /*! |
901 |
870 Show delete confirmation query |
902 |
871 */ |
903 /*! |
872 void AgendaEventView::showDeleteConfirmationQuery() |
904 * Show delete confirmation query |
873 { |
905 */ |
874 |
906 int AgendaEventView::showDeleteConfirmationQuery() |
875 HbMessageBox *popup = new HbMessageBox(HbMessageBox::MessageTypeQuestion); |
907 { |
876 popup->setDismissPolicy(HbDialog::NoDismiss); |
908 qDebug() |
877 popup->setTimeout(HbDialog::NoTimeout); |
909 << "AgendaEventViewer: AgendaEventView::showDeleteConfirmationQuery -->"; |
878 popup->setAttribute( Qt::WA_DeleteOnClose, true ); |
910 int retStatus = 0; |
879 |
911 |
880 QString text = 0; |
912 HbMessageBox popup(HbMessageBox::MessageTypeQuestion); |
881 |
913 popup.setDismissPolicy(HbDialog::NoDismiss); |
882 switch (mAgendaEntry.type()) { |
914 popup.setTimeout(HbDialog::NoTimeout); |
883 case AgendaEntry::TypeAppoinment: |
915 popup.setIconVisible(true); |
884 case AgendaEntry::TypeEvent: { |
916 |
885 text.append(hbTrId("txt_calendar_info_delete_meeting")); |
917 QString text = 0; |
886 break; |
918 |
887 } |
919 switch (mAgendaEntry.type()) { |
888 case AgendaEntry::TypeAnniversary: { |
920 case AgendaEntry::TypeAppoinment: |
889 text.append(hbTrId("txt_calendar_info_delete_anniversary")); |
921 case AgendaEntry::TypeEvent: { |
890 break; |
922 text.append(hbTrId("txt_calendar_info_delete_meeting")); |
891 } |
923 break; |
892 case AgendaEntry::TypeTodo: { |
924 } |
893 text.append(hbTrId("txt_calendar_info_delete_todo_note")); |
925 case AgendaEntry::TypeAnniversary: { |
894 break; |
926 text.append(hbTrId("txt_calendar_info_delete_anniversary")); |
895 } |
927 break; |
896 case AgendaEntry::TypeNote: { |
928 } |
897 text.append(hbTrId("txt_calendar_info_delete_anniversary")); |
929 case AgendaEntry::TypeTodo: { |
898 break; |
930 text.append(hbTrId("txt_calendar_info_delete_todo_note")); |
899 } |
931 break; |
900 } |
932 } |
901 popup->setText(text); |
933 case AgendaEntry::TypeNote: { |
902 |
934 text.append(hbTrId("txt_calendar_info_delete_anniversary")); |
903 QList<QAction*> list = popup->actions(); |
935 break; |
904 for(int i=0; i < list.count(); i++) |
936 } |
905 { |
937 } |
906 popup->removeAction(list[i]); |
938 |
907 } |
939 popup.setText(text); |
908 HbAction *deleteAction = |
940 |
909 new HbAction(hbTrId("txt_calendar_button_delete"), popup); |
941 popup.setPrimaryAction(new HbAction( |
910 popup->addAction(deleteAction); |
942 hbTrId("txt_calendar_button_delete"), &popup)); |
911 connect(deleteAction, SIGNAL(triggered()), this , |
943 popup.setSecondaryAction(new HbAction( |
912 SLOT(handleDeleteAction())); |
944 hbTrId("txt_calendar_button_cancel"), &popup)); |
913 popup->addAction(new HbAction(hbTrId("txt_calendar_button_cancel"), popup)); |
945 HbAction *selected = popup.exec(); |
914 popup->open(); |
946 if (selected == popup.primaryAction()) { |
915 } |
947 retStatus = 1; |
916 |
948 } |
917 /*! |
949 |
918 Handles the delete action |
950 qDebug() |
919 */ |
951 << "AgendaEventViewer: AgendaEventView::showDeleteConfirmationQuery <--"; |
920 void AgendaEventView::handleDeleteAction() |
952 return retStatus; |
921 { |
|
922 // If delete button is pressed delete the entry |
|
923 // To notify client that deleting Started |
|
924 // Calendar Application changing state from viewing to deleting. |
|
925 mOwner->deletingStarted(); |
|
926 |
|
927 // Delete the entry. |
|
928 mOwner->mAgendaUtil->deleteEntry(mAgendaEntry.id()); |
953 } |
929 } |
954 |
930 |
955 /*! |
931 /*! |
956 Marks to-do entry as done or undone based on the completed value. |
932 Marks to-do entry as done or undone based on the completed value. |
957 */ |
933 */ |
958 void AgendaEventView::markTodoStatus() |
934 void AgendaEventView::markTodoStatus() |
959 { |
935 { |
960 qDebug() << "AgendaEventViewer: AgendaEventView::markTodoStatus -->"; |
|
961 |
936 |
962 QDateTime currentDateTime = QDateTime::currentDateTime(); |
937 QDateTime currentDateTime = QDateTime::currentDateTime(); |
963 |
938 |
964 // Set the to-do status using the agenda util. |
939 // Set the to-do status using the agenda util. |
965 if (AgendaEntry::TodoNeedsAction == mAgendaEntry.status()) { |
940 if (AgendaEntry::TodoCompleted != mAgendaEntry.status()) { |
966 |
|
967 // Update the menu text to mark to-do as undone. |
941 // Update the menu text to mark to-do as undone. |
968 mMarkTodoAction->setText(hbTrId("txt_calendar_menu_mark_as_not_done")); |
942 mMarkTodoAction->setText(hbTrId("txt_calendar_menu_mark_as_not_done")); |
969 |
|
970 mAgendaEntry.setStatus(AgendaEntry::TodoCompleted); |
943 mAgendaEntry.setStatus(AgendaEntry::TodoCompleted); |
971 mAgendaEntry.setCompletedDateTime(currentDateTime); |
944 mAgendaEntry.setCompletedDateTime(currentDateTime); |
972 mOwner->mAgendaUtil->setCompleted(mAgendaEntry, true, currentDateTime); |
945 mOwner->mAgendaUtil->setCompleted(mAgendaEntry, true, currentDateTime); |
973 |
946 } else { |
974 |
|
975 |
|
976 } else if (AgendaEntry::TodoCompleted == mAgendaEntry.status()) { |
|
977 |
947 |
978 // Update the menu text to mark to-do as done. |
948 // Update the menu text to mark to-do as done. |
979 mMarkTodoAction->setText(hbTrId("txt_calendar_menu_mark_as_done")); |
949 mMarkTodoAction->setText(hbTrId("txt_calendar_menu_mark_as_done")); |
980 |
|
981 mAgendaEntry.setStatus(AgendaEntry::TodoNeedsAction); |
950 mAgendaEntry.setStatus(AgendaEntry::TodoNeedsAction); |
982 mOwner->mAgendaUtil->setCompleted(mAgendaEntry, false, currentDateTime); |
951 mOwner->mAgendaUtil->setCompleted(mAgendaEntry, false, currentDateTime); |
983 |
|
984 |
|
985 } |
952 } |
986 |
953 |
987 updateCompletedReminderData(); |
954 updateCompletedReminderData(); |
988 |
955 |
989 qDebug() << "AgendaEventViewer: AgendaEventView::markTodoStatus <--"; |
|
990 } |
956 } |
991 |
957 |
992 /*! |
958 /*! |
993 Edits the agenda entry by lanching the to-do viewer. |
959 Edits the agenda entry by lanching the to-do viewer. |
994 */ |
960 */ |
995 void AgendaEventView::edit() |
961 void AgendaEventView::edit() |
996 { |
962 { |
997 qDebug() << "AgendaEventViewer: AgendaEventView::edit -->"; |
|
998 |
963 |
999 mOwner->editingStarted(); |
964 mOwner->editingStarted(); |
1000 |
965 |
1001 if (AgendaEntry::TypeTodo == mAgendaEntry.type()) { |
966 if (AgendaEntry::TypeTodo == mAgendaEntry.type()) { |
1002 // Launch the to-do editor using notes editor api |
967 // Load notes editor plugin if not loaded. |
1003 // Construct Note editor for launching the to-do editor |
968 if(!mNotesPluginLoaded) { |
1004 mNoteEditor = new NotesEditor(mOwner->mAgendaUtil, this); |
969 // Launch the to-do editor using notes editor plugin api |
1005 mNoteEditor->edit(mAgendaEntry); |
970 QDir dir(NOTES_EDITOR_PLUGIN_PATH); |
|
971 QString pluginName = dir.absoluteFilePath(NOTES_EDITOR_PLUGIN_NAME); |
|
972 |
|
973 // Create NotesEditor plugin loader object. |
|
974 mNotesEditorPluginLoader = new QPluginLoader(pluginName); |
|
975 |
|
976 // Load the plugin |
|
977 mNotesPluginLoaded = mNotesEditorPluginLoader->load(); |
|
978 } |
|
979 QObject *plugin = qobject_cast<QObject*> ( |
|
980 mNotesEditorPluginLoader->instance()); |
|
981 |
|
982 NotesEditorInterface* interface = |
|
983 qobject_cast<NotesEditorInterface*>(plugin); |
|
984 |
|
985 interface->edit(mAgendaEntry, mOwner->mAgendaUtil); |
1006 |
986 |
1007 connect( |
987 connect( |
1008 mNoteEditor, SIGNAL(editingCompleted(bool)), |
988 interface, SIGNAL(editingCompleted(bool)), |
1009 this, SLOT(handleNoteEditorClosed(bool))); |
989 this, SLOT(handleNoteEditorClosed(bool))); |
1010 |
990 |
1011 |
991 |
1012 } else { |
992 } else { |
1013 // Launch the calendar entry editor using calendar editor api |
993 // Launch the calendar entry editor using calendar editor api |
1136 } else { |
1100 } else { |
1137 // Close the agenda entry viewer |
1101 // Close the agenda entry viewer |
1138 close(); |
1102 close(); |
1139 } |
1103 } |
1140 |
1104 |
1141 qDebug() << "AgendaEventViewer: AgendaEventView::handleEntryUpdation <--"; |
|
1142 } |
1105 } |
1143 |
1106 |
1144 /*! |
1107 /*! |
1145 Handles the entry deletion of the agenda entry |
1108 Handles the entry deletion of the agenda entry |
1146 */ |
1109 */ |
1147 void AgendaEventView::handleEntryDeletion(ulong id) |
1110 void AgendaEventView::handleEntryDeletion(ulong id) |
1148 { |
1111 { |
1149 qDebug() <<"AgendaEventViewer: AgendaEventView::handleEntryDeletion -->"; |
|
1150 |
1112 |
1151 if (id == mAgendaEntry.id()) { |
1113 if (id == mAgendaEntry.id()) { |
1152 // Close the agenda entry viewer |
1114 // Close the agenda entry viewer |
1153 close(); |
1115 close(); |
1154 mOwner->deletingCompleted(); |
1116 mOwner->deletingCompleted(); |
1155 } |
1117 } |
1156 |
1118 |
1157 qDebug() <<"AgendaEventViewer: AgendaEventView::handleEntryDeletion <--"; |
|
1158 } |
1119 } |
1159 |
1120 |
1160 /*! |
1121 /*! |
1161 Handles the Note Editor editing completion of the agenda entry |
1122 Handles the Note Editor editing completion of the agenda entry |
1162 */ |
1123 */ |
1163 void AgendaEventView::handleNoteEditorClosed(bool status) |
1124 void AgendaEventView::handleNoteEditorClosed(bool status) |
1164 { |
1125 { |
1165 Q_UNUSED(status); |
1126 Q_UNUSED(status); |
1166 qDebug() <<"AgendaEventViewer: AgendaEventView::handleNoteEditorClosed -->"; |
1127 |
1167 |
1128 // To avoid loading the plugin again for editing, |
1168 // Cleanup. |
1129 // Unload the plug-in while destruction. |
1169 mNoteEditor->deleteLater(); |
1130 |
1170 mOwner->editingCompleted(); |
1131 mOwner->editingCompleted(); |
1171 |
1132 |
1172 qDebug() <<"AgendaEventViewer: AgendaEventView::handleNoteEditorClosed <--"; |
|
1173 } |
1133 } |
1174 |
1134 |
1175 /*! |
1135 /*! |
1176 Handles the Note Editor editing completion of the agenda entry |
1136 Handles the Note Editor editing completion of the agenda entry |
1177 */ |
1137 */ |
1178 void AgendaEventView::handleCalendarEditorClosed() |
1138 void AgendaEventView::handleCalendarEditorClosed() |
1179 { |
1139 { |
1180 qDebug() |
|
1181 <<"AgendaEventViewer: AgendaEventView::handleCalendarEditorClosed -->"; |
|
1182 |
1140 |
1183 // Cleanup. |
1141 // Cleanup. |
1184 mCalenEditor->deleteLater(); |
1142 mCalenEditor->deleteLater(); |
1185 mOwner->editingCompleted(); |
1143 mOwner->editingCompleted(); |
1186 |
1144 |
1187 qDebug() |
|
1188 <<"AgendaEventViewer: AgendaEventView::handleCalendarEditorClosed <--"; |
|
1189 } |
1145 } |
1190 |
1146 |
1191 /*! |
1147 /*! |
1192 Slot to handle User selection for series deleting or single occurence popup |
1148 Slot to handle User selection for series deleting or single occurence popup |
1193 */ |
1149 */ |
1194 void AgendaEventView::handleDeleteOccurence(int index) |
1150 void AgendaEventView::handleDeleteOccurence(int index) |
1195 { |
1151 { |
1196 qDebug() << "AgendaEventViewer: AgendaEventView::handleDeleteOccurence -->"; |
|
1197 |
1152 |
1198 // To notify client that deleting Started |
1153 // To notify client that deleting Started |
1199 // Calendar Application changing state from viewing to deleting. |
1154 // Calendar Application changing state from viewing to deleting. |
1200 mOwner->deletingStarted(); |
1155 mOwner->deletingStarted(); |
1201 |
1156 |
1211 mOwner->mAgendaUtil->deleteRepeatedEntry(mAgendaEntry, |
1166 mOwner->mAgendaUtil->deleteRepeatedEntry(mAgendaEntry, |
1212 AgendaUtil::ThisAndAll); |
1167 AgendaUtil::ThisAndAll); |
1213 break; |
1168 break; |
1214 } |
1169 } |
1215 |
1170 |
1216 qDebug() << "AgendaEventViewer: AgendaEventView::handleDeleteOccurence <--"; |
1171 } |
|
1172 |
|
1173 /*! |
|
1174 Returns subject icon |
|
1175 */ |
|
1176 void AgendaEventView::getSubjectIcon(AgendaEntry::Type type, QString &subjectIcon) |
|
1177 { |
|
1178 switch(type) { |
|
1179 case AgendaEntry::TypeAppoinment: |
|
1180 { |
|
1181 subjectIcon.append("qtg_small_meeting"); |
|
1182 } |
|
1183 break; |
|
1184 case AgendaEntry::TypeTodo: |
|
1185 { |
|
1186 subjectIcon.append("qtg_small_todo"); |
|
1187 } |
|
1188 break; |
|
1189 case AgendaEntry::TypeEvent: |
|
1190 { |
|
1191 subjectIcon.append("qtg_small_day"); |
|
1192 } |
|
1193 break; |
|
1194 case AgendaEntry::TypeAnniversary: |
|
1195 { |
|
1196 subjectIcon.append("qtg_small_anniversary"); |
|
1197 } |
|
1198 break; |
|
1199 default: |
|
1200 break; |
|
1201 } |
|
1202 |
|
1203 } |
|
1204 |
|
1205 /*! |
|
1206 According to maptile fetching status , update the viewer screen. |
|
1207 */ |
|
1208 void AgendaEventView::updateProgressIndicator() |
|
1209 { |
|
1210 if (!mMaptileStatusReceived) { |
|
1211 QString iconName("qtg_anim_small_loading_"); |
|
1212 mProgressIconCount = mProgressIconCount % 10 + 1; |
|
1213 iconName.append(QVariant(mProgressIconCount).toString()); |
|
1214 QStringList itemData; |
|
1215 itemData.append("qtg_small_location"); |
|
1216 itemData.append(iconName); |
|
1217 itemData.append(QString::null); |
|
1218 mLocationWidget->setProperty(primaryLeftIconItem, true); |
|
1219 mLocationWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
|
1220 mProgressTimer->start(100); |
|
1221 } |
|
1222 else { |
|
1223 if (mProgressTimer->isActive()) { |
|
1224 mProgressTimer->stop(); |
|
1225 } |
|
1226 if (mMaptileStatus == MapTileService::MapTileFetchingCompleted) { |
|
1227 QStringList itemData; |
|
1228 itemData.append(QString::null); |
|
1229 itemData.append(QString::null); |
|
1230 itemData.append("qtg_small_location"); |
|
1231 mLocationWidget->setProperty(primaryLeftIconItem, false); |
|
1232 mLocationWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
|
1233 Qt::Orientations orientation=hbInstance->allMainWindows().first()->orientation(); |
|
1234 mMaptilePath.clear(); |
|
1235 mMaptileStatus = mMaptileService->getMapTileImage(mAgendaEntry.id(), MapTileService::AddressPlain, mMaptilePath ,orientation); |
|
1236 addMapTileImage(); |
|
1237 QFile file(mMaptilePath); |
|
1238 if (file.exists()) { |
|
1239 //add to linear layout |
|
1240 int indexMaptileLabel = 3;// index of maptile widget position |
|
1241 mLinearLayout->insertItem(indexMaptileLabel, mMaptileLabel); |
|
1242 mMaptileLabel->show(); |
|
1243 } |
|
1244 file.close(); |
|
1245 |
|
1246 } |
|
1247 else { |
|
1248 QStringList itemData; |
|
1249 itemData.append("qtg_small_location"); |
|
1250 QString stopIcon; |
|
1251 stopIcon.append(QString("qtg_mono_search_stop")); |
|
1252 itemData.append(stopIcon); |
|
1253 itemData.append(QString::null); |
|
1254 mLocationWidget->setProperty(primaryLeftIconItem, true); |
|
1255 mLocationWidget->setEventViewerItemData(itemData, Qt::DecorationRole); |
|
1256 |
|
1257 } |
|
1258 } |
|
1259 } |
|
1260 |
|
1261 /*! |
|
1262 Maptile status received from maptile service |
|
1263 */ |
|
1264 void AgendaEventView::receiveMapTileStatus(int entryid,int addressType, int status) |
|
1265 { |
|
1266 if (mAgendaEntry.id() == entryid && addressType == MapTileService::AddressPlain) { |
|
1267 mMaptileStatusReceived = true; |
|
1268 mMaptileStatus = status; |
|
1269 updateProgressIndicator(); |
|
1270 } |
|
1271 } |
|
1272 |
|
1273 /*! |
|
1274 Returns progress indication icon as per status of entry in database. |
|
1275 */ |
|
1276 void AgendaEventView::getProgressIndicatorstatus(QString &progressIcon) |
|
1277 { |
|
1278 MapTileService::AddressType addressType; |
|
1279 addressType = MapTileService::AddressPlain; |
|
1280 int eventId = mAgendaEntry.id(); |
|
1281 mMaptilePath.clear(); |
|
1282 mMaptileStatus = -1; |
|
1283 connect(mMaptileService, SIGNAL(maptileFetchingStatusUpdate(int, |
|
1284 int ,int)), this, SLOT(receiveMapTileStatus(int,int,int))); |
|
1285 Qt::Orientations orientation=hbInstance->allMainWindows().first()->orientation(); |
|
1286 mMaptileStatus = mMaptileService->getMapTileImage(eventId, addressType, mMaptilePath ,orientation); |
|
1287 if (mMaptileStatus == MapTileService::MapTileFetchingNetworkError || mMaptileStatus |
|
1288 == MapTileService::MapTileFetchingInProgress) { |
|
1289 mMaptilePath.clear(); |
|
1290 mMaptileStatusReceived = false; //reseting receiving status value |
|
1291 progressIcon.append(QString("qtg_anim_small_loading_1")); |
|
1292 mProgressTimer->start(100); |
|
1293 } |
|
1294 else if (mMaptileStatus == MapTileService::MapTileFetchingInvalidAddress || mMaptileStatus |
|
1295 == MapTileService::MapTileFetchingUnknownError) { |
|
1296 mMaptilePath.clear(); |
|
1297 //no further need of this coonnection |
|
1298 disconnect(mMaptileService, SIGNAL(maptileFetchingStatusUpdate(int, |
|
1299 int ,int)), this, SLOT(receiveMapTileStatus(int,int,int))); |
|
1300 progressIcon.append(QString("qtg_mono_search_stop")); |
|
1301 } |
|
1302 else { |
|
1303 //no further need of this coonnection |
|
1304 disconnect(mMaptileService, SIGNAL(maptileFetchingStatusUpdate(int, |
|
1305 int ,int)), this, SLOT(receiveMapTileStatus(int,int,int))); |
|
1306 progressIcon.append(QString::null); |
|
1307 } |
|
1308 } |
|
1309 /*! |
|
1310 Reload the maptile image on system orientation change. |
|
1311 */ |
|
1312 void AgendaEventView::changedOrientation(Qt::Orientation orientation) |
|
1313 { |
|
1314 if (mMaptileStatus == MapTileService::MapTileFetchingCompleted) { |
|
1315 mMaptilePath.clear(); |
|
1316 mMaptileService->getMapTileImage(mAgendaEntry.id(), MapTileService::AddressPlain, mMaptilePath,orientation); |
|
1317 addMapTileImage(); |
|
1318 } |
1217 } |
1319 } |
1218 |
1320 |
1219 // End of file |
1321 // End of file |