Messagelib

quicksearchwarning.cpp
1/*
2 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "quicksearchwarning.h"
8#include "messagelistsettings.h"
9#include <KLocalizedString>
10#include <QAction>
11using namespace MessageList::Core;
12
13QuickSearchWarning::QuickSearchWarning(QWidget *parent)
14 : KMessageWidget(parent)
15{
16 setVisible(false);
17 setCloseButtonVisible(true);
18 setMessageType(Warning);
19 setWordWrap(true);
20 setPosition(KMessageWidget::Header);
21 setText(i18n("The words less than 3 letters are ignored."));
22 auto action = new QAction(i18n("Do not show again"), this);
23 action->setObjectName(QLatin1StringView("donotshowagain"));
24 connect(action, &QAction::triggered, this, &QuickSearchWarning::slotDoNotRememberIt);
25 addAction(action);
26}
27
28QuickSearchWarning::~QuickSearchWarning() = default;
29
30void QuickSearchWarning::setSearchText(const QString &text)
31{
32 if (!MessageList::MessageListSettings::quickSearchWarningDoNotShowAgain()) {
35 for (const QStringView splitText : lstText) {
36 if (splitText.trimmed().size() < 3) {
38 break;
39 }
40 }
43 } else {
45 }
46 }
47}
48
49void QuickSearchWarning::slotDoNotRememberIt()
50{
51 MessageList::MessageListSettings::setQuickSearchWarningDoNotShowAgain(true);
53}
54
55#include "moc_quicksearchwarning.cpp"
void animatedHide()
QString text() const
void animatedShow()
QString i18n(const char *text, const TYPE &arg...)
The implementation independent part of the MessageList library.
Definition aggregation.h:22
void triggered(bool checked)
T qobject_cast(QObject *object)
SkipEmptyParts
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sun Feb 25 2024 18:37:31 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.