Libksieve

sieveinfowidget.cpp
1/*
2 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-only
5*/
6
7#include "sieveinfowidget.h"
8
9#include <KLocalizedString>
10
11#include <QHBoxLayout>
12#include <QTextEdit>
13
14using namespace KSieveUi;
15SieveInfoWidget::SieveInfoWidget(QWidget *parent)
16 : QWidget(parent)
17 , mInfo(new QTextEdit(this))
18{
19 auto lay = new QHBoxLayout(this);
20 lay->setContentsMargins({});
21 mInfo->setReadOnly(true);
22 mInfo->setAcceptRichText(true);
23 lay->addWidget(mInfo);
24}
25
26SieveInfoWidget::~SieveInfoWidget() = default;
27
28void SieveInfoWidget::setServerInfo(const QStringList &serverInfos)
29{
30 QString result = QLatin1StringView("<qt><b>") + i18n("Sieve server supports:") + QLatin1StringView("</b><ul>");
31 for (const QString &info : std::as_const(serverInfos)) {
32 result += QLatin1StringView("<li>") + info;
33 }
34 result += QLatin1StringView("</ul></qt>");
35 mInfo->setHtml(result);
36}
37
38#include "moc_sieveinfowidget.cpp"
QString i18n(const char *text, const TYPE &arg...)
void setHtml(const QString &text)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:14:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.