+//! Acts as a proxy for Action signals targetted at a ContentsChatItem
+/** Since a ChatItem is not a QObject, hence cannot receive signals, we use a static ActionProxy
+ * as a receiver instead. This avoids having to handle ChatItem actions (e.g. context menu entries)
+ * outside the ChatItem.
+ */
+class ContentsChatItem::ActionProxy : public QObject {
+ Q_OBJECT
+
+public slots:
+ inline void copyLinkToClipboard() { item()->copyLinkToClipboard(); }
+
+private:
+ /// Returns the ContentsChatItem that should receive the action event.
+ /** For efficiency reasons, values are not checked for validity. You gotta make sure that you set the data() member
+ * in the Action correctly.
+ * @return The ChatItem from which the sending Action originated
+ */
+ inline ContentsChatItem *item() const {
+ return static_cast<ContentsChatItem *>(qobject_cast<QAction *>(sender())->data().value<void *>());
+ }
+};
+
+/*************************************************************************************************/
+
+#include "chatline.h" /* avoid circular includes */
+
+// Inlines
+
+ChatLine *ChatItem::chatLine() const { return _parent; }
+ChatScene *ChatItem::chatScene() const { return chatLine()->chatScene(); }
+const QAbstractItemModel *ChatItem::model() const { return chatLine()->model(); }
+int ChatItem::row() const { return chatLine()->row(); }
+
+QRectF ChatItem::boundingRect() const { return _boundingRect; }
+qreal ChatItem::width() const { return _boundingRect.width(); }
+qreal ChatItem::height() const { return _boundingRect.height(); }
+QPointF ChatItem::pos() const { return _boundingRect.topLeft(); }
+qreal ChatItem::x() const { return pos().x(); }
+qreal ChatItem::y() const { return pos().y(); }
+
+QPointF ChatItem::mapToLine(const QPointF &p) const { return p + pos(); }
+QPointF ChatItem::mapFromLine(const QPointF &p) const { return p - pos(); }
+// relative to the ChatLine
+QPointF ChatItem::mapToScene(const QPointF &p) const { return chatLine()->mapToScene(p /* + pos() */); }
+QPointF ChatItem::mapFromScene(const QPointF &p) const { return chatLine()->mapFromScene(p) /* - pos() */; }