Commit graph

34 commits

Author SHA1 Message Date
Michael Gratton
f9ef6492ec Don't bother setting default icon for the ConversationMessage avatar
Since we are now using the GNOME 3.32 initals when there is no avatar
in Folks, it will never be displayed.
2019-03-09 20:17:01 +11:00
Michael Gratton
d93e5fe879 Update avatar size to be 48px, per recommendation
See #269
2019-03-09 20:17:01 +11:00
Michael Gratton
23973b57ff Rename ConversationViewer "preview" widgets to "compact"
Reduce confusion with Geary.Email.preview.
2019-01-21 11:08:18 +10:30
Michael Gratton
2f35f58610 Handle long-loading indication for conversations better
Moving the loading placeholder from ConversationListBox to
ConversationEmail allows a more fine-grained indication of what is
happening - only show the loading indicator when the remote actually
needs to get hit, display the email's details and load the rest of the
conversation while waiting for the remote body load. Also lets us pass
errors loading the initial email locally all the way up to the
controller.
2019-01-21 10:29:15 +10:30
Michael James Gratton
360e5a094c Make copying a message subject much more likely to work. Bug 788494.
* ui/conversation-message.ui: Make subject label focusable so if clicked
  on, its default keyboard bindings will Just Work.
2018-02-05 22:30:58 +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
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
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
0e57d6e8d1 Display Sender and Reply-To headers for conversation messages. 2016-10-04 10:58:17 +11:00
Michael James Gratton
e044b27471 Define message address popover activation handlers via the UI file. 2016-10-04 10:58:17 +11:00
Michael James Gratton
e0b956b64d Minor GTK and HTML CSS tweaks. 2016-10-04 10:58:17 +11:00
Michael James Gratton
d32676d5f5 Dismiss link popover when a link is activated. 2016-10-04 10:58:17 +11:00
Michael James Gratton
a2644f243a Fix missing space between message avatar and headers. 2016-10-04 10:58:17 +11:00
Michael James Gratton
b03c0add14 Convert new convo widgets to use Gtk.Grid instead of Box. 2016-10-04 10:58:17 +11:00
Michael James Gratton
640e8fdbc6 Workaround wide convo InfoBars being too wide for small screens.
* ui/conversation-email.ui, ui/conversation-message.ui: Ellipsie labels
  on InfoBars so they can shrink.
2016-10-04 10:58:17 +11:00
Michael James Gratton
a7570f88f2 Ensure conversation messages min width is low enough for small screens.
* src/client/conversation-viewer/conversation-message.vala
  (AddressFlowBoxChild): Enable ellipsizing the label. Set the alignment
  so labels are correctly aligned at narrow widths. Removed some cruft.

* ui/conversation-message.ui: Ensure long words in subject are
  wrapped. Ensure there's always at least two cols for recipient address
  flow boxes.
2016-10-04 10:58:17 +11:00
Michael James Gratton
6af28fed41 Tidy up ConversationMessage GTK theme CSS. 2016-10-04 10:58:17 +11:00
Michael James Gratton
93e8a148dc Add a tooltip to to conversartion viewer's date headers with full date. 2016-10-04 10:58:17 +11:00
Michael James Gratton
911e81a907 Go back to using the same size avatar for expanded/collapsed messages. 2016-10-04 10:58:17 +11:00
Michael James Gratton
dcc5f42eea Tidy up conversation list style. 2016-10-04 10:58:17 +11:00
Michael James Gratton
12e64b4a3a Fix alignment of conversation message date and preview date alignment. 2016-10-04 10:58:17 +11:00
Michael James Gratton
a97a371826 Update message header layout, use GtkFlowBox for addresses.
This takes some inspiration from the GNOME Mail mockups.

* src/client/components/main-window.vala (MainWindow::set_styling): Work
  around GtkFlowBoxChild padding issue.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Updated to populate new header labels, add
  addresses to GtkFlowBoxes.

* ui/conversation-message.ui: Make date always visible and
  right-aligned. Remove label for sender address. Use GtkFlowBoxes for
  sender/to/cc/bcc.
2016-10-04 10:58:17 +11:00
Michael James Gratton
aabfb1d6de Reenable displaying sender avatars using Gravatar.
Since we're no longer using the web view to display the user avatar, use
libsoup and add some additional infrastructure to support caching the
avatars. Also switches to HTTPS for accessing the Gravatar service.

* src/client/application/geary-application.vala
  (GearyApplication::get_user_cache_directory): New method to return the
  XDG cache directory for Geary.

* src/client/application/geary-controller.vala: Add both a Soup session
  and cache for fetching avatars. Write the cache to disk on controller
  close.

* src/client/conversation-viewer/conversation-email.vala
  (ConversationEmail::start_loading): Trigger avatar loads when loading
  the email.

* src/client/conversation-viewer/conversation-message.vala: Replace
  single avatar image widget with two, so the image does not need to be
  rescaled when expanded/collapsed.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage::load_avatar): Queue a request for a Gravatar
  avatar.
  (ConversationMessage::set_avatar): Load pixbuf returned by Gravatar,
  scale and set it for the preview and expanded avatar images.

* src/client/conversation-viewer/conversation-viewer.vala
  (ConversationViewer::clear): Cancel any outsanding avatar loads.

* src/client/util/util-gravatar.vala (Gravatar): Construct a HTTPS URL to
  avoid advertising to the NSA who we are receiving email from.

* ui/conversation-message.ui: Add the second avatar image.
2016-10-04 10:58:17 +11:00
Michael James Gratton
ad035f799c Allow ConversationEmail to manage its infobars indep. of ConversationMessage.
* src/client/conversation-viewer/conversation-email.vala: Move the
  draft_infobar wdiget from ConversationMessage, when the message is a
  draft add it to ConversationMessage's infobar box and show it.

* ui/conversation-email.ui: Move the draft_infobar definition from
  conversation-message.ui here.

* ui/conversation-message.ui: Wrap the remote messages infobar in an box
  so that ConversationEmail can easily append its own in the same location.
2016-10-04 10:58:17 +11:00
Michael James Gratton
ec22b33825 Reenable displaying sub-messages.
Geary currently displays RFC 822 attachments inline, below the email's
primary message body, using the same HTML chrome for the headers and
email body as for the primary body. Taking the same approach but using
GTK+ widgets meant splitting ConversationMessage up into a
ConversationEmail class that manages the UI for displaying an email in
its entirety, and a ConversationMessage to manage the only header widgets
and webview for displaying an individual RFC 822 message, usable for both
the primary body and any sub-messages. Thus, this is a big change.

One behavioural change is that each sub-message with remote images now
requires individual approval, rather than being dependant on the
containing message's sender and/or approval. This prevents some attacks
e.g. a trusted sender forwarding a spam/malware message, but does not
prevent it if the message is forwarded inline, obviosuly.

* src/client/conversation-viewer/conversation-email.vala (ConversationEmail):
  New class for managing the UI for an overall email message. This
  replaces the old ConversationMessage and contains much of it's code and
  widgets - anything from that class which does not directly support
  displaying headers or a message body.

* src/client/conversation-viewer/conversation-message.vala:
  (ConversationMessage): Same class as before, but now with its scope
  narrowed to only display message headers and body. The draft infobar
  remains here rather than being put ConversationEmail where it belongs
  since it's bit of a pain to insert in the right place and doesn't
  really hurt.
  (::email): Moved this property and any code that depends on it to
  ConversationEmail.
  (::always_load_remote_images): New property passed in via the ctor,
  allowing one dependency on the old ::email property to be removed.
  (::inlined_content_ids): Moved to ConversationEmail, since that is the
  class that keeps track of attachments to display. Add the signal
  attachment_displayed_inline to allow ConversationEmail to be notified
  of inlined attachments instead.
  (::flag_remote_images, ::remember_remote_images): New signals to notify
  ConversationEmail that the user has flagged this message or the
  message's sender for loading remote images. This is passed through
  since in the former's case we may need to set flags on the email
  itself, the latter because it is one less use of the contact_store
  property, which should be removed from this class at some point.

* src/client/conversation-viewer/conversation-viewer.vala: Chase API
  changes from the above. In general, replace use of the term "message"
  with "email" since this class is now mostly dealing with
  ConversationEmail instances, rather than ConversationMessage instances.
  (ConversationViewer::check_mark_read): Only consider the
  ConversationEmail's primary message body when checking for visibility
  rather than that and any submessages to keep things simple.
  (ConversationViewer::show_message, ::hide_message): Renamed to
  expand_email/collapse_email respectively since we don't ever actually
  hide it. Carry that change on to same methods on ConversationEmail.

* src/engine/rfc822/rfc822-message.vala (Geary.RFC822.Message): Add
  get_primary_originator(), almost vermatim from Geary.Email, to support
  determining the sender for remembering remote message loading for
  senders of sub-emails.

* src/client/components/main-window.vala (MainWindow::set_styling): Fix
  background transition for collapsed emails.

* src/client/application/geary-controller.vala: Chase API name changes.

* src/CMakeLists.txt: Include new ConversationEmail source file.

* ui/conversation-email.ui: New UI for ConversationEmail, move the email
  action box, attachments box amd sub-messages box here from
  conversation-message.ui.

* ui/CMakeLists.txt: Include new UI in compiled resources.

* po/POTFILES.in: Add new UI for transation.
2016-10-04 10:58:17 +11:00
Michael James Gratton
ea8a9c992c Reenable and update code for editing draft messages.
Use a Gtk.InfoBar for displaying the draft button.

* src/client/conversation-viewer/conversation-message.vala: Add draft
  infobar template child, edit_draft signal. Remove unused draft-related
  code.
  (ConversationMessage::ConversationMessage): Add new is_draft ctor
  param, when true show the draft infobar.
  (ConversationMessage::on_draft_response): New handler for when the edit
  draft button on the infobar is clicked.

* src/client/conversation-viewer/conversation-viewer.vala: Remove
  edit_draft signal, make a lame attemppt to work out if a message is a
  draft and pass that through to ConversationMessage.

* src/client/application/geary-controller.vala: Hook up on_edit_draft
  handler to added conversation messages.

* ui/conversation-message.ui: Added draft infobar.
2016-10-04 10:58:17 +11:00
Michael James Gratton
b5270e3740 Reenable and update code for displayed attachments.
* src/client/conversation-viewer/conversation-message.vala: Add template
  child widgets for displayed attachment UI, add signal for when user
  activates an attachment.
  (ConversationMessage::ConversationMessage): Ensure the attachment UI
  is visible when there are displayed attachments.
  (ConversationMessage::start_loading): New method for async loading of
  message content, use just for attachments for now.
  (ConversationMessage::on_attachments_view_activated): Handle activation
  signal for specific attachments.
  (ConversationMessage::load_attachments): Load attachments from the
  message into the new UI.
  (ConversationMessage::load_attachment_icon): Load icons for the
  attachments UI from the attachment itself if an image, else from the
  icon theme.

* src/client/application/geary-controller.vala: Hook up
  attachment_activated signal to conversation messages.

* src/client/conversation-viewer/conversation-viewer.vala
  (ConversationViewer::add_message): Ensure message loading starts after
  new conversation messages are added to the window hierarchy.

* ui/conversation-message.ui: Add an attachments box, with an icon view
  for displayed attachments.
2016-10-04 10:58:17 +11:00
Michael James Gratton
9e9e007974 Use two different buttons in ConversationMessage to show starred state.
Having two buttons means we don't need to change the image and handler
when clicked, just manage their visbility.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Add both a star and unstar template child,
  update their state as the message's state changes.

* ui/conversation-message.ui: Rename flag button to "star", add new
  unstar button.
2016-10-04 10:58:17 +11:00
Michael James Gratton
0f64460c90 Don't display ConversationMessage header boxes when header not present.
* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage::ConversationMessage): Remove old "empty" theme CSS
  class, just set header boxes to be visible when setting their text.

* ui/conversation-message.ui: Default header box visibility to off.
2016-10-04 10:58:17 +11:00
Michael James Gratton
21be64fe01 Add attachment icon back to the message viewer. 2016-10-04 10:58:17 +11:00
Michael James Gratton
d0dc003772 Clean up message header UI, tranitions and style a bit.
* ui/conversation-message.ui: Split out preview labels from existing
  header box and create a new preview box for them.

* src/client/components/main-window.vala (MainWindow::set_styling): Use
  style-defined names to allow us to specify message row backgrounds better.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Update GTK composite template children
  properties and visible state when showing/hiding the body, set new
  preview/header box label texts.

* src/client/conversation-viewer/conversation-viewer.vala
  (ConversationViewer::do_embedded_composer,
  ConversationViewer::add_message): Don't add 'frame' class to conversation
  list rows, we're styling it explicitly now.
2016-10-04 10:58:17 +11:00
Michael James Gratton
22e67655ac Reenable and update code for inline message image display.
Use a GtkInfoBar to display to the user the message and related buttons
instead of the message-inline HTML approach. Still needs some additional
work to save per-message loading and displaying images from same sender
in convo when "Always Show" is chosen.

* src/client/conversation-viewer/conversation-message.vala: Reenable
  remote image related code, remove HTML-based UI management code.

* src/client/components/main-window.vala (MainWindow::set_styling):
  Add some theme CSS to style the remote images infobar.

* ui/conversation-message.ui: Add the remote images infobar.
2016-10-04 10:58:17 +11:00
Michael James Gratton
3bf173881c Renable and update code for clicking on links in messages.
Requires GTK+ 3.12.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage::link_selected): Added to pass through successful
  link clicks to the message_viewer, hook it up to the web_view.
  (ConversationMessage::load_message_body): Hook up WebKit event handler
  for when links are clicked, so phishing links can be intercepted.
  (ConversationMessage::on_link_clicked_self): Use a popover to display
  phishing warning, recursively check link's offset parent's when
  calculating box position, escape link text/href before using it as
  markup.

* src/client/conversation-viewer/conversation-viewer.vala
  (ConversationViewer::add_message): Ensure unhandled mouse clicks o the
  web_view are not used to activate the message's ListBoxRow.

* ui/conversation-message.ui: Add popover (GTK+ 3.12) for phishing links.
2016-10-04 10:58:17 +11:00
Michael James Gratton
64aa037c04 Add new ConversationMessage widget to display a single message with a WebView.
The new widget is designed to be added to a ListBox like container, and
can display both a summary and the complete message, a'la the traditional
Geary ConversationView.

Most features are currently disabled, but it does handle hiding/showing
the message body using a single WebKit.WebView. All code from
ConversationViewer relating to DOM manipulation as been copied over, all
but that which was needed to display the message has been commentd out.

* src/client/conversation-viewer/conversation-message.vala: Source code
  for new widget.

* src/client/components/main-window.vala: Add CSS theme code for
  ConversationMessage.

* ui/conversation-message.ui: GtkBuilder template for new widget.

* ui/conversation-message-menu.ui: GtkBuilder for the message menu. This
  is a separate file since GTK+ 3.10 doesn't support GtkPopoverMenu and I
  can't build it using Glade otherwise.

* src/CMakeLists.txt: Added new source file.

* po/POTFILES.in, ui/CMakeLists.txt: Added new UI files.
2016-10-04 10:58:17 +11:00