const TnyMsgFolderIface *folder;
GString *re_sub;
const gchar *subject, *from;
+ GtkTextBuffer *unquoted;
gchar *quoted;
time_t sent_date;
/* FIXME: honor replyto, cc */
from = tny_msg_header_iface_get_from(header);
sent_date = tny_msg_header_iface_get_date_sent(header);
- quoted = modest_ui_quote_msg(msg, from, sent_date);
+
+ unquoted = modest_tny_msg_view_get_selected(msg_view);
+
+ if (unquoted != NULL) {
+ quoted = modest_text_utils_quote (unquoted, from, sent_date, 66);
+ } else {
+ quoted = modest_ui_quote_msg(msg, from, sent_date);
+ }
} else {
g_warning("no header");
return;
return TRUE;
}
+/* WIP (az), unused */
+char *
+get_all_text(ModestTnyMsgView *self)
+{
+ GtkWidget *html;
+ ModestTnyMsgViewPrivate *priv;
+ GSList *list;
+ GString *str = g_string_new ("");
+ gchar *ptr;
+ gint id = 0;
+ GObject *obj;
+ //HtmlBoxText *text;
+
+ g_return_if_fail (self);
+ priv = MODEST_TNY_MSG_VIEW_GET_PRIVATE(self);
+ html = priv->gtkhtml;
+
+ //list = view->sel_list;
+
+ //if (view->sel_list == NULL)
+ // return NULL;
+
+ while (obj = gtk_html_get_object_by_id(GTK_HTML(html), id)) {
+ //text = HTML_BOX_TEXT (obj->data);
+
+ //list = list->next;
+ /*
+ * Some boxes may not have any text
+ */
+ //if (text->canon_text == NULL)
+ // continue;
+ //ptr = (gchar *)text->canon_text;
+ //g_string_append_len (str, ptr, text->length);
+ printf("obj#%d\n", id);
+ id++;
+
+ }
+ ptr = str->str;
+ g_string_free (str, FALSE);
+ return ptr;
+}
+
+
+GtkTextBuffer *
+modest_tny_msg_view_get_selected (ModestTnyMsgView *self)
+{
+ ModestTnyMsgViewPrivate *priv;
+ gchar *sel;
+ GtkWidget *html;
+ int len;
+ GtkClipboard *clip;
+ gchar *text;
+ GtkTextBuffer *buf;
+
+ g_return_if_fail (self);
+ priv = MODEST_TNY_MSG_VIEW_GET_PRIVATE(self);
+ html = priv->gtkhtml;
+
+ /* I'm sure there is a better way to check for selected text */
+ sel = gtk_html_get_selection_html(GTK_HTML(html), &len);
+
+ /* and I hope we can get rid of this hack soon: */
+ if (sel == NULL)
+ gtk_html_select_all(GTK_HTML(html));
+
+ clip = gtk_widget_get_clipboard(html, GDK_SELECTION_PRIMARY);
+ text = gtk_clipboard_wait_for_text(clip);
+ if (text == NULL)
+ return NULL;
+
+ buf = gtk_text_buffer_new(NULL);
+ gtk_text_buffer_set_text(buf, text, -1);
+ g_free(text);
+ return buf;
+}
void
modest_tny_msg_view_set_message (ModestTnyMsgView *self, TnyMsgIface *msg)
fill_gtkhtml_with_txt (GTK_HTML(priv->gtkhtml),
_("Unsupported message type"));
}
-
-
-