Implement sharing with Purpose (export)

This provide both a mobile and desktop view

Fix #181
This commit is contained in:
Carl Schwan
2022-02-05 16:30:02 +00:00
parent 3e6f38c8ea
commit ca8a21c0eb
14 changed files with 531 additions and 63 deletions

View File

@@ -61,6 +61,12 @@ if(NOT ANDROID)
target_compile_definitions(neochat PRIVATE -DHAVE_WINDOWSYSTEM)
endif()
if (NOT ANDROID AND NOT WIN32 AND NOT APPLE)
target_sources(neochat PRIVATE ../res_desktop.qrc)
else()
target_sources(neochat PRIVATE ../res_android.qrc)
endif()
target_include_directories(neochat PRIVATE ${CMAKE_BINARY_DIR})
target_link_libraries(neochat PRIVATE Qt::Quick Qt::Qml Qt::Gui Qt::Network Qt::QuickControls2 KF5::I18n KF5::Kirigami2 KF5::Notifications KF5::ConfigCore KF5::ConfigGui KF5::CoreAddons Quotient cmark::cmark ${QTKEYCHAIN_LIBRARIES})
if(TARGET QCoro5::Coro)

View File

@@ -47,6 +47,7 @@ QHash<int, QByteArray> MessageEventModel::roleNames() const
roles[ReactionRole] = "reaction";
roles[IsEditedRole] = "isEdited";
roles[SourceRole] = "source";
roles[MimeTypeRole] = "mimeType";
roles[FormattedBodyRole] = "formattedBody";
return roles;
}
@@ -544,6 +545,15 @@ QVariant MessageEventModel::data(const QModelIndex &idx, int role) const
return e->content()->fileInfo()->mimeType.iconName();
}
if (role == MimeTypeRole) {
auto e = eventCast<const RoomMessageEvent>(&evt);
if (!e || !e->hasFileContent()) {
return QVariant();
}
return e->content()->fileInfo()->mimeType.name();
}
if (role == SpecialMarksRole) {
if (isPending) {
return pendingIt->deliveryStatus();

View File

@@ -30,6 +30,7 @@ public:
UserMarkerRole,
FormattedBodyRole,
MimeTypeRole,
FileMimetypeIcon,
ReplyRole,