calendarui/agendaeventviewer/src/agendaeventview.cpp
changeset 55 2c54b51f39c4
parent 51 0b38fc5b94c6
child 57 bb2d3e476f29
equal deleted inserted replaced
51:0b38fc5b94c6 55:2c54b51f39c4
    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 #include "OstTraceDefinitions.h"
       
    56 #ifdef OST_TRACE_COMPILER_IN_USE
       
    57 #include "agendaeventviewTraces.h"
       
    58 #endif
       
    59 
    55 // Constants
    60 // Constants
    56 #define CHARACTER_HYPHEN    "-"
       
    57 #define CHARACTER_SPACE     " "
    61 #define CHARACTER_SPACE     " "
    58 #define CHARACTER_NEW_LINE  "\n"
    62 #define CHARACTER_HYPHEN    " - "
       
    63 
    59 
    64 
    60 //This Property is use for setting a primary left icon
    65 //This Property is use for setting a primary left icon
    61 static const char *primaryLeftIconItem("leftPrimaryIconItem");
    66 static const char *primaryLeftIconItem("leftPrimaryIconItem");
    62 
    67 
    63 /*!
    68 /*!
    87 		mProgressIconCount(0),
    92 		mProgressIconCount(0),
    88 		mMaptileStatusReceived(false),
    93 		mMaptileStatusReceived(false),
    89 		mMaptileStatus(-1),
    94 		mMaptileStatus(-1),
    90 		mNotesPluginLoaded(false)
    95 		mNotesPluginLoaded(false)
    91 {
    96 {
    92 	
    97 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_AGENDAEVENTVIEW_ENTRY );
       
    98 	mTranslator->loadCommon();
    93 	mDocLoader = new AgendaEventViewerDocLoader;
    99 	mDocLoader = new AgendaEventViewerDocLoader;
    94 
   100 
    95 	// Load to-do viewer's docml.
   101 	// Load to-do viewer's docml.
    96 	bool loadSuccess;
   102 	bool loadSuccess;
    97 	mDocLoader->load(AGENDA_EVENT_VIEWER_DOCML, &loadSuccess);
   103 	mDocLoader->load(AGENDA_EVENT_VIEWER_DOCML, &loadSuccess);
   146         mProgressTimer->setSingleShot(true);
   152         mProgressTimer->setSingleShot(true);
   147         connect(mProgressTimer, SIGNAL(timeout()), this, SLOT(updateProgressIndicator()));
   153         connect(mProgressTimer, SIGNAL(timeout()), this, SLOT(updateProgressIndicator()));
   148     }
   154     }
   149         
   155         
   150 	
   156 	
       
   157     OstTraceFunctionExit0( AGENDAEVENTVIEW_AGENDAEVENTVIEW_EXIT );
   151 }
   158 }
   152 
   159 
   153 /*!
   160 /*!
   154 	Destructor.
   161 	Destructor.
   155  */
   162  */
   156 AgendaEventView::~AgendaEventView()
   163 AgendaEventView::~AgendaEventView()
   157 {
   164 {
       
   165     OstTraceFunctionEntry0( DUP1_AGENDAEVENTVIEW_AGENDAEVENTVIEW_ENTRY );
   158 
   166 
   159 	// Remove the translator
   167 	// Remove the translator
   160 	if (mTranslator) {
   168 	if (mTranslator) {
   161 		delete mTranslator;
   169 		delete mTranslator;
   162 		mTranslator = 0;
   170 		mTranslator = 0;
   186 	if (mProgressTimer) {
   194 	if (mProgressTimer) {
   187         delete mProgressTimer;
   195         delete mProgressTimer;
   188         mProgressTimer = NULL;
   196         mProgressTimer = NULL;
   189     }
   197     }
   190 	
   198 	
       
   199 	OstTraceFunctionExit0( DUP1_AGENDAEVENTVIEW_AGENDAEVENTVIEW_EXIT );
   191 }
   200 }
   192 
   201 
   193 /*!
   202 /*!
   194 	Displays the to-do viewer and populates the to-do entry attributes.
   203 	Displays the to-do viewer and populates the to-do entry attributes.
   195 
   204 
   196 	\param entry Agenda entry from which attributes have to be read.
   205 	\param entry Agenda entry from which attributes have to be read.
   197  */
   206  */
   198 void AgendaEventView::execute(AgendaEntry entry,
   207 void AgendaEventView::execute(AgendaEntry entry,
   199 											AgendaEventViewer::Actions action)
   208 											AgendaEventViewer::Actions action)
   200 {
   209 {
       
   210     OstTraceFunctionEntry0( AGENDAEVENTVIEW_EXECUTE_ENTRY );
   201 
   211 
   202 	mOriginalAgendaEntry = entry;
   212 	mOriginalAgendaEntry = entry;
   203 	mAgendaEntry = entry;
   213 	mAgendaEntry = entry;
   204 
   214 
   205 	// Add the viewer data reading from the agenda entry.
   215 	// Add the viewer data reading from the agenda entry.
   245 	mBackAction = new HbAction(Hb::BackNaviAction);
   255 	mBackAction = new HbAction(Hb::BackNaviAction);
   246 	mViewer->setNavigationAction(mBackAction);
   256 	mViewer->setNavigationAction(mBackAction);
   247 		
   257 		
   248 	connect(mBackAction, SIGNAL(triggered()), this, SLOT(close()));
   258 	connect(mBackAction, SIGNAL(triggered()), this, SLOT(close()));
   249 
   259 
       
   260 	OstTraceFunctionExit0( AGENDAEVENTVIEW_EXECUTE_EXIT );
   250 }
   261 }
   251 
   262 
   252 /*!
   263 /*!
   253 	Refreshes the to-do viewer after the to-do editor is closed.
   264 	Refreshes the to-do viewer after the to-do editor is closed.
   254  */
   265  */
   255 void AgendaEventView::addViewerData()
   266 void AgendaEventView::addViewerData()
   256 {
   267 {
       
   268 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDVIEWERDATA_ENTRY );
   257 	
   269 	
   258 	// Add the title to event viewer.
   270 	// Add the title to event viewer.
   259 	addGroupBoxData();
   271 	addGroupBoxData();
   260 
   272 
   261 	// Set the summary & priority to viewer.
   273 	// Set the summary & priority to viewer.
   287 	}
   299 	}
   288 
   300 
   289 	// Set the description.
   301 	// Set the description.
   290 	addDescriptionData();
   302 	addDescriptionData();
   291 	
   303 	
       
   304 	OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDVIEWERDATA_EXIT );
   292 }
   305 }
   293 
   306 
   294 /*!
   307 /*!
   295 	Add the menu item depends up on entry type
   308 	Add the menu item depends up on entry type
   296  */
   309  */
   297 void AgendaEventView::addMenuItem()
   310 void AgendaEventView::addMenuItem()
   298 {
   311 {
       
   312     OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDMENUITEM_ENTRY );
   299 
   313 
   300 	if (mAgendaEntry.type() == AgendaEntry::TypeTodo) {
   314 	if (mAgendaEntry.type() == AgendaEntry::TypeTodo) {
   301 
   315 
   302 		HbMenu *menu = qobject_cast<HbMenu *> (
   316 		HbMenu *menu = qobject_cast<HbMenu *> (
   303 				mDocLoader->findWidget(AGENDA_EVENT_VIEWER_MENU));
   317 				mDocLoader->findWidget(AGENDA_EVENT_VIEWER_MENU));
   311 		}
   325 		}
   312 		connect(mMarkTodoAction, SIGNAL(triggered()), this,
   326 		connect(mMarkTodoAction, SIGNAL(triggered()), this,
   313 		        SLOT(markTodoStatus()));
   327 		        SLOT(markTodoStatus()));
   314 		menu->addAction(mMarkTodoAction);
   328 		menu->addAction(mMarkTodoAction);
   315 	}
   329 	}
       
   330 	OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDMENUITEM_EXIT );
   316 }
   331 }
   317 
   332 
   318 /*!
   333 /*!
   319 	Add the toolbar item
   334 	Add the toolbar item
   320  */
   335  */
   321 void AgendaEventView::addToolBarItem(AgendaEventViewer::Actions action)
   336 void AgendaEventView::addToolBarItem(AgendaEventViewer::Actions action)
   322 {
   337 {
       
   338     OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDTOOLBARITEM_ENTRY );
   323 
   339 
   324 	HbToolBar *toolBar = qobject_cast<HbToolBar *> (
   340 	HbToolBar *toolBar = qobject_cast<HbToolBar *> (
   325 	                       mDocLoader->findWidget(AGENDA_EVENT_VIEWER_TOOLBAR));
   341 	                       mDocLoader->findWidget(AGENDA_EVENT_VIEWER_TOOLBAR));
   326 
   342 
   327 	// Load all the actions for event viewer
   343 	// Load all the actions for event viewer
   348 		saveAction->setIcon(HbIcon("qtg_mono_add_to_calendar"));
   364 		saveAction->setIcon(HbIcon("qtg_mono_add_to_calendar"));
   349 		connect(saveAction, SIGNAL(triggered()), this, SLOT(saveAgendaEntry()));
   365 		connect(saveAction, SIGNAL(triggered()), this, SLOT(saveAgendaEntry()));
   350 		toolBar->addAction(saveAction);
   366 		toolBar->addAction(saveAction);
   351 	}
   367 	}
   352 
   368 
       
   369 	OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDTOOLBARITEM_EXIT );
   353 }
   370 }
   354 
   371 
   355 /*!
   372 /*!
   356 	Add the groupbox data depends up on entry type
   373 	Add the groupbox data depends up on entry type
   357  */
   374  */
   358 void AgendaEventView::addGroupBoxData()
   375 void AgendaEventView::addGroupBoxData()
   359 {
   376 {
       
   377 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDGROUPBOXDATA_ENTRY );
   360 	
   378 	
   361 	HbGroupBox *groupBox = qobject_cast<HbGroupBox *> (
   379 	HbGroupBox *groupBox = qobject_cast<HbGroupBox *> (
   362 			mDocLoader->findWidget(AGENDA_EVENT_VIEWER_GROUPBOX));
   380 			mDocLoader->findWidget(AGENDA_EVENT_VIEWER_GROUPBOX));
   363 
   381 
   364 	AgendaEntry::Type entryType = mAgendaEntry.type();
   382 	AgendaEntry::Type entryType = mAgendaEntry.type();
   365 	if (entryType == AgendaEntry::TypeTodo) {
   383 	if (entryType == AgendaEntry::TypeTodo) {
   366 		groupBox->setHeading(hbTrId("txt_calendar_subhead_to_do"));
   384 		groupBox->setHeading(hbTrId("txt_calendar_subhead_to_do"));
   367 	} else if (entryType == AgendaEntry::TypeAppoinment) {
   385 	} else if (entryType == AgendaEntry::TypeAppoinment) {
   368 		groupBox->setHeading(hbTrId("txt_calendar_subhead_meeting"));
   386 		groupBox->setHeading(hbTrId("txt_calendar_subhead_meeting"));
   369 	}else if (entryType == AgendaEntry::TypeEvent) {
   387 	}else if (entryType == AgendaEntry::TypeEvent) {
   370 		//TODO: Add text id once available
   388 		groupBox->setHeading(hbTrId("txt_calendar_subhead_all_day_event"));
   371 		groupBox->setHeading(hbTrId("All day event"));
       
   372 	}
   389 	}
   373 		
   390 		
       
   391 	OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDGROUPBOXDATA_EXIT );
   374 }
   392 }
   375 
   393 
   376 /*!
   394 /*!
   377 	Add subject and priority data to Event viewer
   395 	Add subject and priority data to Event viewer
   378  */
   396  */
   379 void AgendaEventView::addSubjectAndPriorityData()
   397 void AgendaEventView::addSubjectAndPriorityData()
   380 {
   398 {
       
   399     OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDSUBJECTANDPRIORITYDATA_ENTRY );
   381 
   400 
   382 	QStringList itemList;
   401 	QStringList itemList;
   383 	itemList.append(hbTrId("txt_calendar_dblist_subject"));
   402 	itemList.append(hbTrId("txt_calendar_dblist_subject"));
   384 	if (mAgendaEntry.summary().isEmpty()) {
   403 	if (mAgendaEntry.summary().isEmpty()) {
   385 		itemList.append(hbTrId("txt_calendar_dblist_val_unnamed"));
   404 		itemList.append(hbTrId("txt_calendar_dblist_val_unnamed"));
   399     itemList.append(priorityIcon);
   418     itemList.append(priorityIcon);
   400     itemList.append(QString::null);
   419     itemList.append(QString::null);
   401 
   420 
   402 	mSubjectWidget->setEventViewerItemData(itemList, Qt::DecorationRole);
   421 	mSubjectWidget->setEventViewerItemData(itemList, Qt::DecorationRole);
   403 
   422 
       
   423 	OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDSUBJECTANDPRIORITYDATA_EXIT );
   404 }
   424 }
   405 
   425 
   406 /*!
   426 /*!
   407 	Add date & time data to Event viewer
   427 	Add date & time data to Event viewer
   408  */
   428  */
   409 void AgendaEventView::addDateTimeData()
   429 void AgendaEventView::addDateTimeData()
   410 {
   430 {
       
   431     OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDDATETIMEDATA_ENTRY );
   411     
   432     
   412     QStringList itemData;
   433     QStringList itemData;
   413     HbExtendedLocale systemLocale = HbExtendedLocale::system();
   434     HbExtendedLocale systemLocale = HbExtendedLocale::system();
   414     QDateTime startDateTime = mAgendaEntry.startTime();
   435     QDateTime startDateTime = mAgendaEntry.startTime();
   415     QDateTime endDateTime = mAgendaEntry.endTime();
   436     QDateTime endDateTime = mAgendaEntry.endTime();
   441 												r_qtn_time_usual_with_zero));
   462 												r_qtn_time_usual_with_zero));
   442     		startDateText.append(
   463     		startDateText.append(
   443     				systemLocale.format(startDateTime.date(),
   464     				systemLocale.format(startDateTime.date(),
   444 												r_qtn_date_usual_with_zero));
   465 												r_qtn_date_usual_with_zero));
   445     		if (CalenDateUtils::onSameDay(startDateTime, endDateTime)) {
   466     		if (CalenDateUtils::onSameDay(startDateTime, endDateTime)) {
   446     			data.append(hbTrId("txt_calendar_dblist_start_end_time").arg(
   467     			data.append(startTimeText);
   447 											startTimeText).arg(endTimeText));
   468     			data.append(CHARACTER_HYPHEN);
       
   469     			data.append(endTimeText);
   448     			data.append(CHARACTER_SPACE);
   470     			data.append(CHARACTER_SPACE);
   449     			data.append(hbTrId("txt_calendar_dblist_meeting_date").arg(
   471     			data.append(startDateText);
   450 											startDateText));
       
   451     		} else {
   472     		} else {
   452     			data.append(hbTrId("txt_calendar_dblist_start_time_date").arg(
   473     			// If both start and end time of a meeting are on different dates
   453 											startTimeText).arg(startDateText));
   474     			data.append(startTimeText);
       
   475     			data.append(CHARACTER_SPACE);
       
   476 				data.append(startDateText);
   454     			QString endDateText;
   477     			QString endDateText;
   455     			endDateText.append(
   478     			endDateText.append(
   456     					systemLocale.format(endDateTime.date(),
   479     					systemLocale.format(endDateTime.date(),
   457 												r_qtn_date_usual_with_zero));
   480     					                    r_qtn_date_usual_with_zero));
   458     			data.append(hbTrId("txt_calendar_dblist_end_time_date").arg(
   481     			data.append(CHARACTER_HYPHEN);
   459 											endTimeText).arg(endDateText));
   482     			data.append(endTimeText);
       
   483     			data.append(CHARACTER_SPACE);
       
   484     			data.append(endDateText);
   460     		}
   485     		}
   461     		break;
   486     		break;
   462     	case AgendaEntry::TypeAnniversary:
   487     	case AgendaEntry::TypeAnniversary:
   463     	case AgendaEntry::TypeTodo:
   488     	case AgendaEntry::TypeTodo:
   464     		dateTimeText.append(systemLocale.format(endDateTime.date(),
   489     		dateTimeText.append(systemLocale.format(endDateTime.date(),
   465 												r_qtn_date_usual_with_zero));
   490     											r_qtn_date_usual_with_zero));
   466     		data.append(hbTrId(
   491     		data.append(dateTimeText);
   467 						"txt_calendar_dblist_meeting_date").arg(dateTimeText));
       
   468     		break;
   492     		break;
   469     	case AgendaEntry::TypeEvent:
   493     	case AgendaEntry::TypeEvent:
   470 
   494 
   471     		dateTimeText.append(systemLocale.format(startDateTime.date(),
   495     		dateTimeText.append(systemLocale.format(startDateTime.date(),
   472 												r_qtn_date_usual_with_zero));
   496     		                                        r_qtn_date_usual_with_zero));
   473     		if (CalenDateUtils::onSameDay(startDateTime, endDateTime.addSecs(-60))) {
   497     		if (CalenDateUtils::onSameDay(startDateTime, endDateTime.addSecs(-60))) {
   474     			data.append(hbTrId("txt_calendar_dblist_meeting_date").arg(
   498     			data.append(dateTimeText);
   475 											dateTimeText));
       
   476     		} else {
   499     		} else {
   477     			QString endDate;
   500     			QString endDate;
   478     			endDate.append(
   501     			endDate.append(
   479     					systemLocale.format(endDateTime.addSecs(-60).date(),
   502     					systemLocale.format(endDateTime.addSecs(-60).date(),
   480 												r_qtn_date_usual_with_zero));
   503     					                    r_qtn_date_usual_with_zero));
   481     			data.append(hbTrId("txt_calendar_dblist_start_end_time").arg(
   504     			data.append(dateTimeText);
   482 											dateTimeText).arg(endDate));
   505     			data.append(" - ");
       
   506     			data.append(endDate);
   483     		}
   507     		}
   484     		break;
   508     		break;
   485     	default:
   509     	default:
   486     		break;
   510     		break;
   487     }
   511     }
   488 	itemData.append(data);
   512 	itemData.append(data);
   489     mDateTimeWidget->setEventViewerItemData(itemData, Qt::DisplayRole);
   513     mDateTimeWidget->setEventViewerItemData(itemData, Qt::DisplayRole);
   490     
   514     
       
   515     OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDDATETIMEDATA_EXIT );
   491 }
   516 }
   492 
   517 
   493 /*!
   518 /*!
   494 	Add location data to Event viewer
   519 	Add location data to Event viewer
   495  */
   520  */
   496 void AgendaEventView::addLocationData()
   521 void AgendaEventView::addLocationData()
   497 {
   522 {
       
   523 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDLOCATIONDATA_ENTRY );
   498 	QStringList itemData;
   524 	QStringList itemData;
   499 	QString progressIcon(QString::null);	
   525 	QString progressIcon(QString::null);	
   500 	if ( mLocationFeatureEnabled ) {
   526 	if ( mLocationFeatureEnabled ) {
   501 	    getProgressIndicatorstatus(progressIcon);	   
   527 	    getProgressIndicatorstatus(progressIcon);	   
   502 	}
   528 	}
   515 	mLocationWidget->setEventViewerItemData(itemData, Qt::DecorationRole);
   541 	mLocationWidget->setEventViewerItemData(itemData, Qt::DecorationRole);
   516 	itemData.clear();
   542 	itemData.clear();
   517 	itemData.append(QString::null);
   543 	itemData.append(QString::null);
   518 	itemData.append(mAgendaEntry.location());
   544 	itemData.append(mAgendaEntry.location());
   519 	mLocationWidget->setEventViewerItemData(itemData, Qt::DisplayRole);
   545 	mLocationWidget->setEventViewerItemData(itemData, Qt::DisplayRole);
       
   546 	OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDLOCATIONDATA_EXIT );
   520 }
   547 }
   521 
   548 
   522 /*!
   549 /*!
   523     Add maptile image to Event viewer
   550     Add maptile image to Event viewer
   524  */
   551  */
   525 void AgendaEventView::addMapTileImage()
   552 void AgendaEventView::addMapTileImage()
   526 {
   553 {
       
   554     OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDMAPTILEIMAGE_ENTRY );
   527     if (mLocationFeatureEnabled && !mAgendaEntry.location().isEmpty() && !mMaptilePath.isEmpty()) {
   555     if (mLocationFeatureEnabled && !mAgendaEntry.location().isEmpty() && !mMaptilePath.isEmpty()) {
   528 
   556 
   529         HbIcon maptile(mMaptilePath);
   557         HbIcon maptile(mMaptilePath);
   530         mMaptileLabel->setIcon(maptile);
   558         mMaptileLabel->setIcon(maptile);
   531         mMaptileLabel->setPreferredSize(QSizeF(maptile.width(), maptile.height()));
   559         //get the margin size
   532     }
   560         qreal left, bottom;
       
   561         mMaptileLabel->getContentsMargins( &left, 0, 0, &bottom );
       
   562         mMaptileLabel->setPreferredSize( 
       
   563                  QSizeF( maptile.width() + left, maptile.height() + bottom ) );
       
   564     }
       
   565     OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDMAPTILEIMAGE_EXIT );
   533 }
   566 }
   534 /*!
   567 /*!
   535 	Add reminder data to Event viewer
   568 	Add reminder data to Event viewer
   536  */
   569  */
   537 void AgendaEventView::addReminderData()
   570 void AgendaEventView::addReminderData()
   538 {
   571 {
       
   572 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDREMINDERDATA_ENTRY );
   539 	QStringList itemData;
   573 	QStringList itemData;
   540 	itemData.append(QString::null);
   574 	itemData.append(QString::null);
   541     itemData.append(QString::null);
   575     itemData.append(QString::null);
   542     itemData.append("qtg_small_reminder");
   576     itemData.append("qtg_small_reminder");
   543     mReminderWidget->setProperty(primaryLeftIconItem, false); 
   577     mReminderWidget->setProperty(primaryLeftIconItem, false); 
   544 	mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole);
   578 	mReminderWidget->setEventViewerItemData(itemData, Qt::DecorationRole);
   545 	itemData.clear();
   579 	itemData.clear();
   546 	itemData.append(QString::null);
   580 	itemData.append(QString::null);
   547 	itemData.append(alarmTimeText());
   581 	itemData.append(alarmTimeText());
   548 	mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole);
   582 	mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole);
       
   583     OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDREMINDERDATA_EXIT );
   549     }
   584     }
   550 
   585 
   551 /*!
   586 /*!
   552 	Add completed to-do data to Event viewer
   587 	Add completed to-do data to Event viewer
   553  */
   588  */
   554 void AgendaEventView::addCompletedTodoData()
   589 void AgendaEventView::addCompletedTodoData()
   555 {
   590 {
       
   591 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDCOMPLETEDTODODATA_ENTRY );
   556 	QStringList itemData;
   592 	QStringList itemData;
   557 	QString     completedText;
   593 	QString     completedText;
   558     HbExtendedLocale systemLocale = HbExtendedLocale::system();;
   594     HbExtendedLocale systemLocale = HbExtendedLocale::system();;
   559     itemData.append(QString::null);
   595     itemData.append(QString::null);
   560 	itemData.append(QString::null);
   596 	itemData.append(QString::null);
   565 	completedText = systemLocale.format(mAgendaEntry.completedDateTime().date(),
   601 	completedText = systemLocale.format(mAgendaEntry.completedDateTime().date(),
   566 					                    r_qtn_date_usual_with_zero);
   602 					                    r_qtn_date_usual_with_zero);
   567 	itemData.append(hbTrId("txt_calendar_dblist_completed_date"));
   603 	itemData.append(hbTrId("txt_calendar_dblist_completed_date"));
   568 	itemData.append(completedText);
   604 	itemData.append(completedText);
   569 	mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole);
   605 	mReminderWidget->setEventViewerItemData(itemData, Qt::DisplayRole);
       
   606 	OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDCOMPLETEDTODODATA_EXIT );
   570 }
   607 }
   571 
   608 
   572 /*!
   609 /*!
   573 	Add repeat data to Event viewer
   610 	Add repeat data to Event viewer
   574  */
   611  */
   575 void AgendaEventView::addRepeatData()
   612 void AgendaEventView::addRepeatData()
   576 {
   613 {
       
   614 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDREPEATDATA_ENTRY );
   577 	QStringList itemData;
   615 	QStringList itemData;
   578 	itemData.append(QString::null);
   616 	itemData.append(QString::null);
   579     itemData.append(QString::null);
   617     itemData.append(QString::null);
   580     itemData.append("qtg_small_repeat");
   618     if(!mAgendaEntry.recurrenceId().isNull()) {
       
   619         itemData.append("qtg_small_repeat_exception");
       
   620     }else {
       
   621            itemData.append("qtg_small_repeat");
       
   622     }
   581     mRepeatWidget->setProperty(primaryLeftIconItem, false);
   623     mRepeatWidget->setProperty(primaryLeftIconItem, false);
   582 	mRepeatWidget->setEventViewerItemData(itemData, Qt::DecorationRole);
   624 	mRepeatWidget->setEventViewerItemData(itemData, Qt::DecorationRole);
   583 	itemData.clear();
   625 	itemData.clear();
   584 	itemData.append(QString::null);
   626 	itemData.append(QString::null);
   585 	itemData.append(repeatRule());
   627 	itemData.append(repeatRule());
   586 	mRepeatWidget->setEventViewerItemData(itemData, Qt::DisplayRole);
   628 	mRepeatWidget->setEventViewerItemData(itemData, Qt::DisplayRole);
       
   629 	OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDREPEATDATA_EXIT );
   587 }
   630 }
   588 
   631 
   589 /*!
   632 /*!
   590 	Add description data to Event viewer
   633 	Add description data to Event viewer
   591  */
   634  */
   592 void AgendaEventView::addDescriptionData()
   635 void AgendaEventView::addDescriptionData()
   593 {
   636 {
       
   637 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDDESCRIPTIONDATA_ENTRY );
   594 	QStringList itemData;
   638 	QStringList itemData;
   595 	itemData.append(QString::null);
   639 	itemData.append(QString::null);
   596 	itemData.append(QString::null);
   640 	itemData.append(QString::null);
   597     itemData.append(QString::null);
   641     itemData.append(QString::null);
   598     mDescriptionWidget->setProperty(primaryLeftIconItem, true);
   642     mDescriptionWidget->setProperty(primaryLeftIconItem, true);
   599 	mDescriptionWidget->setEventViewerItemData(itemData, Qt::DecorationRole);
   643 	mDescriptionWidget->setEventViewerItemData(itemData, Qt::DecorationRole);
   600 	itemData.clear();
   644 	itemData.clear();
   601 	itemData.append(hbTrId("txt_calendar_dblist_description"));
   645 	itemData.append(hbTrId("txt_calendar_dblist_description"));
   602 	itemData.append(mAgendaEntry.description());
   646 	itemData.append(mAgendaEntry.description());
   603 	mDescriptionWidget->setEventViewerItemData(itemData, Qt::DisplayRole);
   647 	mDescriptionWidget->setEventViewerItemData(itemData, Qt::DisplayRole);
       
   648 	OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDDESCRIPTIONDATA_EXIT );
   604 }
   649 }
   605 
   650 
   606 /*!
   651 /*!
   607 	Returns priority icon
   652 	Returns priority icon
   608  */
   653  */
   609 void AgendaEventView::getPriorityIcon(int priority, QString &priorityIcon)
   654 void AgendaEventView::getPriorityIcon(int priority, QString &priorityIcon)
   610 {
   655 {
       
   656     OstTraceFunctionEntry0( AGENDAEVENTVIEW_GETPRIORITYICON_ENTRY );
   611 
   657 
   612 	switch(priority) {
   658 	switch(priority) {
   613 		case 1:priorityIcon.append("qtg_small_priority_high");
   659 		case 1:priorityIcon.append("qtg_small_priority_high");
   614 		break;
   660 		break;
   615 		case 3:priorityIcon.append("qtg_small_priority_low");
   661 		case 3:priorityIcon.append("qtg_small_priority_low");
   616 		break;
   662 		break;
   617 		default:
   663 		default:
   618 		break;
   664 		break;
   619 	}
   665 	}
   620 
   666 
       
   667 	OstTraceFunctionExit0( AGENDAEVENTVIEW_GETPRIORITYICON_EXIT );
   621 }
   668 }
   622 
   669 
   623 /*!
   670 /*!
   624 	Returns repeat rule
   671 	Returns repeat rule
   625  */
   672  */
   626 QString AgendaEventView::repeatRule() const
   673 QString AgendaEventView::repeatRule()
   627 {
   674 {
       
   675 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_REPEATRULE_ENTRY );
   628 	
   676 	
   629 	QString repeatRule;
   677 	QString repeatRule;
   630 	AgendaRepeatRule agendaRepeatRule = mAgendaEntry.repeatRule();
   678 	AgendaRepeatRule agendaRepeatRule;
       
   679 	if (mAgendaEntry.isRepeating()) {
       
   680 	    agendaRepeatRule = mAgendaEntry.repeatRule();
       
   681 	} else {
       
   682             if (!mAgendaEntry.recurrenceId().isNull()) {
       
   683                 AgendaEntry parentEntry= mOwner->mAgendaUtil->parentEntry(mAgendaEntry);
       
   684                 agendaRepeatRule = parentEntry.repeatRule();
       
   685                 }
       
   686 	}
       
   687 	
   631 	if (agendaRepeatRule.type() != AgendaRepeatRule::InvalidRule)
   688 	if (agendaRepeatRule.type() != AgendaRepeatRule::InvalidRule)
   632 	{
   689 	{
   633 		switch (agendaRepeatRule.type()) {
   690 		switch (agendaRepeatRule.type()) {
   634 			case AgendaRepeatRule::DailyRule:
   691 			case AgendaRepeatRule::DailyRule:
   635 				repeatRule.append(hbTrId("txt_calendar_dblist_repeats_daily"));
   692 				repeatRule.append(hbTrId("txt_calendar_dblist_repeats_daily"));
   636 			break;
   693 			break;
   637 			case AgendaRepeatRule::WeeklyRule:
   694 			case AgendaRepeatRule::WeeklyRule:
   638 				if (AgendaUtil::isWorkdaysRepeatingEntry(agendaRepeatRule)) {
   695 				if (AgendaUtil::isWorkdaysRepeatingEntry(agendaRepeatRule)) {
   639 					repeatRule.append(hbTrId("txt_calendar_dblist_repeats_workdays"));
   696 					repeatRule.append(
       
   697 								hbTrId("txt_calendar_dblist_repeats_workdays"));
   640 				} else {
   698 				} else {
   641 					if (agendaRepeatRule.interval() == 2) {
   699 					if (agendaRepeatRule.interval() == 2) {
   642 						repeatRule.append(
   700 						repeatRule.append(
   643 							hbTrId("txt_calendar_dblist_repeats_fortnightly"));
   701 							hbTrId("txt_calendar_dblist_repeats_fortnightly"));
   644 					} else {
   702 					} else {
   656 						hbTrId("txt_calendar_dblist_repeats_yearly"));
   714 						hbTrId("txt_calendar_dblist_repeats_yearly"));
   657 			break;
   715 			break;
   658 			default:
   716 			default:
   659 			break;
   717 			break;
   660 		}
   718 		}
   661 		repeatRule.append(CHARACTER_NEW_LINE);
   719 		repeatRule.append(CHARACTER_SPACE);
   662 		HbExtendedLocale systemLocale = HbExtendedLocale::system();
   720 		HbExtendedLocale systemLocale = HbExtendedLocale::system();
   663 		QString untilDateString = systemLocale.format(
   721 		QString untilDateString = systemLocale.format(
   664 				mAgendaEntry.repeatRule().until().date(), 
   722 		                agendaRepeatRule.until().date(), 
   665 				r_qtn_date_usual_with_zero);
   723 		                r_qtn_date_usual_with_zero);
   666 		repeatRule.append(
   724 		repeatRule.append(
   667 			hbTrId("txt_calendar_dblist_repeats_daily_val_until_1").
   725 			hbTrId("txt_calendar_dblist_repeats_daily_val_until_1").
   668 			arg(untilDateString));
   726 			arg(untilDateString));
   669 	}
   727 	}
   670 	
   728 	
       
   729 	OstTraceFunctionExit0( AGENDAEVENTVIEW_REPEATRULE_EXIT );
   671 	return repeatRule;
   730 	return repeatRule;
   672 }
   731 }
   673 
   732 
   674 /*!
   733 /*!
   675 	Alarm time text to display in the viewer.
   734 	Alarm time text to display in the viewer.
   676 
   735 
   677 	\return QString	Holds the alarm time text.
   736 	\return QString	Holds the alarm time text.
   678  */
   737  */
   679 QString AgendaEventView::alarmTimeText() const
   738 QString AgendaEventView::alarmTimeText() const
   680 {
   739 {
       
   740     OstTraceFunctionEntry0( AGENDAEVENTVIEW_ALARMTIMETEXT_ENTRY );
   681 
   741 
   682 	QString alarmDateTimeText;
   742 	QString alarmDateTimeText;
   683 	QDateTime startTime;
   743 	QDateTime startTime;
   684 	QDateTime alarmDateTime;
   744 	QDateTime alarmDateTime;
   685 	
   745 	
   692 		
   752 		
   693 		int alarmTimeOffsetInMinutes = mAgendaEntry.alarm().timeOffset();
   753 		int alarmTimeOffsetInMinutes = mAgendaEntry.alarm().timeOffset();
   694 		alarmDateTime = startTime.addSecs(-alarmTimeOffsetInMinutes * 60);
   754 		alarmDateTime = startTime.addSecs(-alarmTimeOffsetInMinutes * 60);
   695 
   755 
   696 		HbExtendedLocale systemLocale = HbExtendedLocale::system();
   756 		HbExtendedLocale systemLocale = HbExtendedLocale::system();
   697 		alarmDateTimeText.append(
   757 		alarmDateTimeText.append(systemLocale.format(alarmDateTime.time(),
   698 						hbTrId("txt_calendar_list_reminder_time_date").arg(
   758 										r_qtn_time_usual_with_zero));
   699 						systemLocale.format(alarmDateTime.time(),
   759 		// Show the alarm date only if its not on the same day of the entry
   700 						r_qtn_time_usual_with_zero)).arg(
   760 		if (!CalenDateUtils::onSameDay(alarmDateTime, startTime)) {
   701 						systemLocale.format(alarmDateTime.date(),
   761 			alarmDateTimeText.append(CHARACTER_SPACE);
   702 						r_qtn_date_usual_with_zero)));
   762 			alarmDateTimeText.append(systemLocale.format(alarmDateTime.date(),
   703 	}
   763 											r_qtn_date_usual_with_zero));	
   704 	
   764 		}
       
   765 	}
       
   766 	
       
   767 	OstTraceFunctionExit0( AGENDAEVENTVIEW_ALARMTIMETEXT_EXIT );
   705 	return alarmDateTimeText;
   768 	return alarmDateTimeText;
   706 }
   769 }
   707 
   770 
   708 /*!
   771 /*!
   709 	Remove unnecessary widget from layout.
   772 	Remove unnecessary widget from layout.
   710  */
   773  */
   711 void AgendaEventView::removeWidget()
   774 void AgendaEventView::removeWidget()
   712 {
   775 {
       
   776 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_REMOVEWIDGET_ENTRY );
   713 	
   777 	
   714 	if (mAgendaEntry.location().isEmpty()) { 
   778 	if (mAgendaEntry.location().isEmpty()) { 
   715 		mLocationWidget->hide();
   779 		mLocationWidget->hide();
   716 		mLinearLayout->removeItem(mLocationWidget);
   780 		mLinearLayout->removeItem(mLocationWidget);
   717 	}
   781 	}
   737 			mLinearLayout->removeItem(mReminderWidget);
   801 			mLinearLayout->removeItem(mReminderWidget);
   738 			mReminderWidgetAdded = false;
   802 			mReminderWidgetAdded = false;
   739 		}
   803 		}
   740 	}
   804 	}
   741 	
   805 	
   742 	if (mAgendaEntry.repeatRule().type() == AgendaRepeatRule::InvalidRule) { 
   806 	if ((mAgendaEntry.repeatRule().type() == AgendaRepeatRule::InvalidRule) &&
       
   807 	        (mAgendaEntry.recurrenceId().isNull())) { 
   743 		mRepeatWidget->hide();
   808 		mRepeatWidget->hide();
   744 		mLinearLayout->removeItem(mRepeatWidget);
   809 		mLinearLayout->removeItem(mRepeatWidget);
   745 	}
   810 	}
   746 	
   811 	
   747 	if (mAgendaEntry.description().isEmpty()) { 
   812 	if (mAgendaEntry.description().isEmpty()) { 
   750 	}
   815 	}
   751 	
   816 	
   752 	mLinearLayout->invalidate();
   817 	mLinearLayout->invalidate();
   753 	mLinearLayout->activate();
   818 	mLinearLayout->activate();
   754 	
   819 	
       
   820 	OstTraceFunctionExit0( AGENDAEVENTVIEW_REMOVEWIDGET_EXIT );
   755 }
   821 }
   756 
   822 
   757 /*!
   823 /*!
   758 	Update the completed to-do or reminder data to event viewer.
   824 	Update the completed to-do or reminder data to event viewer.
   759  */
   825  */
   760 void AgendaEventView::updateCompletedReminderData()
   826 void AgendaEventView::updateCompletedReminderData()
   761 {
   827 {
       
   828     OstTraceFunctionEntry0( AGENDAEVENTVIEW_UPDATECOMPLETEDREMINDERDATA_ENTRY );
   762 
   829 
   763 	if (AgendaEntry::TodoCompleted == mAgendaEntry.status()) {
   830 	if (AgendaEntry::TodoCompleted == mAgendaEntry.status()) {
   764 		addCompletedTodoData();
   831 		addCompletedTodoData();
   765 		if (!mReminderWidgetAdded) {
   832 		if (!mReminderWidgetAdded) {
   766 			mReminderWidget->show();
   833 			mReminderWidget->show();
   786 
   853 
   787 	}
   854 	}
   788 	
   855 	
   789 	mLinearLayout->invalidate();
   856 	mLinearLayout->invalidate();
   790 	mLinearLayout->activate();
   857 	mLinearLayout->activate();
       
   858 	OstTraceFunctionExit0( AGENDAEVENTVIEW_UPDATECOMPLETEDREMINDERDATA_EXIT );
   791 }
   859 }
   792 
   860 
   793 /*!
   861 /*!
   794 	Remove all widgets from layout.
   862 	Remove all widgets from layout.
   795  */
   863  */
   796 void AgendaEventView::removeAllWidgets()
   864 void AgendaEventView::removeAllWidgets()
   797 {
   865 {
       
   866     OstTraceFunctionEntry0( AGENDAEVENTVIEW_REMOVEALLWIDGETS_ENTRY );
   798 
   867 
   799 	for (int i = 2; i < mLinearLayout->count(); i++) {
   868 	for (int i = 2; i < mLinearLayout->count(); i++) {
   800 		mLinearLayout->removeAt(i);
   869 		mLinearLayout->removeAt(i);
   801 	}
   870 	}
   802 	mLinearLayout->invalidate();
   871 	mLinearLayout->invalidate();
   803 	mLinearLayout->activate();
   872 	mLinearLayout->activate();
   804 	
   873 	
       
   874 	OstTraceFunctionExit0( AGENDAEVENTVIEW_REMOVEALLWIDGETS_EXIT );
   805 }
   875 }
   806 
   876 
   807 /*!
   877 /*!
   808 	Add all widgets to layout.
   878 	Add all widgets to layout.
   809  */
   879  */
   810 void AgendaEventView::addAllWidgets()
   880 void AgendaEventView::addAllWidgets()
   811 {
   881 {
       
   882 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_ADDALLWIDGETS_ENTRY );
   812 	
   883 	
   813 	mLinearLayout->addItem(mLocationWidget);
   884 	mLinearLayout->addItem(mLocationWidget);
   814 	mLocationWidget->show();
   885 	mLocationWidget->show();
   815 	mLinearLayout->addItem(mMaptileLabel);
   886 	mLinearLayout->addItem(mMaptileLabel);
   816 	mMaptileLabel->show();		
   887 	mMaptileLabel->show();		
   822 	mDescriptionWidget->show();
   893 	mDescriptionWidget->show();
   823 	
   894 	
   824 	mLinearLayout->invalidate();
   895 	mLinearLayout->invalidate();
   825 	mLinearLayout->activate();
   896 	mLinearLayout->activate();
   826 	
   897 	
       
   898 	OstTraceFunctionExit0( AGENDAEVENTVIEW_ADDALLWIDGETS_EXIT );
   827 }
   899 }
   828 
   900 
   829 /*!
   901 /*!
   830 	Queries user whether to delete whole series or just this single occurence
   902 	Queries user whether to delete whole series or just this single occurence
   831  */
   903  */
   832 void AgendaEventView::showDeleteOccurencePopup()
   904 void AgendaEventView::showDeleteOccurencePopup()
   833 {
   905 {
       
   906 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_SHOWDELETEOCCURENCEPOPUP_ENTRY );
   834 	HbDialog *popUp = new HbDialog();
   907 	HbDialog *popUp = new HbDialog();
   835 	popUp->setDismissPolicy(HbDialog::NoDismiss);
   908 	popUp->setDismissPolicy(HbDialog::NoDismiss);
   836 	popUp->setTimeout(HbDialog::NoTimeout);
   909 	popUp->setTimeout(HbDialog::NoTimeout);
   837 	popUp->setAttribute( Qt::WA_DeleteOnClose, true );
   910 	popUp->setAttribute( Qt::WA_DeleteOnClose, true );
   838 
   911 
   857 	connect(deleteButtonList, SIGNAL(itemSelected(int)), this,
   930 	connect(deleteButtonList, SIGNAL(itemSelected(int)), this,
   858 											SLOT(handleDeleteOccurence(int)));
   931 											SLOT(handleDeleteOccurence(int)));
   859 	connect(deleteButtonList, SIGNAL(itemSelected(int)), popUp, SLOT(close()));
   932 	connect(deleteButtonList, SIGNAL(itemSelected(int)), popUp, SLOT(close()));
   860 
   933 
   861 	popUp->addAction(new HbAction(
   934 	popUp->addAction(new HbAction(
   862 			hbTrId("txt_calendar_button_softkey1_cancel")));
   935 			hbTrId("txt_common_button_cancel_singledialog")));
   863 
   936 
   864 	// Show the popup
   937 	// Show the popup
   865 	popUp->open();
   938 	popUp->open();
   866 
   939 
       
   940 	OstTraceFunctionExit0( AGENDAEVENTVIEW_SHOWDELETEOCCURENCEPOPUP_EXIT );
   867 }
   941 }
   868 
   942 
   869 /*!
   943 /*!
   870 	Show delete confirmation query
   944 	Show delete confirmation query
   871  */
   945  */
   872 void AgendaEventView::showDeleteConfirmationQuery()
   946 void AgendaEventView::showDeleteConfirmationQuery()
   873     {
   947     {
       
   948     OstTraceFunctionEntry0( AGENDAEVENTVIEW_SHOWDELETECONFIRMATIONQUERY_ENTRY );
   874     
   949     
   875     HbMessageBox *popup = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
   950     HbMessageBox *popup = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
   876     popup->setDismissPolicy(HbDialog::NoDismiss);
   951     popup->setDismissPolicy(HbDialog::NoDismiss);
   877     popup->setTimeout(HbDialog::NoTimeout);
   952     popup->setTimeout(HbDialog::NoTimeout);
   878     popup->setAttribute( Qt::WA_DeleteOnClose, true );
   953     popup->setAttribute( Qt::WA_DeleteOnClose, true );
   910     popup->addAction(deleteAction);
   985     popup->addAction(deleteAction);
   911     connect(deleteAction, SIGNAL(triggered()), this ,
   986     connect(deleteAction, SIGNAL(triggered()), this ,
   912 												SLOT(handleDeleteAction()));
   987 												SLOT(handleDeleteAction()));
   913     popup->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popup));
   988     popup->addAction(new HbAction(hbTrId("txt_common_button_cancel"), popup));
   914     popup->open();
   989     popup->open();
       
   990     OstTraceFunctionExit0( AGENDAEVENTVIEW_SHOWDELETECONFIRMATIONQUERY_EXIT );
   915 }
   991 }
   916 
   992 
   917 /*!
   993 /*!
   918 	Handles the delete action
   994 	Handles the delete action
   919  */
   995  */
   920 void AgendaEventView::handleDeleteAction()
   996 void AgendaEventView::handleDeleteAction()
   921     {
   997     {
       
   998     OstTraceFunctionEntry0( AGENDAEVENTVIEW_HANDLEDELETEACTION_ENTRY );
   922     // If delete button is pressed delete the entry
   999     // If delete button is pressed delete the entry
   923     // To notify client that deleting Started
  1000     // To notify client that deleting Started
   924     // Calendar Application changing state from viewing to deleting.
  1001     // Calendar Application changing state from viewing to deleting.
   925     mOwner->deletingStarted();
  1002     mOwner->deletingStarted();
   926 
  1003 
   927     // Delete the entry.
  1004     // Delete the entry.
   928     mOwner->mAgendaUtil->deleteEntry(mAgendaEntry.id());
  1005     mOwner->mAgendaUtil->deleteEntry(mAgendaEntry.id());
       
  1006     OstTraceFunctionExit0( AGENDAEVENTVIEW_HANDLEDELETEACTION_EXIT );
   929 }
  1007 }
   930 
  1008 
   931 /*!
  1009 /*!
   932 	Marks to-do entry as done or undone based on the completed value.
  1010 	Marks to-do entry as done or undone based on the completed value.
   933  */
  1011  */
   934 void AgendaEventView::markTodoStatus()
  1012 void AgendaEventView::markTodoStatus()
   935 {
  1013 {
       
  1014     OstTraceFunctionEntry0( AGENDAEVENTVIEW_MARKTODOSTATUS_ENTRY );
   936 
  1015 
   937 	QDateTime currentDateTime = QDateTime::currentDateTime();
  1016 	QDateTime currentDateTime = QDateTime::currentDateTime();
   938 
  1017 
   939 	// Set the to-do status using the agenda util.
  1018 	// Set the to-do status using the agenda util.
   940 	if (AgendaEntry::TodoCompleted != mAgendaEntry.status()) {
  1019 	if (AgendaEntry::TodoCompleted != mAgendaEntry.status()) {
   951 		mOwner->mAgendaUtil->setCompleted(mAgendaEntry, false, currentDateTime);
  1030 		mOwner->mAgendaUtil->setCompleted(mAgendaEntry, false, currentDateTime);
   952 	}
  1031 	}
   953 
  1032 
   954 	updateCompletedReminderData();
  1033 	updateCompletedReminderData();
   955 	
  1034 	
       
  1035 	OstTraceFunctionExit0( AGENDAEVENTVIEW_MARKTODOSTATUS_EXIT );
   956 }
  1036 }
   957 
  1037 
   958 /*!
  1038 /*!
   959 	Edits the agenda entry by lanching the to-do viewer.
  1039 	Edits the agenda entry by lanching the to-do viewer.
   960  */
  1040  */
   961 void AgendaEventView::edit()
  1041 void AgendaEventView::edit()
   962 {
  1042 {
       
  1043     OstTraceFunctionEntry0( AGENDAEVENTVIEW_EDIT_ENTRY );
   963 
  1044 
   964 	mOwner->editingStarted();
  1045 	mOwner->editingStarted();
   965 	
  1046 	
   966 	if (AgendaEntry::TypeTodo == mAgendaEntry.type()) {
  1047 	if (AgendaEntry::TypeTodo == mAgendaEntry.type()) {
   967 		// Load notes editor plugin if not loaded.
  1048 		// Load notes editor plugin if not loaded.
   996 		                        this, SLOT(handleCalendarEditorClosed()));
  1077 		                        this, SLOT(handleCalendarEditorClosed()));
   997 		mCalenEditor->edit(mAgendaEntry, false);
  1078 		mCalenEditor->edit(mAgendaEntry, false);
   998 	
  1079 	
   999 		
  1080 		
  1000 	}
  1081 	}
       
  1082 	OstTraceFunctionExit0( AGENDAEVENTVIEW_EDIT_EXIT );
  1001 }
  1083 }
  1002 
  1084 
  1003 /*!
  1085 /*!
  1004 	Deletes the agenda entry.
  1086 	Deletes the agenda entry.
  1005  */
  1087  */
  1006 void AgendaEventView::deleteAgendaEntry()
  1088 void AgendaEventView::deleteAgendaEntry()
  1007 {
  1089 {
       
  1090     OstTraceFunctionEntry0( AGENDAEVENTVIEW_DELETEAGENDAENTRY_ENTRY );
  1008 
  1091 
  1009 	// Before we do anything, check in the entry is repeating
  1092 	// Before we do anything, check in the entry is repeating
  1010 	// OR its a child item
  1093 	// OR its a child item
  1011 	bool isChild = !(mAgendaEntry.recurrenceId().isNull());
  1094 	bool isChild = !(mAgendaEntry.recurrenceId().isNull());
  1012 	bool isRepeating = mAgendaEntry.isRepeating();
  1095 	bool isRepeating = mAgendaEntry.isRepeating();
  1017 		showDeleteOccurencePopup();
  1100 		showDeleteOccurencePopup();
  1018 	} else {
  1101 	} else {
  1019         showDeleteConfirmationQuery();
  1102         showDeleteConfirmationQuery();
  1020 	}
  1103 	}
  1021 
  1104 
       
  1105 	OstTraceFunctionExit0( AGENDAEVENTVIEW_DELETEAGENDAENTRY_EXIT );
  1022 }
  1106 }
  1023 
  1107 
  1024 /*!
  1108 /*!
  1025 	Save the agenda entry to calendar db.
  1109 	Save the agenda entry to calendar db.
  1026  */
  1110  */
  1027 void AgendaEventView::saveAgendaEntry()
  1111 void AgendaEventView::saveAgendaEntry()
  1028 {
  1112 {
       
  1113 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_SAVEAGENDAENTRY_ENTRY );
  1029 	
  1114 	
  1030 	// Save entry to calendar.
  1115 	// Save entry to calendar.
  1031 	mOwner->mAgendaUtil->addEntry(mAgendaEntry);
  1116 	mOwner->mAgendaUtil->store(mAgendaEntry);
  1032 	
  1117 	
  1033 	// Close the agenda entry viewer
  1118 	// Close the agenda entry viewer
  1034 	close();
  1119 	close();
       
  1120 	OstTraceFunctionExit0( AGENDAEVENTVIEW_SAVEAGENDAENTRY_EXIT );
  1035 }
  1121 }
  1036 /*!
  1122 /*!
  1037 	Closes the event viewer
  1123 	Closes the event viewer
  1038  */
  1124  */
  1039 void AgendaEventView::close()
  1125 void AgendaEventView::close()
  1040 {
  1126 {
       
  1127     OstTraceFunctionEntry0( AGENDAEVENTVIEW_CLOSE_ENTRY );
  1041 
  1128 
  1042 	// Remove the view from main window.
  1129 	// Remove the view from main window.
  1043 	HbMainWindow *window = hbInstance->allMainWindows().first();
  1130 	HbMainWindow *window = hbInstance->allMainWindows().first();
  1044 
  1131 
  1045 	// Cleanup.
  1132 	// Cleanup.
  1046 	disconnect(
  1133 	disconnect(
  1047 			mBackAction, SIGNAL(triggered()),
  1134 			mBackAction, SIGNAL(triggered()),
  1048 			this, SLOT(close()));
  1135 			this, SLOT(close()));
  1049 
  1136 
  1050 	window->removeView(mViewer);
  1137 	window->removeView(mViewer);
       
  1138 	if (AgendaEntry::TypeTodo == mAgendaEntry.type()) {
       
  1139 	    mAgendaEntry.setStartAndEndTime(
       
  1140 	            CalenDateUtils::today(), CalenDateUtils::today());
       
  1141 	}
  1051 	mOwner->viewingCompleted(mAgendaEntry.startTime().date());
  1142 	mOwner->viewingCompleted(mAgendaEntry.startTime().date());
  1052 
  1143 
       
  1144 	OstTraceFunctionExit0( AGENDAEVENTVIEW_CLOSE_EXIT );
  1053 }
  1145 }
  1054 
  1146 
  1055 /*!
  1147 /*!
  1056 	Handles entry updation of the event entry.
  1148 	Handles entry updation of the event entry.
  1057  */
  1149  */
  1058 void AgendaEventView::handleEntryUpdation(ulong id)
  1150 void AgendaEventView::handleEntryUpdation(ulong id)
  1059 {
  1151 {
       
  1152     OstTraceFunctionEntry0( AGENDAEVENTVIEW_HANDLEENTRYUPDATION_ENTRY );
  1060 
  1153 
  1061 	AgendaEntry updatedEntry = mOwner->mAgendaUtil->fetchById(id);
  1154 	AgendaEntry updatedEntry = mOwner->mAgendaUtil->fetchById(id);
  1062 
  1155 
  1063 	// Agenda entry is not null then refresh the view else close event viewer
  1156 	// Agenda entry is not null then refresh the view else close event viewer
  1064 	if (!updatedEntry.isNull()) {
  1157 	if (!updatedEntry.isNull()) {
  1065 
  1158 
  1066 		mAgendaEntry = updatedEntry;
  1159 		mAgendaEntry = updatedEntry;
  1067 
  1160 		
  1068 		if (updatedEntry.isRepeating() && mAgendaEntry.type()
  1161 		// If the updated entry's & original entry's repeat rule mismatches than
  1069 		        != AgendaEntry::TypeTodo) {
  1162 		// show the parent entry.
       
  1163 		if (updatedEntry.isRepeating() &&
       
  1164 		        mAgendaEntry.type() != AgendaEntry::TypeTodo &&
       
  1165 		        mOriginalAgendaEntry.repeatRule() ==
       
  1166 		                updatedEntry.repeatRule()) {
  1070 			// if start date of original entry is between start date of updated 
  1167 			// if start date of original entry is between start date of updated 
  1071 			// entry and until date of updated entry then only update time.
  1168 			// entry and until date of updated entry then only update time.
  1072 			if (mOriginalAgendaEntry.startTime().date()
  1169 			if (mOriginalAgendaEntry.startTime().date()
  1073 			        >= updatedEntry.startTime().date()
  1170 			        >= updatedEntry.startTime().date()
  1074 			        && mOriginalAgendaEntry.startTime().date()
  1171 			        && mOriginalAgendaEntry.startTime().date()
  1100 	} else {
  1197 	} else {
  1101 		// Close the agenda entry viewer
  1198 		// Close the agenda entry viewer
  1102 		close();
  1199 		close();
  1103 	}
  1200 	}
  1104 
  1201 
       
  1202 	OstTraceFunctionExit0( AGENDAEVENTVIEW_HANDLEENTRYUPDATION_EXIT );
  1105 }
  1203 }
  1106 
  1204 
  1107 /*!
  1205 /*!
  1108 	Handles the entry deletion of the agenda entry
  1206 	Handles the entry deletion of the agenda entry
  1109 */
  1207 */
  1110 void AgendaEventView::handleEntryDeletion(ulong id)
  1208 void AgendaEventView::handleEntryDeletion(ulong id)
  1111 {
  1209 {
       
  1210     OstTraceFunctionEntry0( AGENDAEVENTVIEW_HANDLEENTRYDELETION_ENTRY );
  1112 
  1211 
  1113 	if (id == mAgendaEntry.id()) {
  1212 	if (id == mAgendaEntry.id()) {
  1114 		// Close the agenda entry viewer
  1213 		// Close the agenda entry viewer
  1115 		close();
  1214 		close();
  1116 		mOwner->deletingCompleted();
  1215 		mOwner->deletingCompleted();
  1117 	}
  1216 	}
  1118 
  1217 
       
  1218 	OstTraceFunctionExit0( AGENDAEVENTVIEW_HANDLEENTRYDELETION_EXIT );
  1119 }
  1219 }
  1120 
  1220 
  1121 /*!
  1221 /*!
  1122 	Handles the Note Editor editing completion of the agenda entry
  1222 	Handles the Note Editor editing completion of the agenda entry
  1123  */
  1223  */
  1124 void AgendaEventView::handleNoteEditorClosed(bool status)
  1224 void AgendaEventView::handleNoteEditorClosed(bool status)
  1125 {
  1225 {
       
  1226 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_HANDLENOTEEDITORCLOSED_ENTRY );
  1126 	Q_UNUSED(status);
  1227 	Q_UNUSED(status);
  1127 
  1228 
  1128 	// To avoid loading the plugin again for editing,
  1229 	// To avoid loading the plugin again for editing,
  1129 	// Unload the plug-in while destruction.
  1230 	// Unload the plug-in while destruction.
  1130 
  1231 
  1131 	mOwner->editingCompleted();
  1232 	mOwner->editingCompleted();
  1132 
  1233 
       
  1234 	OstTraceFunctionExit0( AGENDAEVENTVIEW_HANDLENOTEEDITORCLOSED_EXIT );
  1133 }
  1235 }
  1134 
  1236 
  1135 /*!
  1237 /*!
  1136 	Handles the Note Editor editing completion of the agenda entry
  1238 	Handles the Note Editor editing completion of the agenda entry
  1137  */
  1239  */
  1138 void AgendaEventView::handleCalendarEditorClosed()
  1240 void AgendaEventView::handleCalendarEditorClosed()
  1139 {
  1241 {
       
  1242     OstTraceFunctionEntry0( AGENDAEVENTVIEW_HANDLECALENDAREDITORCLOSED_ENTRY );
  1140 
  1243 
  1141 	// Cleanup.
  1244 	// Cleanup.
  1142 	mCalenEditor->deleteLater();
  1245 	mCalenEditor->deleteLater();
  1143 	mOwner->editingCompleted();
  1246 	mOwner->editingCompleted();
  1144 
  1247 
       
  1248 	OstTraceFunctionExit0( AGENDAEVENTVIEW_HANDLECALENDAREDITORCLOSED_EXIT );
  1145 }
  1249 }
  1146 
  1250 
  1147 /*!
  1251 /*!
  1148 	Slot to handle User selection for series deleting or single occurence popup
  1252 	Slot to handle User selection for series deleting or single occurence popup
  1149  */
  1253  */
  1150 void AgendaEventView::handleDeleteOccurence(int index)
  1254 void AgendaEventView::handleDeleteOccurence(int index)
  1151 {
  1255 {
       
  1256 	OstTraceFunctionEntry0( AGENDAEVENTVIEW_HANDLEDELETEOCCURENCE_ENTRY );
  1152 	
  1257 	
  1153 	// To notify client that deleting Started
  1258 	// To notify client that deleting Started
  1154 	// Calendar Application changing state from viewing to deleting.
  1259 	// Calendar Application changing state from viewing to deleting.
  1155 	mOwner->deletingStarted();
  1260 	mOwner->deletingStarted();
  1156 	
  1261 	
  1166 			mOwner->mAgendaUtil->deleteRepeatedEntry(mAgendaEntry,
  1271 			mOwner->mAgendaUtil->deleteRepeatedEntry(mAgendaEntry,
  1167 			                                         AgendaUtil::ThisAndAll);
  1272 			                                         AgendaUtil::ThisAndAll);
  1168 			break;
  1273 			break;
  1169 	}
  1274 	}
  1170 
  1275 
       
  1276 	OstTraceFunctionExit0( AGENDAEVENTVIEW_HANDLEDELETEOCCURENCE_EXIT );
  1171 }
  1277 }
  1172 
  1278 
  1173 /*!
  1279 /*!
  1174     Returns subject icon
  1280     Returns subject icon
  1175  */
  1281  */
  1176 void AgendaEventView::getSubjectIcon(AgendaEntry::Type type, QString &subjectIcon)
  1282 void AgendaEventView::getSubjectIcon(AgendaEntry::Type type, QString &subjectIcon)
  1177     {
  1283     {
       
  1284     OstTraceFunctionEntry0( AGENDAEVENTVIEW_GETSUBJECTICON_ENTRY );
  1178     switch(type) {
  1285     switch(type) {
  1179         case AgendaEntry::TypeAppoinment:
  1286         case AgendaEntry::TypeAppoinment:
  1180             {
  1287             {
  1181             subjectIcon.append("qtg_small_meeting");
  1288             subjectIcon.append("qtg_small_meeting");
  1182             }
  1289             }
  1183             break;
  1290             break;
  1184         case AgendaEntry::TypeTodo:
  1291         case AgendaEntry::TypeTodo:
  1185             {
  1292             {
  1186             subjectIcon.append("qtg_small_todo");
  1293             if (AgendaEntry::TodoCompleted == mAgendaEntry.status()) {
       
  1294                 subjectIcon.append("qtg_small_todo_done");
       
  1295             } else {
       
  1296                 subjectIcon.append("qtg_small_todo");
       
  1297             }
  1187             }
  1298             }
  1188             break;
  1299             break;
  1189         case AgendaEntry::TypeEvent:
  1300         case AgendaEntry::TypeEvent:
  1190             {
  1301             {
  1191             subjectIcon.append("qtg_small_day");
  1302             subjectIcon.append("qtg_small_day");
  1198             break;
  1309             break;
  1199         default:
  1310         default:
  1200             break;
  1311             break;
  1201     }
  1312     }
  1202 
  1313 
       
  1314     OstTraceFunctionExit0( AGENDAEVENTVIEW_GETSUBJECTICON_EXIT );
  1203     }
  1315     }
  1204 
  1316 
  1205 /*!
  1317 /*!
  1206     According to maptile fetching status , update the viewer screen.
  1318     According to maptile fetching status , update the viewer screen.
  1207  */
  1319  */
  1208 void AgendaEventView::updateProgressIndicator()
  1320 void AgendaEventView::updateProgressIndicator()
  1209 {   
  1321 {   
       
  1322     OstTraceFunctionEntry0( AGENDAEVENTVIEW_UPDATEPROGRESSINDICATOR_ENTRY );
  1210     if (!mMaptileStatusReceived) {
  1323     if (!mMaptileStatusReceived) {
  1211         QString iconName("qtg_anim_small_loading_");
  1324         QString iconName("qtg_anim_small_loading_");
  1212         mProgressIconCount = mProgressIconCount % 10 + 1;
  1325         mProgressIconCount = mProgressIconCount % 10 + 1;
  1213         iconName.append(QVariant(mProgressIconCount).toString());
  1326         iconName.append(QVariant(mProgressIconCount).toString());
  1214         QStringList itemData;
  1327         QStringList itemData;
  1254             mLocationWidget->setProperty(primaryLeftIconItem, true);
  1367             mLocationWidget->setProperty(primaryLeftIconItem, true);
  1255             mLocationWidget->setEventViewerItemData(itemData, Qt::DecorationRole);
  1368             mLocationWidget->setEventViewerItemData(itemData, Qt::DecorationRole);
  1256 
  1369 
  1257         }
  1370         }
  1258     }
  1371     }
       
  1372     OstTraceFunctionExit0( AGENDAEVENTVIEW_UPDATEPROGRESSINDICATOR_EXIT );
  1259 }
  1373 }
  1260 
  1374 
  1261 /*!
  1375 /*!
  1262     Maptile status received from maptile service 
  1376     Maptile status received from maptile service 
  1263  */
  1377  */
  1264 void AgendaEventView::receiveMapTileStatus(int entryid,int addressType, int status)
  1378 void AgendaEventView::receiveMapTileStatus(int entryid,int addressType, int status)
  1265 {
  1379 {
       
  1380     OstTraceFunctionEntry0( AGENDAEVENTVIEW_RECEIVEMAPTILESTATUS_ENTRY );
  1266     if (mAgendaEntry.id() == entryid && addressType == MapTileService::AddressPlain) {
  1381     if (mAgendaEntry.id() == entryid && addressType == MapTileService::AddressPlain) {
  1267         mMaptileStatusReceived = true;
  1382         mMaptileStatusReceived = true;
  1268         mMaptileStatus = status;
  1383         mMaptileStatus = status;
  1269         updateProgressIndicator();
  1384         updateProgressIndicator();
  1270     }
  1385     }
       
  1386     OstTraceFunctionExit0( AGENDAEVENTVIEW_RECEIVEMAPTILESTATUS_EXIT );
  1271 }
  1387 }
  1272 
  1388 
  1273 /*!
  1389 /*!
  1274     Returns progress indication icon as per status of entry in database.
  1390     Returns progress indication icon as per status of entry in database.
  1275  */
  1391  */
  1276 void AgendaEventView::getProgressIndicatorstatus(QString &progressIcon)
  1392 void AgendaEventView::getProgressIndicatorstatus(QString &progressIcon)
  1277 {
  1393 {
       
  1394     OstTraceFunctionEntry0( AGENDAEVENTVIEW_GETPROGRESSINDICATORSTATUS_ENTRY );
  1278     MapTileService::AddressType addressType;
  1395     MapTileService::AddressType addressType;
  1279     addressType = MapTileService::AddressPlain;
  1396     addressType = MapTileService::AddressPlain;
  1280     int eventId = mAgendaEntry.id();
  1397     int eventId = mAgendaEntry.id();
  1281     mMaptilePath.clear();
  1398     mMaptilePath.clear();
  1282     mMaptileStatus = -1;
  1399     mMaptileStatus = -1;
  1303         //no further need of this coonnection
  1420         //no further need of this coonnection
  1304         disconnect(mMaptileService, SIGNAL(maptileFetchingStatusUpdate(int,
  1421         disconnect(mMaptileService, SIGNAL(maptileFetchingStatusUpdate(int,
  1305                 int ,int)), this, SLOT(receiveMapTileStatus(int,int,int)));
  1422                 int ,int)), this, SLOT(receiveMapTileStatus(int,int,int)));
  1306         progressIcon.append(QString::null);
  1423         progressIcon.append(QString::null);
  1307     }
  1424     }
       
  1425     OstTraceFunctionExit0( AGENDAEVENTVIEW_GETPROGRESSINDICATORSTATUS_EXIT );
  1308 }
  1426 }
  1309 /*!
  1427 /*!
  1310     Reload the maptile image on system orientation change.
  1428     Reload the maptile image on system orientation change.
  1311  */
  1429  */
  1312 void AgendaEventView::changedOrientation(Qt::Orientation orientation)
  1430 void AgendaEventView::changedOrientation(Qt::Orientation orientation)
  1313 {
  1431 {
       
  1432     OstTraceFunctionEntry0( AGENDAEVENTVIEW_CHANGEDORIENTATION_ENTRY );
  1314     if (mMaptileStatus == MapTileService::MapTileFetchingCompleted) {
  1433     if (mMaptileStatus == MapTileService::MapTileFetchingCompleted) {
  1315         mMaptilePath.clear();
  1434         mMaptilePath.clear();
  1316         mMaptileService->getMapTileImage(mAgendaEntry.id(), MapTileService::AddressPlain, mMaptilePath,orientation);
  1435         mMaptileService->getMapTileImage(mAgendaEntry.id(), MapTileService::AddressPlain, mMaptilePath,orientation);
  1317         addMapTileImage();
  1436         addMapTileImage();
  1318     }
  1437     }
       
  1438     OstTraceFunctionExit0( AGENDAEVENTVIEW_CHANGEDORIENTATION_EXIT );
  1319 }
  1439 }
  1320 
  1440 
  1321 // End of file
  1441 // End of file