File indexing completed on 2024-12-29 04:54:48

0001 /*
0002   SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-only
0005 */
0006 
0007 #include "sieveinfowidget.h"
0008 
0009 #include <KLocalizedString>
0010 
0011 #include <QHBoxLayout>
0012 #include <QTextEdit>
0013 
0014 using namespace KSieveUi;
0015 SieveInfoWidget::SieveInfoWidget(QWidget *parent)
0016     : QWidget(parent)
0017     , mInfo(new QTextEdit(this))
0018 {
0019     auto lay = new QHBoxLayout(this);
0020     lay->setContentsMargins({});
0021     mInfo->setReadOnly(true);
0022     mInfo->setAcceptRichText(true);
0023     lay->addWidget(mInfo);
0024 }
0025 
0026 SieveInfoWidget::~SieveInfoWidget() = default;
0027 
0028 void SieveInfoWidget::setServerInfo(QStringList serverInfos)
0029 {
0030     serverInfos.sort();
0031     QString result = QLatin1StringView("<qt><b>") + i18n("Sieve server supports:") + QLatin1StringView("</b><ul>");
0032     for (const QString &info : std::as_const(serverInfos)) {
0033         result += QLatin1StringView("<li>") + info;
0034     }
0035     result += QLatin1StringView("</ul></qt>");
0036     mInfo->setHtml(result);
0037 }
0038 
0039 #include "moc_sieveinfowidget.cpp"