[Xfce4-commits] <postler:master> Restore accidentally removed missing attachment warning
Christian Dywan
noreply at xfce.org
Sun Mar 20 18:24:01 CET 2011
Updating branch refs/heads/master
to d15e3435a6083b84681d1c4eee0169a296df5bdb (commit)
from 7547cf10cf9001addbdfdafe76ef66e135f19794 (commit)
commit d15e3435a6083b84681d1c4eee0169a296df5bdb
Author: Christian Dywan <christian at twotoasts.de>
Date: Sun Mar 20 18:23:04 2011 +0100
Restore accidentally removed missing attachment warning
postler/postler-composer.vala | 42 +++++++++++++++++++++++++++-------------
1 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/postler/postler-composer.vala b/postler/postler-composer.vala
index 8ee11fd..ed4ebf3 100644
--- a/postler/postler-composer.vala
+++ b/postler/postler-composer.vala
@@ -142,6 +142,31 @@ public class Postler.Composer : Gtk.Window {
return;
}
+ content.execute_script ("document.title = document.body.innerText;");
+ body = content.title;
+ if (attachments.model.iter_n_children (null) == 0) {
+ /* i18n: A warning is displayed when writing a new message
+ and there are no attachments but the text mentions
+ attachments. Words are separated by |. */
+ string[] attachments = _("attachment|attach").split ("|");
+ foreach (string keyword in attachments)
+ if (keyword in body) {
+ var dialog = new Gtk.MessageDialog (this, 0,
+ Gtk.MessageType.ERROR, Gtk.ButtonsType.NONE,
+ _("An attachment is mentioned in the text, but no files were attached."));
+ dialog.format_secondary_text (
+ _("Do you want to send the message without attachments?"));
+ dialog.add_buttons (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
+ _("_Send message without attachments"), Gtk.ResponseType.OK);
+ dialog.set_default_response (Gtk.ResponseType.CANCEL);
+ int response = dialog.run ();
+ dialog.destroy ();
+ if (response != Gtk.ResponseType.OK)
+ return;
+ break;
+ }
+ }
+
string? sender = combo_from.get_active_text ();
if (sender == null) {
var dialog = new Gtk.MessageDialog (this, 0,
@@ -213,13 +238,8 @@ public class Postler.Composer : Gtk.Window {
+ "Content-Type: text/plain; charset=UTF-8\n";
}
- var clipboard = content.get_clipboard (Gdk.SELECTION_CLIPBOARD);
- clipboard.set_text ("",0);
- content.select_all ();
- content.copy_clipboard ();
- string body = clipboard.wait_for_text ();
- clear_selection ();
-
+ content.execute_script ("document.title = document.body.innerText;");
+ body = content.title;
if (attachments.model.get_iter_first (out iter)) {
string boundary = GLib.Checksum.compute_for_string (
GLib.ChecksumType.MD5,
@@ -277,7 +297,7 @@ public class Postler.Composer : Gtk.Window {
if (sender == null) {
var dialog = new Gtk.MessageDialog (this, 0,
Gtk.MessageType.ERROR, Gtk.ButtonsType.NONE,
- _("You have not configured any accounts for saving."));
+ _("You have not configured any accounts for sending."));
dialog.add_buttons (Gtk.STOCK_OK, Gtk.ResponseType.OK);
dialog.run ();
dialog.destroy ();
@@ -384,12 +404,6 @@ public class Postler.Composer : Gtk.Window {
printf (text.replace ("'", "\\'")));
}
- void clear_selection () {
- content.execute_script ("""
- window.getSelection ().removeAllRanges ();
- """);
- }
-
void action_quote () {
if (!content.can_copy_clipboard ())
content.select_all ();
More information about the Xfce4-commits
mailing list