[tracker/tracker-0.8] Bug 620828 - returns no e-mail results



commit 6f68fbe082d2fc1dd6250a4e914d9195595a4526
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jun 24 14:34:30 2010 +0200

    Bug 620828 - returns no e-mail results
    
    Make tracker-search-tool search e-mails as well, the information provided
    is a bit basic at the moment.

 src/tracker-search-tool/tracker-category-view.gs |    4 +++
 src/tracker-search-tool/tracker-metadata-tile.gs |   29 ++++++++++++++++++++-
 src/tracker-search-tool/tracker-result-grid.gs   |   11 ++++++++
 3 files changed, 42 insertions(+), 2 deletions(-)
---
diff --git a/src/tracker-search-tool/tracker-category-view.gs b/src/tracker-search-tool/tracker-category-view.gs
index 8607562..ad81890 100644
--- a/src/tracker-search-tool/tracker-category-view.gs
+++ b/src/tracker-search-tool/tracker-category-view.gs
@@ -78,6 +78,10 @@ class TrackerCategoryView : ScrolledWindow
         store.set (iter, CategoryColumns.Icon, GetThemePixbufByName ("system-run", icon_size, get_screen ()), \
                    CategoryColumns.Name, "nfo:SoftwareApplication", CategoryColumns.DisplayName, N_("Applications") , -1);
 
+        store.append (out iter);
+        store.set (iter, CategoryColumns.Icon, GetThemePixbufByName ("evolution-mail", icon_size, get_screen ()), \
+                   CategoryColumns.Name, "nmo:Email", CategoryColumns.DisplayName, N_("Emails") , -1);
+
         treeview = new TreeView.with_model (store)
         treeview.insert_column_with_attributes (-1, "icon", new CellRendererPixbuf (), "pixbuf", 0, null)
         treeview.insert_column_with_attributes (-1, "name", new CellRendererText (), "text", 2, null)
diff --git a/src/tracker-search-tool/tracker-metadata-tile.gs b/src/tracker-search-tool/tracker-metadata-tile.gs
index 6af3111..0f37000 100644
--- a/src/tracker-search-tool/tracker-metadata-tile.gs
+++ b/src/tracker-search-tool/tracker-metadata-tile.gs
@@ -217,7 +217,10 @@ class TrackerMetadataTile : EventBox
         path_link.label = ""
 
         name_link.set_sensitive (false)
+        name_link.show ()
+
         path_link.set_sensitive (false)
+        path_link.show ()
 
         name_label.show ()
         path_label.show ()
@@ -270,9 +273,10 @@ class TrackerMetadataTile : EventBox
         if res.contains ("nfo#Video") do return Categories.Video
         if res.contains ("nfo#Image") do return Categories.Image
         if res.contains ("nfo#Audio") do return Categories.Audio
+        if res.contains ("nmo#Email") do return Categories.Email
         if res.contains ("nfo#Document") do return Categories.Document
         if res.contains ("nfo#Software") do return Categories.Application       
-        if res.contains ("nfo#Folder") do return Categories.Folder        
+        if res.contains ("nfo#Folder") do return Categories.Folder
                          
         return Categories.File
         
@@ -354,6 +358,26 @@ class TrackerMetadataTile : EventBox
             SetLabelValue (info_value6, result[2])  
         
 
+    def private DisplayEmailDetails (uri : string)
+        var query = "SELECT nmo:messageSubject(?e) nco:fullname(?s) nmo:receivedDate(?e) WHERE { ?e nie:url \"%s\" ; nmo:from ?s }".printf(uri)
+        var result = Query.Query (query)
+
+        name_label.hide ()
+        name_link.hide ()
+        path_link.hide ()
+        path_label.hide ()
+        info_label2.hide ()
+
+        info_label1.set_text (N_("Subject:"))
+        info_label4.set_text (N_("From:"))
+        info_label3.set_text (N_("Received:"))
+
+        if result is not null
+            SetLabelValue (info_value1, result[0])
+            SetLabelValue (info_value4, result[1])
+            SetLabelValue (info_value3, result[2])
+
+
     def private DisplayDocumentDetails (uri : string)
         var query = "SELECT nie:title(?s) nco:creator(?s) nfo:pageCount (?s) WHERE { ?s nie:url \"%s\" }".printf(uri)
         var result = Query.Query (query)
@@ -414,13 +438,14 @@ class TrackerMetadataTile : EventBox
         /* determine category type */
         var cat = GetCategory (uri)
 
-        if cat is not Categories.Application
+        if cat is not Categories.Application and cat is not Categories.Email
             DisplayFileDetails (uri, mime)
 
         case cat
             when Categories.Audio do DisplayAudioDetails (uri)
             when Categories.Video do DisplayVideoDetails (uri)
             when Categories.Image do DisplayImageDetails (uri)
+            when Categories.Email do DisplayEmailDetails (uri)
             when Categories.Document do DisplayDocumentDetails (uri)
             when Categories.Application do DisplayApplicationDetails (uri)
             default do return
diff --git a/src/tracker-search-tool/tracker-result-grid.gs b/src/tracker-search-tool/tracker-result-grid.gs
index d25571b..ee99d58 100644
--- a/src/tracker-search-tool/tracker-result-grid.gs
+++ b/src/tracker-search-tool/tracker-result-grid.gs
@@ -169,6 +169,17 @@ class TrackerResultGrid : ScrolledWindow
                         except e:Error
                             print "Could not get file info for %s", uri
 
+                else
+                    if uri.has_prefix ("email://")
+
+                        var query = "SELECT nmo:messageSubject(?s) where { ?s nie:url \"%s\" }".printf(uri)
+                        var qresults = Query.Query (query)
+
+                        store.append (out iter);
+                        store.set (iter, ResultColumns.Id, id, ResultColumns.Uri, uri, ResultColumns.Mime, mime, ResultColumns.Icon, GetThemePixbufByName ("evolution-mail", 48, get_screen ()), \
+                                   ResultColumns.DisplayName, qresults[0], ResultColumns.IsDirectory, false, -1)
+
+
             /* select first result */
             if has_results
                 var path = new TreePath.from_string ("0:0:0")



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