Example #1
0
        public ITask CreateTask(string taskName, ICategory category)
        {
            Gtk.TreeIter taskIter;
            EDSTask      edsTask;

            if (category == null)
            {
                return(null);
            }

            if (category is Tasque.AllCategory && defaultCategory != null)
            {
                category = this.defaultCategory;
            }

            EDSCategory  edsCategory = category as EDSCategory;
            CalComponent task        = new CalComponent(edsCategory.TaskList);

            task.Summary = taskName;

            lock (taskLock) {
                edsTask  = new EDSTask(task, edsCategory);
                taskIter = taskStore.AppendNode();
                taskStore.SetValue(taskIter, 0, edsTask);
                taskIters [task.Uid] = taskIter;
            }

            task.Commit();

            return(edsTask);
        }
Example #2
0
        public EDSTask(CalComponent task, EDSCategory category)
        {
            this.name = task.Summary;
            Logger.Debug("Creating New Task Object : {0}", this.name);
            this.id             = task.Uid;
            this.category       = category;
            this.completionDate = task.Dtend;
            this.taskComp       = task;

            if (task.Status == CalStatus.Completed)
            {
                this.state = TaskState.Completed;
            }
            else
            {
                this.state = TaskState.Active;
            }

            //Descriptions
            notes = new List <INote>();

            foreach (string description in task.Descriptions)
            {
                EDSNote edsNote = new EDSNote(description);
                Logger.Debug("Note :" + description);
                notes.Add(edsNote);
            }
        }
Example #3
0
        private void AddCategory(Evolution.Source source)
        {
            Logger.Debug("AddCategory");
            EDSCategory edsCategory;

            Gtk.TreeIter iter;

            if (source.IsLocal())
            {
                Cal taskList = new Cal(source, CalSourceType.Todo);

                edsCategory = new EDSCategory(source, taskList);
                iter        = categoryListStore.Append();
                categoryListStore.SetValue(iter, 0, edsCategory);

                //Assumption : EDS Creates atleast one System category.
                if (edsCategory.IsSystem)
                {
                    this.defaultCategory = edsCategory;
                }

                if (!taskList.Open(true))
                {
                    Logger.Debug("laskList Open failed");
                    return;
                }

                CalView query = taskList.GetCalView("#t");
                if (query == null)
                {
                    Logger.Debug("Query object creation failed");
                    return;
                }
                else
                {
                    query.Start();
                }

                query.ObjectsModified += TasksModified;
                query.ObjectsAdded    += TasksAdded;
                query.ObjectsRemoved  += TasksRemoved;
            }
        }
Example #4
0
        public EDSBackend()
        {
            initialized = false;

            taskIters = new Dictionary <string, Gtk.TreeIter> ();
            taskStore = new Gtk.TreeStore(typeof(ITask));
            taskLock  = new object();

            sortedTasksModel = new Gtk.TreeModelSort(taskStore);
            sortedTasksModel.SetSortFunc(0, new Gtk.TreeIterCompareFunc(CompareTasksSortFunc));
            sortedTasksModel.SetSortColumnId(0, Gtk.SortType.Ascending);

            categoryListStore = new Gtk.ListStore(typeof(ICategory));

            sortedCategoriesModel = new Gtk.TreeModelSort(categoryListStore);
            sortedCategoriesModel.SetSortFunc(0, new Gtk.TreeIterCompareFunc(CompareCategorySortFunc));
            sortedCategoriesModel.SetSortColumnId(0, Gtk.SortType.Ascending);

            defaultCategory = null;
        }
Example #5
0
        public EDSBackend()
        {
            initialized = false;

                       taskIters = new Dictionary<string, Gtk.TreeIter> ();
                       taskStore = new Gtk.TreeStore (typeof (ITask));
                       taskLock = new object ();

                       sortedTasksModel = new Gtk.TreeModelSort (taskStore);
                       sortedTasksModel.SetSortFunc (0, new Gtk.TreeIterCompareFunc (CompareTasksSortFunc));
                       sortedTasksModel.SetSortColumnId (0, Gtk.SortType.Ascending);

                       categoryListStore = new Gtk.ListStore (typeof (ICategory));

                       sortedCategoriesModel = new Gtk.TreeModelSort (categoryListStore);
                       sortedCategoriesModel.SetSortFunc (0, new Gtk.TreeIterCompareFunc (CompareCategorySortFunc));
                       sortedCategoriesModel.SetSortColumnId (0, Gtk.SortType.Ascending);

               defaultCategory = null;
        }
Example #6
0
        public void TasksModified(object o, Evolution.ObjectsModifiedArgs args)
        {
            Logger.Debug("Tasks Modified ");
            Gtk.TreeIter iter;
            EDSTask      edsTask;
            EDSCategory  edsCategory;

            CalComponent[] modifiedTasks = CalUtil.ICalToCalComponentArray(args.Objects.Handle, ((CalView)o).Client);

            foreach (CalComponent task in modifiedTasks)
            {
                Logger.Debug("Modified : " + task.Summary);
                if (taskIters.ContainsKey(task.Uid))
                {
                    edsCategory = new EDSCategory(task.Source);
                    edsTask     = new EDSTask(task, edsCategory);
                    iter        = taskIters[edsTask.Id];
                    taskStore.SetValue(iter, 0, edsTask);
                }
            }
        }
Example #7
0
 public void TasksAdded(object o, Evolution.ObjectsAddedArgs args)
 {
     Logger.Debug("Tasks Added ");
     CalComponent[] addedTasks = CalUtil.ICalToCalComponentArray(args.Objects.Handle, ((CalView)o).Client);
     lock (taskLock) {
         Gtk.TreeIter taskIter;
         EDSTask      edsTask;
         EDSCategory  edsCategory;
         foreach (CalComponent task in addedTasks)
         {
             if (!taskIters.ContainsKey(task.Uid))
             {
                 edsCategory = new EDSCategory(task.Source);
                 edsTask     = new EDSTask(task, edsCategory);
                 taskIter    = taskStore.AppendNode();
                 taskStore.SetValue(taskIter, 0, edsTask);
                 taskIters [edsTask.Id] = taskIter;
             }
         }
     }
 }
Example #8
0
        public EDSTask(CalComponent task, EDSCategory category)
        {
            this.name = task.Summary;
                       Logger.Debug ("Creating New Task Object : {0}",this.name);
                       this.id = task.Uid;
                       this.category = category;
                       this.completionDate = task.Dtend;
                       this.taskComp = task;

               if (task.Status == CalStatus.Completed)
                   this.state = TaskState.Completed;
               else
                   this.state = TaskState.Active;

               //Descriptions
               notes = new List<INote>();

               foreach(string description in task.Descriptions) {
                   EDSNote edsNote = new EDSNote (description);
                   Logger.Debug ("Note :" + description);
                   notes.Add(edsNote);
               }
        }
Example #9
0
        private void AddCategory(Evolution.Source source)
        {
            Logger.Debug ("AddCategory");
                       EDSCategory edsCategory;
                       Gtk.TreeIter iter;

               if (source.IsLocal()) {
                   Cal taskList = new Cal (source, CalSourceType.Todo);

                   edsCategory = new EDSCategory (source, taskList);
                   iter = categoryListStore.Append ();
                   categoryListStore.SetValue (iter, 0, edsCategory);

                   //Assumption : EDS Creates atleast one System category.
                   if (edsCategory.IsSystem)
                       this.defaultCategory = edsCategory;

                   if (!taskList.Open (true)) {
                       Logger.Debug ("laskList Open failed");
                       return;
                   }

                   CalView query = taskList.GetCalView ("#t");
                   if (query == null) {
                       Logger.Debug ("Query object creation failed");
                       return;
                   } else
                       query.Start ();

                   query.ObjectsModified += TasksModified;
                   query.ObjectsAdded += TasksAdded;
                   query.ObjectsRemoved += TasksRemoved;
               }
        }
Example #10
0
        public void TasksModified(object o, Evolution.ObjectsModifiedArgs args)
        {
            Logger.Debug ("Tasks Modified ");
                       Gtk.TreeIter iter;
                       EDSTask edsTask;
                       EDSCategory edsCategory;

                       CalComponent[] modifiedTasks = CalUtil.ICalToCalComponentArray (args.Objects.Handle, ((CalView) o).Client);

                       foreach (CalComponent task in modifiedTasks) {
                   Logger.Debug ("Modified : " + task.Summary);
                               if(taskIters.ContainsKey(task.Uid)) {
                       edsCategory = new EDSCategory (task.Source);
                       edsTask = new EDSTask (task, edsCategory);
                                       iter = taskIters[edsTask.Id];
                                       taskStore.SetValue (iter, 0, edsTask);
                               }
                       }
        }
Example #11
0
 public void TasksAdded(object o, Evolution.ObjectsAddedArgs args)
 {
     Logger.Debug ("Tasks Added ");
                CalComponent[] addedTasks = CalUtil.ICalToCalComponentArray (args.Objects.Handle, ((CalView) o).Client);
                lock (taskLock) {
                        Gtk.TreeIter taskIter;
                        EDSTask edsTask;
                        EDSCategory edsCategory;
                        foreach (CalComponent task in addedTasks) {
                if(!taskIters.ContainsKey(task.Uid)) {
                    edsCategory = new EDSCategory (task.Source);
                    edsTask = new EDSTask (task, edsCategory);
                    taskIter = taskStore.AppendNode ();
                    taskStore.SetValue (taskIter, 0, edsTask);
                    taskIters [edsTask.Id] = taskIter;
                }
                        }
                }
 }