Libksieve

sieveinfowidget.cpp
1 /*
2  Copyright (C) 2013-2020 Laurent Montel <[email protected]>
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License, version 2, as
6  published by the Free Software Foundation.
7 
8  This program is distributed in the hope that it will be useful, but
9  WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License along
14  with this program; if not, write to the Free Software Foundation, Inc.,
15  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #include "sieveinfowidget.h"
19 
20 #include <KLocalizedString>
21 
22 #include <QHBoxLayout>
23 #include <QTextEdit>
24 
25 using namespace KSieveUi;
26 SieveInfoWidget::SieveInfoWidget(QWidget *parent)
27  : QWidget(parent)
28 {
29  QHBoxLayout *lay = new QHBoxLayout(this);
30  lay->setContentsMargins(0, 0, 0, 0);
31  mInfo = new QTextEdit(this);
32  mInfo->setReadOnly(true);
33  mInfo->setAcceptRichText(true);
34  lay->addWidget(mInfo);
35 }
36 
37 SieveInfoWidget::~SieveInfoWidget()
38 {
39 }
40 
41 void SieveInfoWidget::setServerInfo(QStringList serverInfos)
42 {
43  serverInfos.sort();
44  QString result = QLatin1String("<qt><b>") + i18n("Sieve server supports:") + QLatin1String("</b><ul>");
45  for (const QString &info : qAsConst(serverInfos)) {
46  result += QLatin1String("<li>") + info;
47  }
48  result += QLatin1String("</ul></qt>");
49  mInfo->setHtml(result);
50 }
void setContentsMargins(int left, int top, int right, int bottom)
void addWidget(QWidget *widget, int stretch, Qt::Alignment alignment)
QString i18n(const char *text, const TYPE &arg...)
void sort(Qt::CaseSensitivity cs)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sun May 31 2020 22:46:48 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.