Yeet HoverActions into the sun
Replace HoverActions with an inline action component that appears on hover. There are only actions for reply and react if there is space the overflow button opens the normal message menu.
NOTE: the most recent update changes things slightly, from the images below the buttons are now top aligned because of potentially hige messages. The actions are also now disabled for compact mode as they never really made sense there anyway. The menu now has all options so no one is missing out.
For normal messages
{width=419 height=138}
When space is limited
{width=411 height=130}
User messages
{width=296 height=114}
BUG: 503784
This commit is contained in:
@@ -37,6 +37,9 @@
|
||||
#include <Quotient/events/simplestateevents.h>
|
||||
#include <Quotient/jobs/downloadfilejob.h>
|
||||
#include <Quotient/qt_connection_util.h>
|
||||
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 1)
|
||||
#include <Quotient/thread.h>
|
||||
#endif
|
||||
|
||||
#include "chatbarcache.h"
|
||||
#include "clipboard.h"
|
||||
@@ -1708,4 +1711,34 @@ bool NeoChatRoom::isEventPinned(const QString &eventId) const
|
||||
return pinnedEventIds().contains(eventId);
|
||||
}
|
||||
|
||||
bool NeoChatRoom::eventIsThreaded(const QString &eventId) const
|
||||
{
|
||||
const auto event = eventCast<const RoomMessageEvent>(getEvent(eventId).first);
|
||||
if (event == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 1)
|
||||
return event->isThreaded() || threads().contains(eventId);
|
||||
#else
|
||||
return event->isThreaded();
|
||||
#endif
|
||||
}
|
||||
|
||||
QString NeoChatRoom::rootIdForThread(const QString &eventId) const
|
||||
{
|
||||
const auto event = eventCast<const RoomMessageEvent>(getEvent(eventId).first);
|
||||
if (event == nullptr) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto rootId = event->threadRootEventId();
|
||||
#if Quotient_VERSION_MINOR > 9 || (Quotient_VERSION_MINOR == 9 && Quotient_VERSION_PATCH > 1)
|
||||
if (rootId.isEmpty() && threads().contains(eventId)) {
|
||||
rootId = event->id();
|
||||
}
|
||||
#endif
|
||||
return rootId;
|
||||
}
|
||||
|
||||
#include "moc_neochatroom.cpp"
|
||||
|
||||
@@ -576,6 +576,17 @@ public:
|
||||
*/
|
||||
Q_INVOKABLE bool isEventPinned(const QString &eventId) const;
|
||||
|
||||
/**
|
||||
* @return True if the given @p eventId is threaded.
|
||||
*/
|
||||
Q_INVOKABLE bool eventIsThreaded(const QString &eventId) const;
|
||||
|
||||
/**
|
||||
* @return Returns the thread root ID for @p eventId as a string. The string
|
||||
* is empty if the event is not part of a thread.
|
||||
*/
|
||||
Q_INVOKABLE QString rootIdForThread(const QString &eventId) const;
|
||||
|
||||
private:
|
||||
bool m_visible = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user