Commit graph

2836 commits

Author SHA1 Message Date
Michael James Gratton
26fe139e97 Initial pass at getting the HTML document's height from the web process.
* bindings/vapi/javascriptcore-4.0.vapi: Add some methods to
  GlobalContext for accessing JSValues as ints.

* src/client/components/client-web-view.vala
  (ClientWebView): Hook up UserContentManager script messages handler and
  handler implementation for "preferredHeightChanged", update the new
  preferred_height prop on the class, and queue a resize. Hook those
  values up to the GTK allocation machinery.
  (ClientWebView::get_int_result): Convenience method for getting an int
  from a JavascriptResult.
  (ClientWebView::get_preferred_height): Report back values as reported
  by messages from the script handler.
  (ClientWebView::register_message_handler): Convenience method for
  registering script messages handlers.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Remove now-redundant GTK allocation machinery.

* ui/client-web-view.js: Post a message to preferredHeightChanged when
  the page is sorta-kinda loaded.
2017-02-01 00:41:43 +11:00
Michael James Gratton
09c9a398f7 Load a default app script into ClientWebViews at construction time.
* src/client/application/geary-controller.vala
  (GearyController::open_async): Load the app script for ClientWebView at
  startup.

* src/client/components/client-web-view.vala
  (ClientWebView::ClientWebView): Ensure we actually have a
  UserContentManager instance to work with, add the app script to the
  manager for the instance.
  (ClientWebView::load_scripts): Actually load client-web-view.js.
  (ClientWebView::load_user_stylesheet): Helper method for this class and
  subsclasses for doing the actual script load from the app.

* ui/client-web-view.js: Add boilerplaye for new file.

* ui/CMakeLists.txt: Include client-web-view.js.
2017-02-01 00:41:43 +11:00
Michael James Gratton
adf912faae Explicitly set a bunch of good-to-know default WebSettings values. 2017-02-01 00:41:43 +11:00
Michael James Gratton
f51f55cd78 Depend on javascriptcore, generate webkit2 VAPI that uses it.
This gives us a means of using JS objects returned by UserContentManager
script messages directly from Vala.

* bindings/metadata/WebKit2-4.0.metadata: Tweak standard webkit2 VAPI to
  re-include methods that return javascriptcore objects.

* bindings/vapi/javascriptcore-4.0.vapi: Copy generated VAPI file into
  the tree, customise it so that it actually works.

* src/CMakeLists.txt: Generate the custom webkit2 VAPI, depend on
  javascriptcore and include in-tree javascriptcore VAPI in the client
  build.

* bindings/metadata/JSCore-3.0.metadata: Remove obsolete file.
2017-02-01 00:41:43 +11:00
Michael James Gratton
330dc10f71 Impromptu minor cell renderer cleanup (long story). 2017-02-01 00:41:43 +11:00
Michael James Gratton
8a0aad1a2b Disable WebKit2 accelerated compositing. 2017-02-01 00:41:43 +11:00
Michael James Gratton
45a050271e Bump minimum WebKitGTK+ version to 2.10.
We already need to 2.10 for the EditorState::typing-attributes property,
and we're probably going to want 2.8 anyway for
WebKit.UserContentManager::register_script_message_handler.

This means geary 0.12 won't compile under Debian stable unless backports
(bpo) are enabled, but that is how most users will get it 0.12
anyway. Further, the fact that stable is still shipping WK 2.6 is pretty
heinous from a security POV.

* src/CMakeLists.txt: Yoiks and away.
2017-02-01 00:41:43 +11:00
Michael James Gratton
b8bd5095a4 Remove workaround for WK1 Settings zoom-level being floats, not doubles. 2017-02-01 00:41:43 +11:00
Michael James Gratton
b45152facd Set desktop font pref sizes on ClientWebView as pixels, per WK2's expectation. 2017-02-01 00:41:43 +11:00
Michael James Gratton
392c517f3c Load ConversationWebView HTML CSS using a WK2 UserContentManager.
* src/client/application/geary-controller.vala (GearyController): Load
  the ConversationWebView's stylesheets at startup.

* src/client/components/client-web-view.vala (ClientWebView): Add
  ::load_app_stylesheet and ::load_user_stylesheet static methods for use
  by derived classes.

* src/client/conversation-viewer/conversation-web-view.vala
  (ConversationWebView): Add static ::load_stylehseets method to load app
  and user CSS. Remove old WK1 user style loading code.

* src/client/web-process/util-conversation.vala (Util.Conversation):
  Remove old WK1 app style loading code.
2017-02-01 00:41:43 +11:00
Michael James Gratton
2b7ffd8a98 Minor code cleanup. 2017-02-01 00:41:43 +11:00
Michael James Gratton
d9cca42169 Update how inline email attachments are loaded for viewing.
* src/client/components/client-web-view.vala
  (ClientWebView::add_inline_resource): Renamed fro add_cid_resource, to
  make it more obvious what it is useful for and updated call sites.
  (ClientWebView::add_inline_resources): New method for adding a complete
  set of inline resources.

* src/client/conversation-viewer/conversation-email.vala
  (ConversationEmail::ConversationEmail): Construct a map of inline
  resources, add them to both the primary and attached messages.
  (ConversationEmail::start_loading): Only load attachments once all web
  views have been loaded, so any inline parts that were not displayed
  inline can be displayed as attachments.
2017-02-01 00:41:43 +11:00
Michael James Gratton
10ab9c6115 Reenable notifiying of inline parts being loaded by the web view.
* src/client/components/client-web-view.vala
  (ClientWebView::inline_resource_loaded): New signal to notify of when
  an inline part has been loaded by the web view.
  (ClientWebView::handle_cid_request): Fire new signal when a part is
  loaded.

* src/client/conversation-viewer/conversation-email.vala
  (ConversationEmail::connect_message_view_signals): Hook up new signal.

* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Remove now-unesed attachment_displayed_inline signal.
2017-02-01 00:41:43 +11:00
Michael James Gratton
1d1229b623 Use CID resources to display images for multipart/mixed messages.
* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Remove ReplacedImage and related code.
  (ConversationMessage::inline_image_replacer): Don't bother loading,
  scaling, rotating and serialising the images, just add them as CID
  resources.

* src/client/components/client-web-view.vala (ClientWebView): Modify the
  cid_resources map contain memory buffers, not files, and update call
  sites.
2017-02-01 00:41:43 +11:00
Michael James Gratton
6515db2a18 Reimplement saving inline images using WebResources.
* src/client/conversation-viewer/conversation-message.vala
  (ConversationMessage): Add a map to keep track of loaded resources,
  update it using the WebView.resource-load-started signal, clear it
  when the widget is destroyed.
  (ConversationMessage::on_context_menu): Use the hit test to get the
  image's URI, update the menu's action using that.
  (ConversationMessage::on_save_image): Implement getting and saving
  image data from the web resource object.
2017-02-01 00:41:43 +11:00
Michael James Gratton
0dbf925a86 Implement loading cid: scheme resources in ClientWebView.
* src/client/application/geary-controller.vala
  (GearyController::open_async): Register a handler for the 'cid' scheme.

* src/client/components/client-web-view.vala
  (ClientWebView::handle_cid_request): Hook up requests for cid URIs
  using attachment files.
2017-02-01 00:41:43 +11:00
Michael James Gratton
d2fac49e18 Remove now-empty util-random.vala file. 2017-02-01 00:41:43 +11:00
Michael James Gratton
2117c23734 Implement web view resource loading policy for CID, data, & remote URLs.
* src/client/web-process/web-process-extension.vala
  (GearyWebExtension::GearyWebExtension): Set the allow_prefix here,
  since this is where we need to make the decision. Hook up to the
  page-created and subsequently the send-request signals.
  (GearyWebExtension::on_send_request): Always allow data and cid
  requests through, only allow remote requests through if they have the
  allow prefix.
  (random_string): Moved here from util-random so we can call it.

* src/client/components/client-web-view.vala
  (ClientWebView::allow_prefix): Keep this here for now, but its value
  still needs to be fetched from the extension.
  (ClientWebView::on_resource_load_started): Removed, the policy needs to
  be set in the extension to actually work.
2017-02-01 00:41:43 +11:00
Michael James Gratton
6d18b247c0 Properly build and load the web extension for ClientWebView.
* src/CMakeLists.txt: Pass the build dir through to the application so it
  can work out where to find the extension when running from the source
  tree. Build geary-static as reloacatable so we can link it with the
  extension. Actually link geary-static into the extension and install it.

* src/client/application/geary-application.vala
  (GearyApplication::get_web_extensions_dir): New method that determines
  where the web extension lib is to be found.

* src/client/application/geary-controller.vala
  (GearyController::open_async): Set the extension dir on the WebContext,
  and pass through logging config to the extension.

* src/client/web-process/web-process-extension.vala: Add a
  GearyWebExtension extension object, create it on init and init logging.
2017-02-01 00:41:43 +11:00
Michael James Gratton
1eb56bb34e Allow HTML string page loads to occur, so email bodies actually show up.
* src/client/components/client-web-view.vala
  (ClientWebView::on_decide_policy): HTML string page loads are treaded
  as other navigation policy decisions, so allow them rather than
  ignoring them.
2017-02-01 00:41:43 +11:00
Michael James Gratton
b183f9d91c Fix massive graphics corruptiom when WebViews are displayed.
* src/client/application/geary-controller.vala
  (GearyController::open_async): Initialise WebKit default context here,
  rather than in GearyApplication::startup so it happens after GTK+ has
  been initialised.
2017-02-01 00:41:43 +11:00
Michael James Gratton
d542dda48e Begin the WebKit2 port in earnest.
Replace StylishWebView with ClientWebView, to act as a common base class
for the composer, conversation and other uses of web views.

Introduce a ComposerWebView that replaces WebviewEditFixer and extends
ClientWebView, and adds (dummy for now) methods for ComposerWidget to
call. Simiarly, make ConversationWebView extend ClientWebView, add dummy
calls to support the conversation viewer classes. Move common code from
both into ClientWebView.

Add a web-process library, unused other than for compile-time checking,
and move all client functions and methods involving DOM objects into util
classes there.

Bug 728002
2017-02-01 00:41:43 +11:00
Michael James Gratton
48b91b56d0 Replace WebKitGtk and custom VAPI in build with WebKit2GTK.
Start of changes for Bug 728002.
2017-02-01 00:41:43 +11:00
Michael James Gratton
933dae2dda Fix crash in progress meter when populating search table. Bug 776383.
* src/engine/imap-db/imap-db-account.vala
  (Account::populate_search_table_batch_async): total_unindexed was wildy
  inaccurate, since there may be been messages missing from MessageTable,
  MessageSearchTable, or both. When clamped to 0, but when there actually
  were messages to index, this would trigger an assert in the search
  progress meter. So for now instead use something wildly overinflated
  but guaranteed to not trigger the assert.
2017-01-27 18:25:08 +11:00
Michael James Gratton
b706158e75 Don't try to FTS index messages that don't meet the field requirements.
Bug 776654.

* src/engine/imap-db/imap-db-folder.vala (Folder): Add
  REQUIRED_FTS_FIELDS constant that specifys what are the required fields
  for FTS.

* src/engine/imap-db/imap-db-account.vala
  (Account::populate_search_table_batch_async): Ensure rows returned meet
  REQUIRED_FTS_FIELDS requirements.
2017-01-27 18:22:54 +11:00
Michael James Gratton
6abd78b97d Don't crash on login failure when server response has no response code.
Bug 777138.

* src/engine/imap-engine/imap-engine-generic-account.vala (Account):
  Check the response's response_code is not null before calling it.
2017-01-12 01:20:13 +11:00
Gautier Pelloux-Prayer
d3fa60fdbe Fix EHLO message by adding IPv6 prefix when local address is an IPv6 address 2017-01-11 17:07:41 +11:00
Michael James Gratton
1679618b5b Fix connecting to servers with invalidly high UIDVALIDITY values.
Bug 755424.

* src/engine/imap/message/imap-uid-validity.vala (UIDValidity::MAX):
  Allow values larger than permitted by RFC 3501 since at least one
  server has been sending them.
2017-01-11 12:27:58 +11:00
Michael James Gratton
326c450a68 Fix non-parallel build after landing geary-client changes. Bug 776421.
* src/CMakeLists.txt: Make geary-client depend on the VAPI generation,
  not the final client binary. Make geary-client depend on resource_copy
  so valac can find the actual resource files.

* ui/CMakeLists.txt: Don't bother generating the GResources header file,
  it's not needed.
2017-01-10 02:39:11 +11:00
Alan Mortensen
aa2ef1a28a Updated Danish translation 2017-01-09 16:03:12 +01:00
Michael James Gratton
17ce3ed913 Fix GSetttings schema error running tests. Bug 776837.
* test/main.vala (main): Set the location of the compiled dev schema
  before running any tests.

* test/CMakeLists.txt: Pass location of compiled GSettings schema through
  to the test source. Depend on the geary binary so things like the
  shcema are already compiled before compiling the tests.
2017-01-09 09:14:31 +11:00
Josef Andersson
c68810a6b6 Update Swedish translation 2017-01-04 22:57:07 +00:00
Michael James Gratton
387db95e28 Valadoc generation fixes & updates.
* configure: Allow specifying a custom valadoc executable.

* src/CMakeLists.txt: Tidy up valadoc command, include dependencies when
  in generated HTML output, enable warnings.

* src/engine/api/geary.vala: Provide boilerplate doc comment for the
  Geary namespace.

* src/engine/api/geary-email.vala, src/engine/rfc822/rfc822.vala: Don't
  use single-line doc comments, valadoc doesn't support them (see Bug
  736483).

* src/engine/api/geary-folder-path.vala: Fix errors reported by valadoc.
2017-01-02 13:49:18 +11:00
Mario Blättermann
11ab1e099a Update German translation 2016-12-29 11:13:44 +00:00
Rafael Fontenelle
118fcbe583 Update Brazilian Portuguese translation 2016-12-27 09:08:39 +00:00
Michael James Gratton
f7af75fdc1 Make client classes unit testable. Fixes Bug 776421. 2016-12-26 13:27:27 +10:30
Michael James Gratton
50120c67ff Add simple/demo client unit test using GSettings.
* test/client/application/geary-configuration-test.vala: New unit test
  for Configuration class.

* test/main.vala: Add new unit test to the client suite, ensure the
  memory GSettings backend is used as the default so we get default
  setting values, and never save any changes made.

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

* src/client/application/geary-config.vala: Tidy up code a bit to adhere
  to code conventions.
2016-12-26 13:21:58 +10:30
Michael James Gratton
325232bad7 Add client lib to the test build.
* test/CMakeLists.txt: Add client lib and dependent packages to the
  build.

* test/main.vala (main): Add test suites  for both client and engine
  tests to allow some more fine-grained control when running them. Also
  add some sectioning doc comments.
2016-12-26 13:18:51 +10:30
Michael James Gratton
bf42b7e0dd Split the client binary build up into a static lib + final binary.
This allows unit tests to link against client code for testing.

* src/CMakeLists.txt: Add a new geary-client static lib to the build,
  that compiles all client code (except main.vala) as the executable
  previously did, and generates a VAPI for it. Make the target for the
  client then binary simply compile main.vala and link in the client
  lib.

* src/client/application/geary-config.vala,
  src/client/util/util-migrate.vala: Fix errors reported vy valac when
  attempting to use the client lib VAPI.
2016-12-26 12:17:21 +10:30
Michael James Gratton
ef46102374 Rename "geary-static" to "geary-engine" to better reflect what it is.
* src/CMakeLists.txt, test/CMakeLists.txt: Rename engine lib to
  geary-engine, add it to valac compilation steps via their list of
  dependent packages, rather than as custom VAPIs.
2016-12-26 12:06:55 +10:30
Michael James Gratton
403c50a4c2 Add webkit to the list of client packages, so it can be re-used.
This also makes the dependency betwen the client binary adn the webkit
CAPI generation explicit, and makes CLIENT_PACKAGES both complete and
less confusing.

* src/CMakeLists.txt: Add a custom target for webkit VAPI generation with
  the VAPI as a dependency, so we can add that as a dependency of the
  geary target, which means we won't need to use the ValaPrecompile
  CUSTOM_VAPIS to add the dependency for us. With that in place, we can
  simply add webkit to the client packages.
2016-12-26 12:01:03 +10:30
Michael James Gratton
2f23f92074 Don't duplicate gthread library when linking. 2016-12-26 10:49:51 +10:30
Michael James Gratton
e0b1c7b546 Make VAPI build source arg a common valac arg, rather than repeating it. 2016-12-26 10:42:51 +10:30
Michael James Gratton
b7224d6da3 Stop cmake warning that we are using an internal target name.
* CMakeLists.txt: Rename "test" to "tests"

* Makefile.in: Chase target name, add a compatibility target for the old
  name.
2016-12-26 10:31:02 +10:30
Michael Gratton
1ad02284bd Fix HTML, CSS, MIME and other artifiacts appearing in previews. Bug 714317.
Also works around conversation message preview being too short
on wide (4K) screens. Bug 772607.

Merge branch 'bug/714317-hide-html-in-preview'
2016-12-25 10:43:03 +10:30
Gautier Pelloux-Prayer
f8c2a9a7bb Remove unnecessary return carriage in debug invokations 2016-12-23 11:38:00 +10:30
Michael James Gratton
7654b16908 Add unit test for Geary.RFC822.Message::get_preview. 2016-12-23 10:38:23 +10:30
Daniel Mustieles
77346fb5f2 Update Spanish translation 2016-12-21 16:25:13 +00:00
Michael James Gratton
fdb3c6cac6 Make to_preview_text() require UNIX (LF), not RFC833 (CRLF) strings.
Fixes Base64 encoded parts when fetching PREVIEW, and armour, etc
stripping etc not being applied to previews geneated via
Geary.RFC822.Message.

* src/engine/rfc822/rfc822-utils.vala
  (Geary.RFC822.Utils::to_preview_text): Assume line endings are LF
  encoded, update doc comment and unit tests to reflect that.

* src/engine/rfc822/rfc822-message-data.vala (PreviewText.with_header):
  Add CRLF filter to preveiw text to strip CR chars from lines.
2016-12-21 10:45:21 +11:00
Michael James Gratton
c2f0f14830 Use preview synthesis when conversation list is refreshing previews.
Since currently, PREVIEW has some bad assumptions, we want to avoid using
it. As a workaround, when listing messages with PREVIEW, include ALL so
that HEADER and BODY are also retreived and the preview can synthesised,
also NONE to ensure that after setting ALL, UIDs will be returned in the
result.

Bug 714317.

* src/client/conversation-list/conversation-list-store.vala
  (ConversationListStore): Include ALL and NONE in WITH_PREVIEW_FIELDS.

* src/client/conversation-viewer/conversation-list-box.vala
  (ConversationListBox): Remove PREVIEW from REQUIRED_FIELDS, it's no
  longer needed.
2016-12-20 23:29:31 +11:00