Commit 8b57daaa authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Continue to implement dialogbox

parent d8cc1678
Pipeline #74331 passed with stage
in 55 minutes and 11 seconds
......@@ -5,9 +5,35 @@
*/
#include "confirmbeforedeletingmessageboxwidgettest.h"
#include "confirmbeforedeletingmessageboxwidget.h"
#include <QCheckBox>
#include <QLabel>
#include <QTest>
#include <QVBoxLayout>
QTEST_MAIN(ConfirmBeforeDeletingMessageBoxWidgetTest)
ConfirmBeforeDeletingMessageBoxWidgetTest::ConfirmBeforeDeletingMessageBoxWidgetTest(QObject *parent)
: QObject(parent)
{
}
void ConfirmBeforeDeletingMessageBoxWidgetTest::shouldHaveDefaultValues()
{
ConfirmBeforeDeletingMessageBoxWidget w;
// TODO
#if 0
, mLabelInfo(new QLabel(this))
, mUseSameResultForOtherCheck(new QCheckBox(i18n("Reuse..."), this)) //TODO fix i18n
{
auto mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mainLayout->setContentsMargins({});
mLabelInfo->setObjectName(QStringLiteral("mLabelInfo"));
mLabelInfo->setWordWrap(true);
mainLayout->addWidget(mLabelInfo);
mUseSameResultForOtherCheck->setObjectName(QStringLiteral("mUseSameResultForOtherCheck"));
mainLayout->addWidget(mUseSameResultForOtherCheck);
#endif
}
......@@ -13,4 +13,6 @@ class ConfirmBeforeDeletingMessageBoxWidgetTest : public QObject
public:
explicit ConfirmBeforeDeletingMessageBoxWidgetTest(QObject *parent = nullptr);
~ConfirmBeforeDeletingMessageBoxWidgetTest() override = default;
private Q_SLOTS:
void shouldHaveDefaultValues();
};
......@@ -34,5 +34,10 @@ ConfirmBeforeDeletingMessageBoxDialog::~ConfirmBeforeDeletingMessageBoxDialog()
void ConfirmBeforeDeletingMessageBoxDialog::setInfo(const QString &str)
{
// TODO
mConfirmBeforeDeletingWidget->setInfo(str);
}
bool ConfirmBeforeDeletingMessageBoxDialog::useSameResult() const
{
return mConfirmBeforeDeletingWidget->useSameResult();
}
......@@ -16,6 +16,8 @@ public:
~ConfirmBeforeDeletingMessageBoxDialog() override;
void setInfo(const QString &str);
Q_REQUIRED_RESULT bool useSameResult() const;
private:
ConfirmBeforeDeletingMessageBoxWidget *const mConfirmBeforeDeletingWidget;
};
......@@ -5,15 +5,39 @@
*/
#include "confirmbeforedeletingmessageboxwidget.h"
#include <QCheckBox>
#include <QLabel>
#include <QVBoxLayout>
#include <KLocalizedString>
ConfirmBeforeDeletingMessageBoxWidget::ConfirmBeforeDeletingMessageBoxWidget(QWidget *parent)
: QWidget(parent)
, mLabelInfo(new QLabel(this))
, mUseSameResultForOtherCheck(new QCheckBox(i18n("Reuse..."), this)) // TODO fix i18n
{
auto mainLayout = new QVBoxLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
mainLayout->setContentsMargins({});
mLabelInfo->setObjectName(QStringLiteral("mLabelInfo"));
mLabelInfo->setWordWrap(true);
mainLayout->addWidget(mLabelInfo);
mUseSameResultForOtherCheck->setObjectName(QStringLiteral("mUseSameResultForOtherCheck"));
mainLayout->addWidget(mUseSameResultForOtherCheck);
}
ConfirmBeforeDeletingMessageBoxWidget::~ConfirmBeforeDeletingMessageBoxWidget()
{
}
void ConfirmBeforeDeletingMessageBoxWidget::setInfo(const QString &str)
{
mLabelInfo->setText(str);
}
bool ConfirmBeforeDeletingMessageBoxWidget::useSameResult() const
{
return mUseSameResultForOtherCheck->isChecked();
}
......@@ -8,11 +8,19 @@
#include <QWidget>
#include "confirmbeforedeleting_private_export.h"
class QLabel;
class QCheckBox;
class KMAILCONFIRMBEFOREDELETING_TESTS_EXPORT ConfirmBeforeDeletingMessageBoxWidget : public QWidget
{
Q_OBJECT
public:
explicit ConfirmBeforeDeletingMessageBoxWidget(QWidget *parent = nullptr);
~ConfirmBeforeDeletingMessageBoxWidget() override;
void setInfo(const QString &str);
Q_REQUIRED_RESULT bool useSameResult() const;
private:
QLabel *const mLabelInfo;
QCheckBox *const mUseSameResultForOtherCheck;
};
Supports Markdown
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