~c-franke/do/XesamSearch

« back to all changes in this revision

Viewing changes to XesamItem.cs

  • Committer: Christof Franke
  • Date: 2008-02-26 10:55:05 UTC
  • Revision ID: kraut@workstation-20080226105505-8am13vug28ok1wsf
version 0.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// XesamItem.cs 
 
2
// User: kraut (c.franke@muenchen-mail.de) at 22:23¬†21.02.2008
 
3
 
 
4
 
 
5
using System;
 
6
using System.Collections.Generic;
 
7
using Do.Universe;
 
8
 
 
9
namespace Do.Addins.DoXesam
 
10
{
 
11
        
 
12
        class XesamItem: IItem 
 
13
        {
 
14
                
 
15
                protected string title;
 
16
                protected string author;
 
17
                protected string creator;
 
18
                protected string width;
 
19
                protected string hight;
 
20
                protected string pagecount;
 
21
                protected string mimetype;
 
22
                protected string url;
 
23
                protected string fileextension;
 
24
                protected string from;
 
25
                protected string to;
 
26
                protected string subject;
 
27
                protected string isread;
 
28
                protected string date;
 
29
 
 
30
                protected string artist;
 
31
                protected string exactfilename;
 
32
                protected string videocodec;
 
33
                
 
34
                public  XesamItem(Dictionary<string,string> field){
 
35
                        this.title=field["xesam:title"];
 
36
                        this.author=field["xesam:author"];
 
37
                        this.creator=field["xesam:creator"];
 
38
                        this.width=field["xesam:width"];
 
39
                        this.hight=field["xesam:hight"];
 
40
                        this.pagecount=field["xesam:pageCount"];
 
41
                        this.mimetype=field["xesam:mimeType"];
 
42
                        this.url=field["xesam:url"];
 
43
                        this.fileextension=field["xesam:fileExtension"];
 
44
                        this.from=field["xesam:from"];
 
45
                        this.to=field["xesam:to"];
 
46
                        this.subject=field["xesam:subject"];
 
47
                        this.isread=field["xesam:isRead"];
 
48
                        this.title=field["xesam:title"];
 
49
                        this.artist=field["xesam:artist"];
 
50
                        this.exactfilename=field["xesam:ExactFilename"];
 
51
                        this.videocodec=field["xesam:videoCodec"];
 
52
                        this.date=field["xesam:sourceModified"];//FIX ME: format date
 
53
                }
 
54
                
 
55
                public virtual string Name
 
56
                {
 
57
                get { return exactfilename ;}
 
58
                }
 
59
                
 
60
                public virtual string Description 
 
61
                { 
 
62
                get{ return url;} 
 
63
                }
 
64
                
 
65
                public virtual string Icon
 
66
                {
 
67
                get {
 
68
                        string icon;
 
69
                                icon = mimetype;
 
70
                                try {
 
71
                                        if (icon == "x-directory/normal") {
 
72
                                                icon = "folder";
 
73
                                        } else if (icon.StartsWith ("image")) {
 
74
                                                icon = "gnome-mime-image";
 
75
                                        } else {
 
76
                                                icon = icon.Replace ('/', '-');
 
77
                                                icon = string.Format ("gnome-mime-{0}", icon);
 
78
                                        }
 
79
                                } catch (NullReferenceException) {
 
80
                                        icon = "file";
 
81
                                }
 
82
                                return icon; 
 
83
                        }
 
84
                }       
 
85
        }
 
86
}
 
 
b'\\ No newline at end of file'