/* * qtmaildir - a Qt6 mail client for notmuch-indexed Maildirs * Copyright (C) 2026 Danilo M. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once #include #include #include #include struct ThreadSummary { QString threadId; QString subject; QString authors; QDateTime date; int totalCount = 0; int matchedCount = 0; QStringList tags; bool isUnread() const { return tags.contains(QStringLiteral("unread")); } bool isFlagged() const { return tags.contains(QStringLiteral("flagged")); } bool isDeleted() const { return tags.contains(QStringLiteral("deleted")); } bool isSpam() const { return tags.contains(QStringLiteral("spam")); } /// True while the thread is tagged for removal. notmuch deletes nothing /// itself: the tag marks the thread for whatever the user's sync script /// does next, so the row has to show it is on its way out. bool isDoomed() const { return isDeleted() || isSpam(); } }; struct MessageRef { QString messageId; QString filePath; QStringList tags; /// True when the message itself matched the user's query, as opposed to /// being pulled in only because a sibling in its thread matched. Drives /// whether it renders expanded or as a stub. bool matched = true; }; /// One tag mutation, kept so it can be inverted for undo. struct TagChange { QStringList messageIds; QStringList added; QStringList removed; QString description; ///< Shown in the undo action's text. TagChange inverted() const { return TagChange{ messageIds, removed, added, QStringLiteral("Undo %1").arg(description) }; } }; Q_DECLARE_METATYPE(ThreadSummary) Q_DECLARE_METATYPE(MessageRef) Q_DECLARE_METATYPE(TagChange)