mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Implement drag-n-drop to forum topics.
This commit is contained in:
@@ -7,7 +7,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "core/mime_type.h"
|
||||
|
||||
#include "core/utils.h"
|
||||
|
||||
#include <QtCore/QMimeDatabase>
|
||||
#include <QtCore/QMimeData>
|
||||
|
||||
namespace Core {
|
||||
|
||||
@@ -152,4 +155,19 @@ bool FileIsImage(const QString &name, const QString &mime) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::shared_ptr<QMimeData> ShareMimeMediaData(
|
||||
not_null<const QMimeData*> original) {
|
||||
auto result = std::make_shared<QMimeData>();
|
||||
if (original->hasFormat(u"application/x-td-forward"_q)) {
|
||||
result->setData(u"application/x-td-forward"_q, "1");
|
||||
}
|
||||
if (original->hasImage()) {
|
||||
result->setImageData(original->imageData());
|
||||
}
|
||||
if (auto list = base::GetMimeUrls(original); !list.isEmpty()) {
|
||||
result->setUrls(std::move(list));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
@@ -12,6 +12,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include <QtCore/QStringList>
|
||||
#include <QtCore/QMimeType>
|
||||
|
||||
class QMimeData;
|
||||
|
||||
namespace Core {
|
||||
|
||||
class MimeType {
|
||||
@@ -47,4 +49,7 @@ private:
|
||||
|
||||
[[nodiscard]] bool FileIsImage(const QString &name, const QString &mime);
|
||||
|
||||
[[nodiscard]] std::shared_ptr<QMimeData> ShareMimeMediaData(
|
||||
not_null<const QMimeData*> original);
|
||||
|
||||
} // namespace Core
|
||||
|
Reference in New Issue
Block a user