calendarui/caleneditor/src/caleneditor_p.cpp
changeset 77 b0711afde476
parent 68 a5a1242fd2e8
child 80 fa7c359294fa
equal deleted inserted replaced
68:a5a1242fd2e8 77:b0711afde476
   394  */
   394  */
   395 void CalenEditorPrivate::showEditOccurencePopup()
   395 void CalenEditorPrivate::showEditOccurencePopup()
   396 {
   396 {
   397 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SHOWEDITOCCURENCEPOPUP_ENTRY );
   397 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SHOWEDITOCCURENCEPOPUP_ENTRY );
   398 	HbDialog *popUp = new HbDialog();
   398 	HbDialog *popUp = new HbDialog();
       
   399 	// Set the parent for the dialog
       
   400 	// Once the editor object is deleted the dialog will also be deleted 
       
   401 	popUp->setParent(this);
   399 	popUp->setDismissPolicy(HbDialog::NoDismiss);
   402 	popUp->setDismissPolicy(HbDialog::NoDismiss);
   400 	popUp->setTimeout(HbDialog::NoTimeout);
   403 	popUp->setTimeout(HbDialog::NoTimeout);
   401 	popUp->setAttribute( Qt::WA_DeleteOnClose, true );
   404 	popUp->setAttribute( Qt::WA_DeleteOnClose, true );
   402 	
   405 	
   403 	QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
   406 	QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
   576 		AgendaEntry::Type entryType = mEditedEntry->type();
   579 		AgendaEntry::Type entryType = mEditedEntry->type();
   577 		if( entryType == AgendaEntry::TypeAppoinment) {
   580 		if( entryType == AgendaEntry::TypeAppoinment) {
   578 			headingWidget->setHeading(hbTrId("txt_calendar_subhead_meeting"));
   581 			headingWidget->setHeading(hbTrId("txt_calendar_subhead_meeting"));
   579 		}else if(CalenAgendaUtils::isAlldayEvent(*mEditedEntry)) {
   582 		}else if(CalenAgendaUtils::isAlldayEvent(*mEditedEntry)) {
   580 			headingWidget->setHeading(hbTrId("txt_calendar_subhead_all_day_event"));
   583 			headingWidget->setHeading(hbTrId("txt_calendar_subhead_all_day_event"));
   581 		}else if (entryType == AgendaEntry::TypeTodo) {
   584 		}		
   582 			headingWidget->setHeading(hbTrId("txt_calendar_subhead_to_do"));
       
   583 		}
       
   584 		
       
   585 	}
   585 	}
   586 
   586 
   587 	initModel();
   587 	initModel();
   588 	// Set the custom item.
   588 	// Set the custom item.
   589 	CalenEditorCustomItem *customItem =
   589 	CalenEditorCustomItem *customItem =
   850 /*!
   850 /*!
   851 	Calculates default time when Event is on same day.
   851 	Calculates default time when Event is on same day.
   852  */
   852  */
   853 QDateTime CalenEditorPrivate::defaultTimeSameDay( )
   853 QDateTime CalenEditorPrivate::defaultTimeSameDay( )
   854 {
   854 {
       
   855 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_DEFAULTTIMESAMEDAY_ENTRY );
   855 	QDateTime currentDateTime = QDateTime::currentDateTime();
   856 	QDateTime currentDateTime = QDateTime::currentDateTime();
   856 	
   857 	
   857 	//Start time should be one hour more than current time.
   858 	//Start time should be one hour more than current time.
   858 	currentDateTime = currentDateTime.addSecs(SecsInOneHour);
   859 	currentDateTime = currentDateTime.addSecs(SecsInOneHour);
   859 
   860 
   881 		currentDateTime = currentDateTime.addSecs(SecsInOneHour);
   882 		currentDateTime = currentDateTime.addSecs(SecsInOneHour);
   882 	}
   883 	}
   883 	
   884 	
   884 	// After adding one hour and rounding off the minutes to current time,
   885 	// After adding one hour and rounding off the minutes to current time,
   885 	// if midnight crossover happens return default time(8:00 am) for next day
   886 	// if midnight crossover happens return default time(8:00 am) for next day
   886 	if(CalenDateUtils::isOnToday(currentDateTime))
   887 	if(CalenDateUtils::isOnToday(currentDateTime)) {
       
   888 		OstTraceFunctionExit0( CALENEDITORPRIVATE_DEFAULTTIMESAMEDAY_EXIT );
   887 		return currentDateTime;
   889 		return currentDateTime;
   888 	else
   890 	} else {
   889 		return CalenDateUtils::defaultTime(currentDateTime);
   891 		return CalenDateUtils::defaultTime(currentDateTime);
       
   892 	}
   890 }
   893 }
   891 
   894 
   892 /*!
   895 /*!
   893 	Sets to default time, when AllDay is unchecked
   896 	Sets to default time, when AllDay is unchecked
   894  */
   897  */
   895 void CalenEditorPrivate::refreshTimeForUncheckAllDay()
   898 void CalenEditorPrivate::refreshTimeForUncheckAllDay()
   896 {
   899 {
       
   900 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_REFRESHTIMEFORUNCHECKALLDAY_ENTRY );
   897 	//Get the default time as 8:00 am from CalenDateUtils.
   901 	//Get the default time as 8:00 am from CalenDateUtils.
   898 	QDateTime fromDateTime = CalenDateUtils::defaultTime(mEditedEntry->startTime());
   902 	QDateTime fromDateTime = CalenDateUtils::defaultTime(mEditedEntry->startTime());
   899 	QDateTime toDateTime;
   903 	QDateTime toDateTime;
   900 	
   904 	
   901 	// The default time will be 8.00 am only if its not on current day
   905 	// The default time will be 8.00 am only if its not on current day
   910 	toDateTime = fromDateTime.addSecs(SecsInOneHour);
   914 	toDateTime = fromDateTime.addSecs(SecsInOneHour);
   911 	mViewToItem->populateDateTime(toDateTime, false);
   915 	mViewToItem->populateDateTime(toDateTime, false);
   912 
   916 
   913 	// Set the default start time to the event.
   917 	// Set the default start time to the event.
   914 	mEditedEntry->setStartAndEndTime(fromDateTime, toDateTime);
   918 	mEditedEntry->setStartAndEndTime(fromDateTime, toDateTime);
       
   919 	OstTraceFunctionExit0( CALENEDITORPRIVATE_REFRESHTIMEFORUNCHECKALLDAY_EXIT );
   915 }	
   920 }	
   916 
   921 
   917 /*!
   922 /*!
   918 	Populates the start and end time of the event item.
   923 	Populates the start and end time of the event item.
   919  */
   924  */
  1328 	Triggered when the subject editor is being edited.
  1333 	Triggered when the subject editor is being edited.
  1329 	\param subject Contains the string displayed in the subject item.
  1334 	\param subject Contains the string displayed in the subject item.
  1330  */
  1335  */
  1331 void CalenEditorPrivate::handleSubjectChange(const QString subject)
  1336 void CalenEditorPrivate::handleSubjectChange(const QString subject)
  1332 {
  1337 {
       
  1338 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLESUBJECTCHANGE_ENTRY );
  1333 	mEditedEntry->setSummary(subject);
  1339 	mEditedEntry->setSummary(subject);
  1334 	if(!mNewEntry ){
  1340 	if(!mNewEntry ){
  1335 		addDiscardAction();
  1341 		addDiscardAction();
  1336 	}
  1342 	}
       
  1343 	OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLESUBJECTCHANGE_EXIT );
  1337 }
  1344 }
  1338 
  1345 
  1339 /*!
  1346 /*!
  1340  Triggered when the Allday Checkbox is being edited.
  1347  Triggered when the Allday Checkbox is being edited.
  1341  \param state of checkbox.
  1348  \param state of checkbox.
  1448  * Handles the completion of location editing
  1455  * Handles the completion of location editing
  1449  */
  1456  */
  1450 void CalenEditorPrivate::handleLocationEditingFinished()
  1457 void CalenEditorPrivate::handleLocationEditingFinished()
  1451 {
  1458 {
  1452     OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLELOCATIONEDITINGFINISHED_ENTRY );
  1459     OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLELOCATIONEDITINGFINISHED_ENTRY );
       
  1460     QString trimmedLocation ;
       
  1461     trimmedLocation  = mEditedEntry->location().trimmed();
  1453     if ( !mOriginalEntry->location().isEmpty() )
  1462     if ( !mOriginalEntry->location().isEmpty() )
  1454     {
  1463     {
  1455        AgendaGeoValue entryGeoValue =mAgendaUtil->fetchById(mEditedEntry->id()).geoValue();
  1464         if(!trimmedLocation .isEmpty())
  1456        if ( !entryGeoValue.isNull() && (mEditedEntry->location()!=mOriginalEntry->location()) )
  1465         {
  1457        {   
  1466             AgendaGeoValue entryGeoValue =mAgendaUtil->fetchById(mEditedEntry->id()).geoValue();
  1458           
  1467             if ( !entryGeoValue.isNull() && (mEditedEntry->location()!=mOriginalEntry->location()) )
  1459            mEditedEntry->setGeoValue(entryGeoValue);
  1468             {   
  1460            HbMessageBox* confirmationQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
  1469 
  1461                    
  1470                 mEditedEntry->setGeoValue(entryGeoValue);
  1462            confirmationQuery->setDismissPolicy(HbDialog::NoDismiss);
  1471                 HbMessageBox* confirmationQuery = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
  1463            confirmationQuery->setTimeout(HbDialog::NoTimeout);
  1472            		// Set the parent for the dialog
  1464            confirmationQuery->setIconVisible(true);  
  1473 		        // Once the editor object is deleted the dialog will also be deleted
  1465            
  1474            		confirmationQuery->setParent(this);
  1466            QString displayText;
  1475                 confirmationQuery->setDismissPolicy(HbDialog::NoDismiss);
  1467            displayText = displayText.append(hbTrId("txt_calendar_info_location_updated_keep_existing"));
  1476                 confirmationQuery->setTimeout(HbDialog::NoTimeout);
  1468            
  1477                 confirmationQuery->setIconVisible(true);  
  1469            confirmationQuery->setText(displayText);
  1478 
  1470            
  1479                 QString displayText;
  1471            // Remove the default actions.
  1480                 displayText = displayText.append(hbTrId("txt_calendar_info_location_updated_keep_existing"));
  1472            QList<QAction *> defaultActions = confirmationQuery->actions();
  1481 
  1473            for (int index=0;index<defaultActions.count();index++) 
  1482                 confirmationQuery->setText(displayText);
  1474            {
  1483 
  1475                confirmationQuery->removeAction(defaultActions[index]);
  1484                 // Remove the default actions.
  1476            }
  1485                 QList<QAction *> defaultActions = confirmationQuery->actions();
  1477            
  1486                 for (int index=0;index<defaultActions.count();index++) 
  1478            defaultActions.clear();
  1487                 {
  1479            confirmationQuery->addAction(new HbAction(hbTrId("txt_common_button_yes")));
  1488                     confirmationQuery->removeAction(defaultActions[index]);
  1480            confirmationQuery->addAction(new HbAction(hbTrId("txt_common_button_no")));
  1489                 }
  1481            confirmationQuery->open(this, SLOT(selectEditingFinishedAction(HbAction*)));
  1490 
  1482        }
  1491                 defaultActions.clear();
       
  1492                 confirmationQuery->addAction(new HbAction(hbTrId("txt_common_button_yes")));
       
  1493                 confirmationQuery->addAction(new HbAction(hbTrId("txt_common_button_no")));
       
  1494                 confirmationQuery->open(this, SLOT(selectEditingFinishedAction(HbAction*)));
       
  1495             }
       
  1496         }
       
  1497         else
       
  1498         {
       
  1499             mEditedEntry->clearGeoValue();
       
  1500             // sets null string for the location
       
  1501             mEditedEntry->setLocation(trimmedLocation );
       
  1502         }
  1483     }       
  1503     }       
  1484     OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLELOCATIONEDITINGFINISHED_EXIT );
  1504     OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLELOCATIONEDITINGFINISHED_EXIT );
  1485 }
  1505 }
  1486 
  1506 
  1487 /*!
  1507 /*!
  1519  */
  1539  */
  1520 void CalenEditorPrivate::saveAndCloseEditor()
  1540 void CalenEditorPrivate::saveAndCloseEditor()
  1521 {
  1541 {
  1522 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SAVEANDCLOSEEDITOR_ENTRY );
  1542 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SAVEANDCLOSEEDITOR_ENTRY );
  1523 	Action action = handleDone();
  1543 	Action action = handleDone();
  1524 	if (CalenEditorPrivate::ActionDelete != action) {
  1544 	closeEditor();
  1525 		closeEditor();
       
  1526 	}
       
  1527 
  1545 
  1528 	if (CalenEditorPrivate::ActionSave == action) {
  1546 	if (CalenEditorPrivate::ActionSave == action) {
  1529 		// check if we need to launch the calendar application
  1547 		// check if we need to launch the calendar application
  1530 		if (mLaunchCalendar) {
  1548 		if (mLaunchCalendar) {
  1531 			CalenLauncher* launcher = new CalenLauncher(this);
  1549 			CalenLauncher* launcher = new CalenLauncher(this);
  1562 		closeEditor();
  1580 		closeEditor();
  1563 		OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLEDELETEACTION_EXIT );
  1581 		OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLEDELETEACTION_EXIT );
  1564 		return;
  1582 		return;
  1565 	}else {
  1583 	}else {
  1566 		// Delete entry and close editor
  1584 		// Delete entry and close editor
  1567 		deleteEntry(true);
  1585 		// if editor is launched from Notes then don't delete entry
       
  1586 		// Just exit from calendar editor
       
  1587 		if (mOriginalEntry->id() > 0) {
       
  1588 			// If user is editing single instanc then delete single instance 
       
  1589 			// else delete entry
       
  1590 			if (mEditRange == ThisOnly) {
       
  1591 				// User wants to delete only this occurence
       
  1592 				mAgendaUtil->deleteRepeatedEntry(*mOriginalEntry,
       
  1593 												AgendaUtil::ThisOnly);
       
  1594 			} else {
       
  1595 				// Delete the entry.
       
  1596 				mAgendaUtil->deleteEntry(mOriginalEntry->id());
       
  1597 			}
       
  1598 			closeEditor();
       
  1599 		}
  1568 	}
  1600 	}
  1569 	OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_HANDLEDELETEACTION_EXIT );
  1601 	OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_HANDLEDELETEACTION_EXIT );
       
  1602 }
       
  1603 
       
  1604 /*!
       
  1605 	Deletes the entry based on the selection: This occurence or All occurences 
       
  1606  */
       
  1607 void CalenEditorPrivate::handleDeleteOccurence(int index)
       
  1608 {
       
  1609 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_HANDLEDELETEOCCURENCE_ENTRY );
       
  1610 	switch (index) {
       
  1611 		case 0:
       
  1612 			// User wants to delete only this occurence
       
  1613 			mAgendaUtil->deleteRepeatedEntry(mEntry, AgendaUtil::ThisOnly);
       
  1614 			break;
       
  1615 		case 1:
       
  1616 			// User wants to delete all the occurences
       
  1617 			// Delete the parent entry.
       
  1618 			if(isChild()) {
       
  1619 				AgendaEntry entryToBeDeleted = mAgendaUtil->parentEntry(mEntry);
       
  1620 				mAgendaUtil->deleteEntry(entryToBeDeleted.id());
       
  1621 			}else {
       
  1622 				mAgendaUtil->deleteEntry(mOriginalEntry->id());
       
  1623 			}
       
  1624 			break;
       
  1625 	}
       
  1626 	closeEditor();
       
  1627 	OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLEDELETEOCCURENCE_EXIT );
  1570 }
  1628 }
  1571 
  1629 
  1572 /*!
  1630 /*!
  1573 	Launches the Settings view.
  1631 	Launches the Settings view.
  1574  */
  1632  */
  1589 	closeEditor();
  1647 	closeEditor();
  1590 	OstTraceFunctionExit0( CALENEDITORPRIVATE_DISCARDCHANGES_EXIT );
  1648 	OstTraceFunctionExit0( CALENEDITORPRIVATE_DISCARDCHANGES_EXIT );
  1591 }
  1649 }
  1592 
  1650 
  1593 /*!
  1651 /*!
  1594  * Show delete confirmation query
  1652  * Show delete confirmation query based on the entry
  1595  */
  1653  */
  1596 void CalenEditorPrivate::showDeleteConfirmationQuery(bool closeEditor)
  1654 void CalenEditorPrivate::showDeleteConfirmationQuery()
  1597 {
  1655 {
  1598 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SHOWDELETECONFIRMATIONQUERY_ENTRY );
  1656 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SHOWDELETECONFIRMATIONQUERY_ENTRY );
       
  1657 	if(mOriginalEntry->isRepeating() || isChild()) {
       
  1658 		showDeleteOccurencePopup();
       
  1659 	}else {
       
  1660 		showDeletePopup();
       
  1661 	}
       
  1662 	OstTraceFunctionExit0( CALENEDITORPRIVATE_SHOWDELETECONFIRMATIONQUERY_EXIT );
       
  1663 }
       
  1664 
       
  1665 /*!
       
  1666  * Show delete confirmation query for repeated entries
       
  1667  */
       
  1668 void CalenEditorPrivate::showDeleteOccurencePopup()
       
  1669 {
       
  1670 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SHOWDELETEOCCURENCEPOPUP_ENTRY );
       
  1671 	HbDialog *popUp = new HbDialog();
       
  1672 	// Set the parent for the dialog
       
  1673 	// Once the editor object is deleted the dialog will also be deleted
       
  1674 	popUp->setParent(this);
       
  1675 	popUp->setDismissPolicy(HbDialog::NoDismiss);
       
  1676 	popUp->setTimeout(HbDialog::NoTimeout);
       
  1677 	popUp->setAttribute( Qt::WA_DeleteOnClose, true );
       
  1678 	
       
  1679 	QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
       
  1680 	HbWidget *editWidget = new HbWidget();
       
  1681 	editWidget->setLayout(layout);
       
  1682 
       
  1683 	HbRadioButtonList *editButtonList = new HbRadioButtonList();
       
  1684 
       
  1685 	QStringList list;
       
  1686 	list << hbTrId("txt_calendar_info_this_occurrence_only")
       
  1687 	        << hbTrId("txt_calendar_info_all_occurences");
       
  1688 
       
  1689 	editButtonList->setItems(list);
       
  1690 
       
  1691 	layout->addItem(editButtonList);
       
  1692 
       
  1693 	popUp->setContentWidget(editWidget);
       
  1694 	popUp->setHeadingWidget(new HbLabel(hbTrId("txt_calendar_title_delete_repeated_entry")));
       
  1695 
       
  1696 	// Create cancel action
       
  1697 	HbAction *cancelAction =
       
  1698 	        new HbAction(hbTrId("txt_common_button_cancel_singledialog"));
       
  1699 	popUp->addAction(cancelAction);
       
  1700 	connect(editButtonList, SIGNAL(itemSelected(int)), popUp, SLOT(close()));
       
  1701 	connect(editButtonList, SIGNAL(itemSelected(int)), this,
       
  1702 	        SLOT(handleDeleteOccurence(int)));
       
  1703 	connect(cancelAction, SIGNAL(triggered()), this, SLOT(close()));
       
  1704 
       
  1705 	// Show the popup
       
  1706 	popUp->open();
       
  1707 	OstTraceFunctionExit0( CALENEDITORPRIVATE_SHOWDELETEOCCURENCEPOPUP_EXIT );
       
  1708 }
       
  1709 
       
  1710 /*!
       
  1711  * Show delete confirmation query for non repeated entries
       
  1712  */
       
  1713 void CalenEditorPrivate::showDeletePopup()
       
  1714 {
       
  1715 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_SHOWDELETEPOPUP_ENTRY );
  1599 	HbMessageBox *popup = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
  1716 	HbMessageBox *popup = new HbMessageBox(HbMessageBox::MessageTypeQuestion);
       
  1717 	// Set the parent for the dialog
       
  1718 	// Once the editor object is deleted the dialog will also be deleted
       
  1719 	popup->setParent(this);
  1600 	popup->setDismissPolicy(HbDialog::NoDismiss);
  1720 	popup->setDismissPolicy(HbDialog::NoDismiss);
  1601 	popup->setTimeout(HbDialog::NoTimeout);
  1721 	popup->setTimeout(HbDialog::NoTimeout);
  1602 	popup->setAttribute( Qt::WA_DeleteOnClose, true );
  1722 	popup->setAttribute( Qt::WA_DeleteOnClose, true );
  1603 
  1723 
  1604 	QString text = 0;
  1724 	popup->setText(hbTrId("txt_calendar_info_delete_entry"));
  1605 
  1725 
  1606 	switch (mOriginalEntry->type()) {
  1726 	QList<QAction*> list = popup->actions();
  1607 		case AgendaEntry::TypeAppoinment:
  1727 	for(int i=0; i < list.count(); i++)
  1608 		case AgendaEntry::TypeEvent: {
  1728 	{
  1609 			if (mEditRange == ThisAndAll) {
  1729 		popup->removeAction(list[i]);
  1610 				text.append(hbTrId("txt_calendar_info_delete_entries"));
  1730 	}
  1611 			} else {
       
  1612 				text.append(hbTrId("txt_calendar_info_delete_meeting"));
       
  1613 			}
       
  1614 			break;
       
  1615 		}
       
  1616 		case AgendaEntry::TypeAnniversary: {
       
  1617 			text.append(hbTrId("txt_calendar_info_delete_anniversary"));
       
  1618 			break;
       
  1619 		}
       
  1620 	}
       
  1621 
       
  1622 	popup->setText(text);
       
  1623 	
       
  1624     QList<QAction*> list = popup->actions();
       
  1625     for(int i=0; i < list.count(); i++)
       
  1626         {
       
  1627         popup->removeAction(list[i]);
       
  1628         }
       
  1629 	HbAction *deleteAction = new HbAction(hbTrId("txt_common_button_delete"),
  1731 	HbAction *deleteAction = new HbAction(hbTrId("txt_common_button_delete"),
  1630 										popup);
  1732 	                                      popup);
  1631 	popup->addAction(deleteAction);
  1733 	popup->addAction(deleteAction);
  1632 	connect(deleteAction, SIGNAL(triggered()), this, 
  1734 	connect(deleteAction, SIGNAL(triggered()), this, 
  1633 										SLOT(handleDeleteAction()));
  1735 	        SLOT(handleDeleteAction()));
  1634 	HbAction *cancelAction = new HbAction(hbTrId("txt_common_button_cancel"), 
  1736 	HbAction *cancelAction = new HbAction(hbTrId("txt_common_button_cancel"), 
  1635 											popup);
  1737 	                                      popup);
  1636 	// Editor should not be closed for all the cases when cancel is pressed
  1738 	connect(cancelAction, SIGNAL(triggered()), this, SLOT(close()));
  1637 	if(closeEditor) {
       
  1638 		connect(cancelAction, SIGNAL(triggered()), this, 
       
  1639 											SLOT(closeEditor()));
       
  1640 	}
       
  1641 	popup->addAction(cancelAction);
  1739 	popup->addAction(cancelAction);
  1642 	popup->open();
  1740 	popup->open();
  1643 	OstTraceFunctionExit0( CALENEDITORPRIVATE_SHOWDELETECONFIRMATIONQUERY_EXIT );
  1741 
       
  1742 	OstTraceFunctionExit0( CALENEDITORPRIVATE_SHOWDELETEPOPUP_EXIT );
  1644 }
  1743 }
  1645 
  1744 
  1646 /*!
  1745 /*!
  1647 	Returns true if the entry is a child ,else false.
  1746 	Returns true if the entry is a child ,else false.
  1648 	\return true if the entry is a child, false otherwise.
  1747 	\return true if the entry is a child, false otherwise.
  1649  */
  1748  */
  1650 bool CalenEditorPrivate::isChild() const
  1749 bool CalenEditorPrivate::isChild() const
  1651 {
  1750 {
  1652 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ISCHILD_ENTRY );
  1751 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ISCHILD_ENTRY );
  1653 	return mEditedEntry->recurrenceId().toUTC().isNull();
  1752 	return !(mEditedEntry->recurrenceId().toUTC().isNull());
  1654 }
  1753 }
  1655 
  1754 
  1656 /*!
  1755 /*!
  1657 	Check for errors in the form. This function should only be called when the
  1756 	Check for errors in the form. This function should only be called when the
  1658 	user has decided they want to edit "This and all" from a prompt, or when the
  1757 	user has decided they want to edit "This and all" from a prompt, or when the
  1696 				OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLEDONE_EXIT );
  1795 				OstTraceFunctionExit0( CALENEDITORPRIVATE_HANDLEDONE_EXIT );
  1697 				return CalenEditorPrivate::ActionSave;
  1796 				return CalenEditorPrivate::ActionSave;
  1698 			}
  1797 			}
  1699 			OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_HANDLEDONE_EXIT );
  1798 			OstTraceFunctionExit0( DUP1_CALENEDITORPRIVATE_HANDLEDONE_EXIT );
  1700 			return CalenEditorPrivate::ActionNothing;
  1799 			return CalenEditorPrivate::ActionNothing;
  1701 		case CalenEditorPrivate::ActionDelete:
       
  1702 			showDeleteConfirmationQuery(true);
       
  1703 			OstTraceFunctionExit0( DUP2_CALENEDITORPRIVATE_HANDLEDONE_EXIT );
       
  1704 			return CalenEditorPrivate::ActionDelete;
       
  1705 		case CalenEditorPrivate::ActionNothing:
  1800 		case CalenEditorPrivate::ActionNothing:
  1706 			return CalenEditorPrivate::ActionNothing;
  1801 			return CalenEditorPrivate::ActionNothing;
  1707 		default:
  1802 		default:
  1708 			break;
  1803 			break;
  1709 	}
  1804 	}
  1744 	}
  1839 	}
  1745 	emit q_ptr->entrySaved();
  1840 	emit q_ptr->entrySaved();
  1746 	OstTraceFunctionExit0( DUP2_CALENEDITORPRIVATE_SAVEENTRY_EXIT );
  1841 	OstTraceFunctionExit0( DUP2_CALENEDITORPRIVATE_SAVEENTRY_EXIT );
  1747 	return true;
  1842 	return true;
  1748 
  1843 
  1749 }
       
  1750 
       
  1751 /*!
       
  1752 	Delete the entry 
       
  1753 	@param closeEditor set true to close editor else default value is false
       
  1754  */
       
  1755 void CalenEditorPrivate::deleteEntry(bool close)
       
  1756 {
       
  1757 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_DELETEENTRY_ENTRY );
       
  1758 	// if editor is launched from Notes then don't delete entry
       
  1759 	// Just exit from calendar editor
       
  1760 	if (mOriginalEntry->id() > 0) {
       
  1761 		// If user is editing single instanc then delete single instance 
       
  1762 		// else delete entry
       
  1763 		if (mEditRange == ThisOnly) {
       
  1764 			// User wants to delete only this occurence
       
  1765 			mAgendaUtil->deleteRepeatedEntry(*mOriginalEntry,
       
  1766 			                                 AgendaUtil::ThisOnly);
       
  1767 		} else {
       
  1768 			// Delete the entry.
       
  1769 			mAgendaUtil->deleteEntry(mOriginalEntry->id());
       
  1770 		}
       
  1771 
       
  1772 		if (close) {
       
  1773 			closeEditor();
       
  1774 		}
       
  1775 	}
       
  1776 	OstTraceFunctionExit0( CALENEDITORPRIVATE_DELETEENTRY_EXIT );
       
  1777 }
  1844 }
  1778 
  1845 
  1779 /*!
  1846 /*!
  1780  Change the entry before saving, depending on AllDay checkbox state
  1847  Change the entry before saving, depending on AllDay checkbox state
  1781  */
  1848  */
  1946 	Used to know if the entry is repeating. For new entries this
  2013 	Used to know if the entry is repeating. For new entries this
  1947 	is the only way to find whether its repeating or not
  2014 	is the only way to find whether its repeating or not
  1948  */
  2015  */
  1949 bool CalenEditorPrivate::isRepeatUntilItemAdded()
  2016 bool CalenEditorPrivate::isRepeatUntilItemAdded()
  1950 {
  2017 {
       
  2018 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_ISREPEATUNTILITEMADDED_ENTRY );
  1951 	// For exceptional entries the repeatfield will not be present
  2019 	// For exceptional entries the repeatfield will not be present
  1952 	// So need to check if the repeat field is there or not
  2020 	// So need to check if the repeat field is there or not
  1953 	if( mRepeatField ) {
  2021 	if( mRepeatField ) {
  1954 		return mRepeatField->isRepeatUntilItemAdded();
  2022 		return mRepeatField->isRepeatUntilItemAdded();
  1955 	}else {
  2023 	}else {
       
  2024 		OstTraceFunctionExit0( CALENEDITORPRIVATE_ISREPEATUNTILITEMADDED_EXIT );
  1956 		return false;
  2025 		return false;
  1957 	}
  2026 	}
  1958 }
  2027 }
  1959 
  2028 
  1960 /*!
  2029 /*!
  2003 /*!
  2072 /*!
  2004 	Gets the reminder options count
  2073 	Gets the reminder options count
  2005  */
  2074  */
  2006 int CalenEditorPrivate::getReminderCount()
  2075 int CalenEditorPrivate::getReminderCount()
  2007 {
  2076 {
       
  2077 	OstTraceFunctionEntry0( CALENEDITORPRIVATE_GETREMINDERCOUNT_ENTRY );
  2008 	return mReminderField->reminderItemsCount();
  2078 	return mReminderField->reminderItemsCount();
  2009 }
  2079 }
  2010 
  2080 
  2011 /*!
  2081 /*!
  2012 	Checks if editing all occurences or a single occurence.
  2082 	Checks if editing all occurences or a single occurence.
  2031 /*!
  2101 /*!
  2032     save the entry from other views.
  2102     save the entry from other views.
  2033  */
  2103  */
  2034 void CalenEditorPrivate::forcedSaveEntry()
  2104 void CalenEditorPrivate::forcedSaveEntry()
  2035 {
  2105 {
  2036     saveAndCloseEditor();   
  2106     OstTraceFunctionEntry0( CALENEDITORPRIVATE_FORCEDSAVEENTRY_ENTRY );
       
  2107     // Check if the editor is launched completely
       
  2108     // If yes, save entry and close the editor
       
  2109     if(mEditorView) {
       
  2110 		saveAndCloseEditor();
       
  2111     }else {
       
  2112     	// If the view is not launched then just emit signal dialogClosed()
       
  2113     	// When the edit popup is shown for repeating entries,
       
  2114     	// this else case will get executed
       
  2115     	emit q_ptr->dialogClosed();
       
  2116     }
       
  2117     OstTraceFunctionExit0( CALENEDITORPRIVATE_FORCEDSAVEENTRY_EXIT );
  2037 }
  2118 }
  2038 // End of file	--Don't remove this.
  2119 // End of file	--Don't remove this.