This restores some old behaviour after teh WK2 port.
* src/client/conversation-viewer/conversation-message.vala
(ConversationMessage): Add alt_text param to ::save_image
signal. Replace ::set_action_param_string with
::set_action_param_string so we can pass a (url, alt_text) tuple for
the save_image tuple and update call sites. Set this tuple for the
action when enabling it, and pass the two values to the ::save_image
signal handler when activated.
* src/engine/api/geary-attachment.vala (Attachment::get_safe_file_name):
Add alt_file_name param method, use that when constructing a file
name. Add doc comment, test.
* src/client/application/geary-controller.vala: Updated to pass alt text
from save_imge signal emission all thr way through to
get_safe_file_name.
This ensures both inline images are saved using the specified content
filename, if any, and that an extension is attempted to be guessed when
no filename is specified.
Fixes Bug 713999, Bug 712923, Bug 778026.
* src/client/application/geary-controller.vala: Major rework of how
attachments are saved. Rework how save dialogs are constructed,
combining common code paths into one constrcutor method. Split up code
for saving one attachment vs many into two different methods. Ensure
all code baths ultimately use the same method to do the actual
saving. Lookup a attachment when saving an inline image and use that
by default. Get filenames from new Attachment::get_useful_filename
method that guesses if needed.
* src/client/conversation-viewer/conversation-message.vala
(ConversationMessage::save_image): Fix name of first param to reflect
what it actually is.
* src/engine/api/geary-attachment.vala (Attachment): Add
::get_safe_filename method that checks the type of both the
attachment's content and its file name, if any. Will construct an
appropriate file name if non is given. Add unit tests.
* src/engine/api/geary-email.vala (Email): Add new
::get_attachment_by_content_id to lookup attachments by MIME
content-id. Rename old ::get_attachment method to disambiguate.
This could probably use a DB migration to set all attachments will "none"
as their filename to NULL, but that's a lot of trouble for little gain.
* src/client/conversation-viewer/conversation-email.vala (if): Remove
workaround for "none" attachment file names.
* src/client/conversation-viewer/conversation-message.vala
(ConversationMessage::inline_image_replacer): Handle translation for
null attachment file names here, rather than in the engine.
* src/engine/api/geary-email.vala
(Email::get_searchable_attachment_list): Don't bother appending file
names for attachments when they are null.
* src/engine/imap-db/imap-db-attachment.vala (Attachment): Use a const
for null file name replacement string so it can be used elsewhere.
* src/engine/imap-db/imap-db-folder.vala (Folder::do_list_attachments):
Clean up old "none" file names when loading from DB.
(Folder::do_save_attachments_db): Allow for file name being null.
* src/engine/rfc822/rfc822-message.vala (Message::InlinePartReplacer):
Allow file name to be null, update call sites.
* src/engine/rfc822/rfc822-utils.vala (get_clean_attachment_filename):
Don't attempt to translate null filenames, just return it null. Update
call sites.
* src/engine/api/geary-attachment.vala (Attachment): Allow direct access
to MIME content-disposition filename if available. Make it obvious that
the filename comes from content-disposition. Reorder attrs to reflect
importance. Update subclasses and call sites.
* src/client/accounts/account-dialog-add-edit-pane.vala
(AccountDialogAddEditPane): Pass an account id to edit_alternate_emails
signal, not an email addess.
* src/client/accounts/account-dialog.vala
(AccountDialog::get_account_info_for_email): Rename method to
"get_account_info" and param since it actually accepts an account
id. Update call sites.
* src/client/accounts/add-edit-page.vala (AddEditPage::id): Make RO
access public, so the AddEditPane can access it.
* src/client/conversation-list/conversation-list-view.vala
(ConversationListView): Convert to using IdleManager for handling
selection updating, reset it when widget is destroyed.
Should help/fix Bug 778025.
* ui/client-web-view.js (PageView::init): Also add a load handler to the
window, to (strangely) catch the final load event on the
document. Expand and correct comments a bit.
* src/client/composer/composer-web-view.vala
(ComposerWebView::load_html): Remove spacers around cursor, just add
them after body and inline quote if present. Update unit tests.
In some cases, it may happen that a mail is being sent multiple times simultaneously
to the same recipient.
The only modified field being the Message-ID, we have to check it as well as
message's size before merging 2 mails together.
Otherwise, at each start-up Geary will try to fetch "missing mails" but will never
succeed to do so.
This lets us implement changing signatures and deleting bottom-quoted
messages without having to reload the whole view, and makes it possible
to target only the user's content when modifying for send, etc.
* src/client/composer/composer-web-view.vala (ComposerWebView): Move
composer CSS into composer-web-view.css resource file, load it when
loading JS resource and add it to the view's user content manager.
(ComposerWebView::load_html): Split up body, signature and quote into a
DIV container for each.
(ComposerWebView::linkify_content): Replaced with ::clean_content,
which will also tidy up internal markup before sending. Update call
site and unit test.
* src/engine/rfc822/rfc822-utils.vala (Geary.RFC822.Utils): Remove some
more obtrusive white space when sending replies/forwards.
* test/client/composer/composer-web-view-test.vala,
test/js/composer-page-state-test.vala: Update tests to expect new HTML
and text output from ComposerWebView and use of individual parts for
composer markup.
* ui/composer-web-view.js (ComposerPageState): Replace messageBody
property and uses with bodyPart, signaturePart and quotePart. Set these
content-editable on load. Move listeners from messageBody back to the
document.body so they also listen for events on the additional
parts. Keep track of text cursor location within the parts and set a
class if so, to work around the lack of :focus-inside support.
(ComposerPageState::updateSignature): Implement by updating the inner
content of the signature part.
(ComposerPageState::deleteQuotedMessage): Implement by removing the
quote part from the DOM tree.
(ComposerPageState::containsAttachmentKeyword): Consider only the
bodyPart when scanning for attachments, remove hacks for ignoring the
signature any any quoted message.
(ComposerPageState::linkifyContent): Mirror ClientWebView change and
replace with ::cleanContent. Ensure existing parts have contenteditable
and focus class removed, remove signature and quote parts if empty.
(ComposerPageState::getHtml): Generate HTML using clones of the three
parts, so we can rmeove contenteditable and focus classes without
modifying the actual DOM.
(ComposerPageState::selectionChanged): Update focus class on parts as
needed.
* ui/conversation-web-view.js
(ConversationPageState::createControllableQuotes): Only add control
buttons if the quote is controllable. Calculat the height difference up
front, not in the control button's click handler, so the value is
correct.
* test/client/components/client-web-view-test.vala: New explicit tests
for init'ing the WebContext and loading default resources.
* test/client/components/client-web-view-test-case.vala:
Init the WebContext and load resources in the constructor rather than
fixture setup, so it only happens once per suite, not once per
test. Update subclasses to do same.
* test/client/composer/composer-web-view-test.vala: Add an explicit test
for loading ComposerWebView resources.
* src/client/composer/composer-link-popover.vala:
Gtk.Popover::set_default_widget is only available in GTK+ 3.18,
Gtk.Widget::set_tooltop_text param can't be null in earlier GTK vala
bindings.
* src/client/composer/composer-link-popover.vala (ComposerLinkPopover):
Replace calls to GTK 3.22-specific ::popdown() with ::hide().
* src/engine/util/util-js.vala (Geary.JS): Replace '\v' literal,
unsupported on at least valac 0.30.1 and gcc 5.4, with ordinal equiv.
* ui/conversation-web-view.js (ConversationPageState::createControllableQuotes):
Since WK does not want to seem to reduce the value of offsetHeight for
the HTML element when a quote is collapsed, calculate the difference
and manually update the preferred height.
* ui/client-web-view.js (PageState::updatePreferredHeight): Allow the new
preferred height to be passed in as a param.
* src/client/composer/composer-link-popover.vala
(ComposerLinkPopover::show): Focus URL entry on being shown.
* ui/composer-link-popover.ui: Replace URL entry text label with an
accessibility name. Refine the tooltip for the insert button, add notes
to translators about it.
* src/client/composer/composer-web-view.vala (ComposerWebView): Add
::save_selection and ::free_selection to allow the selection to be
saved when inserting a link. Thunk calls to JS.
(ComposerWebView::insert_link): Add selection id param, pass through to
JS.
* src/client/composer/composer-widget.vala
(ComposerWidget::new_link_popover): Manage saving the editor's
selection, passing its id when inserting a link, freeing it
again. Convert into an async method so we can wait for the selection id
to get back from the WebProcess, update call sites.
(ComposerWidget::on_insert_link): Disconnect and reconnect selection
changed signal so the popover isn't dismissed when the selection does
change/
* ui/composer-web-view.js (ComposerPageState): Implement new
::saveSelection, ::freeSelection and selectionId param on ::insertLink.