Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit f9c27da9 authored by Laurent Montel's avatar Laurent Montel 😁

Improve it

parent 8cab3999
......@@ -42,6 +42,9 @@ void GravatarCreateWidgetTest::shouldHaveDefaultValue()
QPushButton *searchGravatar = widget.findChild<QPushButton *>(QLatin1String("search"));
QVERIFY(searchGravatar);
QLabel *resultGravatar = widget.findChild<QLabel *>(QLatin1String("result"));
QVERIFY(resultGravatar);
}
void GravatarCreateWidgetTest::shouldEnableDisableSearchButton()
......
......@@ -16,7 +16,10 @@
*/
#include "gravatarupdatewidgettest.h"
#include <QLabel>
#include <QPushButton>
#include <qtest_kde.h>
#include <kaddressbook/gravatar/widgets/gravatarupdatewidget.h>
GravatarUpdateWidgetTest::GravatarUpdateWidgetTest(QObject *parent)
: QObject(parent)
{
......@@ -28,4 +31,21 @@ GravatarUpdateWidgetTest::~GravatarUpdateWidgetTest()
}
void GravatarUpdateWidgetTest::shouldHaveDefaultValue()
{
KABGravatar::GravatarUpdateWidget widget;
QLabel *lab = widget.findChild<QLabel *>(QLatin1String("emaillabel"));
QVERIFY(lab);
QLabel *emaillabel = widget.findChild<QLabel *>(QLatin1String("email"));
QVERIFY(emaillabel);
QPushButton *searchGravatar = widget.findChild<QPushButton *>(QLatin1String("search"));
QVERIFY(searchGravatar);
QLabel *resultGravatar = widget.findChild<QLabel *>(QLatin1String("result"));
QVERIFY(resultGravatar);
}
QTEST_KDEMAIN(GravatarUpdateWidgetTest, GUI)
......@@ -24,6 +24,9 @@ class GravatarUpdateWidgetTest : public QObject
public:
explicit GravatarUpdateWidgetTest(QObject *parent = 0);
~GravatarUpdateWidgetTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // GRAVATARUPDATEWIDGETTEST_H
......@@ -50,7 +50,7 @@ GravatarCreateWidget::GravatarCreateWidget(QWidget *parent)
mResultGravatar = new QLabel;
mResultGravatar->setObjectName(QLatin1String("result"));
mainLayout->addWidget(mSearchGravatar, 1, 0);
mainLayout->addWidget(mResultGravatar, 1, 0);
}
......
......@@ -17,11 +17,39 @@
#include "gravatarupdatewidget.h"
#include <QGridLayout>
#include <KLocalizedString>
#include <QLabel>
#include <QPushButton>
using namespace KABGravatar;
GravatarUpdateWidget::GravatarUpdateWidget(QWidget *parent)
: QWidget(parent)
{
QGridLayout *mainLayout = new QGridLayout;
setLayout(mainLayout);
//KF5 add i18n
QLabel *lab = new QLabel(QLatin1String("Email:"));
lab->setObjectName(QLatin1String("emaillabel"));
mainLayout->addWidget(lab, 0, 0);
mEmailLab = new QLabel;
mEmailLab->setObjectName(QLatin1String("email"));
mainLayout->addWidget(mEmailLab, 0, 1);
//KF5 add i18n
mSearchGravatar = new QPushButton(QLatin1String("Search"));
mSearchGravatar->setEnabled(false);
mSearchGravatar->setObjectName(QLatin1String("search"));
mainLayout->addWidget(mSearchGravatar, 0, 2);
connect(mSearchGravatar, SIGNAL(clicked(bool)), this, SLOT(slotSearchGravatar()));
mResultGravatar = new QLabel;
mResultGravatar->setObjectName(QLatin1String("result"));
mainLayout->addWidget(mResultGravatar, 1, 0);
updateActualGravatar();
}
GravatarUpdateWidget::~GravatarUpdateWidget()
......@@ -33,4 +61,14 @@ void GravatarUpdateWidget::setEmail(const QString &email)
mEmail = email;
}
void GravatarUpdateWidget::updateActualGravatar()
{
//TODO
}
void GravatarUpdateWidget::slotSearchGravatar()
{
//TODO
}
......@@ -19,6 +19,8 @@
#define GRAVATARUPDATEWIDGET_H
#include <QWidget>
class QLabel;
class QPushButton;
namespace KABGravatar {
class GravatarUpdateWidget : public QWidget
{
......@@ -29,8 +31,15 @@ public:
void setEmail(const QString &email);
private Q_SLOTS:
void slotSearchGravatar();
private:
void updateActualGravatar();
QString mEmail;
QLabel *mEmailLab;
QPushButton *mSearchGravatar;
QLabel *mResultGravatar;
};
}
......
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