2017-04-23 15:05:48 +02:00
|
|
|
#include "clipboarduploader.hpp"
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QClipboard>
|
2017-06-06 17:05:34 +02:00
|
|
|
#include <QMimeData>
|
|
|
|
#include <formats.hpp>
|
2017-04-25 22:17:36 +02:00
|
|
|
#include <notifications.hpp>
|
2017-04-23 15:05:48 +02:00
|
|
|
|
2017-06-06 17:05:34 +02:00
|
|
|
void ClipboardUploader::doUpload(QByteArray imgData, QString format) {
|
|
|
|
auto f = formats::recordingFormatFromName(format);
|
|
|
|
if (f != formats::Recording::None) {
|
|
|
|
auto data = new QMimeData();
|
|
|
|
data->setData(formats::recordingFormatMIME(f), imgData);
|
|
|
|
QApplication::clipboard()->setMimeData(data);
|
2017-06-13 10:56:08 +02:00
|
|
|
} else
|
|
|
|
QApplication::clipboard()->setImage(QImage::fromData(imgData, format.toLocal8Bit().constData()));
|
2017-07-29 23:58:09 +02:00
|
|
|
notifications::notify("KShare", tr("Copied to clipboard!"));
|
2017-04-23 15:05:48 +02:00
|
|
|
}
|