Commit graph

426 commits

Author SHA1 Message Date
Michael James Gratton
919aea1516 Make MainWindow and ComposerWindow uniquely targetable via CSS.
Fixes Bug 746590.
2017-03-06 13:20:16 +11:00
Michael James Gratton
57ca408c53 Fix composer UI brokenness when compiled under vala 0.36.
Don't rely ComposerState::state notify and property bindings firing when
the value hasn't actually changed to update the composer's UI. This is
works around Vala Bug 631267 landing.

* src/client/composer/composer-headerbar.vala (ComposerHeaderbar): Add
  signal and methods to be called explicity on state changes, rather than
  relying on being notified of ComposerWidget::state changing.

* src/client/composer/composer-widget.vala (ComposerWidget): Hook up new
  ComposerHeaderbar signal and method. Remove notify and property
  bindings on ::state property, move related code to new
  ::update_composer_view method and call that as needed. Remove
  overridden ::show_all, because the UI state should now always be
  consistent with ::state. Clean up various methods.

* src/client/composer/email-entry.vala (EmailEntry::EmailEntry): Make
  widget visible by default, since we are no longer calling
  ComposerWidget::show_all().

* src/client/application/geary-controller.vala: Don't call show all on
  new composers, they now manage their visibility properly.

* ui/composer-headerbar.ui: Make toolbar icons visible by default.

* ui/composer-widget.ui: Make toolbar icons visible by default, set Send
  button icon here rather than in the class.
2017-03-04 13:45:17 +11:00
Michael James Gratton
07966a1156 Fix crash when conversation scrolled window child changes.
This is a workaround for GTK+ Bug 778190.

* src/client/conversation-viewer/conversation-viewer.vala
  (ConversationViewer): Replace the whole conversation scrolled window
  when changing the conversation, not just the viewport.

* ui/conversation-viewer.ui: Remove the ScrolledWindow for now since we
  are constructing it manually.
2017-02-28 21:18:07 +11:00
Alex Henrie
f38f0d150d Rename archive/trash/delete actions to clearly be for conversations 2017-02-23 11:33:12 +11:00
Michael James Gratton
928189f36d Fix matching message subject not being highlighted in find/search.
Bug 778033

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage::highlight_search_terms): Also check the subject
  for matching items and highlight if found.

* src/client/conversation-viewer/conversation-list-box.vala
  (ConversationListBox::EmailRow): Update matching row class to
  disambiguate from matching headers.

* ui/geary.css: Ensure matching subject labels get highlighted.
2017-02-23 11:33:12 +11:00
Michael James Gratton
b19d0c8cad Ensure mixed landscape/portrait attachment previews are centred vertically. 2017-02-16 08:44:44 +11:00
Michael James Gratton
dd3d604b6d Tidy up ConversationWebView's CSS a bit. 2017-02-08 00:31:25 +11:00
Michael James Gratton
fdde9b15a1 Prevent messages from setting a broken body height. Fixes Bug 750075.
* ui/conversation-web-view.css: Require body height to remain set to
  CSS's default value.
2017-02-08 00:30:48 +11:00
Michael James Gratton
d6ed3e3877 Ensure ClientWebView's preferred height is updated after doc load.
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.
2017-02-08 00:28:46 +11:00
Michael James Gratton
96ffcdb608 Split composer web view up into multiple parts.
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.
2017-02-01 00:41:45 +11:00
Michael James Gratton
96c16d8b78 Fix more issues hiding/showing collapsed quotes.
* 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.
2017-02-01 00:41:45 +11:00
Michael James Gratton
67762f22cb Really fix JS error calling ComposerWebView::save_selection.
* ui/composer-web-view.js: Increment must be in brackets.
2017-02-01 00:41:45 +11:00
Michael James Gratton
d74fcd2e2c Fix conversation message not shrinking when collapsing quotes.
* 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.
2017-02-01 00:41:45 +11:00
Michael James Gratton
8bf68bd345 ComposerLinkPopover UI polish.
* 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.
2017-02-01 00:41:45 +11:00
Michael James Gratton
5163b5198d Stop the insert link popover being dismissed when selecting text.
* 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.
2017-02-01 00:41:45 +11:00
Michael James Gratton
7f75a7e944 Fix messages with "html { height: 100%; }" set getting 1px-high views.
Partially reverts commit d4e2b84.

* ui/conversation-web-view.css: Reinstate triggering CSS 2.1 §
  10.6.7. for the HTML element.
2017-02-01 00:41:45 +11:00
Michael James Gratton
5ff2d9b908 Calculate ClientWebView to include HTML element margins.
* ui/client-web-view.js (PageState::getPreferredHeight): Compute and use
  top and bottom when determining the height value.

* ui/conversation-web-view.css: Remove onerous style defaults now we
  can deal with HTML elements with margins.
2017-02-01 00:41:44 +11:00
Michael James Gratton
9e171d0db1 Remove composer's scrolled window since WebView now scrolls internally.
We can't easily wrap ComposerWebView in a GtkScrolledWindow, since we
don't any notifications that the cursor has moved offscreen and hence the
view needs to be scrolled, so let the view do its own scrolling.

* ui/composer-widget.ui: Replace editor_scrolled with editor_container,
  update uses.
2017-02-01 00:41:44 +11:00
Michael James Gratton
b24291defe Break containing blockquotes when Enter pressed in composer.
* ui/composer-web-view.js (ComposerPageState): Break any blockquote
  elements under the cursor when Enter is pressed, unless Shift is also
  down.

* src/client/web-process/util-composer.vala: Removed, no longer used.
2017-02-01 00:41:44 +11:00
Michael James Gratton
848558f368 Reenable converting plain text URLs to links in HTML documents.
* src/client/composer/composer-web-view.vala (ComposerWebView): Rename
  ::linkify_document since it really only applies to editor content. Make
  an asyc method so we can wait until its finished. Update call
  sites. Thunk call to JS.

* src/client/web-process/util-composer.vala,
  src/client/web-process/util-webkit.vala: Remove unused code.

* ui/composer-web-view.js (ComposerPageState):  Add ::linkifyContent
  method and ::linkify static method. Add unit tests.
2017-02-01 00:41:44 +11:00
Michael James Gratton
e22ece508c Replace two composer IPC calls for indenting with a single one.
* src/client/composer/composer-web-view.vala (ClientWebView): Replace
  ::undo_blockquote_style with ::indent_line.

* src/client/composer/composer-widget.vala (ComposerWidget::on_indent):
  Call new ::indent_line method, rather than doing a execCommand and a
  second JS thunking call to fix the markup.

* ui/composer-web-view.js: Also replace ::undoBlockquoteStyle with new
  ::indentLine method. Add unit test.
2017-02-01 00:41:44 +11:00
Michael James Gratton
e0bff994fa Reenable composer attachment keyword checking.
* src/client/composer/composer-web-view.vala (ComposerWebView): Add
  ::contains_attachment_keywords that thunks to JS, remove uneeded
  ::get_block_quote_representation method.

* src/client/composer/composer-widget.vala (ComposerWidget): Remove
  attachment keywork checking related code, just call new method on
  editor to do the check.

* src/client/web-process/util-composer.vala,
  src/client/web-process/util-webkit.vala: Remove uneeded code.

* ui/composer-web-view.js (ComposerPageState): Implement new
  ::containsAttachmentKeyword method based on previous code. Add unit
  tests.
2017-02-01 00:41:44 +11:00
Michael James Gratton
48d92fa67c Let focus escape composer web view using Ctrl+Tab/Ctrl+Shift+Tab.
* src/client/composer/composer-widget.vala: Let default keyboard
  shortcuts handle focus move.

* ui/composer-web-view.js: Don't consume Tab presses with Crtl/Alt/Meta
  modifiers.
2017-02-01 00:41:44 +11:00
Michael James Gratton
dec06d93be Clean up how composer loads content into its web view.
The main gist of this is to ensure that the composer's widgets are
constructed seperately to loading its content, and that we only ever call
ComposerWebView::load_html precisely once per composer instance.

* src/client/composer/composer-widget.vala: Remove referred message,
  quote text and draft flag param from constructor signature, move any
  calls that loaded data from them to new load method. Don't load
  anything into the editor here. Make loading the signature file async,
  and call new ComposerWebView::updateSignature method on the editor to
  update it.
  (ComposerWidget::load): New async message for loading content into the
  composer. Move related code from the constructor and GearyController
  here, make methods that were previously public for that private
  again. Tidy up calls a bit now that we have a single place from which
  to do it all, and can understand the process a bit better.
  (ComposerWidget::on_editor_key_press_event): Don't reload the editor to
  remove the quoted text, call new ComposerWebView::delete_quoted_message
  method on it instead.

* src/client/composer/composer-web-view.vala
  (ComposerWebView): Add ::delete_quoted_message ::update_signature
  methods, thunk to JS.
  (ComposerWebView::load_html): Add quote and is_draft parameters,
  construct HTML for the composer using apporporate spacing here, instead
  of relying on all the disparate parts from doing the right thing.

* src/client/application/geary-controller.vala
  (GearyController::create_compose_widget_async): Load composer content
  after adding it to the widget hierarchy, set focus only after
  everything is set up.

* src/engine/rfc822/rfc822-utils.vala (quote_email_for_reply,
  quote_email_for_forward): Don't add extra padding around quoted parts -
  let callers manage their own whitespace.

* test/client/components/client-web-view-test-case.vala
  (TestCase:load_body_fixture): Make HTML param non-nullable, update
  subclasses.

* ui/composer-web-view.js (ComposerPageState): Add ::updateSignature and
  ::deleteQuotedMessage method stubs.
2017-02-01 00:41:44 +11:00
Michael James Gratton
5dfcfe4c8e Update how ClientWebView HTML preferred size changes are sent to the app.
* ui/client-web-view.js (PageState): Use event listeners to send
  coalesced preferred height changes, rather than using polling. Call
  ::load on DOM loaded, not on complete page loaded, so in-place
  mutations take affect ASAP. Replace ::preferredHeightChanged with
  ::updatePreferredHeight method that checks that the height has changed
  before sending the message to the app.

* ui/composer-web-view.js: Remove loaded event handler, it's managed by
  the base class now.

* ui/conversation-web-view.js (ConversationPageState): Rename
  ::updatePreferredHeight to ::pollPreferredHeightUpdate to avoid name
  clash with parent class. Stop polling if no change has occurred after a
  number of repeated checks. Remove loaded event handler, it's managed by
  the base class now.
  (ComposerPageState::createControllableQuotes): Don't update preferred
  height at the end of the call since it will be handled by the DOM load
  event handler.
2017-02-01 00:41:44 +11:00
Michael James Gratton
78d116d054 Update deceptive link popover to provide context and advice. 2017-02-01 00:41:44 +11:00
Michael James Gratton
2b5f94da7d Reenable basic deceptive link highlighting.
* bindings/vapi/javascriptcore-4.0.vapi (Object::get_property): Fix
  return type.

* src/client/conversation-viewer/conversation-message.vala (GtkTemplate):
  Hook up to new deceptive_link_clicked signal, remove old DOM-based
  implementation.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Add new deceptive_link_clicked signal and
  DeceptiveText enum, listen for deceptiveLinkClicked JS message and fire
  signal when received.

* src/client/util/util-webkit.vala (WebKitUtil): Add to_object util function.

* src/engine/util/util-js.vala (Geary.JS): Add to_object and get_property
  util functions.

* ui/conversation-web-view.js (ConversationPageState) Listen for link
  clicks, check for deceptive text and send message if found. Add unit
  tests for deceptive text check.

* test/js/composer-page-state-test.vala: Move ::run_javascript to parent
  class so new ConversationPageStateTest class can use it, adapt call
  sites to different parent signature.
2017-02-01 00:41:44 +11:00
Michael James Gratton
ab4fec91be Enable editing a link by clicking on it.
* src/client/composer/composer-widget.vala
  (ComposerWidget::on_button_press): Show a link popover on button
  release.

* src/client/composer/composer-web-view.vala (ComposerWebView): Add
  button_release_event_done signal to work around WK eating mouse events,
  fire it after default processing has occurred.

* ui/composer-web-view.js: Don't bother selecting a link on click, we
  are handling insertion and deletion without it fine now. Just cancel
  the event's default so link clicks are not activated.
2017-02-01 00:41:44 +11:00
Michael James Gratton
e4f50e1c36 Implement ComposerWebView::insert_link and ::delete_link.
* src/client/composer/composer-web-view.vala (ComposerWebView): Call
  new ComposerPageState methods for ::insert_link and ::delete_link.

* ui/composer-web-view.js (ComposerPageState): Add new ::insertLink
  and ::deleteLink methods, handle linking/unlinking both the
  current selection and the link under the text cursor, if nothing
  is selected.
2017-02-01 00:41:44 +11:00
Michael James Gratton
c476fdc6d1 Replace composer link dialog with a popover.
* src/client/composer/composer-link-popover.vala: New GtkPopover subclass
  for creating/editing links.

* src/client/composer/composer-web-view.vala (EditContext): Add is_link
  and link_uri properties, decode them from the message string, add
  decoding tests.
  (ComposerWebView): Add some as-yet un-implemented methods for
  inserting/deleting links.

* src/client/composer/composer-widget.vala (ComposerWidget): Add
  cursor_url for storing current text cursor link, update it from the
  cursor_context_changed signal param, rename hover_url to pointer_url to
  match. Add link_activated signal to let user's open links they are
  adding, hook that up in the controller. Rename
  ::update_selection_actions to ::update_cursor_actions, since that's a
  little more apt now, also enable insert link action if there is a
  cursor_url set as well as a selection. Remove ::link_dialog, replace
  with ::new_link_popover, hook up the new popover's signals there as
  appropriate.
  (ComposerWidget::on_insert_link): Create and show a lin popover instead
  of a dialog.

* ui/composer-web-view.js: Take note of whther the context node is a link
  and if so, also it's href. Include both when serialsing for the
  cursorContextChanged message. Add serialisation tests.

* ui/composer-link-popover.ui: New UI for link popover.
2017-02-01 00:41:44 +11:00
Michael James Gratton
805a052f1f Don't send JS selectionChanged message unless param value has changed. 2017-02-01 00:41:44 +11:00
Michael James Gratton
53caf43fca Replace ad-hoc ComposerWebView cursor signal param w/ structured object.
This lets us notify of more cursor editing context state in the future
without changing the signal signature.

* src/client/composer/composer-web-view.vala (ComposerWebView): Replace
  cursor_style_changed signal and cursorStyleChanged JS message with
  cursor_context_changed signal and cursorContextChanged message, add new
  EditContext inner class and pass as arg to new signal, update call
  sites. Move parsing of JS message to new inner class. Add unit tests,
  fix a font-family bug revealed by tests.

* ui/composer-web-view.js (ComposerPageState): Replace cursorFontFamily
  and cursorFontSize with a cursor context and new EditContext object to
  encapsulate them, update them from a node and serialise them. Add unit
  tests.
2017-02-01 00:41:44 +11:00
Michael James Gratton
617dd45393 Remove use of underscores in client-web-view.js var names. 2017-02-01 00:41:44 +11:00
Michael James Gratton
f27dea1318 Update some composer action tooltips. 2017-02-01 00:41:44 +11:00
Michael James Gratton
f8957c4d7a Ensure draft is saved when envelope (from, to, etc) changes. Bug 726290.
* src/client/composer/composer-widget.vala (ComposerWidget): Rename
  subject changed handler to something more generic, hook that up to the
  to/cc/bcc & reply_to entries.

* ui/composer-widget.ui: Hook up multiple to on_envelope_changed, make
  subject entry use that as well.
2017-02-01 00:41:44 +11:00
Michael James Gratton
fcf5be297e Re-enable composer empty body checking and draft save timer.
* src/client/composer/composer-web-view.vala (ClientWebView): Add a
  ::document_modified signal and a documentModified JS message listener,
  fire it when the JS message is receieved. Update value of ::is_empty
  based on whether a non-empty HTML body was provided in the first place,
  and if it has been subsequently modified. Update related doc comments a
  bit.

* src/client/composer/composer-widget.vala (ComposerWidget): Rename
  `blank` property to `is_blank`, fix sense of editor.is_blank check,
  update call sites. Convert ::can_save method into a property, include
  the this.is_blank check since there's no point saving a blank message,
  updtae call sites. Replace use of GLib.Timeout with
  Geary.TimeoutManager, tidy up resulting code, hook up timer to new
  document_modified signal.

* ui/composer-web-view.js: Use body mutation observer to send
  documentModified messages to the client, coalescing consecutive events
  over a period of 1s into a single message.
2017-02-01 00:41:44 +11:00
Michael James Gratton
a8d1da7ee7 Fix infinite WebView key event chain when it doesn't handle a key press.
* src/client/components/main-window.vala (MainWindow): Convert
  on_key_press_event handler to override Gtk.Window's key_press_event
  virtual method. Reimplement that so that single keystroke shortcuts
  work, but also so GtkWindow.propagate_key_event only gets called once,
  and the WebKit event loop is avoided. See source comments for
  details. Also clean up shift up/down handling to not update when any
  GtkEntry or ComposerWebView is focused.
2017-02-01 00:41:44 +11:00
Michael James Gratton
fd97ad2887 Reimplement inserting/removing \t chars in the composer.
* ui/composer-web-view.js (ComposerPageState): Add tabOut/tabIn
  functions, listen to key Tab key pressess on the body and invoke the
  appropriate method if found.

* src/client/web-process/util-composer.vala: Removed old vala
  implementation of same.
2017-02-01 00:41:44 +11:00
Michael James Gratton
67d81c3e15 Re-implement composer font family/size action state updating.
* src/client/composer/composer-web-view.vala (ComposerWebView): Add new
  ::cursor_style_changed signal, hook it up to the JS cursorStyleChanged
  message and interpret the raw results from the web view before passing
  it on.

* src/client/composer/composer-widget.vala (ComposerWidget): Replace
  remainder of old ::update_actions method with a listener for
  ComposerWebView::cursor_style_changed. Reimplement in terms of that
  signal.

* ui/composer-web-view.js: Keep track of font family and size changes,
  send a cursorStyleChanged message when they change.
2017-02-01 00:41:44 +11:00
Michael James Gratton
2bd5306d30 Reenable undo/redo composer actions.
* src/client/composer/composer-web-view.vala (ComposerWebView): Add new
  ::command_stack_changed signal to manage undo/redo enabled state, hook
  it up to a JS callback. Add ::is_empty property as a non-functioning
  shim in lieu of can_undo going away. Remove ::can_undo and ::can_redo,
  replace them with methods to actually fire an undo and redo.

* src/client/composer/composer-widget.vala (ComposerWidget): Use
  ClientWebView::is_empty rather inplace of can_redo for determining
  editing state. Remove old undo/redo signal hookups, replace with
  ::command_stack_changed and manage action enable state from there.
  (ComposerWidget::action_entries): Add explicit actions for undo/redo,
  since they need some custom code over on on the web process side.
  (ComposerWidget::on_compose_as_html_toggled): Explciitly manage the
  visibility of rich text toolbar buttons, don't rely on obscure
  GtkBuilder magic that Glade doesn't support.

* ui/composer-web-view.js: Add a mutation observer for the message body
  and explcit methods for firing undo/redo commands, so we can keep track
  of how the command stack changes. As it does, fire commandStackChanged
  messages back to the client process. Explicity set the message body as
  content-editable after the document has been mutated for quotes, etc.

* ui/composer-widget.ui: Add bonus undo/redo toobar buttons for the
  composer.
2017-02-01 00:41:44 +11:00
Michael James Gratton
20db6e57dd Re-enable custom composer context menu, add WK text entry items to it.
* src/client/composer/composer-widget.vala
  (ComposerWidget::action_entries): Add an entry for the inspector so it
  can be loaded via the context model in the same way as other items.
  (ComposerWidget::context_menu_*): Keep track of a number of the context
  menu's sections, so we can selectively include them in the WK context
  menu.
  (ComposerWidget::on_context_menu): Re-implement to work wth the WK2
  context menu model, which annoyingly doesn't even extend any of the
  GtkMenu infrastrcuture.

* src/client/util/util-gtk.vala (menu_foreach): Pass the action
  target through to the loop's delegate, it's a bit more useful for
  dealing with the WK2 model.
  (add_g_menu_to_gtk_menu): Removed, WebKitContextMenu doesn't extend
  Gtk.Menu any longer so this is is no longer needed.

* ui/composer-menus.ui: Reoganise to use standard composer action
  prefix. Duplicate rich and plain text clipboard sections so they can
  just be selectively enabled. Include dummy sections for WK items to
  specify where they are located in the menu, and a section for the
  inspector.
2017-02-01 00:41:44 +11:00
Michael James Gratton
f69c461955 Re-enable spell checking in composer.
* src/client/application/geary-config.vala (Configuration): Remove
  spell-check setting, we can just get it from the list of visible
  languages instead. Update the schema.

* src/client/components/client-web-view.vala (WebView::init_web_context):
  Pass in a config object, use that to init WebKit's spell checking on
  the WebContext now that is a global configuration, update it when the
  config changes, update call sites.

* src/client/composer/composer-widget.vala (ComposerWidget): Remove
  WK1-syle spell checking settings prefs.

* src/client/composer/spell-check-popover.vala (SpellCheckPopover): Pass
  a config object in so we don't have to use the global app singleton
  instance.

* src/client/dialogs/preferences-dialog.vala (PreferencesDialog):
  Modernise by converting into a widget template.

* test/client/components/client-web-view-test-case.vala (TestCase):
  Construct a config object as a fixture, use it to init the WebContext
  and make it avalaible to subclasses & update subclasses.

* ui/preferences-dialog.ui: Moved from preferences.dialog, remove spell
  check preference.
2017-02-01 00:41:44 +11:00
Michael James Gratton
6171ff2ebd Fix attachments UI not ever being displayed.
* src/client/components/client-web-view.vala (ClientWebView): Make
  has_valid_height a GObject property so we can get notified about it
  changing.

* src/client/conversation-viewer/conversation-email.vala
  (ConversationEmail::connect_message_view_signals): Fixed to listen to
  has-valid-height changing rather than the old WK1 load-status property.

* ui/conversation-message.ui: Set body_container orientation to vertical
  so adding the attachments widget works as expected.
2017-02-01 00:41:43 +11:00
Michael James Gratton
636e514cda Minor code cleanup.
* src/client/components/client-web-view.vala (ClientWebView): Make some
  unnecessarily internal methods private.

* ui/*.js: Replace "var" with "let" where appropriate - i.e. almost
  everywhere.
2017-02-01 00:41:43 +11:00
Michael James Gratton
8864e2b7a7 Work around rendering quote controller buttons, enable expanding quotes.
* ui/conversation-web-view.js (ConversationPageState): Add
  ::updatePreferredHeight method to waitch for and update the web view's
  preferred height when it changes.
  (ConversationPageState::createControllableQuotes): Create quote
  controllers using the DOM so we can easily attach click handlers to
  it. Attach handlers to toggle the hide class and updated the preferred
  height.

* ui/client-web-view.js (PageState): Add ::getPreferredHeight method, use
  that to determine the preferred height of the page.

* ui/conversation-web-view.css: Import GTK+4 Adwaita button CSS to work
  around WebKitGTK+ Bug 166648. Tweak quote style a bit.
2017-02-01 00:41:43 +11:00
Michael James Gratton
e002f0c320 Add an OSD prgress bar for remote image loading.
* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Chase body container type and name change,
  update call sites. Add in a Progress bar and update it using callbacks
  from the web view, handling both initial load and the user subsequently
  giving permission to load remote images.

* src/client/components/client-web-view.vala (ClientWebView): Provide a
  form of the internal URL scheme prefix.

* ui/conversation-message.ui: Convert body container from being a GtkBox
  to a GtkGrid, add in a GtkProgressBar.
2017-02-01 00:41:43 +11:00
Michael James Gratton
977bb2827a Minor code cleanup. 2017-02-01 00:41:43 +11:00
Michael James Gratton
17fda41b85 Fix non-breaking spaces breaking formatting in sent messages.
This ensures that non-breaking space chars (not HTML entities) are
removed from text obtainined from the composer, and moves the F=F text
formatting from JS back to Vala, to minimimse the JS footprint and return
to using the old (working) version again.

* src/client/composer/composer-web-view.vala (ClientWebView::get_text):
  Restore the old F=F formatting code previously in webkit-util, apply it
  to plain text obtained from the composer.

* test/client/components/client-web-view-test-case.vala: New base class
  for tests involving ClientWebView.

* test/client/composer/composer-web-view-test.vala: New tests for
  ComposerWebView::get_html and ::get_text.

* test/js/composer-page-state-test.vala: Reworked to use
  ClientWebViewTestCase, updated tests now that JS is returning
  QUOTE_MARKER-delinated text, not F=F text.

* test/testcase.vala (TestCase): Move ::async_complete and ::async_result
  from ComposerPageStateTest so all test cases can test async code.

* test/CMakeLists.txt: Add new source files.

* test/main.vala (main): Add new test.

* ui/composer-web-view.js: Update doc comments, remove F=F code, break
  out non-breaking space replacement so it can be tested.
2017-02-01 00:41:43 +11:00
Michael James Gratton
536fb04840 Minor code updates. 2017-02-01 00:41:43 +11:00
Michael James Gratton
22de6b122e Fix JS error getting F=F text from ComposerWebView. Add JS unit tests.
* ui/composer-web-view.js (ComposerPageState::resolveNesting): Apply JS
  RegExp globally, to match default GLib RegEx behaviour.

* test/js/composer-page-state-test.vala: New tests covering generation of
  HTML and F=F text from JS ComposerPageState object.

* test/CMakeLists.txt: Add the new test.

* test/main.vala (main): Add a test suite for JS tests, add the new test
  to it.

* src/client/components/client-web-view.vala (ClientWebView): Add a
  reason to the JSError domain for when a JS exception is thrown.

* bindings/vapi/javascriptcore-4.0.vapi (JS::Context): Add JS.Type and
  some additional methods needed for the unit tests. Move most
  GlobalContext methods to Context so we can pass the lowest common
  demominator around.
2017-02-01 00:41:43 +11:00