Thumbnail file hits. Based on a patch from D Bera
[beagle.git] / Tiles / TileNote.cs
blobd0edd7ddf907ca35883c47e112e9e10ec931447c
1 //
2 // TileNote.cs
3 //
4 // Copyright (C) 2004 Christopher Orr
5 // Copyright (C) 2004 Novell, Inc.
6 //
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a
10 // copy of this software and associated documentation files (the "Software"),
11 // to deal in the Software without restriction, including without limitation
12 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
13 // and/or sell copies of the Software, and to permit persons to whom the
14 // Software is furnished to do so, subject to the following conditions:
16 // The above copyright notice and this permission notice shall be included in
17 // all copies or substantial portions of the Software.
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25 // DEALINGS IN THE SOFTWARE.
28 using System;
29 using System.Diagnostics;
30 using System.IO;
32 using BU = Beagle.Util;
34 namespace Beagle.Tile {
36 [HitFlavor (Name="Notes", Rank=1000, Emblem="emblem-note.png", Color="#f5f5fe",
37 Type="Note")]
38 public class TileNote : TileFromHitTemplate {
39 public TileNote (Hit _hit) : base (_hit,
40 "template-note.html")
44 [TileAction]
45 public override void Open ()
47 // FIXME: This is broken, since the resulting shell command will not
48 // necessarily be quoted properly... query.QuotedText might return
49 // something containing quotes or other special characters.
51 string args = String.Format ("--open-note {0} --highlight-search \"{1}\"",
52 Hit.Uri, Query.QuotedText);
54 Process p = new Process ();
55 p.StartInfo.UseShellExecute = false;
56 p.StartInfo.FileName = "tomboy";
57 p.StartInfo.Arguments = args;
59 try {
60 p.Start ();
61 } catch (Exception e) {
62 Console.WriteLine ("Could not invoke Tomboy to open note: " + e);