Commit 7c187fcf authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Continue to implement it

parent 49b06b1a
Pipeline #47641 passed with stage
in 41 minutes and 28 seconds
......@@ -9,6 +9,7 @@
#include <QTest>
#include <QFormLayout>
#include <QLineEdit>
#include <QCheckBox>
QTEST_MAIN(RemoteContentWidgetTest)
RemoteContentWidgetTest::RemoteContentWidgetTest(QObject *parent)
: QObject(parent)
......@@ -26,4 +27,7 @@ void RemoteContentWidgetTest::shouldHaveDefaultValues()
auto mLineEdit = w.findChild<QLineEdit *>(QStringLiteral("mLineEdit"));
QVERIFY(mLineEdit);
QVERIFY(mLineEdit->text().isEmpty());
auto mStatusCheckBox = w.findChild<QCheckBox *>(QStringLiteral("mStatusCheckBox"));
QVERIFY(mStatusCheckBox);
}
......@@ -10,11 +10,13 @@
#include <QLabel>
#include <KLocalizedString>
#include <QLineEdit>
#include <QCheckBox>
using namespace MessageViewer;
RemoteContentWidget::RemoteContentWidget(QWidget *parent)
: QWidget(parent)
, mLineEdit(new QLineEdit(this))
, mStatusCheckBox(new QCheckBox(i18n("Authorized"), this))
{
auto mainLayout = new QFormLayout(this);
mainLayout->setObjectName(QStringLiteral("mainLayout"));
......@@ -22,6 +24,9 @@ RemoteContentWidget::RemoteContentWidget(QWidget *parent)
mLineEdit->setObjectName(QStringLiteral("mLineEdit"));
mainLayout->addRow(i18n("Url"), mLineEdit);
mStatusCheckBox->setObjectName(QStringLiteral("mStatusCheckBox"));
mainLayout->addRow(mStatusCheckBox);
}
RemoteContentWidget::~RemoteContentWidget()
......@@ -33,14 +38,14 @@ RemoteContentInfo RemoteContentWidget::info() const
{
RemoteContentInfo info;
info.setUrl(mLineEdit->text());
//info.setStatus() TODO implement
//TODO
info.setStatus(mStatusCheckBox->isChecked() ?
RemoteContentInfo::RemoteContentInfoStatus::Authorized :
RemoteContentInfo::RemoteContentInfoStatus::Blocked);
return info;
}
void RemoteContentWidget::setInfo(const RemoteContentInfo &info)
{
mLineEdit->setText(info.url());
//mLineEdit->setText(info.status());
//TODO
mStatusCheckBox->setChecked(info.status() == RemoteContentInfo::RemoteContentInfoStatus::Authorized);
}
......@@ -11,6 +11,7 @@
#include "messageviewer_private_export.h"
#include "remotecontentinfo.h"
class QLineEdit;
class QCheckBox;
namespace MessageViewer {
class MESSAGEVIEWER_TESTS_EXPORT RemoteContentWidget : public QWidget
{
......@@ -23,6 +24,7 @@ public:
void setInfo(const RemoteContentInfo &info);
private:
QLineEdit *const mLineEdit;
QCheckBox *const mStatusCheckBox;
};
}
#endif // REMOTECONTENTWIDGET_H
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