File indexing completed on 2024-11-24 04:43:05

0001 /*
0002    SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "mergecontactloseinformationwarning.h"
0008 #include <KLocalizedString>
0009 #include <QAction>
0010 
0011 using namespace KABMergeContacts;
0012 MergeContactLoseInformationWarning::MergeContactLoseInformationWarning(QWidget *parent)
0013     : KMessageWidget(parent)
0014 {
0015     setVisible(false);
0016     setCloseButtonVisible(false);
0017     setMessageType(Information);
0018     setWordWrap(true);
0019 
0020     setText(i18n("Some information can be lost. Do you want to continue, or customize what you want to merge?"));
0021 
0022     auto action = new QAction(i18n("Customize"), this);
0023     action->setObjectName(QLatin1StringView("customize"));
0024     connect(action, &QAction::triggered, this, &MergeContactLoseInformationWarning::slotCustomizeMerge);
0025     addAction(action);
0026 
0027     action = new QAction(i18n("Automatic Merging"), this);
0028     action->setObjectName(QLatin1StringView("automatic"));
0029     connect(action, &QAction::triggered, this, &MergeContactLoseInformationWarning::slotAutomaticMerging);
0030     addAction(action);
0031 }
0032 
0033 MergeContactLoseInformationWarning::~MergeContactLoseInformationWarning() = default;
0034 
0035 void MergeContactLoseInformationWarning::slotCustomizeMerge()
0036 {
0037     animatedHide();
0038     Q_EMIT customizeMergingContacts();
0039 }
0040 
0041 void MergeContactLoseInformationWarning::slotAutomaticMerging()
0042 {
0043     animatedHide();
0044     Q_EMIT continueMerging();
0045 }
0046 
0047 #include "moc_mergecontactloseinformationwarning.cpp"