From 006d3cec6779ee85337bbabe02a6ff859d71f656 Mon Sep 17 00:00:00 2001 From: ConfuSomu Date: Tue, 27 Dec 2022 03:58:29 -0500 Subject: Store metadata of items that are in status list There is more control and customizability of elements added to the status list, which allows us to set the icon used and also to store additional information about the status that has been selected, useful when we have to display it with more detail. --- src/archive_parser.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/archive_parser.cpp') diff --git a/src/archive_parser.cpp b/src/archive_parser.cpp index e370bcd..62edfd9 100644 --- a/src/archive_parser.cpp +++ b/src/archive_parser.cpp @@ -1,4 +1,5 @@ #include "archive_parser.h" +#include "src/list_item.h" #include "src/types.h" #include @@ -47,14 +48,14 @@ Archive::~Archive() { delete outbox_items; outbox_items = nullptr; } -QStringList Archive::get_status_list(ViewStatusTypes types) { - QStringList statuses; - +void Archive::update_status_list(ViewStatusTypes allowed_types, QListWidget *parent) { + int i = 0; for (auto&& item : *outbox_items) { if (item.isObject()){ QJsonObject obj = item.toObject(); - // TODO: check the status type + // TODO: check the status type by looking at cc field + StatusType status_type = PUBLIC; if (obj.value("object").isObject()) { QJsonObject activity = obj.value("object").toObject(); @@ -63,11 +64,11 @@ QStringList Archive::get_status_list(ViewStatusTypes types) { // Strip HTML for display in list, according to https://stackoverflow.com/a/12157835 QTextDocument strip_html; strip_html.setHtml(activity.value("content").toString()); - statuses.append(strip_html.toPlainText()); + + ListItem *item = new ListItem(strip_html.toPlainText(), status_type, parent, i); } } } + ++i; } - - return statuses; } -- cgit v1.2.3-54-g00ecf