Implement drag&drop support for flatpaks
BUG: 495552
This commit is contained in:
committed by
Tobias Fella
parent
65c6f4c1d3
commit
38523c97c5
@@ -253,7 +253,6 @@ Kirigami.Page {
|
|||||||
id: timelineView
|
id: timelineView
|
||||||
messageFilterModel: root.messageFilterModel
|
messageFilterModel: root.messageFilterModel
|
||||||
compactLayout: NeoChatConfig.compactLayout
|
compactLayout: NeoChatConfig.compactLayout
|
||||||
fileDropEnabled: !Controller.isFlatpak
|
|
||||||
markReadCondition: NeoChatConfig.markReadCondition
|
markReadCondition: NeoChatConfig.markReadCondition
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,10 @@
|
|||||||
|
|
||||||
#include "chatbarcache.h"
|
#include "chatbarcache.h"
|
||||||
|
|
||||||
|
#include <QMimeData>
|
||||||
|
|
||||||
|
#include <KUrlMimeData>
|
||||||
|
|
||||||
#include <Quotient/roommember.h>
|
#include <Quotient/roommember.h>
|
||||||
|
|
||||||
#include "eventhandler.h"
|
#include "eventhandler.h"
|
||||||
@@ -295,4 +299,17 @@ void ChatBarCache::clearCache()
|
|||||||
clearRelations();
|
clearRelations();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatBarCache::drop(QList<QUrl> u, const QString &transferPortal)
|
||||||
|
{
|
||||||
|
QMimeData mimeData;
|
||||||
|
mimeData.setUrls(u);
|
||||||
|
if (!transferPortal.isEmpty()) {
|
||||||
|
mimeData.setData(u"application/vnd.portal.filetransfer"_s, transferPortal.toLatin1());
|
||||||
|
}
|
||||||
|
auto urls = KUrlMimeData::urlsFromMimeData(&mimeData);
|
||||||
|
if (urls.size() > 0) {
|
||||||
|
setAttachmentPath(urls[0].toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#include "moc_chatbarcache.cpp"
|
#include "moc_chatbarcache.cpp"
|
||||||
|
|||||||
@@ -198,6 +198,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
Q_INVOKABLE void postMessage();
|
Q_INVOKABLE void postMessage();
|
||||||
|
|
||||||
|
Q_INVOKABLE void drop(QList<QUrl> urls, const QString &transferPortal);
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void textChanged();
|
void textChanged();
|
||||||
void relationIdChanged(const QString &oldEventId, const QString &newEventId);
|
void relationIdChanged(const QString &oldEventId, const QString &newEventId);
|
||||||
|
|||||||
@@ -31,11 +31,6 @@ QQC2.ScrollView {
|
|||||||
*/
|
*/
|
||||||
required property bool compactLayout
|
required property bool compactLayout
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Whether the compact message layout is to be used.
|
|
||||||
*/
|
|
||||||
property bool fileDropEnabled: true
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief The TimelineMarkReadCondition to use for when messages should be marked as read automatically.
|
* @brief The TimelineMarkReadCondition to use for when messages should be marked as read automatically.
|
||||||
*/
|
*/
|
||||||
@@ -268,8 +263,7 @@ QQC2.ScrollView {
|
|||||||
DropArea {
|
DropArea {
|
||||||
id: dropAreaFile
|
id: dropAreaFile
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onDropped: drop => { _private.room.mainCache.attachmentPath = drop.urls[0] }
|
onDropped: drop => _private.room.mainCache.drop(drop.urls, drop.getDataAsString("application/vnd.portal.filetransfer"))
|
||||||
enabled: root.fileDropEnabled
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QQC2.Pane {
|
QQC2.Pane {
|
||||||
|
|||||||
Reference in New Issue
Block a user