notes/notesui/notesmodel/src/notesmodel.cpp
changeset 83 5aadd1120515
parent 75 7ac58b2aae6f
--- a/notes/notesui/notesmodel/src/notesmodel.cpp	Tue Oct 05 14:14:48 2010 +0530
+++ b/notes/notesui/notesmodel/src/notesmodel.cpp	Fri Oct 15 12:10:36 2010 +0530
@@ -515,9 +515,12 @@
 		QString modifiedText;
 
 		// Show the creation time if entry is not modified.
-		if (entry.dtStamp().isValid()) {
-			QDateTime creationDateTime = entry.dtStamp();
-
+        // Modified time will be equal to creation time if the entry is newly created
+        QDateTime creationDateTime = entry.dtStamp();
+        QDateTime modifiedDateTime = entry.lastModifiedDateTime();
+        
+        if (creationDateTime.isValid() && modifiedDateTime.isValid() &&
+                modifiedDateTime == creationDateTime) {
 			// If created on today,show only creation time otherwise show the
 			// creation date.
 			if ((QDate::currentDate()) == creationDateTime.date()) {
@@ -532,8 +535,6 @@
 						creationDateTime.date().toString(dateFormatString());
 			}
 		} else {
-			QDateTime modifiedDateTime = entry.lastModifiedDateTime();
-
 			// If modified on today,show only modified time otherwise show the
 			// modified date.
 			if ((QDate::currentDate()) == modifiedDateTime.date() ) {
@@ -777,9 +778,15 @@
 	QString modifiedText;
 
 	// Show the creation time if entry is not modified.
-	if (entry.dtStamp().isValid()) {
-		QDateTime creationDateTime = entry.dtStamp();
-
+	// Modified time will be equal to creation time if the entry is newly created
+	QDateTime creationDateTime = entry.dtStamp();
+	QDateTime modifiedDateTime = entry.lastModifiedDateTime();
+	
+	if (creationDateTime.isValid() && modifiedDateTime.isValid() &&
+	        modifiedDateTime == creationDateTime
+	       /* creationDateTime.time().hour() == modifiedDateTime.time().hour() &&
+	        creationDateTime.time().minute() == modifiedDateTime.time().minute() &&
+	        creationDateTime.time().second() == modifiedDateTime.time().second()*/) {
 		// If created on today,show only creation time otherwise show the
 		// creation date.
 		if ((QDate::currentDate()) == creationDateTime.date()) {
@@ -794,8 +801,6 @@
 					creationDateTime.date().toString(dateFormatString());
 		}
 	} else {
-		QDateTime modifiedDateTime = entry.lastModifiedDateTime();
-
 		// If modified on today,show only modified time otherwise show the
 		// modified date.
 		if ((QDate::currentDate()) == modifiedDateTime.date() ) {