kit/Kit.cpp | 23 ++++++++++++-- loleaflet/dist/errormessages.js | 1 loleaflet/src/core/Socket.js | 3 + loleaflet/src/map/Map.js | 5 ++- loleaflet/src/map/handler/Map.Keyboard.js | 47 ++++++++++++++++++++++++------ 5 files changed, 67 insertions(+), 12 deletions(-)
New commits: commit 5bf86bb0804cd0a0754f0d353c16d8499ce551f4 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Sun Jan 15 22:50:08 2017 -0500 wsd: notify the user when document loading fails Also do not segfault in the event. Change-Id: I80c4c5c0d1d5f1a4cde9a6a3458f69a3df9dc647 Reviewed-on: https://gerrit.libreoffice.org/33140 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> (cherry picked from commit 6b3d2bd7cea9f4c966b523ca806b0fce1aed88dc) Signed-off-by: Andras Timar <andras.ti...@collabora.com> diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 4989132..9d6ff44 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -1395,6 +1395,12 @@ private: /// Return access to the lok::Document instance. std::shared_ptr<lok::Document> getLOKitDocument() override { + if (!_loKitDocument) + { + LOG_ERR("Document [" << _docKey << "] is not loaded."); + throw std::runtime_error("Document " + _docKey + " is not loaded."); + } + return _loKitDocument; } diff --git a/loleaflet/dist/errormessages.js b/loleaflet/dist/errormessages.js index 83b6674..329fa55 100644 --- a/loleaflet/dist/errormessages.js +++ b/loleaflet/dist/errormessages.js @@ -6,6 +6,7 @@ exports.unauthorized = _('Unauthorized WOPI host. Please try again later and rep exports.wrongwopisrc = _('Wrong WOPISrc, usage: WOPISrc=valid encoded URI, or file_path, usage: file_path=/path/to/doc/'); exports.sessionexpiry = _('Your session will expire in %time. Please save your work and refresh the session (or webpage) to continue.'); exports.sessionexpired = _('Your session has been expired. Further changes to document might not be saved. Please refresh the session (or webpage) to continue.'); +exports.faileddocloading = _('Failed to load the document. Please ensure the file type is supported and not corrupted, and try again.'); exports.storage = { savediskfull: _('Save failed due to no disk space left on storage server. Document will now be read-only. Please contact the server administrator to continue editing.'), diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js index f25b580..d18a873 100644 --- a/loleaflet/src/core/Socket.js +++ b/loleaflet/src/core/Socket.js @@ -341,6 +341,9 @@ L.Socket = L.Class.extend({ } else if (errorKind.startsWith('wrongpassword')) { passwordNeeded = true; msg = _('Wrong password provided. Please try again.'); + } else if (errorKind.startsWith('faileddocloading')) { + this._map._fatal = true; + this._map.fire('error', {msg: errorMessages.faileddocloading}); } if (passwordNeeded) { commit cea48e3ae23c58b6170532ffb685cd8583c9350d Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> Date: Sun Jan 15 23:53:00 2017 +0100 fix Chrome Android and Firefox Android text input - Change from textarea to input (type="text") to prevent Firefox to auto-capitalize. - Clean the text input content after each word so that the soft keyboard spellcheck suggestions are correct and that backspace doesn't delete long IME suggestions before it has effect. - Workaround on Chrome Android 'space' and applying spell-check corrections. (cherry picked from commit 724cac1d97ab2458252c60bd949a7852c3852c69) Signed-off-by: Andras Timar <andras.ti...@collabora.com> diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index 28d2bed..d7b50b0 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -598,7 +598,10 @@ L.Map = L.Evented.extend({ } var textAreaContainer = L.DomUtil.create('div', 'clipboard-container', container.parentElement); - this._textArea = L.DomUtil.create('textarea', 'clipboard', textAreaContainer); + this._textArea = L.DomUtil.create('input', 'clipboard', textAreaContainer); + this._textArea.setAttribute('type', 'text'); + this._textArea.setAttribute('autocorrect', 'off'); + this._textArea.setAttribute('autocapitalize', 'off'); this._resizeDetector = L.DomUtil.create('iframe', 'resize-detector', container); this._fileDownloader = L.DomUtil.create('iframe', '', container); L.DomUtil.setStyle(this._fileDownloader, 'display', 'none'); diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js index 0da5e09..a159b68 100644 --- a/loleaflet/src/map/handler/Map.Keyboard.js +++ b/loleaflet/src/map/handler/Map.Keyboard.js @@ -284,12 +284,28 @@ L.Map.Keyboard = L.Handler.extend({ var charCode = e.originalEvent.charCode; var keyCode = e.originalEvent.keyCode; + if (e.type === 'compositionstart' || e.type === 'compositionupdate') { + this._isComposing = true; // we are starting composing with IME + } + if (e.type === 'compositionend') { + this._isComposing = false; // stop of composing with IME + // get the composited char codes var compCharCodes = []; for (var i = 0; i < e.originalEvent.data.length; i++) { compCharCodes.push(e.originalEvent.data[i].charCodeAt()); } + // clear the input now - best to do this ASAP so the input + // is clear for the next word + this._map._textArea.value = ''; + } + + if (!this._isComposing && e.type === 'keyup') { + // not compositing and keyup, clear the input so it is ready + // for next word (or char only) + this._map._textArea.value = ''; } + var unoKeyCode = this._toUNOKeyCode(keyCode); if (this.modifier) { @@ -338,15 +354,30 @@ L.Map.Keyboard = L.Handler.extend({ this._bufferedTextInputEvent = e; } else if (e.type === 'keyup') { - // Hack for making space work in chrome when IME is enabled - // Chrome doesn't fire compositionend event or keypress when - // IME is enabled *and* user presses <space>. - // However, it sends 'textInput' event in such a case. - // Use the buffered textInput event if its the space key and has not been - // handled already by 'keypress' or 'compositionend' events above - if (!this._keyHandled && this._bufferedTextInputEvent && e.originalEvent.key === this._bufferedTextInputEvent.originalEvent.data) { + // Hack for making space and spell-check text insert work + // in Chrome (on Andorid) or Chrome with IME. + // + // Chrome (Android) IME triggers keyup/keydown input with + // code 229 when hitting space (as with all composiiton events) + // with addition to 'textinput' event, in which we only see that + // space was entered. Similar situation is also when inserting + // a soft-keyboard spell-check item - it is visible only with + // 'textinput' event (no composition event is fired). + // To make this work we need to insert textinput.data here.. + // + // TODO: Maybe make sure this is only triggered when keydown has + // 229 code. Also we need to detect that composition was overriden + // (part or whole word deleted) with the spell-checked word. (for + // example: enter 'tar' and with spell-check correct that to 'rat') + + if (!this._keyHandled && this._bufferedTextInputEvent) { + var textInputData = this._bufferedTextInputEvent.originalEvent.data; charCode = e.originalEvent.keyCode; - docLayer._postKeyboardEvent('input', charCode, 0); + var compCharCodes = []; + for (var i = 0; i < textInputData.length; i++) { + compCharCodes.push(textInputData[i].charCodeAt()); + } + docLayer._postKeyboardEvents('input', compCharCodes, Array.apply(null, Array(compCharCodes.length)).map(Number.prototype.valueOf, 0)); } docLayer._postKeyboardEvent('up', charCode, unoKeyCode); commit 58c293cee31a33b4599881a42a1f31b6483b54d1 Author: Ashod Nakashian <ashod.nakash...@collabora.co.uk> Date: Sun Jan 15 23:54:08 2017 -0500 wsd: copy jail files when symlinking fails Change-Id: I1f56d1489820a0689495e09151101d41a2322b82 Reviewed-on: https://gerrit.libreoffice.org/33143 Reviewed-by: Ashod Nakashian <ashnak...@gmail.com> Tested-by: Ashod Nakashian <ashnak...@gmail.com> (cherry picked from commit 6246e744334c1df4fa524cefaabdcb5d0880c26a) Signed-off-by: Andras Timar <andras.ti...@collabora.com> diff --git a/kit/Kit.cpp b/kit/Kit.cpp index 0d9d32d..4989132 100644 --- a/kit/Kit.cpp +++ b/kit/Kit.cpp @@ -148,9 +148,18 @@ namespace File(newPath.parent()).createDirectories(); if (link(fpath, newPath.toString().c_str()) == -1) { - LOG_SYS("link(\"" << std::string(fpath) << "\",\"" << - newPath.toString() << "\") failed. Exiting."); - std::_Exit(Application::EXIT_SOFTWARE); + LOG_SYS("link(\"" << fpath << "\", \"" << + newPath.toString() << "\") failed. Will copy."); + try + { + File(fpath).copyTo(newPath.toString()); + } + catch (const std::exception& exc) + { + LOG_ERR("Copying of '" << fpath << "' to " << newPath.toString() << + " failed: " << exc.what() << ". Exiting."); + std::_Exit(Application::EXIT_SOFTWARE); + } } break; case FTW_D: @@ -201,7 +210,9 @@ namespace sourceForLinkOrCopy.pop_back(); destinationForLinkOrCopy = destination; if (nftw(source.c_str(), linkOrCopyFunction, 10, FTW_ACTIONRETVAL) == -1) + { LOG_ERR("linkOrCopy: nftw() failed for '" << source << "'"); + } } void dropCapability(cap_value_t capability)
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits