calendarui/caleneditor/src/caleneditor_p.cpp
changeset 51 0b38fc5b94c6
parent 45 b6db4fd4947b
child 55 2c54b51f39c4
equal deleted inserted replaced
46:ecd7b9840282 51:0b38fc5b94c6
    60 #include "caleneditorcommon.h"
    60 #include "caleneditorcommon.h"
    61 #include "calendateutils.h"
    61 #include "calendateutils.h"
    62 #include "caleneditordatahandler.h"
    62 #include "caleneditordatahandler.h"
    63 #include "caleneditorreminderfield.h"
    63 #include "caleneditorreminderfield.h"
    64 #include "caleneditorrepeatfield.h"
    64 #include "caleneditorrepeatfield.h"
       
    65 #include "OstTraceDefinitions.h"
       
    66 #ifdef OST_TRACE_COMPILER_IN_USE
       
    67 #include "caleneditor_pTraces.h"
       
    68 #endif
       
    69 
    65 
    70 
    66 /*!
    71 /*!
    67 	\class CalenEditorPrivate
    72 	\class CalenEditorPrivate
    68 	This object loads the calendar editor view. The view is added to the top
    73 	This object loads the calendar editor view. The view is added to the top
    69 	of the HbMainWindow.
    74 	of the HbMainWindow.
   215 									mIsChild(false),
   220 									mIsChild(false),
   216 									mIsAllDayItemAdded(false),
   221 									mIsAllDayItemAdded(false),
   217 									mLaunchCalendar(false),
   222 									mLaunchCalendar(false),
   218 									mMenuItemAdded(false)
   223 									mMenuItemAdded(false)
   219 {
   224 {
       
   225 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_CALENEDITORPRIVATE_ENTRY );
   220 	// First get the q-pointer.
   226 	// First get the q-pointer.
   221 	q_ptr = static_cast<CalenEditor *> (parent);
   227 	q_ptr = static_cast<CalenEditor *> (parent);
   222 	mMainWindow = NULL;
   228 	mMainWindow = NULL;
   223 	mTranslator->loadCommon();
   229 	mTranslator->loadCommon();
   224 	
   230 	
   227 		mOwnsAgendaUtil = true;
   233 		mOwnsAgendaUtil = true;
   228 	} else {
   234 	} else {
   229 		mAgendaUtil = agendaUtil;
   235 		mAgendaUtil = agendaUtil;
   230 		mOwnsAgendaUtil = false;
   236 		mOwnsAgendaUtil = false;
   231 	}
   237 	}
       
   238 	OstTraceFunctionExit0( CALENEDITORPRIVATE_CALENEDITORPRIVATE_EXIT );
   232 }
   239 }
   233 
   240 
   234 /*!
   241 /*!
   235 	Destructor.
   242 	Destructor.
   236  */
   243  */
   237 CalenEditorPrivate::~CalenEditorPrivate()
   244 CalenEditorPrivate::~CalenEditorPrivate()
   238 {
   245 {
       
   246 	OstTraceFunctionEntry0( DUP1_CALENEDITORPRIVATE_CALENEDITORPRIVATE_ENTRY );
   239 	if(mOwnsAgendaUtil) {
   247 	if(mOwnsAgendaUtil) {
   240 		delete mAgendaUtil;
   248 		delete mAgendaUtil;
   241 		mAgendaUtil = NULL;
   249 		mAgendaUtil = NULL;
   242 	}
   250 	}
   243 	if (mOriginalEntry) {
   251 	if (mOriginalEntry) {
   277 	// delete the mainwindow object if created any
   285 	// delete the mainwindow object if created any
   278 	if (mMainWindow) {
   286 	if (mMainWindow) {
   279 		delete mMainWindow;
   287 		delete mMainWindow;
   280 		mMainWindow = NULL;
   288 		mMainWindow = NULL;
   281 	}
   289 	}
       
   290 	OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_CALENEDITORPRIVATE_EXIT );
   282 }
   291 }
   283 
   292 
   284 /*!
   293 /*!
   285 	Shows the caleneditor by parsing a .vcs.
   294 	Shows the caleneditor by parsing a .vcs.
   286 
   295 
   287 	\param handle reference to QFile handle.
   296 	\param handle reference to QFile handle.
   288  */
   297  */
   289 void CalenEditorPrivate::edit(const QFile &/*handle*/, bool launchCalendar)
   298 void CalenEditorPrivate::edit(const QFile &/*handle*/, bool launchCalendar)
   290 {
   299 {
       
   300 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_EDIT_ENTRY );
   291 	// TODO: Needs to be implemented using importer.
   301 	// TODO: Needs to be implemented using importer.
   292 	mNewEntry = false;
   302 	mNewEntry = false;
   293 	mLaunchCalendar = launchCalendar;
   303 	mLaunchCalendar = launchCalendar;
       
   304 	OstTraceFunctionExit0( CALENEDITORPRIVATE_EDIT_EXIT );
   294 }
   305 }
   295 
   306 
   296 /*!
   307 /*!
   297 	Shows the caleneditor, by parsing an AgendaEntry.
   308 	Shows the caleneditor, by parsing an AgendaEntry.
   298 	\param entry An object of AgendaEntry.
   309 	\param entry An object of AgendaEntry.
   299  */
   310  */
   300 void CalenEditorPrivate::edit(AgendaEntry entry, bool launchCalendar)
   311 void CalenEditorPrivate::edit(AgendaEntry entry, bool launchCalendar)
   301 {
   312 {
       
   313 	OstTraceFunctionEntry0( DUP1_CALENEDITORPRIVATE_EDIT_ENTRY );
   302 	mNewEntry = false;
   314 	mNewEntry = false;
   303 	mLaunchCalendar = launchCalendar;
   315 	mLaunchCalendar = launchCalendar;
   304 	openEditor(entry);
   316 	openEditor(entry);
       
   317 	OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_EDIT_EXIT );
   305 }
   318 }
   306 
   319 
   307 /*!
   320 /*!
   308 	Shows the caleneditor, by using the entry id provided.
   321 	Shows the caleneditor, by using the entry id provided.
   309 	\param id entry id.
   322 	\param id entry id.
   310  */
   323  */
   311 void CalenEditorPrivate::edit(ulong id, bool launchCalendar)
   324 void CalenEditorPrivate::edit(ulong id, bool launchCalendar)
   312 {
   325 {
       
   326 	OstTraceFunctionEntry0( DUP2_CALENEDITORPRIVATE_EDIT_ENTRY );
   313 	mNewEntry = false;
   327 	mNewEntry = false;
   314 	AgendaEntry entry = mAgendaUtil->fetchById(id);
   328 	AgendaEntry entry = mAgendaUtil->fetchById(id);
   315 	if(entry.isNull()) {
   329 	if(entry.isNull()) {
       
   330 		OstTraceFunctionExit0( DUP2_CALENEDITORPRIVATE_EDIT_EXIT );
   316 		return;
   331 		return;
   317 	}
   332 	}
   318 	edit(entry, launchCalendar);
   333 	edit(entry, launchCalendar);
       
   334 	OstTraceFunctionExit0( DUP3_CALENEDITORPRIVATE_EDIT_EXIT );
   319 }
   335 }
   320 
   336 
   321 /*!
   337 /*!
   322 	Creates a new entry based on the create type.It launches the
   338 	Creates a new entry based on the create type.It launches the
   323 	editor for editing
   339 	editor for editing
   325 	\QDateTime newEntryDateTime is the event start time.
   341 	\QDateTime newEntryDateTime is the event start time.
   326  */
   342  */
   327 void CalenEditorPrivate::create(CalenEditor::CreateType type,
   343 void CalenEditorPrivate::create(CalenEditor::CreateType type,
   328                                 QDateTime newEntryDateTime, bool launchCalendar)
   344                                 QDateTime newEntryDateTime, bool launchCalendar)
   329 {
   345 {
       
   346 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_CREATE_ENTRY );
   330 	mNewEntryDateTime = newEntryDateTime;
   347 	mNewEntryDateTime = newEntryDateTime;
   331 	mNewEntry = true;
   348 	mNewEntry = true;
   332 	AgendaEntry entry;
   349 	AgendaEntry entry;
   333 	switch(type){
   350 	switch(type){
   334 		case CalenEditor::TypeAppointment: {
   351 		case CalenEditor::TypeAppointment: {
   341 			entry.setType(AgendaEntry::TypeAppoinment);
   358 			entry.setType(AgendaEntry::TypeAppoinment);
   342 			break;
   359 			break;
   343 	}
   360 	}
   344 	mLaunchCalendar = launchCalendar;
   361 	mLaunchCalendar = launchCalendar;
   345 	openEditor(entry);
   362 	openEditor(entry);
       
   363 	OstTraceFunctionExit0( CALENEDITORPRIVATE_CREATE_EXIT );
   346 }
   364 }
   347 
   365 
   348 /*!
   366 /*!
   349 	Creates a new entry based on the create type.It launches the
   367 	Creates a new entry based on the create type.It launches the
   350 	editor for editing
   368 	editor for editing
   352 	\QDateTime newEntryDateTime is the event start time.
   370 	\QDateTime newEntryDateTime is the event start time.
   353  */
   371  */
   354 void CalenEditorPrivate::create(CalenEditor::CreateType type,
   372 void CalenEditorPrivate::create(CalenEditor::CreateType type,
   355                                 AgendaEntry entry, bool launchCalendar)
   373                                 AgendaEntry entry, bool launchCalendar)
   356 {
   374 {
       
   375 	OstTraceFunctionEntry0( DUP1_CALENEDITORPRIVATE_CREATE_ENTRY );
   357 	mNewEntry = true;
   376 	mNewEntry = true;
   358 	switch(type){
   377 	switch(type){
   359 		case CalenEditor::TypeAppointment: {
   378 		case CalenEditor::TypeAppointment: {
   360 			entry.setType(AgendaEntry::TypeAppoinment);
   379 			entry.setType(AgendaEntry::TypeAppoinment);
   361 		}
   380 		}
   367 			break;
   386 			break;
   368 	}
   387 	}
   369 	mNewEntryDateTime = entry.startTime();
   388 	mNewEntryDateTime = entry.startTime();
   370 	mLaunchCalendar = launchCalendar;
   389 	mLaunchCalendar = launchCalendar;
   371 	openEditor(entry);
   390 	openEditor(entry);
       
   391 	OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_CREATE_EXIT );
   372 }
   392 }
   373 
   393 
   374 /*!
   394 /*!
   375 	Queries user whether to edit whole series or just this single occurence
   395 	Queries user whether to edit whole series or just this single occurence
   376  */
   396  */
   377 void CalenEditorPrivate::showEditOccurencePopup()
   397 void CalenEditorPrivate::showEditOccurencePopup()
   378 {
   398 {
       
   399 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SHOWEDITOCCURENCEPOPUP_ENTRY );
   379 	HbDialog *popUp = new HbDialog();
   400 	HbDialog *popUp = new HbDialog();
   380 	popUp->setDismissPolicy(HbDialog::NoDismiss);
   401 	popUp->setDismissPolicy(HbDialog::NoDismiss);
   381 	popUp->setTimeout(HbDialog::NoTimeout);
   402 	popUp->setTimeout(HbDialog::NoTimeout);
   382 	popUp->setAttribute( Qt::WA_DeleteOnClose, true );
   403 	popUp->setAttribute( Qt::WA_DeleteOnClose, true );
   383 	
   404 	
   407 	        SLOT(handleEditOccurence(int)));
   428 	        SLOT(handleEditOccurence(int)));
   408 	connect(cancelAction, SIGNAL(triggered()), this, SLOT(handleCancel()));
   429 	connect(cancelAction, SIGNAL(triggered()), this, SLOT(handleCancel()));
   409 
   430 
   410 	// Show the popup
   431 	// Show the popup
   411 	popUp->open();
   432 	popUp->open();
       
   433 	OstTraceFunctionExit0( CALENEDITORPRIVATE_SHOWEDITOCCURENCEPOPUP_EXIT );
   412 }
   434 }
   413 
   435 
   414 /*!
   436 /*!
   415 	Slot to handle User selection for series editing or single occurence popup
   437 	Slot to handle User selection for series editing or single occurence popup
   416  */
   438  */
   417 void CalenEditorPrivate::handleEditOccurence(int index)
   439 void CalenEditorPrivate::handleEditOccurence(int index)
   418 {
   440 {
       
   441 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLEEDITOCCURENCE_ENTRY );
   419 	switch (index) {
   442 	switch (index) {
   420 		case 0:
   443 		case 0:
   421 			// User wants to edit only this occurence
   444 			// User wants to edit only this occurence
   422 			mEditRange = ThisOnly;
   445 			mEditRange = ThisOnly;
   423 			break;
   446 			break;
   431 	AgendaEntry entryToBeEdited = mEntry;
   454 	AgendaEntry entryToBeEdited = mEntry;
   432 	if (mEditRange == ThisAndAll) {
   455 	if (mEditRange == ThisAndAll) {
   433 		entryToBeEdited = mAgendaUtil->parentEntry(mEntry);
   456 		entryToBeEdited = mAgendaUtil->parentEntry(mEntry);
   434 	}
   457 	}
   435 	showEditor(entryToBeEdited);
   458 	showEditor(entryToBeEdited);
       
   459 	OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLEEDITOCCURENCE_EXIT );
   436 }
   460 }
   437 
   461 
   438 /*!
   462 /*!
   439 	Slot to handle cancel action on the popup
   463 	Slot to handle cancel action on the popup
   440  */
   464  */
   441 void CalenEditorPrivate::handleCancel()
   465 void CalenEditorPrivate::handleCancel()
   442 {
   466 {
       
   467 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLECANCEL_ENTRY );
   443 	// User has chosen not to edit the event, hence return
   468 	// User has chosen not to edit the event, hence return
   444 	mEditRange = UserCancelled;
   469 	mEditRange = UserCancelled;
   445 	// Do cleanup and return
   470 	// Do cleanup and return
   446 	emit q_ptr->dialogClosed();
   471 	emit q_ptr->dialogClosed();
       
   472 	OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLECANCEL_EXIT );
   447 	return;
   473 	return;
   448 }
   474 }
   449 
   475 
   450 /*!
   476 /*!
   451 	Opens the editor.
   477 	Opens the editor.
   452  */
   478  */
   453 void CalenEditorPrivate::openEditor(AgendaEntry entry)
   479 void CalenEditorPrivate::openEditor(AgendaEntry entry)
   454 {
   480 {
       
   481 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_OPENEDITOR_ENTRY );
   455 	if (0 < entry.id()) {
   482 	if (0 < entry.id()) {
   456 		mNewEntry = false;
   483 		mNewEntry = false;
   457 	}
   484 	}
   458 	if (!mNewEntry) {
   485 	if (!mNewEntry) {
   459 		// Before we do anything, check in the entry is repeating
   486 		// Before we do anything, check in the entry is repeating
   464 		mEntry = entry;
   491 		mEntry = entry;
   465 		if (mIsChild || isRepeating) {
   492 		if (mIsChild || isRepeating) {
   466 			// Query user if he wants to edit whole series 
   493 			// Query user if he wants to edit whole series 
   467 			// or just this occurence
   494 			// or just this occurence
   468 			showEditOccurencePopup();
   495 			showEditOccurencePopup();
       
   496 			OstTraceFunctionExit0( CALENEDITORPRIVATE_OPENEDITOR_EXIT );
   469 			return;
   497 			return;
   470 		}else {
   498 		}else {
   471 			mEditRange = ThisAndAll;
   499 			mEditRange = ThisAndAll;
   472 		}
   500 		}
   473 	}
   501 	}
   474 	showEditor(entry);
   502 	showEditor(entry);
       
   503 	OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_OPENEDITOR_EXIT );
   475 }
   504 }
   476 
   505 
   477 /*!
   506 /*!
   478 	Displays the editor.
   507 	Displays the editor.
   479  */
   508  */
   480 void CalenEditorPrivate::showEditor(AgendaEntry entry)
   509 void CalenEditorPrivate::showEditor(AgendaEntry entry)
   481 {
   510 {
       
   511 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SHOWEDITOR_ENTRY );
   482 	mOriginalEntry = new AgendaEntry(entry);
   512 	mOriginalEntry = new AgendaEntry(entry);
   483 	mEditedEntry = new AgendaEntry(entry);
   513 	mEditedEntry = new AgendaEntry(entry);
   484 
   514 
   485 	if (!mEditedEntry->description().isEmpty()) {
   515 	if (!mEditedEntry->description().isEmpty()) {
   486 		mDescriptionItemAdded = true;
   516 		mDescriptionItemAdded = true;
   496 	connect(mSoftKeyAction, SIGNAL(triggered()), this,
   526 	connect(mSoftKeyAction, SIGNAL(triggered()), this,
   497 	        SLOT(saveAndCloseEditor()));
   527 	        SLOT(saveAndCloseEditor()));
   498 
   528 
   499 	// Create the data handler
   529 	// Create the data handler
   500 	mDataHandler = new CalenEditorDataHandler(this,mEditedEntry, mOriginalEntry);
   530 	mDataHandler = new CalenEditorDataHandler(this,mEditedEntry, mOriginalEntry);
       
   531 	OstTraceFunctionExit0( CALENEDITORPRIVATE_SHOWEDITOR_EXIT );
   501 }
   532 }
   502 
   533 
   503 /*!
   534 /*!
   504 	Sets up the view.
   535 	Sets up the view.
   505  */
   536  */
   506 void CalenEditorPrivate::setUpView()
   537 void CalenEditorPrivate::setUpView()
   507 {
   538 {
       
   539 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SETUPVIEW_ENTRY );
   508 	mEditorDocLoader = new CalenEditorDocLoader();
   540 	mEditorDocLoader = new CalenEditorDocLoader();
   509 	bool loadSuccess = false;
   541 	bool loadSuccess = false;
   510 
   542 
   511 	mEditorDocLoader->load(CALEN_EDITOR_XML_FILE, &loadSuccess);
   543 	mEditorDocLoader->load(CALEN_EDITOR_XML_FILE, &loadSuccess);
   512 	Q_ASSERT_X(loadSuccess, "caleneditor.cpp",
   544 	Q_ASSERT_X(loadSuccess, "caleneditor.cpp",
   576 	} else {
   608 	} else {
   577 		window->addView(mEditorView);
   609 		window->addView(mEditorView);
   578 		window->setCurrentView(mEditorView);
   610 		window->setCurrentView(mEditorView);
   579 	}
   611 	}
   580 	
   612 	
       
   613 	OstTraceFunctionExit0( CALENEDITORPRIVATE_SETUPVIEW_EXIT );
   581 }
   614 }
   582 
   615 
   583 /*!
   616 /*!
   584 	Adding the discard Menu option for the Editor view.
   617 	Adding the discard Menu option for the Editor view.
   585  */
   618  */
   586 void CalenEditorPrivate::addDiscardAction()
   619 void CalenEditorPrivate::addDiscardAction()
   587 {
   620 {
       
   621 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ADDDISCARDACTION_ENTRY );
   588 	if (!mMenuItemAdded) {
   622 	if (!mMenuItemAdded) {
   589 		// Set this specific menu   
   623 		// Set this specific menu   
   590 		HbMenu *menu = mEditorView->menu();
   624 		HbMenu *menu = mEditorView->menu();
   591 		HbAction *discardAction =
   625 		HbAction *discardAction =
   592 					new HbAction(hbTrId("txt_calendar_opt_discard_changes"));
   626 					new HbAction(hbTrId("txt_calendar_opt_discard_changes"));
   594 		connect(discardAction, SIGNAL(triggered()), this,
   628 		connect(discardAction, SIGNAL(triggered()), this,
   595 					SLOT(discardChanges()));
   629 					SLOT(discardChanges()));
   596 		mEditorView->setMenu(menu);
   630 		mEditorView->setMenu(menu);
   597 		mMenuItemAdded = true;
   631 		mMenuItemAdded = true;
   598 	}
   632 	}
       
   633 	OstTraceFunctionExit0( CALENEDITORPRIVATE_ADDDISCARDACTION_EXIT );
   599 }
   634 }
   600 
   635 
   601 /*!
   636 /*!
   602 	Initialises the Model & sets for the CalenEditorForm.
   637 	Initialises the Model & sets for the CalenEditorForm.
   603  */
   638  */
   604 void CalenEditorPrivate::initModel()
   639 void CalenEditorPrivate::initModel()
   605 {
   640 {
       
   641 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_INITMODEL_ENTRY );
   606 	// Remove the model.
   642 	// Remove the model.
   607 	if (mCalenEditorForm->model()) {
   643 	if (mCalenEditorForm->model()) {
   608 		delete mCalenEditorForm->model();
   644 		delete mCalenEditorForm->model();
   609 		mCalenEditorForm->setModel(0);
   645 		mCalenEditorForm->setModel(0);
   610 	}
   646 	}
   626 	// Add the repeat information only if particular occurence is not being 
   662 	// Add the repeat information only if particular occurence is not being 
   627 	if (mEditRange == ThisAndAll) {
   663 	if (mEditRange == ThisAndAll) {
   628 		addRepeatItem();
   664 		addRepeatItem();
   629 	}
   665 	}
   630 	mCalenEditorForm->setModel(mCalenEditorModel);
   666 	mCalenEditorForm->setModel(mCalenEditorModel);
       
   667 	OstTraceFunctionExit0( CALENEDITORPRIVATE_INITMODEL_EXIT );
   631 }
   668 }
   632 
   669 
   633 /*!
   670 /*!
   634 	Appends the Subject Item to the Data form Model.
   671 	Appends the Subject Item to the Data form Model.
   635  */
   672  */
   636 void CalenEditorPrivate::addSubjectItem()
   673 void CalenEditorPrivate::addSubjectItem()
   637 {
   674 {
       
   675 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ADDSUBJECTITEM_ENTRY );
   638 	// Creats and appends data form model item to set subject of entry.
   676 	// Creats and appends data form model item to set subject of entry.
   639 	mSubjectItem = mCalenEditorModel->appendDataFormItem(
   677 	mSubjectItem = mCalenEditorModel->appendDataFormItem(
   640 										HbDataFormModelItem::TextItem,
   678 										HbDataFormModelItem::TextItem,
   641 										hbTrId(
   679 										hbTrId(
   642 										"txt_calendar_formlabel_val_subject"),
   680 										"txt_calendar_formlabel_val_subject"),
   643 										mCalenEditorModel->invisibleRootItem());
   681 										mCalenEditorModel->invisibleRootItem());
       
   682 	OstTraceFunctionExit0( CALENEDITORPRIVATE_ADDSUBJECTITEM_EXIT );
   644 }
   683 }
   645 
   684 
   646 /*!
   685 /*!
   647 	Appends the allday item to the Data form Model.
   686 	Appends the allday item to the Data form Model.
   648  */
   687  */
   649 void CalenEditorPrivate::addAllDayCheckBoxItem()
   688 void CalenEditorPrivate::addAllDayCheckBoxItem()
   650 {
   689 {
       
   690 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ADDALLDAYCHECKBOXITEM_ENTRY );
   651 	mAllDayCheckBoxItem = new HbDataFormModelItem();
   691 	mAllDayCheckBoxItem = new HbDataFormModelItem();
   652 	mAllDayCheckBoxItem->setType(HbDataFormModelItem::CheckBoxItem);
   692 	mAllDayCheckBoxItem->setType(HbDataFormModelItem::CheckBoxItem);
   653 	mCalenEditorModel->appendDataFormItem(mAllDayCheckBoxItem);
   693 	mCalenEditorModel->appendDataFormItem(mAllDayCheckBoxItem);
   654 	mIsAllDayItemAdded = true;
   694 	mIsAllDayItemAdded = true;
       
   695 	OstTraceFunctionExit0( CALENEDITORPRIVATE_ADDALLDAYCHECKBOXITEM_EXIT );
   655 }
   696 }
   656 
   697 
   657 /*!
   698 /*!
   658 	Appends the start time of the event item to the Data form Model.
   699 	Appends the start time of the event item to the Data form Model.
   659  */
   700  */
   660 void CalenEditorPrivate::addCustomItemFrom()
   701 void CalenEditorPrivate::addCustomItemFrom()
   661 {
   702 {
       
   703 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ADDCUSTOMITEMFROM_ENTRY );
   662 	HbDataFormModelItem::DataItemType itemType =
   704 	HbDataFormModelItem::DataItemType itemType =
   663 	        static_cast<HbDataFormModelItem::DataItemType> (CustomWidgetFrom);
   705 	        static_cast<HbDataFormModelItem::DataItemType> (CustomWidgetFrom);
   664 	HbDataFormModelItem *customModelItem = new HbDataFormModelItem(itemType,
   706 	HbDataFormModelItem *customModelItem = new HbDataFormModelItem(itemType,
   665 								hbTrId("txt_calendar_setlabel_start_time"));
   707 								hbTrId("txt_calendar_setlabel_start_time"));
   666 	mCalenEditorModel->appendDataFormItem(customModelItem);
   708 	mCalenEditorModel->appendDataFormItem(customModelItem);
       
   709 	OstTraceFunctionExit0( CALENEDITORPRIVATE_ADDCUSTOMITEMFROM_EXIT );
   667 }
   710 }
   668 
   711 
   669 /*!
   712 /*!
   670 	Appends the end time of the event item to the Data form Model.
   713 	Appends the end time of the event item to the Data form Model.
   671  */
   714  */
   672 void CalenEditorPrivate::addCustomItemTo()
   715 void CalenEditorPrivate::addCustomItemTo()
   673 {
   716 {
       
   717 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ADDCUSTOMITEMTO_ENTRY );
   674 
   718 
   675 	HbDataFormModelItem::DataItemType itemType =
   719 	HbDataFormModelItem::DataItemType itemType =
   676 	        static_cast<HbDataFormModelItem::DataItemType> (CustomWidgetTo);
   720 	        static_cast<HbDataFormModelItem::DataItemType> (CustomWidgetTo);
   677 	HbDataFormModelItem *customModelItem = new HbDataFormModelItem(itemType,
   721 	HbDataFormModelItem *customModelItem = new HbDataFormModelItem(itemType,
   678 									hbTrId("txt_calendar_setlabel_end_time"));
   722 									hbTrId("txt_calendar_setlabel_end_time"));
   679 	mCalenEditorModel->appendDataFormItem(customModelItem);
   723 	mCalenEditorModel->appendDataFormItem(customModelItem);
       
   724 	OstTraceFunctionExit0( CALENEDITORPRIVATE_ADDCUSTOMITEMTO_EXIT );
   680 }
   725 }
   681 
   726 
   682 /*!
   727 /*!
   683 	Appends the Location Item to the Data form Model.
   728 	Appends the Location Item to the Data form Model.
   684  */
   729  */
   686 /*!
   731 /*!
   687 	Appends the custom Location widget to the Data form Model.
   732 	Appends the custom Location widget to the Data form Model.
   688  */
   733  */
   689 void CalenEditorPrivate::addCustomItemLocation()
   734 void CalenEditorPrivate::addCustomItemLocation()
   690 {
   735 {
       
   736 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ADDCUSTOMITEMLOCATION_ENTRY );
   691 	HbDataFormModelItem::DataItemType
   737 	HbDataFormModelItem::DataItemType
   692     itemType =
   738     itemType =
   693             static_cast<HbDataFormModelItem::DataItemType> (CustomWidgetLocation);
   739             static_cast<HbDataFormModelItem::DataItemType> (CustomWidgetLocation);
   694     HbDataFormModelItem *customModelItem = new HbDataFormModelItem(itemType, hbTrId("txt_calendar_formlabel_val_location"));
   740     HbDataFormModelItem *customModelItem = new HbDataFormModelItem(itemType, hbTrId("txt_calendar_formlabel_val_location"));
   695     mCalenEditorModel->appendDataFormItem(customModelItem);
   741     mCalenEditorModel->appendDataFormItem(customModelItem);
       
   742     OstTraceFunctionExit0( CALENEDITORPRIVATE_ADDCUSTOMITEMLOCATION_EXIT );
   696 }
   743 }
   697 
   744 
   698 /*!
   745 /*!
   699 	Appends the repeat item to the Data form Model.
   746 	Appends the repeat item to the Data form Model.
   700  */
   747  */
   701 void CalenEditorPrivate::addRepeatItem()
   748 void CalenEditorPrivate::addRepeatItem()
   702 {
   749 {
       
   750 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ADDREPEATITEM_ENTRY );
   703 	// Create the editor reminder field class to handle reminder related
   751 	// Create the editor reminder field class to handle reminder related
   704 	// features
   752 	// features
   705 	mRepeatField = new CalenEditorRepeatField(this, mCalenEditorForm, 
   753 	mRepeatField = new CalenEditorRepeatField(this, mCalenEditorForm, 
   706 												  mCalenEditorModel, this);
   754 												  mCalenEditorModel, this);
       
   755 	OstTraceFunctionExit0( CALENEDITORPRIVATE_ADDREPEATITEM_EXIT );
   707 }
   756 }
   708 /*!
   757 /*!
   709  Appends the reminder item to the Data form Model.
   758  Appends the reminder item to the Data form Model.
   710  */
   759  */
   711 void CalenEditorPrivate::addReminderItem()
   760 void CalenEditorPrivate::addReminderItem()
   712 {
   761 {
       
   762 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ADDREMINDERITEM_ENTRY );
   713 	// Create the editor reminder field class to handle reminder related
   763 	// Create the editor reminder field class to handle reminder related
   714 	// features
   764 	// features
   715 	mReminderField = new CalenEditorReminderField(this, mCalenEditorForm, 
   765 	mReminderField = new CalenEditorReminderField(this, mCalenEditorForm, 
   716 	                                              mCalenEditorModel, this);
   766 	                                              mCalenEditorModel, this);
       
   767 	OstTraceFunctionExit0( CALENEDITORPRIVATE_ADDREMINDERITEM_EXIT );
   717 }
   768 }
   718 
   769 
   719 /*!
   770 /*!
   720 	Appends the description item to the Data form Model.
   771 	Appends the description item to the Data form Model.
   721  */
   772  */
   722 void CalenEditorPrivate::handleDescriptionAction()
   773 void CalenEditorPrivate::handleDescriptionAction()
   723 {
   774 {
       
   775 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLEDESCRIPTIONACTION_ENTRY );
   724 	if (!mDescriptionItemAdded) {
   776 	if (!mDescriptionItemAdded) {
   725 		populateDescriptionItem();
   777 		populateDescriptionItem();
   726 		mDescriptionAction->setText(
   778 		mDescriptionAction->setText(
   727 							hbTrId("txt_calendar_opt_remove_description"));
   779 							hbTrId("txt_calendar_opt_remove_description"));
   728 	} else {
   780 	} else {
   729 		removeDescriptionItem();
   781 		removeDescriptionItem();
   730 		mDescriptionAction->setText(
   782 		mDescriptionAction->setText(
   731 							hbTrId("txt_calendar_opt_add_description"));
   783 							hbTrId("txt_calendar_opt_add_description"));
   732 	}
   784 	}
       
   785 	OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLEDESCRIPTIONACTION_EXIT );
   733 }
   786 }
   734 
   787 
   735 /*!
   788 /*!
   736 	Poplulates the Model.
   789 	Poplulates the Model.
   737  */
   790  */
   738 void CalenEditorPrivate::populateModel()
   791 void CalenEditorPrivate::populateModel()
   739 {
   792 {
       
   793 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_POPULATEMODEL_ENTRY );
   740 	populateSubjectItem();
   794 	populateSubjectItem();
   741 
   795 
   742 	if (mIsAllDayItemAdded) {
   796 	if (mIsAllDayItemAdded) {
   743 		populateAllDayItem();
   797 		populateAllDayItem();
   744 	}
   798 	}
   753 	}
   807 	}
   754 
   808 
   755 	if (mDescriptionItemAdded) {
   809 	if (mDescriptionItemAdded) {
   756 		populateDescriptionItem();
   810 		populateDescriptionItem();
   757 	}
   811 	}
       
   812 	OstTraceFunctionExit0( CALENEDITORPRIVATE_POPULATEMODEL_EXIT );
   758 }
   813 }
   759 
   814 
   760 /*!
   815 /*!
   761 	Populates the Subject Item in the Data From Model.
   816 	Populates the Subject Item in the Data From Model.
   762  */
   817  */
   763 void CalenEditorPrivate::populateSubjectItem()
   818 void CalenEditorPrivate::populateSubjectItem()
   764 {
   819 {
       
   820 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_POPULATESUBJECTITEM_ENTRY );
   765 	mSubjectItem->setContentWidgetData("text", mEditedEntry->summary());
   821 	mSubjectItem->setContentWidgetData("text", mEditedEntry->summary());
   766 	mSubjectItem->setContentWidgetData("minRows", 2);
   822 	mSubjectItem->setContentWidgetData("minRows", 2);
   767 	mSubjectItem->setContentWidgetData("maxRows", 4);
   823 	mSubjectItem->setContentWidgetData("maxRows", 4);
       
   824 	mSubjectItem->setContentWidgetData("objectName", "subjectItem");
   768 	mCalenEditorForm->addConnection(mSubjectItem,
   825 	mCalenEditorForm->addConnection(mSubjectItem,
   769 	                                SIGNAL(textChanged(const QString)), this,
   826 	                                SIGNAL(textChanged(const QString)), this,
   770 	                                SLOT(handleSubjectChange(const QString)));
   827 	                                SLOT(handleSubjectChange(const QString)));
       
   828 	OstTraceFunctionExit0( CALENEDITORPRIVATE_POPULATESUBJECTITEM_EXIT );
   771 }
   829 }
   772 
   830 
   773 /*!
   831 /*!
   774 	Populates the all day item.
   832 	Populates the all day item.
   775  */
   833  */
   776 void CalenEditorPrivate::populateAllDayItem()
   834 void CalenEditorPrivate::populateAllDayItem()
   777 {
   835 {
       
   836 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_POPULATEALLDAYITEM_ENTRY );
   778 	mAllDayCheckBoxItem->setContentWidgetData("text",
   837 	mAllDayCheckBoxItem->setContentWidgetData("text",
   779 									hbTrId("txt_calendar_list_all_day_event"));
   838 									hbTrId("txt_calendar_list_all_day_event"));
   780 	if (AgendaEntry::TypeEvent == mEditedEntry->type()) {
   839 	if (AgendaEntry::TypeEvent == mEditedEntry->type()) {
   781 		//If All day is enabled.
   840 		//If All day is enabled.
   782 		mAllDayCheckBoxItem->setContentWidgetData("checkState", Qt::Checked);
   841 		mAllDayCheckBoxItem->setContentWidgetData("checkState", Qt::Checked);
   783 	}
   842 	}
       
   843 	mAllDayCheckBoxItem->setContentWidgetData("objectName", "allDayItem");
   784 	mCalenEditorForm->addConnection(mAllDayCheckBoxItem,
   844 	mCalenEditorForm->addConnection(mAllDayCheckBoxItem,
   785 	                                SIGNAL(stateChanged(int )), this,
   845 	                                SIGNAL(stateChanged(int )), this,
   786 	                                SLOT(handleAllDayChange(int)));
   846 	                                SLOT(handleAllDayChange(int)));
   787 
   847 
       
   848 	OstTraceFunctionExit0( CALENEDITORPRIVATE_POPULATEALLDAYITEM_EXIT );
   788 }
   849 }
   789 
   850 
   790 /*!
   851 /*!
   791 	Populates the start and end time of the event item.
   852 	Populates the start and end time of the event item.
   792  */
   853  */
   793 void CalenEditorPrivate::populateCustomItemDateTime()
   854 void CalenEditorPrivate::populateCustomItemDateTime()
   794 {
   855 {
       
   856 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_POPULATECUSTOMITEMDATETIME_ENTRY );
   795 	// Get the index of the start time of the event item.
   857 	// Get the index of the start time of the event item.
   796 	// Check if all day has been added or not 
   858 	// Check if all day has been added or not 
   797 	// and calculate the index accordingly
   859 	// and calculate the index accordingly
   798 	int itemIndex;
   860 	int itemIndex;
   799 	if (mIsAllDayItemAdded) {
   861 	if (mIsAllDayItemAdded) {
   883 			                                  nextInstanceStartTime,
   945 			                                  nextInstanceStartTime,
   884 			                                  nextInstanceEndTime);
   946 			                                  nextInstanceEndTime);
   885 			
   947 			
   886 			// If no instances earlier then set it to 01/01/1900.
   948 			// If no instances earlier then set it to 01/01/1900.
   887 			if (prevInstanceStartTime.isNull()) {
   949 			if (prevInstanceStartTime.isNull()) {
   888 				prevInstanceStartTime.setDate(QDate(1900, 01, 01));
   950 				prevInstanceEndTime.setDate(QDate(1900, 01, 01));
   889 				prevInstanceStartTime.setTime(QTime(0, 0, 0));
   951 				prevInstanceEndTime.setTime(QTime(0, 0, 0));
       
   952 			} else {
       
   953 				prevInstanceEndTime = prevInstanceEndTime.addDays(1);
   890 			}
   954 			}
   891 			
   955 			
   892 			// If no instances later then set it to 30/01/2100.
   956 			// If no instances later then set it to 30/01/2100.
   893 			if (nextInstanceEndTime.isNull()) {
   957 			if (nextInstanceEndTime.isNull()) {
   894 				nextInstanceEndTime.setDate(QDate(2100, 12, 30));
   958 				nextInstanceStartTime.setDate(QDate(2100, 12, 30));
   895 				nextInstanceEndTime.setTime(QTime(0, 0, 0));
   959 				nextInstanceStartTime.setTime(QTime(0, 0, 0));
       
   960 			} else {
       
   961 				nextInstanceStartTime = nextInstanceStartTime.addDays(-1);
   896 			}
   962 			}
   897 			mViewFromItem->setDateRange(
   963 			mViewFromItem->setDateRange(
   898 									prevInstanceStartTime.addDays(1).date(),
   964 									prevInstanceEndTime.date(),
   899 									nextInstanceStartTime.addDays(-1).date());
   965 									nextInstanceStartTime.date());
   900 			mViewToItem->setDateRange(prevInstanceEndTime.date().addDays(1),
   966 			mViewToItem->setDateRange(prevInstanceEndTime.date(),
   901 			                        nextInstanceEndTime.date().addDays(-1));
   967 									nextInstanceStartTime.date());
   902 			
   968 			
   903 			// If repeating daily then disable the date fields as 
   969 			// If repeating daily then disable the date fields as 
   904 			// date cannot be changed
   970 			// date cannot be changed
   905  			if ((prevInstanceEndTime.date().daysTo(
   971  			if ((prevInstanceEndTime.date().daysTo(
   906 				mEditedEntry->startTime().date()) == 1) && 
   972 				mEditedEntry->startTime().date()) == 1) && 
   932 		// If the all day option is checked, we need to
   998 		// If the all day option is checked, we need to
   933 		// disable the time fields
   999 		// disable the time fields
   934 		enableFromTotimeFileds(false, mEditedEntry->startTime(),
  1000 		enableFromTotimeFileds(false, mEditedEntry->startTime(),
   935                                 actualEndTime);
  1001                                 actualEndTime);
   936 	}
  1002 	}
       
  1003 	OstTraceFunctionExit0( CALENEDITORPRIVATE_POPULATECUSTOMITEMDATETIME_EXIT );
   937 }
  1004 }
   938 /*!
  1005 /*!
   939 	Populate location item from the editor model and set it in the widget and listen 
  1006 	Populate location item from the editor model and set it in the widget and listen 
   940 	text change happend in the widget. 
  1007 	text change happend in the widget. 
   941 */
  1008 */
   942 void CalenEditorPrivate::populateCustomItemLocation()
  1009 void CalenEditorPrivate::populateCustomItemLocation()
   943 {
  1010 {
       
  1011 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_POPULATECUSTOMITEMLOCATION_ENTRY );
   944 	//Get the index of the custom location  widget item of the event item.
  1012 	//Get the index of the custom location  widget item of the event item.
   945 	// Check if all day has been added or not 
  1013 	// Check if all day has been added or not 
   946 	// and calculate the index accordingly
  1014 	// and calculate the index accordingly
   947 	int itemIndex;
  1015 	int itemIndex;
   948 	if (mIsAllDayItemAdded) {
  1016 	if (mIsAllDayItemAdded) {
   951 	else {
  1019 	else {
   952 		itemIndex = LocationItem - 1;
  1020 		itemIndex = LocationItem - 1;
   953 	}
  1021 	}
   954 	QModelIndex index = mCalenEditorModel->index(itemIndex, 0);
  1022 	QModelIndex index = mCalenEditorModel->index(itemIndex, 0);
   955 	mViewLocationItem = qobject_cast<CalenEditorCustomItem *> 
  1023 	mViewLocationItem = qobject_cast<CalenEditorCustomItem *> 
   956 	                      (mCalenEditorForm->itemByIndex(index));
  1024 									(mCalenEditorForm->itemByIndex(index));
   957 
  1025 	mViewLocationItem->populateLocation(mEditedEntry->location());
       
  1026 	
       
  1027 	// Connect the slots only after setting the location text
   958 	connect(mViewLocationItem, SIGNAL(locationTextChanged(const QString)),
  1028 	connect(mViewLocationItem, SIGNAL(locationTextChanged(const QString)),
   959 			this, SLOT(handleLocationChange(const QString)));
  1029 			this, SLOT(handleLocationChange(const QString)));
   960 	
  1030 	
   961 	connect(mViewLocationItem, SIGNAL(locationTextChanged(const QString, const double, const double)),
  1031 	connect(mViewLocationItem, 
   962 			this, SLOT(handleLocationChange(const QString, const double, const double)));
  1032 		SIGNAL(locationTextChanged(const QString, const double, const double)),
   963 
  1033 		this, 
   964 	mViewLocationItem->populateLocation(mEditedEntry->location());	
  1034 		SLOT(handleLocationChange(const QString, const double, const double)));
       
  1035 
       
  1036 	connect(mViewLocationItem, SIGNAL(locationEditingFinished()),
       
  1037 				this, SLOT(handleLocationEditingFinished()));
   965 	
  1038 	
   966     connect(mViewLocationItem, SIGNAL(locationEditingFinished()),
  1039 	OstTraceFunctionExit0( CALENEDITORPRIVATE_POPULATECUSTOMITEMLOCATION_EXIT );
   967             this, SLOT(handleLocationEditingFinished()));
       
   968 	        
       
   969 }
  1040 }
   970 /*!
  1041 /*!
   971 	Save the changed start time of the event.
  1042 	Save the changed start time of the event.
   972  */
  1043  */
   973 void CalenEditorPrivate::saveFromDateTime(QDateTime& fromDateTime)
  1044 void CalenEditorPrivate::saveFromDateTime(QDateTime& fromDateTime)
   974 {
  1045 {
       
  1046 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SAVEFROMDATETIME_ENTRY );
   975 	QDateTime endTime = mEditedEntry->endTime();
  1047 	QDateTime endTime = mEditedEntry->endTime();
   976 	// Update the end time accordingly on UI - duration will be 60 mins
  1048 	// Update the end time accordingly on UI - duration will be 60 mins
   977 	// bydefault only while creating new entry and if it crossed the endtime
  1049 	// bydefault only while creating new entry and if it crossed the endtime
   978 	if (mNewEntry && fromDateTime > endTime) {
  1050 	if (mNewEntry && fromDateTime > endTime) {
   979 		endTime = fromDateTime.addSecs(3600);
  1051 		endTime = fromDateTime.addSecs(3600);
   997 		// update the repeat choices depending on the meeting duration
  1069 		// update the repeat choices depending on the meeting duration
   998 		mRepeatField->updateRepeatChoices();
  1070 		mRepeatField->updateRepeatChoices();
   999 	}
  1071 	}
  1000 
  1072 
  1001 	updateReminderChoices();
  1073 	updateReminderChoices();
       
  1074 	OstTraceFunctionExit0( CALENEDITORPRIVATE_SAVEFROMDATETIME_EXIT );
  1002 }
  1075 }
  1003 
  1076 
  1004 void CalenEditorPrivate::updateReminderChoices()
  1077 void CalenEditorPrivate::updateReminderChoices()
  1005 {
  1078 {
       
  1079 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_UPDATEREMINDERCHOICES_ENTRY );
  1006 	QDate referenceDate;
  1080 	QDate referenceDate;
  1007 	
  1081 	
  1008 	// Start date or repeat until date will be the reference to decide 
  1082 	// Start date or repeat until date will be the reference to decide 
  1009 	// whether the event is in past or future.
  1083 	// whether the event is in past or future.
  1010 	if (mRepeatField && mRepeatField->isRepeatUntilItemAdded()) {
  1084 	if (mRepeatField && mRepeatField->isRepeatUntilItemAdded()) {
  1038 			if (!mReminderField->isReminderFieldEnabled()) {
  1112 			if (!mReminderField->isReminderFieldEnabled()) {
  1039 				mReminderField->setReminderChoices();
  1113 				mReminderField->setReminderChoices();
  1040 			}
  1114 			}
  1041 		}
  1115 		}
  1042 	}
  1116 	}
       
  1117 	OstTraceFunctionExit0( CALENEDITORPRIVATE_UPDATEREMINDERCHOICES_EXIT );
  1043 }
  1118 }
  1044 
  1119 
  1045 /*!
  1120 /*!
  1046 	Save the changed end time of the event.
  1121 	Save the changed end time of the event.
  1047  */
  1122  */
  1048 void CalenEditorPrivate::saveToDateTime(QDateTime& toDateTime)
  1123 void CalenEditorPrivate::saveToDateTime(QDateTime& toDateTime)
  1049 {
  1124 {
       
  1125 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SAVETODATETIME_ENTRY );
  1050 	QDateTime startTime = mEditedEntry->startTime();
  1126 	QDateTime startTime = mEditedEntry->startTime();
  1051 	bool fromDateChanged = false;
  1127 	bool fromDateChanged = false;
  1052 	// Update the start time accordingly on UI - duration will be 60 mins
  1128 	// Update the start time accordingly on UI - duration will be 60 mins
  1053 	// bydefault for new entry and if it crosses the starttime
  1129 	// bydefault for new entry and if it crosses the starttime
  1054 	if (mNewEntry && toDateTime < startTime) {
  1130 	if (mNewEntry && toDateTime < startTime) {
  1080 	
  1156 	
  1081 	// Update reminder choices if start time got changed.
  1157 	// Update reminder choices if start time got changed.
  1082 	if (fromDateChanged) {
  1158 	if (fromDateChanged) {
  1083 		updateReminderChoices();
  1159 		updateReminderChoices();
  1084 	}
  1160 	}
       
  1161 	OstTraceFunctionExit0( CALENEDITORPRIVATE_SAVETODATETIME_EXIT );
  1085 }
  1162 }
  1086 
  1163 
  1087 /*!
  1164 /*!
  1088 	Populates the repeat item.
  1165 	Populates the repeat item.
  1089  */
  1166  */
  1090 void CalenEditorPrivate::populateRepeatItem()
  1167 void CalenEditorPrivate::populateRepeatItem()
  1091 {
  1168 {
       
  1169 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_POPULATEREPEATITEM_ENTRY );
  1092 	// Check if all day has been added or not 
  1170 	// Check if all day has been added or not 
  1093 	// and calculate the index accordingly
  1171 	// and calculate the index accordingly
  1094 	// all day added implies reminder time field is also added
  1172 	// all day added implies reminder time field is also added
  1095 	int index;
  1173 	int index;
  1096 	if (mIsAllDayItemAdded && !isReminderTimeForAllDayAdded()) {
  1174 	if (mIsAllDayItemAdded && !isReminderTimeForAllDayAdded()) {
  1100 	} else {
  1178 	} else {
  1101 		index = RepeatItem - 2;
  1179 		index = RepeatItem - 2;
  1102 	}
  1180 	}
  1103 	
  1181 	
  1104 	mRepeatField->populateRepeatItem(index);
  1182 	mRepeatField->populateRepeatItem(index);
       
  1183 	OstTraceFunctionExit0( CALENEDITORPRIVATE_POPULATEREPEATITEM_EXIT );
  1105 }
  1184 }
  1106 
  1185 
  1107 /*!
  1186 /*!
  1108 	Populates the description item.
  1187 	Populates the description item.
  1109  */
  1188  */
  1110 void CalenEditorPrivate::populateDescriptionItem()
  1189 void CalenEditorPrivate::populateDescriptionItem()
  1111 {
  1190 {
       
  1191 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_POPULATEDESCRIPTIONITEM_ENTRY );
  1112 	QModelIndex repeatIndex;
  1192 	QModelIndex repeatIndex;
  1113 	if (mEditRange == ThisOnly) {
  1193 	if (mEditRange == ThisOnly) {
  1114 		repeatIndex = mReminderField->modelIndex();
  1194 		repeatIndex = mReminderField->modelIndex();
  1115 	} else {
  1195 	} else {
  1116 		repeatIndex = mRepeatField->modelIndex();
  1196 		repeatIndex = mRepeatField->modelIndex();
  1129 									"txt_calendar_formlabel_val_description")),
  1209 									"txt_calendar_formlabel_val_description")),
  1130 									mCalenEditorModel->invisibleRootItem());
  1210 									mCalenEditorModel->invisibleRootItem());
  1131 	mDescriptionItem->setContentWidgetData("text", mEditedEntry->description());
  1211 	mDescriptionItem->setContentWidgetData("text", mEditedEntry->description());
  1132 	mDescriptionItem->setContentWidgetData("minRows", 2);
  1212 	mDescriptionItem->setContentWidgetData("minRows", 2);
  1133 	mDescriptionItem->setContentWidgetData("maxRows", 4);
  1213 	mDescriptionItem->setContentWidgetData("maxRows", 4);
       
  1214 	mDescriptionItem->setContentWidgetData("objectName", "descriptionItem");
  1134 	mCalenEditorForm->addConnection(
  1215 	mCalenEditorForm->addConnection(
  1135 								mDescriptionItem,
  1216 								mDescriptionItem,
  1136 								SIGNAL(textChanged(const QString)), this,
  1217 								SIGNAL(textChanged(const QString)), this,
  1137 								SLOT(handleDescriptionChange(const QString)));
  1218 								SLOT(handleDescriptionChange(const QString)));
  1138 	mDescriptionItemAdded = true;
  1219 	mDescriptionItemAdded = true;
  1139 	// TODO: Scroll the previous form item to the top so that the description 
  1220     //Scroll to the description item added.
  1140 	// field automatically scrolls to the top as well
  1221 	mCalenEditorForm->scrollTo(mCalenEditorModel->index(descIndex, 0), HbAbstractItemView::EnsureVisible);
  1141 	// mCalenEditorForm->scrollTo(repeatIndex, HbAbstractItemView::EnsureVisible);
  1222 	OstTraceFunctionExit0( CALENEDITORPRIVATE_POPULATEDESCRIPTIONITEM_EXIT );
  1142 }
  1223 }
  1143 
  1224 
  1144 /*!
  1225 /*!
  1145 	Removes the description item.
  1226 	Removes the description item.
  1146  */
  1227  */
  1147 void CalenEditorPrivate::removeDescriptionItem()
  1228 void CalenEditorPrivate::removeDescriptionItem()
  1148 {
  1229 {
       
  1230 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_REMOVEDESCRIPTIONITEM_ENTRY );
  1149 	// Disconnect the slot connected to description item
  1231 	// Disconnect the slot connected to description item
  1150 	mCalenEditorForm->removeConnection(
  1232 	mCalenEditorForm->removeConnection(
  1151 								   mDescriptionItem,
  1233 								   mDescriptionItem,
  1152 								   SIGNAL(textChanged(const QString)), this,
  1234 								   SIGNAL(textChanged(const QString)), this,
  1153 								   SLOT(handleDescriptionChange(const QString)));
  1235 								   SLOT(handleDescriptionChange(const QString)));
  1167 	// Remove the description from the entry
  1249 	// Remove the description from the entry
  1168 	mEditedEntry->setDescription("");
  1250 	mEditedEntry->setDescription("");
  1169 
  1251 
  1170 	mDescriptionItem = NULL;
  1252 	mDescriptionItem = NULL;
  1171 	mDescriptionItemAdded = false;
  1253 	mDescriptionItemAdded = false;
       
  1254 	OstTraceFunctionExit0( CALENEDITORPRIVATE_REMOVEDESCRIPTIONITEM_EXIT );
  1172 }
  1255 }
  1173 
  1256 
  1174 
  1257 
  1175 /*!
  1258 /*!
  1176 	Close the Editor.
  1259 	Close the Editor.
  1177  */
  1260  */
  1178 void CalenEditorPrivate::closeEditor()
  1261 void CalenEditorPrivate::closeEditor()
  1179 {
  1262 {
       
  1263 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_CLOSEEDITOR_ENTRY );
  1180 	HbMainWindow* window = hbInstance->allMainWindows().first();
  1264 	HbMainWindow* window = hbInstance->allMainWindows().first();
  1181 	window->removeView(mEditorView);
  1265 	window->removeView(mEditorView);
  1182 	emit q_ptr->dialogClosed();
  1266 	emit q_ptr->dialogClosed();
       
  1267 	OstTraceFunctionExit0( CALENEDITORPRIVATE_CLOSEEDITOR_EXIT );
  1183 }
  1268 }
  1184 
  1269 
  1185 /*!
  1270 /*!
  1186 	Triggered when the subject editor is being edited.
  1271 	Triggered when the subject editor is being edited.
  1187 	\param subject Contains the string displayed in the subject item.
  1272 	\param subject Contains the string displayed in the subject item.
  1198  Triggered when the Allday Checkbox is being edited.
  1283  Triggered when the Allday Checkbox is being edited.
  1199  \param state of checkbox.
  1284  \param state of checkbox.
  1200  */
  1285  */
  1201 void CalenEditorPrivate::handleAllDayChange(int state)
  1286 void CalenEditorPrivate::handleAllDayChange(int state)
  1202 {
  1287 {
       
  1288 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLEALLDAYCHANGE_ENTRY );
  1203 	Q_UNUSED(state)
  1289 	Q_UNUSED(state)
  1204 	if (mAllDayCheckBoxItem->contentWidgetData("checkState") == Qt::Checked) {
  1290 	if (mAllDayCheckBoxItem->contentWidgetData("checkState") == Qt::Checked) {
  1205 		// AllDayCheckBox is checked
  1291 		// AllDayCheckBox is checked
  1206 		// Set From/To times buttons Read-Only
  1292 		// Set From/To times buttons Read-Only
  1207 		// Display Start/End times as beginning of the day
  1293 		// Display Start/End times as beginning of the day
  1256 	}
  1342 	}
  1257 
  1343 
  1258 	if(!mNewEntry){
  1344 	if(!mNewEntry){
  1259 		addDiscardAction();
  1345 		addDiscardAction();
  1260 	}
  1346 	}
       
  1347 	OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLEALLDAYCHANGE_EXIT );
  1261 }
  1348 }
  1262 
  1349 
  1263 /*!
  1350 /*!
  1264 	Triggered when the location editor is being edited.
  1351 	Triggered when the location editor is being edited.
  1265 	\param subject Contains the string displayed in the subject item.
  1352 	\param subject Contains the string displayed in the subject item.
  1266  */
  1353  */
  1267 void CalenEditorPrivate::handleLocationChange(const QString location)
  1354 void CalenEditorPrivate::handleLocationChange(const QString location)
  1268 {
  1355 {
       
  1356 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLELOCATIONCHANGE_ENTRY );
  1269 	mEditedEntry->setLocation(location);
  1357 	mEditedEntry->setLocation(location);
  1270 	if(!mNewEntry){
  1358 	if(!mNewEntry){
  1271 		addDiscardAction();
  1359 		addDiscardAction();
  1272 	}
  1360 	}
       
  1361 	OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLELOCATIONCHANGE_EXIT );
  1273 }
  1362 }
  1274 
  1363 
  1275 
  1364 
  1276 /*!
  1365 /*!
  1277 	Triggered when the location editor is being edited.
  1366 	Triggered when the location editor is being edited.
  1278 	\param subject Contains the string displayed in the subject item.
  1367 	\param subject Contains the string displayed in the subject item.
  1279  */
  1368  */
  1280 void CalenEditorPrivate::handleLocationChange(const QString location,
  1369 void CalenEditorPrivate::handleLocationChange(const QString location,
  1281     const double /*geoLatitude*/, const double /*geoLongitude*/)
  1370     const double /*geoLatitude*/, const double /*geoLongitude*/)
  1282 {
  1371 {
       
  1372 	OstTraceFunctionEntry0( DUP1_CALENEDITORPRIVATE_HANDLELOCATIONCHANGE_ENTRY );
  1283 	mEditedEntry->setLocation(location);
  1373 	mEditedEntry->setLocation(location);
  1284 	mEditedEntry->clearGeoValue();
  1374 	mEditedEntry->clearGeoValue();
  1285 	addDiscardAction();
  1375 	addDiscardAction();
       
  1376 	OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_HANDLELOCATIONCHANGE_EXIT );
  1286 }
  1377 }
  1287 
  1378 
  1288 /*!
  1379 /*!
  1289  * Handles the completion of location editing
  1380  * Handles the completion of location editing
  1290  */
  1381  */
  1291 void CalenEditorPrivate::handleLocationEditingFinished()
  1382 void CalenEditorPrivate::handleLocationEditingFinished()
  1292 {
  1383 {
       
  1384     OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLELOCATIONEDITINGFINISHED_ENTRY );
  1293     if ( !mOriginalEntry->location().isEmpty() )
  1385     if ( !mOriginalEntry->location().isEmpty() )
  1294     {
  1386     {
  1295        AgendaGeoValue entryGeoValue =mAgendaUtil->fetchById(mEditedEntry->id()).geoValue();
  1387        AgendaGeoValue entryGeoValue =mAgendaUtil->fetchById(mEditedEntry->id()).geoValue();
  1296        if ( !entryGeoValue.isNull() && (mEditedEntry->location()!=mOriginalEntry->location()) )
  1388        if ( !entryGeoValue.isNull() && (mEditedEntry->location()!=mOriginalEntry->location()) )
  1297        {   
  1389        {   
  1320            confirmationQuery->addAction(new HbAction("Yes"));
  1412            confirmationQuery->addAction(new HbAction("Yes"));
  1321            confirmationQuery->addAction(new HbAction("No"));
  1413            confirmationQuery->addAction(new HbAction("No"));
  1322            confirmationQuery->open(this, SLOT(selectEditingFinishedAction(HbAction*)));
  1414            confirmationQuery->open(this, SLOT(selectEditingFinishedAction(HbAction*)));
  1323        }
  1415        }
  1324     }       
  1416     }       
       
  1417     OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLELOCATIONEDITINGFINISHED_EXIT );
  1325 }
  1418 }
  1326 
  1419 
  1327 /*!
  1420 /*!
  1328  * Handles the editing finished action.
  1421  * Handles the editing finished action.
  1329  */
  1422  */
  1330 void CalenEditorPrivate::selectEditingFinishedAction(HbAction* action)
  1423 void CalenEditorPrivate::selectEditingFinishedAction(HbAction* action)
  1331 {
  1424 {
       
  1425     OstTraceFunctionEntry0( CALENEDITORPRIVATE_SELECTEDITINGFINISHEDACTION_ENTRY );
  1332     HbMessageBox* dlg = static_cast<HbMessageBox*>(sender());    
  1426     HbMessageBox* dlg = static_cast<HbMessageBox*>(sender());    
  1333 
  1427 
  1334     if (action == dlg->actions().at(1))
  1428     if (action == dlg->actions().at(1))
  1335     {           
  1429     {           
  1336         mEditedEntry->clearGeoValue();
  1430         mEditedEntry->clearGeoValue();
  1337     } 
  1431     } 
       
  1432     OstTraceFunctionExit0( CALENEDITORPRIVATE_SELECTEDITINGFINISHEDACTION_EXIT );
  1338 }
  1433 }
  1339 
  1434 
  1340 /*!
  1435 /*!
  1341 	Triggered when the description editor is being edited.
  1436 	Triggered when the description editor is being edited.
  1342 	\param description Contains the string displayed in the description item.
  1437 	\param description Contains the string displayed in the description item.
  1343  */
  1438  */
  1344 void CalenEditorPrivate::handleDescriptionChange(const QString description)
  1439 void CalenEditorPrivate::handleDescriptionChange(const QString description)
  1345 {
  1440 {
       
  1441 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLEDESCRIPTIONCHANGE_ENTRY );
  1346 	mEditedEntry->setDescription(description);
  1442 	mEditedEntry->setDescription(description);
  1347 	if(!mNewEntry){
  1443 	if(!mNewEntry){
  1348 		addDiscardAction();
  1444 		addDiscardAction();
  1349 	}
  1445 	}
       
  1446 	OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLEDESCRIPTIONCHANGE_EXIT );
  1350 }
  1447 }
  1351 
  1448 
  1352 /*!
  1449 /*!
  1353 	Saves the entry & closes the editor.
  1450 	Saves the entry & closes the editor.
  1354 	If mLaunchCalendar is true, then it tries to launch the calendar
  1451 	If mLaunchCalendar is true, then it tries to launch the calendar
  1355  */
  1452  */
  1356 void CalenEditorPrivate::saveAndCloseEditor()
  1453 void CalenEditorPrivate::saveAndCloseEditor()
  1357 {
  1454 {
       
  1455 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SAVEANDCLOSEEDITOR_ENTRY );
  1358 	Action action = handleDone();
  1456 	Action action = handleDone();
  1359 	if (CalenEditorPrivate::ActionDelete != action) {
  1457 	if (CalenEditorPrivate::ActionDelete != action) {
  1360 		closeEditor();
  1458 		closeEditor();
  1361 	}
  1459 	}
  1362 
  1460 
  1370 			// connect to the error signal
  1468 			// connect to the error signal
  1371 			connect(launcher, SIGNAL(calendarLaunchFailed(int)), this,
  1469 			connect(launcher, SIGNAL(calendarLaunchFailed(int)), this,
  1372 									SLOT(handleCalendarLaunchError(int)));
  1470 									SLOT(handleCalendarLaunchError(int)));
  1373 		}
  1471 		}
  1374 	}
  1472 	}
       
  1473 	OstTraceFunctionExit0( CALENEDITORPRIVATE_SAVEANDCLOSEEDITOR_EXIT );
  1375 }
  1474 }
  1376 
  1475 
  1377 /*!
  1476 /*!
  1378 	Slot to handle errors while launching the calendar application
  1477 	Slot to handle errors while launching the calendar application
  1379  */
  1478  */
  1380 void CalenEditorPrivate::handleCalendarLaunchError(int error)
  1479 void CalenEditorPrivate::handleCalendarLaunchError(int error)
  1381 {
  1480 {
       
  1481 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLECALENDARLAUNCHERROR_ENTRY );
  1382 	// emit signal to the editor launcher
  1482 	// emit signal to the editor launcher
  1383 	emit q_ptr->calendarLaunchFailed(error);
  1483 	emit q_ptr->calendarLaunchFailed(error);
       
  1484 	OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLECALENDARLAUNCHERROR_EXIT );
  1384 }
  1485 }
  1385 
  1486 
  1386 /*!
  1487 /*!
  1387 	Deletes the entry.
  1488 	Deletes the entry.
  1388  */
  1489  */
  1389 void CalenEditorPrivate::handleDeleteAction()
  1490 void CalenEditorPrivate::handleDeleteAction()
  1390 {
  1491 {
       
  1492 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLEDELETEACTION_ENTRY );
  1391 	// If its a new entry just close the editor
  1493 	// If its a new entry just close the editor
  1392 	if (mNewEntry) {
  1494 	if (mNewEntry) {
  1393 		closeEditor();
  1495 		closeEditor();
       
  1496 		OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLEDELETEACTION_EXIT );
  1394 		return;
  1497 		return;
  1395 	}else {
  1498 	}else {
  1396 		// Delete entry and close editor
  1499 		// Delete entry and close editor
  1397 		deleteEntry(true);
  1500 		deleteEntry(true);
  1398 	}
  1501 	}
       
  1502 	OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_HANDLEDELETEACTION_EXIT );
  1399 }
  1503 }
  1400 
  1504 
  1401 /*!
  1505 /*!
  1402 	Launches the Settings view.
  1506 	Launches the Settings view.
  1403  */
  1507  */
  1404 void CalenEditorPrivate::launchSettingsView()
  1508 void CalenEditorPrivate::launchSettingsView()
  1405 {
  1509 {
       
  1510 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_LAUNCHSETTINGSVIEW_ENTRY );
  1406 	// TODO :: Not yet implemented.
  1511 	// TODO :: Not yet implemented.
       
  1512 	OstTraceFunctionExit0( CALENEDITORPRIVATE_LAUNCHSETTINGSVIEW_EXIT );
  1407 }
  1513 }
  1408 
  1514 
  1409 /*!
  1515 /*!
  1410 	Discards the changes done to the entry.
  1516 	Discards the changes done to the entry.
  1411  */
  1517  */
  1412 void CalenEditorPrivate::discardChanges()
  1518 void CalenEditorPrivate::discardChanges()
  1413 {
  1519 {
       
  1520 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_DISCARDCHANGES_ENTRY );
  1414 	// Close the editor without saving the changes.
  1521 	// Close the editor without saving the changes.
  1415 	closeEditor();
  1522 	closeEditor();
       
  1523 	OstTraceFunctionExit0( CALENEDITORPRIVATE_DISCARDCHANGES_EXIT );
  1416 }
  1524 }
  1417 
  1525 
  1418 /*!
  1526 /*!
  1419  * Show delete confirmation query
  1527  * Show delete confirmation query
  1420  */
  1528  */
  1421 void CalenEditorPrivate::showDeleteConfirmationQuery(bool closeEditor)
  1529 void CalenEditorPrivate::showDeleteConfirmationQuery(bool closeEditor)
  1422 {
  1530 {
       
  1531 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SHOWDELETECONFIRMATIONQUERY_ENTRY );
  1423 	HbMessageBox *popup = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
  1532 	HbMessageBox *popup = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
  1424 	popup->setDismissPolicy(HbDialog::NoDismiss);
  1533 	popup->setDismissPolicy(HbDialog::NoDismiss);
  1425 	popup->setTimeout(HbDialog::NoTimeout);
  1534 	popup->setTimeout(HbDialog::NoTimeout);
  1426 	popup->setAttribute( Qt::WA_DeleteOnClose, true );
  1535 	popup->setAttribute( Qt::WA_DeleteOnClose, true );
  1427 
  1536 
  1448     QList<QAction*> list = popup->actions();
  1557     QList<QAction*> list = popup->actions();
  1449     for(int i=0; i < list.count(); i++)
  1558     for(int i=0; i < list.count(); i++)
  1450         {
  1559         {
  1451         popup->removeAction(list[i]);
  1560         popup->removeAction(list[i]);
  1452         }
  1561         }
  1453 	HbAction *deleteAction = new HbAction(hbTrId("txt_calendar_button_delete"),
  1562 	HbAction *deleteAction = new HbAction(hbTrId("txt_calendar_button_dialog_delete"),
  1454 										popup);
  1563 										popup);
  1455 	popup->addAction(deleteAction);
  1564 	popup->addAction(deleteAction);
  1456 	connect(deleteAction, SIGNAL(triggered()), this, 
  1565 	connect(deleteAction, SIGNAL(triggered()), this, 
  1457 										SLOT(handleDeleteAction()));
  1566 										SLOT(handleDeleteAction()));
  1458 	HbAction *cancelAction = new HbAction(hbTrId("txt_calendar_button_cancel"),
  1567 	HbAction *cancelAction = new HbAction(hbTrId("txt_common_button_cancel"), 
  1459 											popup);
  1568 											popup);
  1460 	// Editor should not be closed for all the cases when cancel is pressed
  1569 	// Editor should not be closed for all the cases when cancel is pressed
  1461 	if(closeEditor) {
  1570 	if(closeEditor) {
  1462 		connect(cancelAction, SIGNAL(triggered()), this, 
  1571 		connect(cancelAction, SIGNAL(triggered()), this, 
  1463 											SLOT(closeEditor()));
  1572 											SLOT(closeEditor()));
  1464 	}
  1573 	}
  1465 	popup->addAction(cancelAction);
  1574 	popup->addAction(cancelAction);
  1466 	popup->open();
  1575 	popup->open();
       
  1576 	OstTraceFunctionExit0( CALENEDITORPRIVATE_SHOWDELETECONFIRMATIONQUERY_EXIT );
  1467 }
  1577 }
  1468 
  1578 
  1469 /*!
  1579 /*!
  1470 	Returns true if the entry is a child ,else false.
  1580 	Returns true if the entry is a child ,else false.
  1471 	\return true if the entry is a child, false otherwise.
  1581 	\return true if the entry is a child, false otherwise.
  1472  */
  1582  */
  1473 bool CalenEditorPrivate::isChild() const
  1583 bool CalenEditorPrivate::isChild() const
  1474 {
  1584 {
       
  1585 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ISCHILD_ENTRY );
  1475 	return mEditedEntry->recurrenceId().toUTC().isNull();
  1586 	return mEditedEntry->recurrenceId().toUTC().isNull();
  1476 }
  1587 }
  1477 
  1588 
  1478 /*!
  1589 /*!
  1479 	Check for errors in the form. This function should only be called when the
  1590 	Check for errors in the form. This function should only be called when the
  1487 	\return true to inform whether editor should be closed or not,
  1598 	\return true to inform whether editor should be closed or not,
  1488 	false otherwise
  1599 	false otherwise
  1489  */
  1600  */
  1490 CalenEditorPrivate::Action CalenEditorPrivate::handleDone()
  1601 CalenEditorPrivate::Action CalenEditorPrivate::handleDone()
  1491 {
  1602 {
       
  1603 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLEDONE_ENTRY );
  1492 	if (mEditRange == ThisAndAll) {
  1604 	if (mEditRange == ThisAndAll) {
  1493 		mRepeatField->saveRepeatRule();
  1605 		mRepeatField->saveRepeatRule();
  1494 	}
  1606 	}
  1495 	// TODO: Need to check entry status here. EntryStillExistsL
  1607 	// TODO: Need to check entry status here. EntryStillExistsL
  1496 	switch (mDataHandler->shouldSaveOrDeleteOrDoNothing(mLaunchCalendar)) {
  1608 	switch (mDataHandler->shouldSaveOrDeleteOrDoNothing(mLaunchCalendar)) {
  1497 		case CalenEditorPrivate::ActionSave:
  1609 		case CalenEditorPrivate::ActionSave:
  1498 			if (saveEntry()) {
  1610 			if (saveEntry()) {
       
  1611 				OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLEDONE_EXIT );
  1499 				return CalenEditorPrivate::ActionSave;
  1612 				return CalenEditorPrivate::ActionSave;
  1500 			}
  1613 			}
       
  1614 			OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_HANDLEDONE_EXIT );
  1501 			return CalenEditorPrivate::ActionNothing;
  1615 			return CalenEditorPrivate::ActionNothing;
  1502 		case CalenEditorPrivate::ActionDelete:
  1616 		case CalenEditorPrivate::ActionDelete:
  1503 			showDeleteConfirmationQuery(true);
  1617 			showDeleteConfirmationQuery(true);
       
  1618 			OstTraceFunctionExit0( DUP2_CALENEDITORPRIVATE_HANDLEDONE_EXIT );
  1504 			return CalenEditorPrivate::ActionDelete;
  1619 			return CalenEditorPrivate::ActionDelete;
  1505 		case CalenEditorPrivate::ActionNothing:
  1620 		case CalenEditorPrivate::ActionNothing:
  1506 			return CalenEditorPrivate::ActionNothing;
  1621 			return CalenEditorPrivate::ActionNothing;
  1507 		default:
  1622 		default:
  1508 			break;
  1623 			break;
  1509 	}
  1624 	}
       
  1625 	OstTraceFunctionExit0( DUP3_CALENEDITORPRIVATE_HANDLEDONE_EXIT );
  1510 	return CalenEditorPrivate::ActionNothing;
  1626 	return CalenEditorPrivate::ActionNothing;
  1511 }
  1627 }
  1512 
  1628 
  1513 /*!
  1629 /*!
  1514 	Save the entry
  1630 	Save the entry
  1515 	\return true if entry is saved ,false otherwise
  1631 	\return true if entry is saved ,false otherwise
  1516  */
  1632  */
  1517 bool CalenEditorPrivate::saveEntry()
  1633 bool CalenEditorPrivate::saveEntry()
  1518 {
  1634 {
       
  1635 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SAVEENTRY_ENTRY );
  1519 	// check if we are editing child
  1636 	// check if we are editing child
  1520 	if (mIsChild && (mEditRange == ThisOnly)) {
  1637 	if (mIsChild && (mEditRange == ThisOnly)) {
  1521 		// Add the entry
  1638 		// Add the entry
  1522 		mAgendaUtil->updateEntry(*mEditedEntry, true);
  1639 		mAgendaUtil->updateEntry(*mEditedEntry, true);
  1523 		// TODO: Add the text id once available
  1640 		// TODO: Add the text id once available
  1525 			HbNotificationDialog::launchDialog(hbTrId("Meeting updated"));
  1642 			HbNotificationDialog::launchDialog(hbTrId("Meeting updated"));
  1526 		}else if(mEditedEntry->type() == AgendaEntry::TypeEvent) {
  1643 		}else if(mEditedEntry->type() == AgendaEntry::TypeEvent) {
  1527 			HbNotificationDialog::launchDialog(hbTrId("All day event updated"));
  1644 			HbNotificationDialog::launchDialog(hbTrId("All day event updated"));
  1528 		}
  1645 		}
  1529 		emit q_ptr->entrySaved();
  1646 		emit q_ptr->entrySaved();
       
  1647 		OstTraceFunctionExit0( CALENEDITORPRIVATE_SAVEENTRY_EXIT );
  1530 		return true;
  1648 		return true;
  1531 	} else if ((mEditRange == ThisOnly)) {
  1649 	} else if ((mEditRange == ThisOnly)) {
  1532 		// If we are editing only this occurence, then 
  1650 		// If we are editing only this occurence, then 
  1533 		// clear the repeating properties of it
  1651 		// clear the repeating properties of it
  1534 		mAgendaUtil->clearRepeatingProperties(*mEditedEntry);
  1652 		mAgendaUtil->clearRepeatingProperties(*mEditedEntry);
  1567 			}
  1685 			}
  1568 		}
  1686 		}
  1569 		emit q_ptr->entrySaved();
  1687 		emit q_ptr->entrySaved();
  1570 	} else if (error) {
  1688 	} else if (error) {
  1571 		mDataHandler->displayErrorMsg(error);
  1689 		mDataHandler->displayErrorMsg(error);
       
  1690 		OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_SAVEENTRY_EXIT );
  1572 		return false;
  1691 		return false;
  1573 	}
  1692 	}
       
  1693 	OstTraceFunctionExit0( DUP2_CALENEDITORPRIVATE_SAVEENTRY_EXIT );
  1574 	return true;
  1694 	return true;
  1575 
  1695 
  1576 }
  1696 }
  1577 
  1697 
  1578 /*!
  1698 /*!
  1579 	Delete the entry 
  1699 	Delete the entry 
  1580 	@param closeEditor set true to close editor else default value is false
  1700 	@param closeEditor set true to close editor else default value is false
  1581  */
  1701  */
  1582 void CalenEditorPrivate::deleteEntry(bool close)
  1702 void CalenEditorPrivate::deleteEntry(bool close)
  1583 {
  1703 {
       
  1704 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_DELETEENTRY_ENTRY );
  1584 	// if editor is launched from Notes then don't delete entry
  1705 	// if editor is launched from Notes then don't delete entry
  1585 	// Just exit from calendar editor
  1706 	// Just exit from calendar editor
  1586 	if (mOriginalEntry->id() > 0) {
  1707 	if (mOriginalEntry->id() > 0) {
  1587 		// If user is editing single instanc then delete single instance 
  1708 		// If user is editing single instanc then delete single instance 
  1588 		// else delete entry
  1709 		// else delete entry
  1597 
  1718 
  1598 		if (close) {
  1719 		if (close) {
  1599 			closeEditor();
  1720 			closeEditor();
  1600 		}
  1721 		}
  1601 	}
  1722 	}
       
  1723 	OstTraceFunctionExit0( CALENEDITORPRIVATE_DELETEENTRY_EXIT );
  1602 }
  1724 }
  1603 
  1725 
  1604 /*!
  1726 /*!
  1605  Change the entry before saving, depending on AllDay checkbox state
  1727  Change the entry before saving, depending on AllDay checkbox state
  1606  */
  1728  */
  1607 bool CalenEditorPrivate::handleAllDayToSave()
  1729 bool CalenEditorPrivate::handleAllDayToSave()
  1608 {
  1730 {
       
  1731 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLEALLDAYTOSAVE_ENTRY );
  1609 	if (!mIsAllDayItemAdded) {
  1732 	if (!mIsAllDayItemAdded) {
  1610 		// All day item was not added, return true
  1733 		// All day item was not added, return true
       
  1734 		OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLEALLDAYTOSAVE_EXIT );
  1611 		return false;
  1735 		return false;
  1612 	}
  1736 	}
  1613 	// Check the state of AllDay checkBox
  1737 	// Check the state of AllDay checkBox
  1614 
  1738 
  1615 	// If Creating new Entry and AllDay Box is checked.
  1739 	// If Creating new Entry and AllDay Box is checked.
  1627 	if (mNewEntry && (mAllDayCheckBoxItem->contentWidgetData("checkState")
  1751 	if (mNewEntry && (mAllDayCheckBoxItem->contentWidgetData("checkState")
  1628 	        == Qt::Checked)) {
  1752 	        == Qt::Checked)) {
  1629 		// changes Start/End times of entry to Beginning ot the day
  1753 		// changes Start/End times of entry to Beginning ot the day
  1630 		mEditedEntry->setStartAndEndTime(tempSartTime, tempEndTime);
  1754 		mEditedEntry->setStartAndEndTime(tempSartTime, tempEndTime);
  1631 		mEditedEntry->setType(AgendaEntry::TypeEvent);
  1755 		mEditedEntry->setType(AgendaEntry::TypeEvent);
       
  1756 		OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_HANDLEALLDAYTOSAVE_EXIT );
  1632 		return false;
  1757 		return false;
  1633 	} else if ((mAllDayCheckBoxItem->contentWidgetData("checkState")
  1758 	} else if ((mAllDayCheckBoxItem->contentWidgetData("checkState")
  1634 	        == Qt::Checked) && (mEditedEntry->type() != 
  1759 	        == Qt::Checked) && (mEditedEntry->type() != 
  1635 								AgendaEntry::TypeEvent)) {
  1760 								AgendaEntry::TypeEvent)) {
  1636 		// Editing existing Meetingentry, and Alldat Box is Checked
  1761 		// Editing existing Meetingentry, and Alldat Box is Checked
  1639 
  1764 
  1640 		// Clone the entry to AllDayEntry, Delete old entry from Database
  1765 		// Clone the entry to AllDayEntry, Delete old entry from Database
  1641 		mAgendaUtil->cloneEntry(*mEditedEntry, AgendaEntry::TypeEvent);
  1766 		mAgendaUtil->cloneEntry(*mEditedEntry, AgendaEntry::TypeEvent);
  1642 		// For later reference for the notification popup
  1767 		// For later reference for the notification popup
  1643 		mEditedEntry->setType(AgendaEntry::TypeEvent);
  1768 		mEditedEntry->setType(AgendaEntry::TypeEvent);
       
  1769 		OstTraceFunctionExit0( DUP2_CALENEDITORPRIVATE_HANDLEALLDAYTOSAVE_EXIT );
  1644 		return true;
  1770 		return true;
  1645 	} else if (mAllDayCheckBoxItem->contentWidgetData("checkState")
  1771 	} else if (mAllDayCheckBoxItem->contentWidgetData("checkState")
  1646 	        != Qt::Checked) {
  1772 	        != Qt::Checked) {
  1647              if (mEditedEntry->type() != AgendaEntry::TypeAppoinment) {
  1773              if (mEditedEntry->type() != AgendaEntry::TypeAppoinment) {
  1648 	            // Editing existing AllDayentry, and Alldat Box is Not-Checked
  1774 	            // Editing existing AllDayentry, and Alldat Box is Not-Checked
  1649 	            // Clone the entry to MeetingEntry, Delete old entry from Database
  1775 	            // Clone the entry to MeetingEntry, Delete old entry from Database
  1650 	            mAgendaUtil->cloneEntry(*mEditedEntry, AgendaEntry::TypeAppoinment);
  1776 	            mAgendaUtil->cloneEntry(*mEditedEntry, AgendaEntry::TypeAppoinment);
  1651 	            // For later reference for the notification popup
  1777 	            // For later reference for the notification popup
  1652 	            mEditedEntry->setType(AgendaEntry::TypeAppoinment);
  1778 	            mEditedEntry->setType(AgendaEntry::TypeAppoinment);
       
  1779 	            OstTraceFunctionExit0( DUP3_CALENEDITORPRIVATE_HANDLEALLDAYTOSAVE_EXIT );
  1653 	            return true;
  1780 	            return true;
  1654 	        }
  1781 	        }
  1655             // Check if the duration of the meeting is matching the all-day criteria
  1782             // Check if the duration of the meeting is matching the all-day criteria
  1656             // if yes, then we need to store it as all-day instead of normal meeting
  1783             // if yes, then we need to store it as all-day instead of normal meeting
  1657              else if (mEditedEntry->startTime() == CalenDateUtils::beginningOfDay(mEditedEntry->startTime())) {
  1784              else if (mEditedEntry->startTime() == CalenDateUtils::beginningOfDay(mEditedEntry->startTime())) {
  1661                 mEditedEntry->setType(AgendaEntry::TypeEvent);
  1788                 mEditedEntry->setType(AgendaEntry::TypeEvent);
  1662                 // Check if this was an all-day earlier and now user has changed it like that
  1789                 // Check if this was an all-day earlier and now user has changed it like that
  1663                 // or it is a new entry
  1790                 // or it is a new entry
  1664                 if (mOriginalEntry->type() == AgendaEntry::TypeEvent ||
  1791                 if (mOriginalEntry->type() == AgendaEntry::TypeEvent ||
  1665                         mNewEntry) {
  1792                         mNewEntry) {
       
  1793                     OstTraceFunctionExit0( DUP4_CALENEDITORPRIVATE_HANDLEALLDAYTOSAVE_EXIT );
  1666                     return false;
  1794                     return false;
  1667                 } else {
  1795                 } else {
  1668                     // It was a meeting
  1796                     // It was a meeting
  1669                     // Clone the entry to AllDayEntry, Delete old entry from Database
  1797                     // Clone the entry to AllDayEntry, Delete old entry from Database
  1670                     mEditedEntry->setStartAndEndTime(tempSartTime, tempEndTime);
  1798                     mEditedEntry->setStartAndEndTime(tempSartTime, tempEndTime);
  1671                     mAgendaUtil->cloneEntry(*mEditedEntry, AgendaEntry::TypeEvent);
  1799                     mAgendaUtil->cloneEntry(*mEditedEntry, AgendaEntry::TypeEvent);
  1672                     // For later reference for the notification popup
  1800                     // For later reference for the notification popup
  1673                     mEditedEntry->setType(AgendaEntry::TypeEvent);
  1801                     mEditedEntry->setType(AgendaEntry::TypeEvent);
       
  1802                     OstTraceFunctionExit0( DUP5_CALENEDITORPRIVATE_HANDLEALLDAYTOSAVE_EXIT );
  1674                     return true;
  1803                     return true;
  1675                 }
  1804                 }
  1676             }
  1805             }
  1677         } 
  1806         } 
  1678 	} 
  1807 	} 
       
  1808 	OstTraceFunctionExit0( DUP6_CALENEDITORPRIVATE_HANDLEALLDAYTOSAVE_EXIT );
  1679 	return false;
  1809 	return false;
  1680 }
  1810 }
  1681 
  1811 
  1682 /*!
  1812 /*!
  1683  Enable/Disable TimeFields depending on AllDay checkbox state
  1813  Enable/Disable TimeFields depending on AllDay checkbox state
  1684  */
  1814  */
  1685 void CalenEditorPrivate::enableFromTotimeFileds(bool enableFileds,
  1815 void CalenEditorPrivate::enableFromTotimeFileds(bool enableFileds,
  1686                                                 QDateTime fromTime,
  1816                                                 QDateTime fromTime,
  1687                                                 QDateTime toTime)
  1817                                                 QDateTime toTime)
  1688 {
  1818 {
       
  1819 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ENABLEFROMTOTIMEFILEDS_ENTRY );
  1689 	mViewFromItem->enableFromTimeFieldAndSetTime(enableFileds, fromTime);
  1820 	mViewFromItem->enableFromTimeFieldAndSetTime(enableFileds, fromTime);
  1690 	mViewToItem->enableToTimeFieldAndSetTime(enableFileds, toTime);
  1821 	mViewToItem->enableToTimeFieldAndSetTime(enableFileds, toTime);
  1691 
  1822 
       
  1823 	OstTraceFunctionExit0( CALENEDITORPRIVATE_ENABLEFROMTOTIMEFILEDS_EXIT );
  1692 }
  1824 }
  1693 
  1825 
  1694 /*!
  1826 /*!
  1695  Returns pointer of entyr being edited
  1827  Returns pointer of entyr being edited
  1696  */
  1828  */
  1697 AgendaEntry* CalenEditorPrivate::editedEntry()
  1829 AgendaEntry* CalenEditorPrivate::editedEntry()
  1698 {
  1830 {
       
  1831 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_EDITEDENTRY_ENTRY );
       
  1832 	OstTraceFunctionExit0( CALENEDITORPRIVATE_EDITEDENTRY_EXIT );
  1699 	return mEditedEntry;
  1833 	return mEditedEntry;
  1700 }
  1834 }
  1701 
  1835 
  1702 /*!
  1836 /*!
  1703  Returns the pointer of original entry
  1837  Returns the pointer of original entry
  1704  */
  1838  */
  1705 AgendaEntry* CalenEditorPrivate::originalEntry()
  1839 AgendaEntry* CalenEditorPrivate::originalEntry()
  1706 {
  1840 {
       
  1841 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ORIGINALENTRY_ENTRY );
       
  1842 	OstTraceFunctionExit0( CALENEDITORPRIVATE_ORIGINALENTRY_EXIT );
  1707 	return mOriginalEntry;
  1843 	return mOriginalEntry;
  1708 }
  1844 }
  1709 
  1845 
  1710 /*!
  1846 /*!
  1711  Returns true if new entry being created else false
  1847  Returns true if new entry being created else false
  1712  */
  1848  */
  1713 bool CalenEditorPrivate::isNewEntry()
  1849 bool CalenEditorPrivate::isNewEntry()
  1714 {
  1850 {
       
  1851 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ISNEWENTRY_ENTRY );
       
  1852 	OstTraceFunctionExit0( CALENEDITORPRIVATE_ISNEWENTRY_EXIT );
  1715 	return mNewEntry;
  1853 	return mNewEntry;
  1716 }
  1854 }
  1717 
  1855 
  1718 /*!
  1856 /*!
  1719  Returns the pointer of all day check box item
  1857  Returns the pointer of all day check box item
  1720  */
  1858  */
  1721 HbDataFormModelItem* CalenEditorPrivate::allDayCheckBoxItem()
  1859 HbDataFormModelItem* CalenEditorPrivate::allDayCheckBoxItem()
  1722 {
  1860 {
       
  1861 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ALLDAYCHECKBOXITEM_ENTRY );
       
  1862 	OstTraceFunctionExit0( CALENEDITORPRIVATE_ALLDAYCHECKBOXITEM_EXIT );
  1723 	return mAllDayCheckBoxItem;
  1863 	return mAllDayCheckBoxItem;
  1724 }
  1864 }
  1725 
  1865 
  1726 /*!
  1866 /*!
  1727 	Checks if all day item is added and if selected implies reminder time is added.
  1867 	Checks if all day item is added and if selected implies reminder time is added.
  1729 	the all day item is not shown.
  1869 	the all day item is not shown.
  1730 	Used to calculate the index of other items which are dependant on this.
  1870 	Used to calculate the index of other items which are dependant on this.
  1731  */
  1871  */
  1732 bool CalenEditorPrivate::isReminderTimeForAllDayAdded()
  1872 bool CalenEditorPrivate::isReminderTimeForAllDayAdded()
  1733 {
  1873 {
       
  1874 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ISREMINDERTIMEFORALLDAYADDED_ENTRY );
  1734 	return mReminderField->isReminderTimeForAllDayAdded();
  1875 	return mReminderField->isReminderTimeForAllDayAdded();
  1735 }
  1876 }
  1736 
  1877 
  1737 /*!
  1878 /*!
  1738 	Checks if it is an all day event or not.
  1879 	Checks if it is an all day event or not.
  1739  */
  1880  */
  1740 bool CalenEditorPrivate::isAllDayEvent()
  1881 bool CalenEditorPrivate::isAllDayEvent()
  1741 {
  1882 {
       
  1883 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ISALLDAYEVENT_ENTRY );
  1742 	if (mAllDayCheckBoxItem) {
  1884 	if (mAllDayCheckBoxItem) {
  1743 		return (mAllDayCheckBoxItem->contentWidgetData("checkState") 
  1885 		return (mAllDayCheckBoxItem->contentWidgetData("checkState") 
  1744 													== Qt::Checked)? true:false;
  1886 													== Qt::Checked)? true:false;
  1745 	} else if (!mNewEntry && mEditedEntry->type() == AgendaEntry::TypeEvent) {
  1887 	} else if (!mNewEntry && mEditedEntry->type() == AgendaEntry::TypeEvent) {
  1746 		// If editing single occurence then all day item not shown but still it 
  1888 		// If editing single occurence then all day item not shown but still it 
  1747 		// is an all day event..
  1889 		// is an all day event..
       
  1890 		OstTraceFunctionExit0( CALENEDITORPRIVATE_ISALLDAYEVENT_EXIT );
  1748 		return true;;
  1891 		return true;;
  1749 	} else {
  1892 	} else {
       
  1893 		OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_ISALLDAYEVENT_EXIT );
  1750 		return false;
  1894 		return false;
  1751 	}
  1895 	}
  1752 }
  1896 }
  1753 
  1897 
  1754 /*!
  1898 /*!
  1755 	Returns the current index of the reminder field.
  1899 	Returns the current index of the reminder field.
  1756  */
  1900  */
  1757 int CalenEditorPrivate::currentIndexOfReminderField()
  1901 int CalenEditorPrivate::currentIndexOfReminderField()
  1758 {
  1902 {
       
  1903 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_CURRENTINDEXOFREMINDERFIELD_ENTRY );
  1759 	return mReminderField->currentReminderIndex();
  1904 	return mReminderField->currentReminderIndex();
  1760 }
  1905 }
  1761 
  1906 
  1762 /*!
  1907 /*!
  1763 	Sets the index. 
  1908 	Sets the index. 
  1764 	/param index indicates the index value to be set.
  1909 	/param index indicates the index value to be set.
  1765  */
  1910  */
  1766 void CalenEditorPrivate::setCurrentIndexOfReminderField(int index)
  1911 void CalenEditorPrivate::setCurrentIndexOfReminderField(int index)
  1767 {
  1912 {
       
  1913 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SETCURRENTINDEXOFREMINDERFIELD_ENTRY );
  1768 	mReminderField->setCurrentIndex(index);
  1914 	mReminderField->setCurrentIndex(index);
       
  1915 	OstTraceFunctionExit0( CALENEDITORPRIVATE_SETCURRENTINDEXOFREMINDERFIELD_EXIT );
  1769 }
  1916 }
  1770 
  1917 
  1771 /*!
  1918 /*!
  1772 	Sets the reminder choices for a non all day event.
  1919 	Sets the reminder choices for a non all day event.
  1773  */
  1920  */
  1774 void CalenEditorPrivate::setReminderChoices()
  1921 void CalenEditorPrivate::setReminderChoices()
  1775 {
  1922 {
  1776 		mReminderField->setReminderChoices();
  1923     OstTraceFunctionEntry0( CALENEDITORPRIVATE_SETREMINDERCHOICES_ENTRY );
       
  1924     mReminderField->setReminderChoices();
       
  1925     OstTraceFunctionExit0( CALENEDITORPRIVATE_SETREMINDERCHOICES_EXIT );
  1777 }
  1926 }
  1778 
  1927 
  1779 /*!
  1928 /*!
  1780 	Checks if editing all occurences or a single occurence.
  1929 	Checks if editing all occurences or a single occurence.
  1781  */
  1930  */
  1782 bool CalenEditorPrivate::isEditRangeThisOnly()
  1931 bool CalenEditorPrivate::isEditRangeThisOnly()
  1783 {
  1932 {
       
  1933 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ISEDITRANGETHISONLY_ENTRY );
       
  1934 	OstTraceFunctionExit0( CALENEDITORPRIVATE_ISEDITRANGETHISONLY_EXIT );
  1784 	return (mEditRange == ThisOnly);
  1935 	return (mEditRange == ThisOnly);
  1785 }
  1936 }
  1786 
  1937 
  1787 /*!
  1938 /*!
  1788 	Checks if all day field is added.
  1939 	Checks if all day field is added.
  1789  */
  1940  */
  1790 bool CalenEditorPrivate::isAllDayFieldAdded()
  1941 bool CalenEditorPrivate::isAllDayFieldAdded()
  1791 {
  1942 {
       
  1943 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ISALLDAYFIELDADDED_ENTRY );
       
  1944 	OstTraceFunctionExit0( CALENEDITORPRIVATE_ISALLDAYFIELDADDED_EXIT );
  1792 	return mIsAllDayItemAdded;
  1945 	return mIsAllDayItemAdded;
  1793 }
  1946 }
  1794 
  1947 
  1795 // End of file	--Don't remove this.
  1948 // End of file	--Don't remove this.