File indexing completed on 2024-12-22 04:52:48

0001 /*
0002    SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "importwizardfilterinfogui.h"
0008 #include <KMessageBox>
0009 #include <QApplication>
0010 
0011 ImportWizardFilterInfoGui::ImportWizardFilterInfoGui(ManualImportMailPage *dlg, QWidget *parent)
0012     : MailImporter::FilterInfoGui()
0013     , m_parent(parent)
0014     , mManualImportMailPage(dlg)
0015 {
0016 }
0017 
0018 ImportWizardFilterInfoGui::~ImportWizardFilterInfoGui() = default;
0019 
0020 void ImportWizardFilterInfoGui::setStatusMessage(const QString &status)
0021 {
0022     mManualImportMailPage->widget()->mMailImporterWidget->setStatusMessage(status);
0023 }
0024 
0025 void ImportWizardFilterInfoGui::setFrom(const QString &from)
0026 {
0027     mManualImportMailPage->widget()->mMailImporterWidget->setFrom(from);
0028 }
0029 
0030 void ImportWizardFilterInfoGui::setTo(const QString &to)
0031 {
0032     mManualImportMailPage->widget()->mMailImporterWidget->setTo(to);
0033 }
0034 
0035 void ImportWizardFilterInfoGui::setCurrent(const QString &current)
0036 {
0037     mManualImportMailPage->widget()->mMailImporterWidget->setCurrent(current);
0038     qApp->processEvents();
0039 }
0040 
0041 void ImportWizardFilterInfoGui::setCurrent(int percent)
0042 {
0043     mManualImportMailPage->widget()->mMailImporterWidget->setCurrent(percent);
0044     qApp->processEvents(); // Be careful - back & finish buttons disabled, so only user event that can happen is cancel/close button
0045 }
0046 
0047 void ImportWizardFilterInfoGui::setOverall(int percent)
0048 {
0049     mManualImportMailPage->widget()->mMailImporterWidget->setOverall(percent);
0050 }
0051 
0052 void ImportWizardFilterInfoGui::addInfoLogEntry(const QString &log)
0053 {
0054     mManualImportMailPage->widget()->mMailImporterWidget->addInfoLogEntry(log);
0055     mManualImportMailPage->widget()->mMailImporterWidget->setLastCurrentItem();
0056     qApp->processEvents();
0057 }
0058 
0059 void ImportWizardFilterInfoGui::addErrorLogEntry(const QString &log)
0060 {
0061     mManualImportMailPage->widget()->mMailImporterWidget->addErrorLogEntry(log);
0062     mManualImportMailPage->widget()->mMailImporterWidget->setLastCurrentItem();
0063     qApp->processEvents();
0064 }
0065 
0066 void ImportWizardFilterInfoGui::clear()
0067 {
0068     mManualImportMailPage->widget()->mMailImporterWidget->clear();
0069 }
0070 
0071 void ImportWizardFilterInfoGui::alert(const QString &message)
0072 {
0073     KMessageBox::information(m_parent, message);
0074 }
0075 
0076 QWidget *ImportWizardFilterInfoGui::parent() const
0077 {
0078     return m_parent;
0079 }