aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMilan Crha <mcrha@src.gnome.org>2007-09-27 15:46:05 +0800
committerMilan Crha <mcrha@src.gnome.org>2007-09-27 15:46:05 +0800
commit10c781d6838d73998c417e2090bf413e09b12807 (patch)
tree61648afddeff03f98e57fdc8f766ae5d516a0227 /calendar
parentc54e15f7cfe18f697baa11a8a44b458cb7694c28 (diff)
downloadgsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.tar
gsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.tar.gz
gsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.tar.bz2
gsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.tar.lz
gsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.tar.xz
gsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.tar.zst
gsoc2013-evolution-10c781d6838d73998c417e2090bf413e09b12807.zip
2007-09-27 mcrha Fixes part of bug #228832
svn path=/trunk/; revision=34311
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog9
-rw-r--r--calendar/gui/e-calendar-view.c4
-rw-r--r--calendar/gui/gnome-cal.c24
-rw-r--r--calendar/gui/gnome-cal.h2
4 files changed, 35 insertions, 4 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index ee997d1a75..c08e197dd2 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,12 @@
+2007-09-27 Milan Crha <mcrha@redhat.com>
+
+ ** Fixes part of bug #228832
+
+ * gui/gnome-cal.h: (gnome_calendar_new_task):
+ * gui/gnome-cal.c: (gnome_calendar_new_task): Added parameters to
+ inherit selected time for 'dtstart' and 'due' of new task.
+ * gui/e-calendar-view.c: (on_new_task): Passing selected time to use.
+
2007-09-21 Milan Crha <mcrha@redhat.com>
** Fix for bug #411125
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index f52d05d4d6..157c1ea6e1 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -1159,8 +1159,10 @@ static void
on_new_task (EPopup *ep, EPopupItem *pitem, void *data)
{
ECalendarView *cal_view = data;
+ time_t dtstart, dtend;
- gnome_calendar_new_task (cal_view->priv->calendar);
+ e_calendar_view_get_selected_time_range (cal_view, &dtstart, &dtend);
+ gnome_calendar_new_task (cal_view->priv->calendar, &dtstart, &dtend);
}
static void
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 81b8893bfa..3fe343dba9 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -3210,11 +3210,13 @@ gnome_calendar_get_selected_time_range (GnomeCalendar *gcal,
/**
* gnome_calendar_new_task:
* @gcal: An Evolution calendar.
+ * @param dtstart Start time of the task, in same timezone as model.
+ * @param dtend End time of the task, in same timezone as model.
*
- * Opens a task editor dialog for a new task.
+ * Opens a task editor dialog for a new task. dtstart or dtend can be NULL.
**/
void
-gnome_calendar_new_task (GnomeCalendar *gcal)
+gnome_calendar_new_task (GnomeCalendar *gcal, time_t *dtstart, time_t *dtend)
{
GnomeCalendarPrivate *priv;
ECal *ecal;
@@ -3224,6 +3226,8 @@ gnome_calendar_new_task (GnomeCalendar *gcal)
icalcomponent *icalcomp;
const char *category;
guint32 flags = 0;
+ ECalComponentDateTime dt;
+ struct icaltimetype itt;
g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
@@ -3244,6 +3248,22 @@ gnome_calendar_new_task (GnomeCalendar *gcal)
category = cal_search_bar_get_category (CAL_SEARCH_BAR (priv->search_bar));
e_cal_component_set_categories (comp, category);
+ dt.value = &itt;
+ dt.tzid = icaltimezone_get_tzid (e_cal_model_get_timezone (model));
+
+ if (dtstart) {
+ itt = icaltime_from_timet_with_zone (*dtstart, FALSE, e_cal_model_get_timezone (model));
+ e_cal_component_set_dtstart (comp, &dt);
+ }
+
+ if (dtend) {
+ itt = icaltime_from_timet_with_zone (*dtend, FALSE, e_cal_model_get_timezone (model));
+ e_cal_component_set_due (comp, &dt); /* task uses 'due' not 'dtend' */
+ }
+
+ if (dtstart || dtend)
+ e_cal_component_commit_sequence (comp);
+
comp_editor_edit_comp (COMP_EDITOR (tedit), comp);
g_object_unref (comp);
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index 8e9203aeb6..49d7c0cc97 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -156,7 +156,7 @@ void gnome_calendar_get_selected_time_range (GnomeCalendar *gcal,
time_t *start_time,
time_t *end_time);
-void gnome_calendar_new_task (GnomeCalendar *gcal);
+void gnome_calendar_new_task (GnomeCalendar *gcal, time_t *dtstart, time_t *dtend);
/* Returns the selected time range for the current view. Note that this may be
different from the fields in the GnomeCalendar, since the view may clip