File indexing completed on 2024-12-22 05:01:14

0001 /*
0002    SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "searchpatternwarning.h"
0008 
0009 #include <KLocalizedString>
0010 
0011 using namespace KMail;
0012 SearchPatternWarning::SearchPatternWarning(QWidget *parent)
0013     : KMessageWidget(parent)
0014 {
0015     setVisible(false);
0016     setCloseButtonVisible(true);
0017     setMessageType(Information);
0018     setWordWrap(true);
0019 }
0020 
0021 SearchPatternWarning::~SearchPatternWarning() = default;
0022 
0023 void SearchPatternWarning::setError(const QStringList &lstError)
0024 {
0025     setText(i18n("Search failed some errors were found: <ul><li>%1</li></ul>", lstError.join(QLatin1StringView("</li><li>"))));
0026 }
0027 
0028 void SearchPatternWarning::showWarningPattern(const QStringList &lstError)
0029 {
0030     setError(lstError);
0031     animatedShow();
0032 }
0033 
0034 void SearchPatternWarning::hideWarningPattern()
0035 {
0036     setText(QString());
0037     animatedHide();
0038 }
0039 
0040 #include "moc_searchpatternwarning.cpp"