aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chat.cpp6
-rw-r--r--chat.h2
-rw-r--r--qml/ChatlistPage.qml18
3 files changed, 25 insertions, 1 deletions
diff --git a/chat.cpp b/chat.cpp
index 0d023bb..32c72c3 100644
--- a/chat.cpp
+++ b/chat.cpp
@@ -70,3 +70,9 @@ DcChat::isMuted()
{
return dc_chat_is_muted(m_chat);
}
+
+int
+DcChat::getVisibility()
+{
+ return dc_chat_get_visibility(m_chat);
+}
diff --git a/chat.h b/chat.h
index 70a813c..0fc6152 100644
--- a/chat.h
+++ b/chat.h
@@ -12,6 +12,7 @@ class DcChat : public QObject {
Q_PROPERTY(bool isContactRequest READ isContactRequest CONSTANT)
Q_PROPERTY(bool canSend READ canSend CONSTANT)
Q_PROPERTY(bool muted READ isMuted CONSTANT)
+ Q_PROPERTY(int visibility READ getVisibility CONSTANT)
public:
explicit DcChat(QObject *parent = nullptr);
@@ -26,6 +27,7 @@ public:
Q_INVOKABLE bool isContactRequest ();
Q_INVOKABLE bool canSend();
Q_INVOKABLE bool isMuted();
+ Q_INVOKABLE int getVisibility();
private:
dc_chat_t *m_chat{nullptr};
diff --git a/qml/ChatlistPage.qml b/qml/ChatlistPage.qml
index a0d171a..03b18be 100644
--- a/qml/ChatlistPage.qml
+++ b/qml/ChatlistPage.qml
@@ -110,7 +110,8 @@ Kirigami.ScrollablePage {
avatarSource: profileImage ? "file:" + profileImage : "",
chatName: chat.name,
freshMsgCnt: chatlistPage.context.getFreshMsgCnt(chatId),
- isContactRequest: chat.isContactRequest
+ isContactRequest: chat.isContactRequest,
+ visibility: chat.visibility
}
let j;
@@ -221,6 +222,7 @@ Kirigami.ScrollablePage {
}
}
+
Label {
text: model.isContactRequest ? "NEW" : model.freshMsgCnt
visible: model.freshMsgCnt > 0 || model.isContactRequest
@@ -237,6 +239,20 @@ Kirigami.ScrollablePage {
radius: 0.25 * height
}
}
+
+ // "Pinned" badge
+ Rectangle {
+ visible: model.visibility == 2
+ color: Kirigami.Theme.alternateBackgroundColor
+ width: Kirigami.Units.gridUnit
+ height: Kirigami.Units.gridUnit
+ radius: 0.25 * height
+ Kirigami.Icon {
+ source: "pin"
+ height: Kirigami.Units.gridUnit
+ width: Kirigami.Units.gridUnit
+ }
+ }
}
}
}