diff options
author | link2xt <link2xt@testrun.org> | 2020-10-12 01:06:11 +0300 |
---|---|---|
committer | link2xt <link2xt@testrun.org> | 2020-10-12 01:06:11 +0300 |
commit | c02c9dbb15af7598994edbcb7e13eb937bce1e6a (patch) | |
tree | b4eaa6cb76b83877e55eed2443fbab1d381ea023 | |
parent | 6b6a96a520d2a33584f9a0220da8874af5012c8b (diff) | |
download | kdeltachat-c02c9dbb15af7598994edbcb7e13eb937bce1e6a.tar.gz kdeltachat-c02c9dbb15af7598994edbcb7e13eb937bce1e6a.zip |
Add basic quoting support
-rw-r--r-- | message.cpp | 9 | ||||
-rw-r--r-- | message.h | 2 | ||||
-rw-r--r-- | qml/Message.qml | 2 |
3 files changed, 12 insertions, 1 deletions
diff --git a/message.cpp b/message.cpp index 7eb6019..3027cec 100644 --- a/message.cpp +++ b/message.cpp @@ -90,3 +90,12 @@ DcMessage::isInfo() { return dc_msg_is_info(m_message); } + +QString +DcMessage::getQuotedText() +{ + char *text = dc_msg_get_quoted_text(m_message); + QString result{text}; + dc_str_unref(text); + return result; +} @@ -17,6 +17,7 @@ class DcMessage : public QObject { Q_PROPERTY(int width READ getWidth CONSTANT) Q_PROPERTY(int height READ getHeight CONSTANT) Q_PROPERTY(bool isInfo READ isInfo CONSTANT) + Q_PROPERTY(QString quotedText READ getQuotedText CONSTANT) dc_msg_t *m_message{nullptr}; public: @@ -52,4 +53,5 @@ public: bool isInfo(); //isIncreation //isSetupmessage + Q_INVOKABLE QString getQuotedText(); }; diff --git a/qml/Message.qml b/qml/Message.qml index 32cf001..0723546 100644 --- a/qml/Message.qml +++ b/qml/Message.qml @@ -63,7 +63,7 @@ RowLayout { } TextEdit { Layout.maximumWidth: messageObject.width > 30 ? messageObject.width - 30 : messageObject.width - text: messageObject.message.text + text: (messageObject.message.quotedText ? "> " + messageObject.message.quotedText + "\n\n" : "") + messageObject.message.text textFormat: Text.PlainText selectByMouse: true readOnly: true |