Commit d8cc1678 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Continue to implement custom dialogbox

parent d28352db
Pipeline #74311 passed with stage
in 53 minutes and 51 seconds
......@@ -10,7 +10,7 @@ target_sources(kmailconfirmbeforedeleting PRIVATE
confirmbeforedeletingrule.cpp
confirmbeforedeletingcreateruledialog.cpp
confirmbeforedeletingcreaterulewidget.cpp
confirmbeforedeletingmessagebox.cpp
confirmbeforedeletingmessageboxdialog.cpp
confirmbeforedeletingmessageboxwidget.cpp
)
ecm_qt_declare_logging_category(kmailconfirmbeforedeleting HEADER confirmbeforedeletingplugin_debug.h IDENTIFIER KMAIL_CONFIRMBEFOREDELETING_PLUGIN_LOG CATEGORY_NAME org.kde.pim.kmail_confirmbeforedeletingplugin
......
......@@ -15,5 +15,5 @@ add_kmail_checkbeforedeleting_unittest(confirmbeforedeletingwidgettest.cpp)
add_kmail_checkbeforedeleting_unittest(confirmbeforedeletingruletest.cpp)
add_kmail_checkbeforedeleting_unittest(confirmbeforedeletingcreaterulewidgettest.cpp)
add_kmail_checkbeforedeleting_unittest(confirmbeforedeletingcreateruledialogtest.cpp)
add_kmail_checkbeforedeleting_unittest(confirmbeforedeletingmessageboxtest.cpp)
add_kmail_checkbeforedeleting_unittest(confirmbeforedeletingmessageboxdialogtest.cpp)
add_kmail_checkbeforedeleting_unittest(confirmbeforedeletingmessageboxwidgettest.cpp)
/*
SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "confirmbeforedeletingmessageboxdialogtest.h"
#include "confirmbeforedeletingmessageboxdialog.h"
#include "confirmbeforedeletingmessageboxwidget.h"
#include <QDialogButtonBox>
#include <QTest>
#include <QVBoxLayout>
QTEST_MAIN(ConfirmBeforeDeletingMessageBoxDialogTest)
ConfirmBeforeDeletingMessageBoxDialogTest::ConfirmBeforeDeletingMessageBoxDialogTest(QObject *parent)
: QObject(parent)
{
}
void ConfirmBeforeDeletingMessageBoxDialogTest::shouldHaveDefaultValues()
{
ConfirmBeforeDeletingMessageBoxDialog d;
QVERIFY(!d.windowTitle().isEmpty());
auto mainLayout = d.findChild<QVBoxLayout *>(QStringLiteral("mainLayout"));
QVERIFY(mainLayout);
auto mConfirmBeforeDeletingWidget = d.findChild<ConfirmBeforeDeletingMessageBoxWidget *>(QStringLiteral("mConfirmBeforeDeletingWidget"));
QVERIFY(mConfirmBeforeDeletingWidget);
auto buttonBox = d.findChild<QDialogButtonBox *>(QStringLiteral("buttonBox"));
QVERIFY(buttonBox);
}
......@@ -8,12 +8,12 @@
#include <QObject>
class ConfirmBeforeDeletingMessageBoxTest : public QObject
class ConfirmBeforeDeletingMessageBoxDialogTest : public QObject
{
Q_OBJECT
public:
explicit ConfirmBeforeDeletingMessageBoxTest(QObject *parent = nullptr);
~ConfirmBeforeDeletingMessageBoxTest() override = default;
explicit ConfirmBeforeDeletingMessageBoxDialogTest(QObject *parent = nullptr);
~ConfirmBeforeDeletingMessageBoxDialogTest() override = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
};
/*
SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "confirmbeforedeletingmessageboxtest.h"
#include "confirmbeforedeletingmessagebox.h"
#include <QTest>
#include <QVBoxLayout>
QTEST_MAIN(ConfirmBeforeDeletingMessageBoxTest)
ConfirmBeforeDeletingMessageBoxTest::ConfirmBeforeDeletingMessageBoxTest(QObject *parent)
: QObject(parent)
{
}
void ConfirmBeforeDeletingMessageBoxTest::shouldHaveDefaultValues()
{
ConfirmBeforeDeletingMessageBox d;
// TODO
}
/*
SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "confirmbeforedeletingmessagebox.h"
#include <QVBoxLayout>
ConfirmBeforeDeletingMessageBox::ConfirmBeforeDeletingMessageBox(QWidget *parent)
: QDialog(parent)
{
auto mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
}
ConfirmBeforeDeletingMessageBox::~ConfirmBeforeDeletingMessageBox()
{
}
/*
SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: LGPL-2.0-or-later
*/
#include "confirmbeforedeletingmessageboxdialog.h"
#include "confirmbeforedeletingmessageboxwidget.h"
#include <KLocalizedString>
#include <QDialogButtonBox>
#include <QVBoxLayout>
ConfirmBeforeDeletingMessageBoxDialog::ConfirmBeforeDeletingMessageBoxDialog(QWidget *parent)
: QDialog(parent)
, mConfirmBeforeDeletingWidget(new ConfirmBeforeDeletingMessageBoxWidget(this))
{
setWindowTitle(i18nc("@title:window", "Confirm Delete Mail"));
auto mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mConfirmBeforeDeletingWidget->setObjectName(QStringLiteral("mConfirmBeforeDeletingWidget"));
mainLayout->addWidget(mConfirmBeforeDeletingWidget);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::Cancel | QDialogButtonBox::No, this);
buttonBox->setObjectName(QStringLiteral("buttonBox"));
mainLayout->addWidget(buttonBox);
connect(buttonBox, &QDialogButtonBox::accepted, this, &ConfirmBeforeDeletingMessageBoxDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &ConfirmBeforeDeletingMessageBoxDialog::reject);
}
ConfirmBeforeDeletingMessageBoxDialog::~ConfirmBeforeDeletingMessageBoxDialog()
{
}
void ConfirmBeforeDeletingMessageBoxDialog::setInfo(const QString &str)
{
// TODO
}
......@@ -7,10 +7,15 @@
#include "confirmbeforedeleting_private_export.h"
#include <QDialog>
class KMAILCONFIRMBEFOREDELETING_TESTS_EXPORT ConfirmBeforeDeletingMessageBox : public QDialog
class ConfirmBeforeDeletingMessageBoxWidget;
class KMAILCONFIRMBEFOREDELETING_TESTS_EXPORT ConfirmBeforeDeletingMessageBoxDialog : public QDialog
{
Q_OBJECT
public:
explicit ConfirmBeforeDeletingMessageBox(QWidget *parent = nullptr);
~ConfirmBeforeDeletingMessageBox() override;
explicit ConfirmBeforeDeletingMessageBoxDialog(QWidget *parent = nullptr);
~ConfirmBeforeDeletingMessageBoxDialog() override;
void setInfo(const QString &str);
private:
ConfirmBeforeDeletingMessageBoxWidget *const mConfirmBeforeDeletingWidget;
};
......@@ -5,10 +5,13 @@
*/
#include "confirmbeforedeletingmessageboxwidget.h"
#include <QVBoxLayout>
ConfirmBeforeDeletingMessageBoxWidget::ConfirmBeforeDeletingMessageBoxWidget(QWidget *parent)
: QWidget(parent)
{
auto mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
}
ConfirmBeforeDeletingMessageBoxWidget::~ConfirmBeforeDeletingMessageBoxWidget()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment