File indexing completed on 2025-01-05 04:58:20
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 0006 */ 0007 0008 #include "blacklistbalooemailwarning.h" 0009 #include <KLocalizedString> 0010 #include <QAction> 0011 0012 using namespace PimCommon; 0013 0014 BlackListBalooEmailWarning::BlackListBalooEmailWarning(QWidget *parent) 0015 : KMessageWidget(parent) 0016 { 0017 setVisible(false); 0018 setCloseButtonVisible(false); 0019 setMessageType(Warning); 0020 setWordWrap(true); 0021 0022 setText(i18n("The list was changed. Do you want to save before to make another search ?")); 0023 auto saveAction = new QAction(i18n("Save"), this); 0024 saveAction->setObjectName(QLatin1StringView("saveblacklist")); 0025 connect(saveAction, &QAction::triggered, this, &BlackListBalooEmailWarning::slotSaveBlackList); 0026 addAction(saveAction); 0027 0028 auto searchAction = new QAction(i18n("Search"), this); 0029 searchAction->setObjectName(QLatin1StringView("search")); 0030 connect(searchAction, &QAction::triggered, this, &BlackListBalooEmailWarning::slotSearch); 0031 addAction(searchAction); 0032 0033 auto cancelAction = new QAction(i18n("Cancel"), this); 0034 cancelAction->setObjectName(QLatin1StringView("cancel")); 0035 connect(cancelAction, &QAction::triggered, this, &BlackListBalooEmailWarning::animatedHide); 0036 addAction(cancelAction); 0037 } 0038 0039 BlackListBalooEmailWarning::~BlackListBalooEmailWarning() = default; 0040 0041 void BlackListBalooEmailWarning::slotSaveBlackList() 0042 { 0043 animatedHide(); 0044 Q_EMIT saveChanges(); 0045 } 0046 0047 void BlackListBalooEmailWarning::slotSearch() 0048 { 0049 animatedHide(); 0050 Q_EMIT newSearch(); 0051 } 0052 0053 #include "moc_blacklistbalooemailwarning.cpp"