drop 'part' from downloadas protocol as it is no longer needed

This commit is contained in:
Mihai Varga 2015-10-16 19:27:13 +03:00
parent fed0cbc77c
commit d7ceedac54
6 changed files with 11 additions and 25 deletions

View file

@ -41,7 +41,6 @@ L.Map.include({
L.Socket.sendMessage('downloadas ' +
'name=' + name + ' ' +
'id=-1 ' + // not a special download
'part=-1 ' + // we don't want to export just a single part
'format=' + format + ' ' +
'options=' + options);
},

View file

@ -287,7 +287,7 @@ L.TileLayer = L.GridLayer.extend({
}
}
else if (command.id === 'slideshow') {
this._map.fire('slidedownloadready', {url: url, part: command.part});
this._map.fire('slidedownloadready', {url: url});
}
else {
this._map._fileDownloader.src = url;

View file

@ -181,7 +181,6 @@ L.Map.Keyboard = L.Handler.extend({
_onKeyDown: function (e) {
if (this._map.slideShow && this._map.slideShow.fullscreen) {
this._map.slideShow._onUserInput(e);
return;
}
var docLayer = this._map._docLayer;
@ -288,7 +287,7 @@ L.Map.Keyboard = L.Handler.extend({
L.Socket.sendMessage('uno .uno:LeftPara');
break;
case 80: // p
L.Socket.sendMessage('downloadas name=print.pdf id=print part=-1 format=pdf options=');
L.Socket.sendMessage('downloadas name=print.pdf id=print format=pdf options=');
break;
case 82: // r
L.Socket.sendMessage('uno .uno:RightPara');

View file

@ -37,12 +37,7 @@ L.Map.Mouse = L.Handler.extend({
_onMouseEvent: function (e) {
var docLayer = this._map._docLayer;
if (!docLayer) {
// document not yet loaded
return;
}
if (this._map.slideShow && this._map.slideShow.fullscreen) {
this._map.slideShow._onUserInput(e);
if (!docLayer || (this._map.slideShow && this._map.slideShow.fullscreen)) {
return;
}
if (docLayer._graphicMarker && docLayer._graphicMarker.isDragged) {

View file

@ -999,22 +999,20 @@ void ChildProcessSession::sendTile(const char* /*buffer*/, int /*length*/, Strin
bool ChildProcessSession::downloadAs(const char* /*buffer*/, int /*length*/, StringTokenizer& tokens)
{
std::string name, id, format, filterOptions;
int part;
if (tokens.count() < 6 ||
if (tokens.count() < 5 ||
!getTokenString(tokens[1], "name", name) ||
!getTokenString(tokens[2], "id", id),
!getTokenInteger(tokens[3], "part", part))
!getTokenString(tokens[2], "id", id))
{
sendTextFrame("error: cmd=downloadas kind=syntax");
return false;
}
getTokenString(tokens[4], "format", format);
getTokenString(tokens[3], "format", format);
if (getTokenString(tokens[5], "options", filterOptions)) {
if (tokens.count() > 6) {
filterOptions += Poco::cat(std::string(" "), tokens.begin() + 6, tokens.end());
if (getTokenString(tokens[4], "options", filterOptions)) {
if (tokens.count() > 5) {
filterOptions += Poco::cat(std::string(" "), tokens.begin() + 5, tokens.end());
}
}
@ -1032,16 +1030,12 @@ bool ChildProcessSession::downloadAs(const char* /*buffer*/, int /*length*/, Str
} while (file->exists());
delete file;
if (part != -1) {
// we need this to export a slide to svg
_loKitDocument->pClass->setPart(_loKitDocument, part);
}
_loKitDocument->pClass->saveAs(_loKitDocument, url.c_str(),
format.size() == 0 ? NULL :format.c_str(),
filterOptions.size() == 0 ? NULL : filterOptions.c_str());
sendTextFrame("downloadas: jail=" + _childId + " dir=" + tmpDir + " name=" + name +
" port=" + std::to_string(LOOLWSD::portNumber) + " id=" + id + " part=" + std::to_string(part));
" port=" + std::to_string(LOOLWSD::portNumber) + " id=" + id);
return true;
}

View file

@ -17,11 +17,10 @@ canceltiles
dropped and will not be handled. There is no guarantee of exactly
which tile: messages might still be sent back to the client.
downloadas downloadas name=<fileName> id=<id> part=<part> format=<document format> options=<SkipImages, etc>
downloadas downloadas name=<fileName> id=<id> format=<document format> options=<SkipImages, etc>
Exports the current document to the desired format and returns a download URL
The id identifies the request on the client.
The part parameter is used to export a specific part, for example when we need to export a slide to svg
gettextselection mimetype=<mimeType>