From 7e8d26e66835c1070cd44ea8f349070b52d3d32d Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 29 Apr 2021 17:04:37 +0200 Subject: [PATCH] Store in CryptDrive from File menu --- www/common/common-interface.js | 2 +- www/common/common-ui-elements.js | 33 ++++++++++++++++++++++++++++++ www/common/sframe-app-framework.js | 3 +++ 3 files changed, 37 insertions(+), 1 deletion(-) diff --git a/www/common/common-interface.js b/www/common/common-interface.js index 9711de3fa..dbcb089f3 100644 --- a/www/common/common-interface.js +++ b/www/common/common-interface.js @@ -1434,13 +1434,13 @@ define([ */ UI.createDrawer = function ($button, $content) { $button.click(function () { + var topPos = $button[0].getBoundingClientRect().bottom; $content.toggle(); $button.removeClass('cp-toolbar-button-active'); if ($content.is(':visible')) { $button.addClass('cp-toolbar-button-active'); $content.focus(); var wh = $(window).height(); - var topPos = $button[0].getBoundingClientRect().bottom; $content.css('max-height', Math.floor(wh - topPos - 1)+'px'); } }); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index 471bd5011..5cac87c97 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -788,6 +788,30 @@ define([ h('span.cp-toolbar-name.cp-toolbar-drawer-element', Messages.toolbar_savetodrive) ])).click(common.prepareFeedback(type)); break; + case 'storeindrive': + Messages.toolbar_storeInDrive = "Store in CryptDrive"; // XXX + button = $(h('button.cp-toolbar-storeindrive', { + style: 'display:none;' + }, [ + h('i.fa.fa-hdd-o'), + h('span.cp-toolbar-name.cp-toolbar-drawer-element', Messages.toolbar_storeInDrive) + ])).click(common.prepareFeedback(type)).click(function () { + $(button).hide(); + common.getSframeChannel().query("Q_AUTOSTORE_STORE", null, function (err, obj) { + waitingForStoringCb = false; + var error = err || (obj && obj.error); + if (error) { + $(button).show(); + if (error === 'E_OVER_LIMIT') { + return void UI.warn(Messages.pinLimitReached); + } + return void UI.warn(Messages.autostore_error); + } + $(document).trigger('cpPadStored'); + UI.log(Messages.autostore_saved); + }); + }); + break; case 'hashtag': button = $('