[tasque/viewmodel: 1/78] Work in progress
- From: Antonius Riha <antoniusri src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tasque/viewmodel: 1/78] Work in progress
- Date: Wed, 29 Aug 2012 18:34:50 +0000 (UTC)
commit 9178d9471798eed960d7ae18cb8a10174fea953d
Author: Antonius Riha <antoniusriha gmail com>
Date: Thu Jul 12 12:04:23 2012 +0200
Work in progress
src/libtasque/Backend.cs | 197 ++++++++++++++++++++
.../DummyCategory.cs => libtasque/Category.cs} | 63 +++----
src/libtasque/IBackend.cs | 126 -------------
src/libtasque/ICategory.cs | 7 +-
src/libtasque/ITask.cs | 161 ----------------
src/libtasque/InternetMode.cs | 35 ++++
src/{tasque/AbstractTask.cs => libtasque/Task.cs} | 30 ++--
src/libtasque/libtasque.csproj | 13 +-
src/tasque/AllCategory.cs | 29 +---
src/tasque/Application.cs | 30 ++--
src/tasque/Backends/Dummy/DummyBackend.cs | 136 ++++----------
src/tasque/Backends/Dummy/DummyTask.cs | 16 +--
src/tasque/Backends/Hiveminder/HmBackend.cs | 12 +-
src/tasque/Backends/Hiveminder/HmCategory.cs | 2 +-
src/tasque/Backends/Hiveminder/HmTask.cs | 6 +-
src/tasque/Backends/Rtm/RtmBackend.cs | 14 +-
src/tasque/Backends/Rtm/RtmCategory.cs | 2 +-
src/tasque/Backends/Sqlite/SqliteBackend.cs | 12 +-
src/tasque/Backends/Sqlite/SqliteCategory.cs | 2 +-
src/tasque/CompletedTaskGroup.cs | 2 +-
src/tasque/CompletedTaskGroupModel.cs | 2 +-
src/tasque/NoteDialog.cs | 6 +-
src/tasque/PreferencesDialog.cs | 12 +-
src/tasque/RemoteControl.cs | 28 ++--
src/tasque/TaskCalendar.cs | 4 +-
src/tasque/TaskGroup.cs | 16 +-
src/tasque/TaskGroupModel.cs | 6 +-
src/tasque/TaskTreeView.cs | 34 ++--
src/tasque/TaskWindow.cs | 32 ++--
src/tasque/tasque.csproj | 4 +-
30 files changed, 443 insertions(+), 596 deletions(-)
---
diff --git a/src/libtasque/Backend.cs b/src/libtasque/Backend.cs
new file mode 100644
index 0000000..1772e7c
--- /dev/null
+++ b/src/libtasque/Backend.cs
@@ -0,0 +1,197 @@
+// ITaskBackend.cs created with MonoDevelop
+// User: boyd at 7:02 AMÂ2/11/2008
+//
+// IBackend.cs
+//
+// Author:
+// Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System.Collections;
+using System.Collections.ObjectModel;
+using CollectionTransforms;
+using Tasque;
+using System.ComponentModel;
+using System;
+using System.Collections.Generic;
+
+namespace Tasque
+{
+ public delegate void BackendInitializedHandler ();
+ public delegate void BackendSyncStartedHandler ();
+ public delegate void BackendSyncFinishedHandler ();
+
+ /// <summary>
+ /// This is the main integration interface for different backends that
+ /// Tasque can use.
+ /// </summary>
+ public abstract class Backend
+ {
+ protected Backend ()
+ {
+ tasks = new ObservableCollection<Task> ();
+ Tasks = new ReadOnlyObservableCollection<Task> (tasks);
+ var cvTasks = new CollectionView<Task> (Tasks);
+ /*
+ * this invokes the default comparer, which in turn
+ * will use the IComparable implmentation of Task
+ */
+ cvTasks.SortDescriptions.Add (new SortDescription ());
+ SortedTasks = cvTasks;
+
+ Categories = new ObservableCollection<ICategory> ();
+ var cvCategories = new CollectionView<ICategory> (Categories);
+ cvCategories.SortDescriptions.Add (new SortDescription ());
+ SortedCategories = cvCategories;
+ }
+
+ public abstract event BackendInitializedHandler BackendInitialized;
+ public abstract event BackendSyncStartedHandler BackendSyncStarted;
+ public abstract event BackendSyncFinishedHandler BackendSyncFinished;
+
+ #region Properties
+ /// <value>
+ /// A human-readable name for the backend that will be displayed in the
+ /// preferences dialog to allow the user to select which backend Tasque
+ /// should use.
+ /// </value>
+ public abstract string Name {
+ get;
+ }
+
+ /// <value>
+ /// All the tasks provided by the backend.
+ /// </value>
+ public ReadOnlyObservableCollection<Task> Tasks { get; }
+
+ public abstract IEnumerable SortedTasks { get; }
+
+ /// <value>
+ /// This returns all the ICategory items from the backend.
+ /// </value>
+ public abstract ObservableCollection<ICategory> Categories { get; }
+
+ public abstract IEnumerable SortedCategories { get; }
+
+ public ICategory DefaultCategory {
+ get { return defaultCategory; }
+ set {
+ if (value == null)
+ throw new ArgumentNullException ("value");
+
+ defaultCategory = value;
+ }
+ }
+
+ /// <value>
+ /// Indication that the backend has enough information
+ /// (credentials/etc.) to run. If false, the properties dialog will
+ /// be shown so the user can configure the backend.
+ /// </value>
+ public abstract bool Configured {
+ get;
+ }
+
+ /// <value>
+ /// Inidication that the backend is initialized
+ /// </value>
+ public abstract bool Initialized {
+ get;
+ }
+
+ /// <summary>
+ /// An object that provides a means of managing backend specific preferences.
+ /// </summary>
+ /// <returns>
+ /// A <see cref="Tasque.Backends.BackendPreferences"/>
+ /// </returns>
+ public abstract IBackendPreferences Preferences { get; }
+ #endregion // Properties
+
+ #region Methods
+ public Task CreateTask (string taskName)
+ {
+ CreateTask (taskName, null);
+ }
+
+ /// <summary>
+ /// Create a new task.
+ /// </summary>
+ public Task CreateTask (string taskName, ICategory category)
+ {
+ return CreateTask (taskName, new ICategory [] { category });
+ }
+
+ public Task CreateTask (string taskName, IEnumerable<ICategory> categories)
+ {
+
+ }
+
+ /// <summary>
+ /// Deletes the specified task.
+ /// </summary>
+ /// <param name="task">
+ /// A <see cref="ITask"/>
+ /// </param>
+ public abstract void DeleteTask (Task task);
+
+ /// <summary>
+ /// Refreshes the backend.
+ /// </summary>
+ public abstract void Refresh ();
+
+ /// <summary>
+ /// Initializes the backend
+ /// </summary>
+ public abstract void Initialize ();
+
+ /// <summary>
+ /// Cleanup the backend before quitting
+ /// </summary>
+ public abstract void Cleanup ();
+ #endregion // Methods
+
+ protected void AddTask (Task task, IEnumerable<ICategory> categories)
+ {
+ if (Categories.Count == 0)
+ throw new InvalidOperationException ("Cannot add a task to a backend " +
+ "which doesn't have any categories defined.");
+ if (categories == null)
+ throw new ArgumentNullException ("categories");
+ if (task == null)
+ throw new ArgumentNullException ("task");
+
+ foreach (var cat in categories) {
+ if (cat == null)
+ cat = DefaultCategory;
+
+ if (!Categories.Contains (cat))
+ throw new ArgumentException (string.Format (
+ "The provided category {0} has not been added to this backend.", cat.Name));
+
+
+ }
+ }
+
+ ICategory defaultCategory;
+ ObservableCollection<Task> tasks;
+ }
+}
diff --git a/src/tasque/Backends/Dummy/DummyCategory.cs b/src/libtasque/Category.cs
similarity index 60%
rename from src/tasque/Backends/Dummy/DummyCategory.cs
rename to src/libtasque/Category.cs
index 125eaae..39b81d4 100644
--- a/src/tasque/Backends/Dummy/DummyCategory.cs
+++ b/src/libtasque/Category.cs
@@ -1,10 +1,5 @@
-// DummyCategory.cs created with MonoDevelop
-// User: boyd at 9:06 AMÂ2/11/2008
-//
-// To change standard headers go to Edit->Preferences->Coding->Standard Headers
-//
//
-// DummyCategory.cs
+// Category.cs
//
// Author:
// Antonius Riha <antoniusriha gmail com>
@@ -28,48 +23,42 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using Tasque;
-using System.ComponentModel;
+using System;
+using System.Collections.ObjectModel;
+using System.Collections;
-namespace Tasque.Backends.Dummy
+namespace Tasque
{
- public class DummyCategory : ICategory
+ public class Category : ObservableCollection<Task>, ICategory
{
- string name;
-
- public DummyCategory (string name)
- {
- this.name = name;
- }
-
- public string Name
+ public Category (string name, Backend backend)
{
- get {
- return name;
- }
+ if (backend == null)
+ throw new ArgumentNullException ("backend");
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ Name = name;
+ this.backend = backend;
}
- public bool ContainsTask(ITask task)
- {
- if(task.Category is DummyCategory)
- return (task.Category.Name.CompareTo(name) == 0);
- else
- return false;
- }
+ public bool IsReadOnly { get { return false; } }
- public int CompareTo (ICategory other)
+ public string Name { get; private set; }
+
+ public virtual int CompareTo (ICategory other)
{
if (other == null)
- return -1;
-
- if (other is AllCategory)
return 1;
- return name.CompareTo (other.Name);
+ return Name.CompareTo (other.Name);
}
-
- #region INotifyPropertyChanged implementation
- public event PropertyChangedEventHandler PropertyChanged;
- #endregion
+
+ IEnumerator IEnumerable.GetEnumerator ()
+ {
+ return GetEnumerator ();
+ }
+
+ Backend backend;
}
}
diff --git a/src/libtasque/ICategory.cs b/src/libtasque/ICategory.cs
index 08427d6..efa9d59 100644
--- a/src/libtasque/ICategory.cs
+++ b/src/libtasque/ICategory.cs
@@ -30,13 +30,14 @@
// THE SOFTWARE.
using System;
using System.ComponentModel;
+using System.Collections.Specialized;
+using System.Collections.Generic;
namespace Tasque
{
- public interface ICategory : IComparable<ICategory>, INotifyPropertyChanged
+ public interface ICategory : ICollection<Task>, IComparable<ICategory>,
+ INotifyPropertyChanged, INotifyCollectionChanged
{
string Name { get; }
-
- bool ContainsTask(ITask task);
}
}
diff --git a/src/libtasque/InternetMode.cs b/src/libtasque/InternetMode.cs
new file mode 100644
index 0000000..bb183da
--- /dev/null
+++ b/src/libtasque/InternetMode.cs
@@ -0,0 +1,35 @@
+//
+// InternetMode.cs
+//
+// Author:
+// Antonius Riha <antoniusriha gmail com>
+//
+// Copyright (c) 2012 Antonius Riha
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+namespace Tasque
+{
+ public enum InternetMode
+ {
+ Online,
+ Offline
+ }
+}
+
diff --git a/src/tasque/AbstractTask.cs b/src/libtasque/Task.cs
similarity index 93%
rename from src/tasque/AbstractTask.cs
rename to src/libtasque/Task.cs
index 4e5bd58..411808d 100644
--- a/src/tasque/AbstractTask.cs
+++ b/src/libtasque/Task.cs
@@ -31,8 +31,16 @@ using System.ComponentModel;
namespace Tasque
{
- public abstract class AbstractTask : ITask
+ public abstract class Task : IComparable<Task>, INotifyPropertyChanged
{
+ protected Task (string name)
+ {
+ if (name == null)
+ throw new ArgumentNullException ("name");
+
+ Name = name;
+ }
+
uint timerID = 0;
#region Properties
@@ -41,11 +49,7 @@ namespace Tasque
get;
}
- public abstract string Name
- {
- get;
- set;
- }
+ public string Name { get; set; }
public abstract DateTime DueDate {
get;
@@ -84,12 +88,6 @@ namespace Tasque
get;
}
- public abstract ICategory Category
- {
- get;
- set;
- }
-
public abstract List<INote> Notes
{
get;
@@ -116,7 +114,7 @@ namespace Tasque
public abstract void DeleteNote(INote note);
public abstract void SaveNote(INote note);
- public int CompareTo (ITask task)
+ public int CompareTo (Task task)
{
bool isSameDate = true;
if (DueDate.Year != task.DueDate.Year
@@ -145,7 +143,7 @@ namespace Tasque
return CompareByPriorityAndName (task);
}
- public int CompareToByCompletionDate (ITask task)
+ public int CompareToByCompletionDate (Task task)
{
bool isSameDate = true;
if (CompletionDate.Year != task.CompletionDate.Year
@@ -185,7 +183,7 @@ namespace Tasque
#region Private Methods
- int CompareByPriorityAndName (ITask task)
+ int CompareByPriorityAndName (Task task)
{
// The due dates match, so now sort based on priority
if (Priority != task.Priority) {
@@ -213,5 +211,7 @@ namespace Tasque
return Name.CompareTo (task.Name);
}
#endregion // Private Methods
+
+ Backend backend;
}
}
diff --git a/src/libtasque/libtasque.csproj b/src/libtasque/libtasque.csproj
index 9b27d2a..657767f 100644
--- a/src/libtasque/libtasque.csproj
+++ b/src/libtasque/libtasque.csproj
@@ -128,10 +128,8 @@
</CustomCommands>
</PropertyGroup>
<ItemGroup>
- <Compile Include="IBackend.cs" />
<Compile Include="ICategory.cs" />
<Compile Include="INote.cs" />
- <Compile Include="ITask.cs" />
<Compile Include="TaskPriority.cs" />
<Compile Include="TaskState.cs" />
<Compile Include="TaskParser.cs" />
@@ -161,11 +159,16 @@
</Compile>
<Compile Include="NativeApplication.cs" />
<Compile Include="IBackendPreferences.cs" />
+ <Compile Include="Category.cs" />
+ <Compile Include="Backend.cs" />
+ <Compile Include="InternetMode.cs" />
+ <Compile Include="Task.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="Mono.Posix" />
+ <Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Folder Include="DateFormatters\" />
@@ -202,4 +205,10 @@
<Target Name="AfterBuild">
<Copy SourceFiles="@(DocsSourcesFile)" DestinationFolder="$(OutputPath)" />
</Target>
+ <ItemGroup>
+ <ProjectReference Include="..\ObservableTransformCollections\CollectionView\CollectionView.csproj">
+ <Project>{A5AAD70F-F4E8-4CAE-A000-01C2D0A10B92}</Project>
+ <Name>CollectionView</Name>
+ </ProjectReference>
+ </ItemGroup>
</Project>
diff --git a/src/tasque/AllCategory.cs b/src/tasque/AllCategory.cs
index b72706d..45f6dac 100644
--- a/src/tasque/AllCategory.cs
+++ b/src/tasque/AllCategory.cs
@@ -31,7 +31,7 @@ using System.ComponentModel;
namespace Tasque
{
- public class AllCategory : ICategory
+ public class AllCategory : Category
{
// A "set" of categories specified by the user to show when the "All"
// category is selected in the TaskWindow. If the list is empty, tasks
@@ -39,7 +39,7 @@ namespace Tasque
// specified lists will be shown.
List<string> categoriesToHide;
- public AllCategory ()
+ public AllCategory () : base ("All")
{
Preferences preferences = Application.Preferences;
categoriesToHide =
@@ -47,25 +47,6 @@ namespace Tasque
Application.Preferences.SettingChanged += OnSettingChanged;
}
- public string Name
- {
- get { return Catalog.GetString ("All"); }
- }
-
- public bool ContainsTask(ITask task)
- {
- // Filter out tasks based on the user's preferences of which
- // categories should be displayed in the AllCategory.
- ICategory category = task.Category;
- if (category == null)
- return true;
-
- //if (categoriesToHide.Count == 0)
- // return true;
-
- return (!categoriesToHide.Contains (category.Name));
- }
-
void OnSettingChanged (Preferences preferences, string settingKey)
{
if (settingKey.CompareTo (Preferences.HideInAllCategory) != 0)
@@ -76,14 +57,10 @@ namespace Tasque
}
#region IComparable implementation
- public int CompareTo (ICategory other)
+ public override int CompareTo (ICategory other)
{
return -1;
}
#endregion
-
- #region INotifyPropertyChanged implementation
- public event PropertyChangedEventHandler PropertyChanged;
- #endregion
}
}
diff --git a/src/tasque/Application.cs b/src/tasque/Application.cs
index eb41ec1..8f4ae45 100644
--- a/src/tasque/Application.cs
+++ b/src/tasque/Application.cs
@@ -57,7 +57,7 @@ namespace Tasque
#endif
private Gtk.StatusIcon trayIcon;
private Preferences preferences;
- private IBackend backend;
+ private Backend backend;
private TaskGroupModel overdue_tasks, today_tasks, tomorrow_tasks;
private PreferencesDialog preferencesDialog;
private bool quietStart = false;
@@ -68,9 +68,9 @@ namespace Tasque
/// Keep track of the available backends. The key is the Type name of
/// the backend.
/// </value>
- private Dictionary<string, IBackend> availableBackends;
+ private Dictionary<string, Backend> availableBackends;
- private IBackend customBackend;
+ private Backend customBackend;
private UIManager uiManager;
private const string menuXml = @"
@@ -88,16 +88,16 @@ namespace Tasque
</ui>
";
- public static IBackend Backend
+ public static Backend Backend
{
get { return Application.Instance.backend; }
set { Application.Instance.SetBackend (value); }
}
- public static List<IBackend> AvailableBackends
+ public static List<Backend> AvailableBackends
{
get {
- return new List<IBackend> (Application.Instance.availableBackends.Values);
+ return new List<Backend> (Application.Instance.availableBackends.Values);
}
// get { return Application.Instance.availableBackends; }
}
@@ -220,7 +220,7 @@ namespace Tasque
customBackend = null;
Assembly asm = Assembly.GetCallingAssembly ();
try {
- customBackend = (IBackend)
+ customBackend = (Backend)
asm.CreateInstance (potentialBackendClassName);
} catch (Exception e) {
Logger.Warn ("Backend specified on args not found: {0}\n\t{1}",
@@ -242,9 +242,9 @@ namespace Tasque
/// </summary>
private void LoadAvailableBackends ()
{
- availableBackends = new Dictionary<string,IBackend> ();
+ availableBackends = new Dictionary<string,Backend> ();
- List<IBackend> backends = new List<IBackend> ();
+ List<Backend> backends = new List<Backend> ();
Assembly tasqueAssembly = Assembly.GetCallingAssembly ();
@@ -274,7 +274,7 @@ namespace Tasque
backends.AddRange (GetBackendsFromAssembly (asm));
}
- foreach (IBackend backend in backends) {
+ foreach (Backend backend in backends) {
string typeId = backend.GetType ().ToString ();
if (availableBackends.ContainsKey (typeId))
continue;
@@ -284,9 +284,9 @@ namespace Tasque
}
}
- private List<IBackend> GetBackendsFromAssembly (Assembly asm)
+ private List<Backend> GetBackendsFromAssembly (Assembly asm)
{
- List<IBackend> backends = new List<IBackend> ();
+ List<Backend> backends = new List<Backend> ();
Type[] types = null;
@@ -306,9 +306,9 @@ namespace Tasque
}
Logger.Debug ("Found Available Backend: {0}", type.ToString ());
- IBackend availableBackend = null;
+ Backend availableBackend = null;
try {
- availableBackend = (IBackend)
+ availableBackend = (Backend)
asm.CreateInstance (type.ToString ());
} catch (Exception e) {
Logger.Warn ("Could not instantiate {0}: {1}",
@@ -325,7 +325,7 @@ namespace Tasque
return backends;
}
- private void SetBackend (IBackend value)
+ private void SetBackend (Backend value)
{
bool changingBackend = false;
if (this.backend != null) {
diff --git a/src/tasque/Backends/Dummy/DummyBackend.cs b/src/tasque/Backends/Dummy/DummyBackend.cs
index 70be94b..88218dc 100644
--- a/src/tasque/Backends/Dummy/DummyBackend.cs
+++ b/src/tasque/Backends/Dummy/DummyBackend.cs
@@ -29,14 +29,12 @@
using System;
using System.Collections;
using System.Collections.ObjectModel;
-using System.ComponentModel;
-using CollectionTransforms;
using Tasque.Backends;
using Tasque.Backends.Dummy.Gtk;
namespace Tasque.Backends.Dummy
{
- public class DummyBackend : IBackend
+ public class DummyBackend : Backend
{
/// <summary>
/// Keep track of the Gtk.TreeIters for the tasks so that they can
@@ -53,40 +51,23 @@ namespace Tasque.Backends.Dummy
public event BackendSyncStartedHandler BackendSyncStarted;
public event BackendSyncFinishedHandler BackendSyncFinished;
- DummyCategory homeCategory;
- DummyCategory workCategory;
- DummyCategory projectsCategory;
+ Category homeCategory;
+ Category workCategory;
+ Category projectsCategory;
- public DummyBackend ()
+ public DummyBackend () : base ()
{
initialized = false;
newTaskId = 0;
- Tasks = new ObservableCollection<ITask> ();
- var cvTasks = new CollectionView<ITask> (Tasks);
- /*
- * this invokes the default comparer, which in turn
- * will use the IComparable implmentation of Task
- */
- cvTasks.SortDescriptions.Add (new SortDescription ());
- SortedTasks = cvTasks;
-
- Categories = new ObservableCollection<ICategory> ();
- var cvCategories = new CollectionView<ICategory> (Categories);
- cvCategories.SortDescriptions.Add (new SortDescription ());
- SortedCategories = cvCategories;
}
#region Public Properties
- public string Name {
- get { return "Debugging System"; }
- }
+ public string Name { get { return "Debugging System"; } }
/// <value>
/// All the tasks including ITaskDivider items.
/// </value>
public IEnumerable SortedTasks { get; private set; }
-
- public ObservableCollection<ITask> Tasks { get; private set; }
/// <value>
/// This returns all the task lists (categories) that exist.
@@ -98,37 +79,33 @@ namespace Tasque.Backends.Dummy
/// <value>
/// Indication that the dummy backend is configured
/// </value>
- public bool Configured {
- get { return configured; }
- }
+ public bool Configured { get { return configured; } }
/// <value>
/// Inidication that the backend is initialized
/// </value>
- public bool Initialized {
- get { return initialized; }
- }
+ public bool Initialized { get { return initialized; } }
#endregion // Public Properties
#region Public Methods
- public ITask CreateTask (string taskName, ICategory category)
+ public Task CreateTask (string taskName, ICategory category)
{
// not sure what to do here with the category
DummyTask task = new DummyTask (this, newTaskId, taskName);
// Determine and set the task category
- if (category == null || category is Tasque.AllCategory)
+ if (category == null || category is AllCategory)
task.Category = workCategory; // Default to work
else
task.Category = category;
-
- Tasks.Add (task);
+
+ tasks.Add (task);
newTaskId++;
return task;
}
- public void DeleteTask (ITask task)
+ public void DeleteTask (Task task)
{
}
@@ -147,13 +124,13 @@ namespace Tasque.Backends.Dummy
//
// Add in some fake categories
//
- homeCategory = new DummyCategory ("Home");
+ homeCategory = new Category ("Home");
Categories.Add (homeCategory);
- workCategory = new DummyCategory ("Work");
+ workCategory = new Category ("Work");
Categories.Add (workCategory);
- projectsCategory = new DummyCategory ("Projects");
+ projectsCategory = new Category ("Projects");
Categories.Add (projectsCategory);
//
@@ -161,80 +138,80 @@ namespace Tasque.Backends.Dummy
//
DummyTask task = new DummyTask (this, newTaskId, "Buy some nails");
- task.Category = projectsCategory;
+ projectsCategory.Add (task);
task.DueDate = DateTime.Now.AddDays (1);
task.Priority = TaskPriority.Medium;
- Tasks.Add (task);
+ tasks.Add (task);
newTaskId++;
task = new DummyTask (this, newTaskId, "Call Roger");
- task.Category = homeCategory;
+ homeCategory.Add (task);
task.DueDate = DateTime.Now.AddDays (-1);
task.Complete ();
task.CompletionDate = task.DueDate;
- Tasks.Add (task);
+ tasks.Add (task);
newTaskId++;
task = new DummyTask (this, newTaskId, "Replace burnt out lightbulb");
- task.Category = homeCategory;
+ homeCategory.Add (task);
task.DueDate = DateTime.Now;
task.Priority = TaskPriority.Low;
- Tasks.Add (task);
+ tasks.Add (task);
newTaskId++;
task = new DummyTask (this, newTaskId, "File taxes");
- task.Category = homeCategory;
+ homeCategory.Add (task);
task.DueDate = new DateTime (2008, 4, 1);
- Tasks.Add (task);
+ tasks.Add (task);
newTaskId++;
task = new DummyTask (this, newTaskId, "Purchase lumber");
- task.Category = projectsCategory;
+ projectsCategory.Add (task);
task.DueDate = DateTime.Now.AddDays (1);
task.Priority = TaskPriority.High;
- Tasks.Add (task);
+ tasks.Add (task);
newTaskId++;
task = new DummyTask (this, newTaskId, "Estimate drywall requirements");
- task.Category = projectsCategory;
+ projectsCategory.Add (task);
task.DueDate = DateTime.Now.AddDays (1);
task.Priority = TaskPriority.Low;
- Tasks.Add (task);
+ tasks.Add (task);
newTaskId++;
task = new DummyTask (this, newTaskId, "Borrow framing nailer from Ben");
- task.Category = projectsCategory;
+ projectsCategory.Add (task);
task.DueDate = DateTime.Now.AddDays (1);
task.Priority = TaskPriority.High;
- Tasks.Add (task);
+ tasks.Add (task);
newTaskId++;
task = new DummyTask (this, newTaskId, "Call for an insulation estimate");
- task.Category = projectsCategory;
+ projectsCategory.Add (task);
task.DueDate = DateTime.Now.AddDays (1);
task.Priority = TaskPriority.Medium;
- Tasks.Add (task);
+ tasks.Add (task);
newTaskId++;
task = new DummyTask (this, newTaskId, "Pay storage rental fee");
- task.Category = homeCategory;
+ homeCategory.Add (task);
task.DueDate = DateTime.Now.AddDays (1);
task.Priority = TaskPriority.None;
- Tasks.Add (task);
+ tasks.Add (task);
newTaskId++;
task = new DummyTask (this, newTaskId, "Place carpet order");
- task.Category = projectsCategory;
+ projectsCategory.Add (task);
task.Priority = TaskPriority.None;
- Tasks.Add (task);
+ tasks.Add (task);
newTaskId++;
task = new DummyTask (this, newTaskId, "Test task overdue");
- task.Category = workCategory;
+ workCategory.Add (task);
task.DueDate = DateTime.Now.AddDays (-89);
task.Priority = TaskPriority.None;
task.Complete ();
- Tasks.Add (task);
+ tasks.Add (task);
newTaskId++;
initialized = true;
@@ -257,41 +234,6 @@ namespace Tasque.Backends.Dummy
}
#endregion // Public Methods
- #region Private Methods
- public void UpdateTask (DummyTask task)
- {
- if (!Tasks.Contains (task))
- return;
-
- if (task.State == TaskState.Deleted) {
- Tasks.Remove (task);
- Logger.Debug ("Successfully deleted from taskStore: {0}", task.Name);
- } else {
- // TODO: Notify UI
- Logger.Debug ("The UI should be notified here.");
- }
-
- // Set the task in the store so the model will update the UI.
-// Gtk.TreeIter iter;
-//
-// if (!taskIters.ContainsKey (task.DummyId))
-// return;
-//
-// iter = taskIters [task.DummyId];
-//
-// if (task.State == TaskState.Deleted) {
-// taskIters.Remove (task.DummyId);
-// if (!taskStore.Remove (ref iter)) {
-// Logger.Debug ("Successfully deleted from taskStore: {0}",
-// task.Name);
-// } else {
-// Logger.Debug ("Problem removing from taskStore: {0}",
-// task.Name);
-// }
-// } else {
-// taskStore.SetValue (iter, 0, task);
-// }
- }
- #endregion // Private Methods
+ ObservableCollection<Task> tasks;
}
}
diff --git a/src/tasque/Backends/Dummy/DummyTask.cs b/src/tasque/Backends/Dummy/DummyTask.cs
index 9c5518d..6b7578e 100644
--- a/src/tasque/Backends/Dummy/DummyTask.cs
+++ b/src/tasque/Backends/Dummy/DummyTask.cs
@@ -9,18 +9,15 @@ namespace Tasque.Backends.Dummy
{
public class DummyTask : AbstractTask
{
- DummyBackend backend;
string name;
DateTime dueDate;
DateTime completionDate;
TaskPriority priority;
TaskState state;
int id;
- DummyCategory category;
- public DummyTask(DummyBackend backend, int id, string taskName)
+ public DummyTask(DummyBackend backend, int id, string taskName) : base (backend)
{
- this.backend = backend;
this.id = id;
this.name = taskName;
this.dueDate = DateTime.MinValue; // No due date specified
@@ -107,17 +104,6 @@ namespace Tasque.Backends.Dummy
get { return state; }
}
- public override ICategory Category
- {
- get { return category; }
- set {
- if (value != category) {
- category = value as DummyCategory;
- OnPropertyChanged ("Category");
- }
- }
- }
-
public override List<INote> Notes
{
get { return null; }
diff --git a/src/tasque/Backends/Hiveminder/HmBackend.cs b/src/tasque/Backends/Hiveminder/HmBackend.cs
index d805613..2b494a2 100644
--- a/src/tasque/Backends/Hiveminder/HmBackend.cs
+++ b/src/tasque/Backends/Hiveminder/HmBackend.cs
@@ -36,7 +36,7 @@ using Tasque.Backends;
namespace Tasque.Backends.HmBackend
{
- public class HmBackend : IBackend
+ public class HmBackend : Backend
{
private Hiveminder.Hiveminder hm;
@@ -78,7 +78,7 @@ namespace Tasque.Backends.HmBackend
newTaskId = 0;
taskIters = new Dictionary<string, Gtk.TreeIter> ();
- taskStore = new Gtk.TreeStore (typeof (ITask));
+ taskStore = new Gtk.TreeStore (typeof (Task));
taskLock = new object ();
@@ -144,7 +144,7 @@ namespace Tasque.Backends.HmBackend
#endregion // Public Properties
#region Public Methods
- public ITask CreateTask (string taskName, ICategory category)
+ public Task CreateTask (string taskName, ICategory category)
{
Hiveminder.Task task = new Task ();
Hiveminder.Task createdTask;
@@ -165,7 +165,7 @@ namespace Tasque.Backends.HmBackend
return hmTask;
}
- public void DeleteTask(ITask task)
+ public void DeleteTask(Task task)
{
}
@@ -305,8 +305,8 @@ namespace Tasque.Backends.HmBackend
Gtk.TreeIter a,
Gtk.TreeIter b)
{
- ITask taskA = model.GetValue (a, 0) as ITask;
- ITask taskB = model.GetValue (b, 0) as ITask;
+ Task taskA = model.GetValue (a, 0) as Task;
+ Task taskB = model.GetValue (b, 0) as Task;
if (taskA == null || taskB == null)
return 0;
diff --git a/src/tasque/Backends/Hiveminder/HmCategory.cs b/src/tasque/Backends/Hiveminder/HmCategory.cs
index eb0ab30..6bc1877 100644
--- a/src/tasque/Backends/Hiveminder/HmCategory.cs
+++ b/src/tasque/Backends/Hiveminder/HmCategory.cs
@@ -47,7 +47,7 @@ namespace Tasque.Backends.HmBackend
{
get { return group.Id; }
}
- public bool ContainsTask(ITask task)
+ public bool ContainsTask(Task task)
{
if (task is HmTask) {
HmTask hmtask = task as HmTask;
diff --git a/src/tasque/Backends/Hiveminder/HmTask.cs b/src/tasque/Backends/Hiveminder/HmTask.cs
index 4798125..fa58e06 100644
--- a/src/tasque/Backends/Hiveminder/HmTask.cs
+++ b/src/tasque/Backends/Hiveminder/HmTask.cs
@@ -300,7 +300,7 @@ namespace Tasque.Backends.HmBackend
this.backend.UpdateTask (this);
}
- public int CompareTo (ITask task)
+ public int CompareTo (Task task)
{
bool isSameDate = true;
if (DueDate.Year != task.DueDate.Year
@@ -329,7 +329,7 @@ namespace Tasque.Backends.HmBackend
return CompareByPriorityAndName (task);
}
- public int CompareToByCompletionDate (ITask task)
+ public int CompareToByCompletionDate (Task task)
{
bool isSameDate = true;
if (CompletionDate.Year != task.CompletionDate.Year
@@ -361,7 +361,7 @@ namespace Tasque.Backends.HmBackend
#region Private Methods
- private int CompareByPriorityAndName (ITask task)
+ private int CompareByPriorityAndName (Task task)
{
// The due dates match, so now sort based on priority
if (Priority != task.Priority) {
diff --git a/src/tasque/Backends/Rtm/RtmBackend.cs b/src/tasque/Backends/Rtm/RtmBackend.cs
index 670ba16..3781249 100644
--- a/src/tasque/Backends/Rtm/RtmBackend.cs
+++ b/src/tasque/Backends/Rtm/RtmBackend.cs
@@ -15,7 +15,7 @@ using System.Linq;
namespace Tasque.Backends.RtmBackend
{
- public class RtmBackend : IBackend
+ public class RtmBackend : Backend
{
private const string apiKey = "b29f7517b6584035d07df3170b80c430";
private const string sharedSecret = "93eb5f83628b2066";
@@ -56,7 +56,7 @@ namespace Tasque.Backends.RtmBackend
// *************************************
// Data Model Set up
// *************************************
- Tasks = new ObservableCollection<ITask>();
+ Tasks = new ObservableCollection<Task>();
categoryListStore = new Gtk.ListStore (typeof (ICategory));
@@ -86,12 +86,12 @@ namespace Tasque.Backends.RtmBackend
/// <value>
/// All the tasks including ITaskDivider items.
/// </value>
- public IEnumerable<ITask> SortedTasks
+ public IEnumerable<Task> SortedTasks
{
- get { return Tasks.OrderBy (t => t, Comparer<ITask>.Default); }
+ get { return Tasks.OrderBy (t => t, Comparer<Task>.Default); }
}
- public ObservableCollection<ITask> Tasks { get; private set; }
+ public ObservableCollection<Task> Tasks { get; private set; }
/// <value>
/// This returns all the task lists (categories) that exist.
@@ -130,7 +130,7 @@ namespace Tasque.Backends.RtmBackend
#endregion // Public Properties
#region Public Methods
- public ITask CreateTask (string taskName, ICategory category)
+ public Task CreateTask (string taskName, ICategory category)
{
string categoryID;
RtmTask rtmTask = null;
@@ -161,7 +161,7 @@ namespace Tasque.Backends.RtmBackend
return rtmTask;
}
- public void DeleteTask(ITask task)
+ public void DeleteTask(Task task)
{
RtmTask rtmTask = task as RtmTask;
if(rtm != null) {
diff --git a/src/tasque/Backends/Rtm/RtmCategory.cs b/src/tasque/Backends/Rtm/RtmCategory.cs
index 87595c3..751212b 100644
--- a/src/tasque/Backends/Rtm/RtmCategory.cs
+++ b/src/tasque/Backends/Rtm/RtmCategory.cs
@@ -61,7 +61,7 @@ namespace Tasque.Backends.RtmBackend
set { iter = value; }
}
- public bool ContainsTask(ITask task)
+ public bool ContainsTask(Task task)
{
if(task.Category is RtmCategory)
return ((task.Category as RtmCategory).ID.CompareTo(ID) == 0);
diff --git a/src/tasque/Backends/Sqlite/SqliteBackend.cs b/src/tasque/Backends/Sqlite/SqliteBackend.cs
index fd4d1a8..12dd985 100644
--- a/src/tasque/Backends/Sqlite/SqliteBackend.cs
+++ b/src/tasque/Backends/Sqlite/SqliteBackend.cs
@@ -9,7 +9,7 @@ using Mono.Data.Sqlite;
namespace Tasque.Backends.Sqlite
{
- public class SqliteBackend : IBackend
+ public class SqliteBackend : Backend
{
private Dictionary<int, Gtk.TreeIter> taskIters;
private Gtk.TreeStore taskStore;
@@ -34,7 +34,7 @@ namespace Tasque.Backends.Sqlite
{
initialized = false;
taskIters = new Dictionary<int, Gtk.TreeIter> ();
- taskStore = new Gtk.TreeStore (typeof (ITask));
+ taskStore = new Gtk.TreeStore (typeof (Task));
sortedTasksModel = new Gtk.TreeModelSort (taskStore);
sortedTasksModel.SetSortFunc (0, new Gtk.TreeIterCompareFunc (CompareTasksSortFunc));
@@ -93,7 +93,7 @@ namespace Tasque.Backends.Sqlite
#endregion // Public Properties
#region Public Methods
- public ITask CreateTask (string taskName, ICategory category)
+ public Task CreateTask (string taskName, ICategory category)
{
// not sure what to do here with the category
SqliteTask task = new SqliteTask (this, taskName);
@@ -111,7 +111,7 @@ namespace Tasque.Backends.Sqlite
return task;
}
- public void DeleteTask(ITask task)
+ public void DeleteTask(Task task)
{
//string id = task.Id;
task.Delete ();
@@ -183,8 +183,8 @@ namespace Tasque.Backends.Sqlite
Gtk.TreeIter a,
Gtk.TreeIter b)
{
- ITask taskA = model.GetValue (a, 0) as ITask;
- ITask taskB = model.GetValue (b, 0) as ITask;
+ Task taskA = model.GetValue (a, 0) as Task;
+ Task taskB = model.GetValue (b, 0) as Task;
if (taskA == null || taskB == null)
return 0;
diff --git a/src/tasque/Backends/Sqlite/SqliteCategory.cs b/src/tasque/Backends/Sqlite/SqliteCategory.cs
index e1579b0..3605cc0 100644
--- a/src/tasque/Backends/Sqlite/SqliteCategory.cs
+++ b/src/tasque/Backends/Sqlite/SqliteCategory.cs
@@ -57,7 +57,7 @@ namespace Tasque.Backends.Sqlite
this.id = id;
}
- public bool ContainsTask(ITask task)
+ public bool ContainsTask(Task task)
{
if(task.Category is SqliteCategory)
return ((task.Category as SqliteCategory).ID == id);
diff --git a/src/tasque/CompletedTaskGroup.cs b/src/tasque/CompletedTaskGroup.cs
index d41fbf4..f5762c1 100644
--- a/src/tasque/CompletedTaskGroup.cs
+++ b/src/tasque/CompletedTaskGroup.cs
@@ -34,7 +34,7 @@ namespace Tasque
/// </summary>
static IEnumerable GetSortedTasks (IEnumerable tasks)
{
- var cv = new CollectionView<ITask> (tasks);
+ var cv = new CollectionView<Task> (tasks);
cv.SortDescriptions.Add (new SortDescription ("CompletionDate", ListSortDirection.Descending));
return cv;
}
diff --git a/src/tasque/CompletedTaskGroupModel.cs b/src/tasque/CompletedTaskGroupModel.cs
index fd5849e..932187c 100644
--- a/src/tasque/CompletedTaskGroupModel.cs
+++ b/src/tasque/CompletedTaskGroupModel.cs
@@ -48,7 +48,7 @@ namespace Tasque
/// <returns>
/// A <see cref="System.Boolean"/>
/// </returns>
- protected override bool FilterTasks (ITask task)
+ protected override bool FilterTasks (Task task)
{
// Don't show any task here if showCompletedTasks is false
if (!ShowCompletedTasks)
diff --git a/src/tasque/NoteDialog.cs b/src/tasque/NoteDialog.cs
index f0b751a..2c3a636 100644
--- a/src/tasque/NoteDialog.cs
+++ b/src/tasque/NoteDialog.cs
@@ -9,14 +9,14 @@ namespace Tasque
{
public class NoteDialog : Gtk.Dialog
{
- private ITask task;
+ private Task task;
Gtk.VBox targetVBox;
Gtk.Button addButton = new Gtk.Button(Gtk.Stock.Add);
Gtk.ScrolledWindow sw = new Gtk.ScrolledWindow ();
#region Constructors
- public NoteDialog (Gtk.Window parentWindow, ITask task)
+ public NoteDialog (Gtk.Window parentWindow, Task task)
: base ()
{
this.ParentWindow = parentWindow.GdkWindow;
@@ -79,7 +79,7 @@ namespace Tasque
#endregion // Constructors
#region Properties
- public ITask Task
+ public Task Task
{
get { return task; }
}
diff --git a/src/tasque/PreferencesDialog.cs b/src/tasque/PreferencesDialog.cs
index 3bc101e..bbf5e69 100644
--- a/src/tasque/PreferencesDialog.cs
+++ b/src/tasque/PreferencesDialog.cs
@@ -48,7 +48,7 @@ namespace Tasque
Gtk.Widget generalPage;
int generalPageId;
Gtk.ComboBox backendComboBox;
- Dictionary<int, IBackend> backendComboMap; // track backends
+ Dictionary<int, Backend> backendComboMap; // track backends
int selectedBackend;
Gtk.CheckButton showCompletedTasksCheckButton;
CollectionView<ICategory> filteredCategories;
@@ -251,11 +251,11 @@ namespace Tasque
sectionVBox.PackStart (l, false, false, 0);
backendComboBox = ComboBox.NewText ();
- backendComboMap = new Dictionary<int,IBackend> ();
+ backendComboMap = new Dictionary<int,Backend> ();
// Fill out the ComboBox
int i = 0;
selectedBackend = -1;
- foreach (IBackend backend in Application.AvailableBackends) {
+ foreach (Backend backend in Application.AvailableBackends) {
backendComboBox.AppendText (backend.Name);
backendComboMap [i] = backend;
if (backend == Application.Backend)
@@ -433,7 +433,7 @@ namespace Tasque
// if yes (replace backend)
if (backendComboMap.ContainsKey (selectedBackend)) {
// Cleanup old backend
- IBackend oldBackend = backendComboMap [selectedBackend];
+ Backend oldBackend = backendComboMap [selectedBackend];
Logger.Info ("Cleaning up '{0}'...", oldBackend.Name);
try {
oldBackend.Cleanup ();
@@ -448,7 +448,7 @@ namespace Tasque
}
}
- IBackend newBackend = null;
+ Backend newBackend = null;
if (backendComboMap.ContainsKey (backendComboBox.Active)) {
newBackend = backendComboMap [backendComboBox.Active];
}
@@ -593,7 +593,7 @@ namespace Tasque
return;
}
- IBackend backend = backendComboMap [selectedBackend];
+ Backend backend = backendComboMap [selectedBackend];
filteredCategories = new CollectionView<ICategory> (backend.SortedCategories);
// Filter out the AllCategory
filteredCategories.Filter = c => c != null && !(c is AllCategory);
diff --git a/src/tasque/RemoteControl.cs b/src/tasque/RemoteControl.cs
index d2aea30..76c4960 100644
--- a/src/tasque/RemoteControl.cs
+++ b/src/tasque/RemoteControl.cs
@@ -111,7 +111,7 @@ namespace Tasque
taskName,
out taskName,
out taskDueDate);
- ITask task = null;
+ Task task = null;
try {
task = Application.Backend.CreateTask (taskName, category);
if (taskDueDate != DateTime.MinValue)
@@ -204,7 +204,7 @@ namespace Tasque
/// </returns>
public string GetNameForTaskById (string id)
{
- ITask task = GetTaskById (id);
+ Task task = GetTaskById (id);
return task != null ? task.Name : string.Empty;
}
@@ -223,7 +223,7 @@ namespace Tasque
/// </returns>
public bool SetNameForTaskById (string id, string name)
{
- ITask task = GetTaskById (id);
+ Task task = GetTaskById (id);
if (task == null)
{
return false;
@@ -243,7 +243,7 @@ namespace Tasque
/// </returns>
public string GetCategoryForTaskById (string id)
{
- ITask task = GetTaskById (id);
+ Task task = GetTaskById (id);
return task != null ? task.Category.Name : string.Empty;
}
@@ -262,7 +262,7 @@ namespace Tasque
/// </returns>
public bool SetCategoryForTaskById (string id, string categoryName)
{
- ITask task = GetTaskById (id);
+ Task task = GetTaskById (id);
if (task == null)
return false;
@@ -282,7 +282,7 @@ namespace Tasque
/// </returns>
public int GetDueDateForTaskById (string id)
{
- ITask task = GetTaskById (id);
+ Task task = GetTaskById (id);
if (task == null)
return -1;
if (task.DueDate == DateTime.MinValue)
@@ -306,7 +306,7 @@ namespace Tasque
/// <returns>
public bool SetDueDateForTaskById (string id, int dueDate)
{
- ITask task = GetTaskById (id);
+ Task task = GetTaskById (id);
if (task == null)
{
return false;
@@ -329,7 +329,7 @@ namespace Tasque
/// </returns>
public int GetStateForTaskById (string id)
{
- ITask task = GetTaskById (id);
+ Task task = GetTaskById (id);
return task != null ? (int) task.State : -1;
}
@@ -344,7 +344,7 @@ namespace Tasque
/// </returns>
public int GetPriorityForTaskById (string id)
{
- ITask task = GetTaskById (id);
+ Task task = GetTaskById (id);
return task != null ? (int) task.Priority : -1;
}
@@ -363,7 +363,7 @@ namespace Tasque
/// </returns>
public bool SetPriorityForTaskById (string id, int priority)
{
- ITask task = GetTaskById (id);
+ Task task = GetTaskById (id);
if (task == null)
{
return false;
@@ -384,7 +384,7 @@ namespace Tasque
/// </returns>
public bool MarkTaskAsActiveById (string id)
{
- ITask task = GetTaskById (id);
+ Task task = GetTaskById (id);
if (task == null)
return false;
@@ -400,7 +400,7 @@ namespace Tasque
/// </param>
public void MarkTaskAsCompleteById (string id)
{
- ITask task = GetTaskById (id);
+ Task task = GetTaskById (id);
if (task == null)
return;
@@ -423,7 +423,7 @@ namespace Tasque
/// </returns>
public bool DeleteTaskById (string id)
{
- ITask task = GetTaskById (id);
+ Task task = GetTaskById (id);
if (task == null)
return false;
@@ -441,7 +441,7 @@ namespace Tasque
/// <returns>
/// A <see cref="ITask"/> having the given ID
/// </returns>
- private ITask GetTaskById (string id)
+ private Task GetTaskById (string id)
{
return Application.Backend.Tasks.SingleOrDefault (f => f.Id == id);
}
diff --git a/src/tasque/TaskCalendar.cs b/src/tasque/TaskCalendar.cs
index 7c8707c..a96f923 100644
--- a/src/tasque/TaskCalendar.cs
+++ b/src/tasque/TaskCalendar.cs
@@ -22,11 +22,11 @@ namespace Tasque
Gtk.Widget parent;
int eventCount;
- private ITask task;
+ private Task task;
private const uint CURRENT_TIME = 0;
- public TaskCalendar(ITask task, Gtk.Widget parent)
+ public TaskCalendar(Task task, Gtk.Widget parent)
{
this.task = task;
diff --git a/src/tasque/TaskGroup.cs b/src/tasque/TaskGroup.cs
index 0fb2154..3206a95 100644
--- a/src/tasque/TaskGroup.cs
+++ b/src/tasque/TaskGroup.cs
@@ -109,7 +109,7 @@ namespace Tasque
//
// Group TreeView
//
- var adapter = new TreeModelListAdapter<ITask> (filteredTasks);
+ var adapter = new TreeModelListAdapter<Task> (filteredTasks);
treeView = new TaskTreeView (adapter);
treeView.Show ();
PackStart (treeView, true, true, 0);
@@ -231,7 +231,7 @@ namespace Tasque
/// Additionally, if true, the <see cref="Gtk.TreeIter">iter</see> will
/// point to the specified <see cref="ITask">task</see>.
/// </returns>
- public bool ContainsTask (ITask task, out Gtk.TreeIter iter)
+ public bool ContainsTask (Task task, out Gtk.TreeIter iter)
{
Gtk.TreeIter tempIter;
Gtk.TreeModel model = treeView.Model;
@@ -243,7 +243,7 @@ namespace Tasque
// Loop through the model looking for a matching task
do {
- ITask tempTask = model.GetValue (tempIter, 0) as ITask;
+ Task tempTask = model.GetValue (tempIter, 0) as Task;
if (tempTask == task) {
iter = tempIter;
return true;
@@ -264,7 +264,7 @@ namespace Tasque
int pos = 0;
Gtk.TreeIter tempIter;
Gtk.TreeModel model = treeView.Model;
- ITask task = model.GetValue (iter, 0) as ITask;
+ Task task = model.GetValue (iter, 0) as Task;
if (!model.GetIterFirst (out tempIter))
return 0;
@@ -272,7 +272,7 @@ namespace Tasque
// This is ugly, but figure out what position the specified iter is
// at so we can return a value accordingly.
do {
- ITask tempTask = model.GetValue (tempIter, 0) as ITask;
+ Task tempTask = model.GetValue (tempIter, 0) as Task;
if (tempTask == task)
break;
@@ -293,7 +293,7 @@ namespace Tasque
int pos = 0;
Gtk.TreeIter tempIter;
Gtk.TreeModel model = treeView.Model;
- ITask task = model.GetValue (iter, 0) as ITask;
+ Task task = model.GetValue (iter, 0) as Task;
if (!model.GetIterFirst (out tempIter))
return 0;
@@ -301,7 +301,7 @@ namespace Tasque
// This is ugly, but figure out what position the specified iter is
// at so we can return a value accordingly.
do {
- ITask tempTask = model.GetValue (tempIter, 0) as ITask;
+ Task tempTask = model.GetValue (tempIter, 0) as Task;
if (tempTask == task)
break;
@@ -315,7 +315,7 @@ namespace Tasque
return pos * height + header.Requisition.Height;
}
- public void EnterEditMode (ITask task, Gtk.TreeIter iter)
+ public void EnterEditMode (Task task, Gtk.TreeIter iter)
{
Gtk.TreePath path;
diff --git a/src/tasque/TaskGroupModel.cs b/src/tasque/TaskGroupModel.cs
index b04ed17..67959a5 100644
--- a/src/tasque/TaskGroupModel.cs
+++ b/src/tasque/TaskGroupModel.cs
@@ -29,7 +29,7 @@ using CollectionTransforms;
namespace Tasque
{
- public class TaskGroupModel : CollectionView<ITask>
+ public class TaskGroupModel : CollectionView<Task>
{
public bool ShowCompletedTasks {
get { return showCompletedTasks; }
@@ -68,7 +68,7 @@ namespace Tasque
/// <summary>
/// Filter out tasks that don't fit within the group's date range
/// </summary>
- protected virtual bool FilterTasks (ITask task)
+ protected virtual bool FilterTasks (Task task)
{
if (task == null || task.State == TaskState.Deleted)
return false;
@@ -100,7 +100,7 @@ namespace Tasque
return today.Year == date.Year && today.DayOfYear == date.DayOfYear;
}
- bool ShowCompletedTask (ITask task)
+ bool ShowCompletedTask (Task task)
{
if (task.State == TaskState.Completed) {
if (!showCompletedTasks)
diff --git a/src/tasque/TaskTreeView.cs b/src/tasque/TaskTreeView.cs
index 3ea3373..a427f1b 100644
--- a/src/tasque/TaskTreeView.cs
+++ b/src/tasque/TaskTreeView.cs
@@ -20,7 +20,7 @@ namespace Tasque
private Gtk.TreeModelFilter modelFilter;
private ICategory filterCategory;
- private ITask taskBeingEdited = null;
+ private Task taskBeingEdited = null;
private bool toggled;
private static string status;
@@ -259,7 +259,7 @@ namespace Tasque
if (!Model.GetIter (out iter, path))
return;
- ITask task = Model.GetValue (iter, 0) as ITask;
+ Task task = Model.GetValue (iter, 0) as Task;
if (task == null)
return;
@@ -335,7 +335,7 @@ namespace Tasque
Gtk.TreeIter iter)
{
Gtk.CellRendererToggle crt = cell as Gtk.CellRendererToggle;
- ITask task = model.GetValue (iter, 0) as ITask;
+ Task task = model.GetValue (iter, 0) as Task;
if (task == null)
crt.Active = false;
else {
@@ -401,7 +401,7 @@ namespace Tasque
{
// TODO: Add bold (for high), light (for None), and also colors to priority?
Gtk.CellRendererCombo crc = cell as Gtk.CellRendererCombo;
- ITask task = Model.GetValue (iter, 0) as ITask;
+ Task task = Model.GetValue (iter, 0) as Task;
if (task == null)
return;
@@ -427,7 +427,7 @@ namespace Tasque
{
Gtk.CellRendererText crt = renderer as Gtk.CellRendererText;
crt.Ellipsize = Pango.EllipsizeMode.End;
- ITask task = model.GetValue (iter, 0) as ITask;
+ Task task = model.GetValue (iter, 0) as Task;
if (task == null) {
crt.Text = string.Empty;
return;
@@ -471,7 +471,7 @@ namespace Tasque
Gtk.TreeIter iter)
{
Gtk.CellRendererCombo crc = renderer as Gtk.CellRendererCombo;
- ITask task = Model.GetValue (iter, 0) as ITask;
+ Task task = Model.GetValue (iter, 0) as Task;
if (task == null)
return;
@@ -495,7 +495,7 @@ namespace Tasque
Gtk.TreeIter iter)
{
Gtk.CellRendererPixbuf crp = renderer as Gtk.CellRendererPixbuf;
- ITask task = model.GetValue (iter, 0) as ITask;
+ Task task = model.GetValue (iter, 0) as Task;
if (task == null) {
crp.Pixbuf = null;
return;
@@ -509,7 +509,7 @@ namespace Tasque
Gtk.TreeIter iter)
{
Gtk.CellRendererPixbuf crp = renderer as Gtk.CellRendererPixbuf;
- ITask task = model.GetValue (iter, 0) as ITask;
+ Task task = model.GetValue (iter, 0) as Task;
if (task == null)
return;
@@ -586,7 +586,7 @@ namespace Tasque
Gtk.TreeIter iter)
{
// Filter out deleted tasks
- ITask task = model.GetValue (iter, 0) as ITask;
+ Task task = model.GetValue (iter, 0) as Task;
if (task == null) {
Logger.Error ("FilterFunc: task at iter was null");
@@ -614,7 +614,7 @@ namespace Tasque
if (!Model.GetIter (out iter, path))
return; // Do nothing
- ITask task = Model.GetValue (iter, 0) as ITask;
+ Task task = Model.GetValue (iter, 0) as Task;
if (task == null)
return;
@@ -669,7 +669,7 @@ namespace Tasque
newPriority = TaskPriority.None;
// Update the priority if it's different
- ITask task = Model.GetValue (iter, 0) as ITask;
+ Task task = Model.GetValue (iter, 0) as Task;
if (task.Priority != newPriority)
task.Priority = newPriority;
}
@@ -681,7 +681,7 @@ namespace Tasque
if (!Model.GetIter (out iter, path))
return;
- ITask task = Model.GetValue (iter, 0) as ITask;
+ Task task = Model.GetValue (iter, 0) as Task;
if (task == null)
return;
@@ -742,7 +742,7 @@ namespace Tasque
DateTime newDate = DateTime.MinValue;
DateTime today = DateTime.Now;
- ITask task = Model.GetValue (iter, 0) as ITask;
+ Task task = Model.GetValue (iter, 0) as Task;
if (args.NewText.CompareTo (
today.ToString(Catalog.GetString("M/d - ")) + Catalog.GetString("Today") ) == 0)
@@ -817,7 +817,7 @@ namespace Tasque
}
private TaskTreeView tree;
- private ITask task;
+ private Task task;
private uint delay;
private uint secondsLeft;
protected uint pulseTimeoutId;
@@ -827,7 +827,7 @@ namespace Tasque
public InactivateTimer (TaskTreeView treeView,
Gtk.TreeIter taskIter,
- ITask taskToComplete,
+ Task taskToComplete,
uint delayInSeconds)
{
tree = treeView;
@@ -851,14 +851,14 @@ namespace Tasque
timers [task.TimerID] = this;
}
- public static void ToggleTimer (ITask task)
+ public static void ToggleTimer (Task task)
{
InactivateTimer timer = null;
if (timers.TryGetValue (task.TimerID, out timer))
timer.Paused = !timer.Paused;
}
- public static void CancelTimer(ITask task)
+ public static void CancelTimer(Task task)
{
Logger.Debug ("Timeout Canceled for task: " + task.Name);
InactivateTimer timer = null;
diff --git a/src/tasque/TaskWindow.cs b/src/tasque/TaskWindow.cs
index a71368a..3d6bbaf 100644
--- a/src/tasque/TaskWindow.cs
+++ b/src/tasque/TaskWindow.cs
@@ -47,7 +47,7 @@ namespace Tasque
private static int lastYPos;
private static Gdk.Pixbuf noteIcon;
- private IBackend backend;
+ private Backend backend;
private ScrolledWindow scrolledWindow;
private Entry addTaskEntry;
@@ -65,7 +65,7 @@ namespace Tasque
private List<TaskGroup> taskGroups;
- private Dictionary<ITask, NoteDialog> noteDialogs;
+ private Dictionary<Task, NoteDialog> noteDialogs;
private Gtk.Statusbar statusbar;
private uint statusContext;
@@ -75,7 +75,7 @@ namespace Tasque
private static string lastLoadedTime;
private const uint DWELL_TIME_MS = 8000;
- private ITask clickedTask;
+ private Task clickedTask;
private Gtk.AccelGroup accelGroup;
private GlobalKeybinder globalKeys;
@@ -85,11 +85,11 @@ namespace Tasque
noteIcon = Utilities.GetIcon ("hicolor_animations_16x16_notebook", 16);
}
- public TaskWindow (IBackend aBackend) : base (Gtk.WindowType.Toplevel)
+ public TaskWindow (Backend aBackend) : base (Gtk.WindowType.Toplevel)
{
this.backend = aBackend;
taskGroups = new List<TaskGroup> ();
- noteDialogs = new Dictionary<ITask, NoteDialog> ();
+ noteDialogs = new Dictionary<Task, NoteDialog> ();
InitWindow();
Realized += OnRealized;
@@ -464,7 +464,7 @@ namespace Tasque
taskWindow.addTaskEntry.GrabFocus ();
}
- public static void SelectAndEdit (ITask task)
+ public static void SelectAndEdit (Task task)
{
ShowWindow ();
taskWindow.EnterEditMode (task, true);
@@ -534,7 +534,7 @@ namespace Tasque
TaskWindow.ShowWindow ();
}
- public void HighlightTask (ITask task)
+ public void HighlightTask (Task task)
{
Gtk.TreeIter iter;
@@ -561,7 +561,7 @@ namespace Tasque
/// <param name="task">
/// A <see cref="ITask"/>
/// </param>
- public void ScrollToTask (ITask task)
+ public void ScrollToTask (Task task)
{
// TODO: NEED to add something to NOT scroll the window if the new
// task is already showing in the window!
@@ -666,7 +666,7 @@ namespace Tasque
/// A <see cref="bool"/> which indicates whether the task should be
/// scrolled to.
/// </param>
- private void EnterEditMode (ITask task, bool adjustScrolledWindow)
+ private void EnterEditMode (Task task, bool adjustScrolledWindow)
{
// Make sure we've waited around for the new task to fully
// be added to the TreeModel before continuing. Some
@@ -744,7 +744,7 @@ namespace Tasque
}
}
- private void ShowTaskNotes (ITask task)
+ private void ShowTaskNotes (Task task)
{
NoteDialog dialog = null;
if (!noteDialogs.ContainsKey (task)) {
@@ -761,9 +761,9 @@ namespace Tasque
dialog.Present ();
}
- private ITask CreateTask (string taskText, ICategory category)
+ private Task CreateTask (string taskText, ICategory category)
{
- ITask task = backend.CreateTask (taskText, category);
+ Task task = backend.CreateTask (taskText, category);
if (task == null) {
Logger.Debug ("Error creating a new task!");
@@ -929,7 +929,7 @@ namespace Tasque
else
taskName = enteredTaskText;
- ITask task = CreateTask (taskName, category);
+ Task task = CreateTask (taskName, category);
if (task == null)
return; // TODO: Explain error to user!
@@ -975,7 +975,7 @@ namespace Tasque
}
}
- ITask task = CreateTask (newTaskText, item.Category);
+ Task task = CreateTask (newTaskText, item.Category);
HighlightTask (task);
}
@@ -1017,7 +1017,7 @@ namespace Tasque
if (!model.GetIter (out iter, args.Path))
return;
- ITask task = model.GetValue (iter, 0) as ITask;
+ Task task = model.GetValue (iter, 0) as Task;
if (task == null)
return;
@@ -1049,7 +1049,7 @@ namespace Tasque
if (!model.GetIter (out iter, path))
return;
- clickedTask = model.GetValue (iter, 0) as ITask;
+ clickedTask = model.GetValue (iter, 0) as Task;
if (clickedTask == null)
return;
diff --git a/src/tasque/tasque.csproj b/src/tasque/tasque.csproj
index aee5e15..d0a85cf 100644
--- a/src/tasque/tasque.csproj
+++ b/src/tasque/tasque.csproj
@@ -198,6 +198,7 @@
<None Include="Backends\Rtm\RtmNote.cs" />
<None Include="Backends\Rtm\RtmPreferencesWidget.cs" />
<None Include="Backends\Rtm\RtmTask.cs" />
+ <None Include="AllCategory.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -207,11 +208,8 @@
<Compile Include="..\..\build\GlobalDefines.cs">
<Link>Properties\GlobalDefines.cs</Link>
</Compile>
- <Compile Include="AbstractTask.cs" />
- <Compile Include="AllCategory.cs" />
<Compile Include="Application.cs" />
<Compile Include="Backends\Dummy\DummyBackend.cs" />
- <Compile Include="Backends\Dummy\DummyCategory.cs" />
<Compile Include="Backends\Dummy\DummyNote.cs" />
<Compile Include="Backends\Dummy\DummyTask.cs" />
<Compile Include="CellRendererDate.cs" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]