diff options
author | ConfuSomu | 2023-01-05 15:26:28 -0500 |
---|---|---|
committer | ConfuSomu | 2023-01-05 15:26:28 -0500 |
commit | a962b2d93227557c68a719b2401f8d6bb3969899 (patch) | |
tree | b50b1bac5b38c9b2dfd82668615ccc8ba6ccd474 /src/archive_parser.cpp | |
parent | c269400dbb2e40d60349ab0a1d67414303653c91 (diff) | |
download | ActorViewer-a962b2d93227557c68a719b2401f8d6bb3969899.tar ActorViewer-a962b2d93227557c68a719b2401f8d6bb3969899.tar.gz ActorViewer-a962b2d93227557c68a719b2401f8d6bb3969899.zip |
Allow only listing statuses which have attachments
Diffstat (limited to 'src/archive_parser.cpp')
-rw-r--r-- | src/archive_parser.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/archive_parser.cpp b/src/archive_parser.cpp index d3b9197..d9d4cf1 100644 --- a/src/archive_parser.cpp +++ b/src/archive_parser.cpp @@ -129,12 +129,19 @@ void Archive::update_status_list(ViewStatusTypes allowed_types, QListWidget *par if (obj.value("object").isObject()) { QJsonObject activity = obj.value("object").toObject(); + bool has_attachment = false; + if (activity.contains("attachment") and not activity["attachment"].toArray().isEmpty()) + has_attachment = true; + + if (allowed_types.onlyWithAttachment and not has_attachment) + goto next_item; + if (activity.value("content").isString()) { // Strip HTML for display in list, according to https://stackoverflow.com/a/12157835 QTextDocument strip_html; strip_html.setHtml(activity.value("content").toString()); - ListItem *item = new ListItem(strip_html.toPlainText(), status_type, parent, i); + ListItem *item = new ListItem(strip_html.toPlainText(), status_type, has_attachment, parent, i); } } } |