File indexing completed on 2025-01-05 04:49:50

0001 /*
0002    SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "selectimapwidgettest.h"
0008 #include <KPluginFactory>
0009 #include <QDebug>
0010 #include <QHBoxLayout>
0011 #include <QLabel>
0012 
0013 SelectImapWidgetTest::SelectImapWidgetTest(QWidget *parent)
0014     : QWidget(parent)
0015 {
0016     setWindowTitle(QStringLiteral("Test AbstractMoveImapFolderWidget plugin"));
0017     auto mainLayout = new QHBoxLayout(this);
0018 
0019     KSieveUi::AbstractMoveImapFolderWidget *lineEdit = nullptr;
0020     const KPluginMetaData editWidgetPlugin(QStringLiteral("pim6/libksieve/imapfoldercompletionplugin"));
0021 
0022     const auto result = KPluginFactory::instantiatePlugin<KSieveUi::AbstractMoveImapFolderWidget>(editWidgetPlugin);
0023     if (result) {
0024         lineEdit = result.plugin;
0025     } else {
0026         lineEdit = new DefaultMoveImapFolderWidget(this);
0027         // qDebug() << " error during load : " << loader.errorString();
0028     }
0029     mainLayout->addWidget(lineEdit);
0030 }
0031 
0032 SelectImapWidgetTest::~SelectImapWidgetTest() = default;
0033 
0034 DefaultMoveImapFolderWidget::DefaultMoveImapFolderWidget(QWidget *parent)
0035     : KSieveUi::AbstractMoveImapFolderWidget(parent)
0036 {
0037     auto mainLayout = new QHBoxLayout(this);
0038     auto label = new QLabel(QStringLiteral("Problem during loading plugin! Please verify your installation."));
0039     mainLayout->addWidget(label);
0040 }
0041 
0042 void DefaultMoveImapFolderWidget::setText(const QString &str)
0043 {
0044     Q_UNUSED(str)
0045 }
0046 
0047 QString DefaultMoveImapFolderWidget::text() const
0048 {
0049     return {};
0050 }
0051 
0052 void DefaultMoveImapFolderWidget::setSieveImapAccountSettings(const KSieveCore::SieveImapAccountSettings &account)
0053 {
0054     Q_UNUSED(account)
0055 }
0056 
0057 #include "moc_selectimapwidgettest.cpp"