Index: calendar/gui/gnome-cal.c
===================================================================
--- calendar/gui/gnome-cal.c	(revision 34276)
+++ calendar/gui/gnome-cal.c	(working copy)
@@ -3210,11 +3210,13 @@
 /**
  * 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 @@
 	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 @@
 	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);
 
Index: calendar/gui/gnome-cal.h
===================================================================
--- calendar/gui/gnome-cal.h	(revision 34276)
+++ calendar/gui/gnome-cal.h	(working copy)
@@ -156,7 +156,7 @@
 						   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
Index: calendar/gui/e-calendar-view.c
===================================================================
--- calendar/gui/e-calendar-view.c	(revision 34276)
+++ calendar/gui/e-calendar-view.c	(working copy)
@@ -1159,8 +1159,10 @@
 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
Index: calendar/ChangeLog
===================================================================
--- calendar/ChangeLog	(revision 34276)
+++ calendar/ChangeLog	(working copy)
@@ -1,3 +1,12 @@
+2007-09-17  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-14  Matthew Barnes  <mbarnes@redhat.com>
 
 	** Fixes part of bug #476231
