Request text/html in get clipboard
Change-Id: I9096fb2470da0255722f58bdeaeba87fcae3511d
This commit is contained in:
parent
d3208f9cfe
commit
18305c8a44
2 changed files with 19 additions and 4 deletions
|
@ -921,20 +921,35 @@ bool ChildSession::getTextSelection(const char* /*buffer*/, int /*length*/, cons
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChildSession::getClipboard(const char* /*buffer*/, int /*length*/, const std::vector<std::string>& /* tokens */)
|
||||
bool ChildSession::getClipboard(const char* /*buffer*/, int /*length*/, const std::vector<std::string>& tokens )
|
||||
{
|
||||
const char **pMimeTypes = nullptr; // fetch all for now.
|
||||
char **pMimeTypes = nullptr; // fetch all for now.
|
||||
size_t nOutCount = 0;
|
||||
char **pOutMimeTypes = nullptr;
|
||||
size_t *pOutSizes = nullptr;
|
||||
char **pOutStreams = nullptr;
|
||||
|
||||
bool hasMimeRequest = tokens.size() > 1;
|
||||
if (hasMimeRequest)
|
||||
{
|
||||
int length = tokens[1].length();
|
||||
pMimeTypes = new char*[1];
|
||||
pMimeTypes[0] = new char[length];
|
||||
strncpy(pMimeTypes[0], tokens[1].c_str(), length);
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
getLOKitDocument()->setView(_viewId);
|
||||
|
||||
success = getLOKitDocument()->getClipboard(pMimeTypes, &nOutCount, &pOutMimeTypes,
|
||||
success = getLOKitDocument()->getClipboard((const char**)pMimeTypes, &nOutCount, &pOutMimeTypes,
|
||||
&pOutSizes, &pOutStreams);
|
||||
|
||||
if (hasMimeRequest)
|
||||
{
|
||||
delete pMimeTypes[0];
|
||||
delete pMimeTypes;
|
||||
}
|
||||
|
||||
if (!success || nOutCount == 0)
|
||||
{
|
||||
LOG_WRN("Get clipboard failed " << getLOKitLastError());
|
||||
|
|
|
@ -146,7 +146,7 @@ void ClientSession::handleClipboardRequest(DocumentBroker::ClipboardRequest
|
|||
if (type == DocumentBroker::CLIP_REQUEST_GET)
|
||||
{
|
||||
LOG_TRC("Session [" << getId() << "] sending getclipboard");
|
||||
docBroker->forwardToChild(getId(), "getclipboard");
|
||||
docBroker->forwardToChild(getId(), "getclipboard text/html");
|
||||
_clipSockets.push_back(socket);
|
||||
}
|
||||
else // REQUEST_SET
|
||||
|
|
Loading…
Reference in a new issue