~c-franke/do/XesamSearch

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// XesamItem.cs 
// User: kraut (c.franke@muenchen-mail.de) at 22:23 21.02.2008


using System;
using System.Collections.Generic;
using Do.Universe;

namespace Do.Addins.DoXesam
{
	
	class XesamItem: IItem 
	{
		
		protected string title;
		protected string author;
		protected string creator;
		protected string width;
		protected string hight;
		protected string pagecount;
		protected string mimetype;
		protected string url;
		protected string fileextension;
		protected string from;
		protected string to;
		protected string subject;
		protected string isread;
		protected string date;

		protected string artist;
		protected string exactfilename;
		protected string videocodec;
		
		public  XesamItem(Dictionary<string,string> field){
			this.title=field["xesam:title"];
			this.author=field["xesam:author"];
			this.creator=field["xesam:creator"];
			this.width=field["xesam:width"];
			this.hight=field["xesam:hight"];
			this.pagecount=field["xesam:pageCount"];
			this.mimetype=field["xesam:mimeType"];
			this.url=field["xesam:url"];
			this.fileextension=field["xesam:fileExtension"];
			this.from=field["xesam:from"];
			this.to=field["xesam:to"];
			this.subject=field["xesam:subject"];
			this.isread=field["xesam:isRead"];
			this.title=field["xesam:title"];
			this.artist=field["xesam:artist"];
			this.exactfilename=field["xesam:ExactFilename"];
			this.videocodec=field["xesam:videoCodec"];
			this.date=field["xesam:sourceModified"];//FIX ME: format date
		}
		
		public virtual string Name
		{
		get { return exactfilename ;}
		}
		
		public virtual string Description 
		{ 
		get{ return url;} 
		}
		
		public virtual string Icon
		{
		get {
			string icon;
				icon = mimetype;
				try {
					if (icon == "x-directory/normal") {
						icon = "folder";
					} else if (icon.StartsWith ("image")) {
						icon = "gnome-mime-image";
					} else {
						icon = icon.Replace ('/', '-');
						icon = string.Format ("gnome-mime-{0}", icon);
					}
				} catch (NullReferenceException) {
					icon = "file";
				}
				return icon; 
			}
		}	
	}
}