File indexing completed on 2025-01-05 04:54:22
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "knotegrantleeprint.h" 0008 #include "knoteprintobject.h" 0009 #include <KLocalizedString> 0010 0011 KNoteGrantleePrint::KNoteGrantleePrint() = default; 0012 0013 KNoteGrantleePrint::KNoteGrantleePrint(const QString &themePath) 0014 : GrantleeTheme::GenericFormatter(QStringLiteral("theme.html"), themePath) 0015 { 0016 } 0017 0018 KNoteGrantleePrint::~KNoteGrantleePrint() = default; 0019 0020 QString KNoteGrantleePrint::notesToHtml(const QList<KNotePrintObject *> &lst) 0021 { 0022 if (lst.isEmpty()) { 0023 return {}; 0024 } 0025 QVariantList notes; 0026 notes.reserve(lst.count()); 0027 for (KNotePrintObject *n : lst) { 0028 notes << QVariant::fromValue(n); 0029 } 0030 QVariantHash variantList; 0031 variantList.insert(QStringLiteral("notes"), notes); 0032 variantList.insert(QStringLiteral("alarm_i18n"), i18n("Alarm:")); 0033 variantList.insert(QStringLiteral("note_is_locked_i18n"), i18n("Note is locked")); 0034 0035 const QString htmlText = render(variantList); 0036 return htmlText; 0037 }