3
// Copyright (C) 2009 GNOME Do
5
// This program is free software: you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation, either version 3 of the License, or
8
// (at your option) any later version.
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
15
// You should have received a copy of the GNU General Public License
16
// along with this program. If not, see <http://www.gnu.org/licenses/>.
21
using System.Collections.Generic;
22
using System.Text.RegularExpressions;
28
namespace RememberTheMilk
31
/// Class for the "New Note" action
33
public class RTMNewNote : Act
35
public override string Name {
36
get { return AddinManager.CurrentLocalizer.GetString ("New Note"); }
39
public override string Description {
40
get { return AddinManager.CurrentLocalizer.GetString ("Add a new note to a task."); }
43
public override string Icon {
44
get { return "note-add.png@" + GetType ().Assembly.FullName; }
47
public override IEnumerable<Type> SupportedItemTypes {
48
get { yield return typeof (RTMTaskItem); }
51
public override IEnumerable<Type> SupportedModifierItemTypes {
52
get { yield return typeof (ITextItem); }
55
public override bool ModifierItemsOptional {
59
public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
61
string note = String.Empty;
63
if (modifierItems.FirstOrDefault() != null) {
64
note = ((modifierItems.FirstOrDefault() as ITextItem).Text);
67
Services.Application.RunOnThread (() => {
68
RTM.NewNote ((items.First () as RTMTaskItem).ListId,
69
(items.First () as RTMTaskItem).TaskSeriesId,
70
(items.First () as RTMTaskItem).Id, note);
b'\\ No newline at end of file'