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