notes/notesui/notesmodel/src/notesmodel.cpp
changeset 83 5aadd1120515
parent 75 7ac58b2aae6f
equal deleted inserted replaced
82:dcd0ca396fa1 83:5aadd1120515
   513 		QString displayText;
   513 		QString displayText;
   514 		QString dateTimeText;
   514 		QString dateTimeText;
   515 		QString modifiedText;
   515 		QString modifiedText;
   516 
   516 
   517 		// Show the creation time if entry is not modified.
   517 		// Show the creation time if entry is not modified.
   518 		if (entry.dtStamp().isValid()) {
   518         // Modified time will be equal to creation time if the entry is newly created
   519 			QDateTime creationDateTime = entry.dtStamp();
   519         QDateTime creationDateTime = entry.dtStamp();
   520 
   520         QDateTime modifiedDateTime = entry.lastModifiedDateTime();
       
   521         
       
   522         if (creationDateTime.isValid() && modifiedDateTime.isValid() &&
       
   523                 modifiedDateTime == creationDateTime) {
   521 			// If created on today,show only creation time otherwise show the
   524 			// If created on today,show only creation time otherwise show the
   522 			// creation date.
   525 			// creation date.
   523 			if ((QDate::currentDate()) == creationDateTime.date()) {
   526 			if ((QDate::currentDate()) == creationDateTime.date()) {
   524 				dateTimeText =
   527 				dateTimeText =
   525 						hbTrId("txt_notes_dblist_note_created_at_time");
   528 						hbTrId("txt_notes_dblist_note_created_at_time");
   530 						hbTrId("txt_notes_dblist_note_created_on_date");
   533 						hbTrId("txt_notes_dblist_note_created_on_date");
   531 				modifiedText =
   534 				modifiedText =
   532 						creationDateTime.date().toString(dateFormatString());
   535 						creationDateTime.date().toString(dateFormatString());
   533 			}
   536 			}
   534 		} else {
   537 		} else {
   535 			QDateTime modifiedDateTime = entry.lastModifiedDateTime();
       
   536 
       
   537 			// If modified on today,show only modified time otherwise show the
   538 			// If modified on today,show only modified time otherwise show the
   538 			// modified date.
   539 			// modified date.
   539 			if ((QDate::currentDate()) == modifiedDateTime.date() ) {
   540 			if ((QDate::currentDate()) == modifiedDateTime.date() ) {
   540 				dateTimeText =
   541 				dateTimeText =
   541 						hbTrId("txt_notes_dblist_note_modified_at_time");
   542 						hbTrId("txt_notes_dblist_note_modified_at_time");
   775 	QString displayText;
   776 	QString displayText;
   776 	QString dateTimeText;
   777 	QString dateTimeText;
   777 	QString modifiedText;
   778 	QString modifiedText;
   778 
   779 
   779 	// Show the creation time if entry is not modified.
   780 	// Show the creation time if entry is not modified.
   780 	if (entry.dtStamp().isValid()) {
   781 	// Modified time will be equal to creation time if the entry is newly created
   781 		QDateTime creationDateTime = entry.dtStamp();
   782 	QDateTime creationDateTime = entry.dtStamp();
   782 
   783 	QDateTime modifiedDateTime = entry.lastModifiedDateTime();
       
   784 	
       
   785 	if (creationDateTime.isValid() && modifiedDateTime.isValid() &&
       
   786 	        modifiedDateTime == creationDateTime
       
   787 	       /* creationDateTime.time().hour() == modifiedDateTime.time().hour() &&
       
   788 	        creationDateTime.time().minute() == modifiedDateTime.time().minute() &&
       
   789 	        creationDateTime.time().second() == modifiedDateTime.time().second()*/) {
   783 		// If created on today,show only creation time otherwise show the
   790 		// If created on today,show only creation time otherwise show the
   784 		// creation date.
   791 		// creation date.
   785 		if ((QDate::currentDate()) == creationDateTime.date()) {
   792 		if ((QDate::currentDate()) == creationDateTime.date()) {
   786 			dateTimeText =
   793 			dateTimeText =
   787 					hbTrId("txt_notes_dblist_note_created_at_time");
   794 					hbTrId("txt_notes_dblist_note_created_at_time");
   792 					hbTrId("txt_notes_dblist_note_created_on_date");
   799 					hbTrId("txt_notes_dblist_note_created_on_date");
   793 			modifiedText =
   800 			modifiedText =
   794 					creationDateTime.date().toString(dateFormatString());
   801 					creationDateTime.date().toString(dateFormatString());
   795 		}
   802 		}
   796 	} else {
   803 	} else {
   797 		QDateTime modifiedDateTime = entry.lastModifiedDateTime();
       
   798 
       
   799 		// If modified on today,show only modified time otherwise show the
   804 		// If modified on today,show only modified time otherwise show the
   800 		// modified date.
   805 		// modified date.
   801 		if ((QDate::currentDate()) == modifiedDateTime.date() ) {
   806 		if ((QDate::currentDate()) == modifiedDateTime.date() ) {
   802 			dateTimeText =
   807 			dateTimeText =
   803 					hbTrId("txt_notes_dblist_note_modified_at_time");
   808 					hbTrId("txt_notes_dblist_note_modified_at_time");