[tracker/needle: 46/53] tracker-needle: Added email support



commit db8b7b1f6893ca1450368bbde69a3d2fdca8395e
Author: Martyn Russell <martyn lanedo com>
Date:   Tue Oct 26 21:33:01 2010 +0100

    tracker-needle: Added email support

 src/tracker-needle/tracker-needle.vala |   11 +++++++++--
 src/tracker-needle/tracker-query.vala  |   23 +++++++++++++++++++++++
 2 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker-needle/tracker-needle.vala b/src/tracker-needle/tracker-needle.vala
index 1fd1d91..b9fd6b1 100644
--- a/src/tracker-needle/tracker-needle.vala
+++ b/src/tracker-needle/tracker-needle.vala
@@ -353,9 +353,10 @@ public class Tracker.Needle {
 		Tracker.Query.Type[] categories = { 
 			Tracker.Query.Type.APPLICATIONS,
 			Tracker.Query.Type.MUSIC,
-			Tracker.Query.Type.IMAGES,
 			Tracker.Query.Type.VIDEOS,
-			Tracker.Query.Type.DOCUMENTS
+			Tracker.Query.Type.DOCUMENTS,
+			Tracker.Query.Type.MAIL,
+			Tracker.Query.Type.IMAGES
 		};
 		Tracker.Query query = new Tracker.Query ();
 
@@ -434,6 +435,12 @@ public class Tracker.Needle {
 							pixbuf_small = tracker_pixbuf_new_from_name (theme, "x-office-presentation", size_medium);
 						}
 						break;
+					case Tracker.Query.Type.MAIL:
+						if (count == 0) {
+							pixbuf_small = tracker_pixbuf_new_from_name (theme, "emblem-mail", size_medium);
+						}
+						column2 = tracker_time_format_from_iso8601 (cursor.get_string (4));
+						break;
 
 					default:
 						break;
diff --git a/src/tracker-needle/tracker-query.vala b/src/tracker-needle/tracker-query.vala
index 59a2fac..f4a748a 100644
--- a/src/tracker-needle/tracker-query.vala
+++ b/src/tracker-needle/tracker-query.vala
@@ -181,6 +181,29 @@ public class Tracker.Query {
 			        ";
 			break;
 
+		case Type.MAIL:
+			string no_subject = _("No Subject");
+			string to = _("To");
+			
+			query = @"
+			        SELECT
+			          ?urn
+			          nie:url(?urn)
+			          tracker:coalesce(nco:fullname(?sender), nco:nickname(?sender), nco:emailAddress(?sender), \"Unknown\")
+			          tracker:coalesce(nmo:messageSubject(?urn), \"$no_subject\")
+			          nmo:receivedDate(?urn)
+			          fn:concat(\"$to: \", tracker:coalesce(nco:fullname(?to), nco:nickname(?to), nco:emailAddress(?to), \"Unknown\"))
+			        WHERE {
+			          ?urn a nmo:Email ;
+			          nmo:from ?sender ;
+			          nmo:to ?to ;
+			          fts:match \"$criteria_escaped\" .
+			        }
+			        ORDER BY DESC(fts:rank(?urn)) DESC(nmo:messageSubject(?urn)) DESC(nmo:receivedDate(?urn))
+			        OFFSET $offset LIMIT $limit
+			        ";
+			break;
+
 		default:
 			assert_not_reached ();
 		}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]