Use different empty field confirm msgs.; fix #6789

This commit is contained in:
Attila Bukor 2013-04-10 17:50:58 -07:00 committed by Charles Lindsay
parent 3c114ddc0b
commit 3b61580938

View file

@ -632,10 +632,19 @@ public class ComposerWindow : Gtk.Window {
}
private bool should_send() {
if (Geary.String.is_empty(subject.strip()) ||
((Geary.String.is_empty(get_html()) && attachment_files.size == 0))) {
bool has_subject = !Geary.String.is_empty(subject.strip());
bool has_body_or_attachment = !Geary.String.is_empty(get_html()) || attachment_files.size > 0;
string? confirmation = null;
if (!has_subject && !has_body_or_attachment) {
confirmation = _("Send message with an empty subject and body?");
} else if (!has_subject) {
confirmation = _("Send message with an empty subject?");
} else if (!has_body_or_attachment) {
confirmation = _("Send message with an empty body?");
}
if (confirmation != null) {
ConfirmationDialog dialog = new ConfirmationDialog(this,
_("Send message with an empty subject and/or body?"), null, Gtk.Stock.OK);
confirmation, null, Gtk.Stock.OK);
if (dialog.run() != Gtk.ResponseType.OK)
return false;
}