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 b6c1a3ad authored by Laurent Montel's avatar Laurent Montel 😁

Now we can see gravatar

parent e5f54da8
......@@ -48,6 +48,10 @@ void GravatarDownloadPixmapWidgetTest::shouldHaveDefaultValue()
QPushButton *getPixmapButton = qFindChild<QPushButton *>(&w, QLatin1String("searchbutton"));
QVERIFY(getPixmapButton);
QVERIFY(!getPixmapButton->isEnabled());
QLabel *resultLabel = qFindChild<QLabel *>(&w, QLatin1String("resultlabel"));
QVERIFY(resultLabel);
}
void GravatarDownloadPixmapWidgetTest::shouldChangeButtonEnableState()
......
......@@ -47,6 +47,10 @@ GravatarDownloadPixmapWidget::GravatarDownloadPixmapWidget(QWidget *parent)
connect(mGetPixmapButton, SIGNAL(clicked(bool)), this, SLOT(slotSearchButton()));
hbox->addWidget(mGetPixmapButton);
mGetPixmapButton->setEnabled(false);
mResultLabel = new QLabel;
mResultLabel->setObjectName(QLatin1String("resultlabel"));
mainLayout->addWidget(mResultLabel);
}
GravatarDownloadPixmapWidget::~GravatarDownloadPixmapWidget()
......@@ -58,14 +62,21 @@ void GravatarDownloadPixmapWidget::slotResolvUrlFinish(PimCommon::GravatarResolv
{
if (job) {
qDebug() << job->hasGravatar();
if (job->hasGravatar()) {
mResultLabel->setPixmap(job->pixmap());
} else {
//KF5 add i18n
mResultLabel->setText(QLatin1String("No gravatar found."));
}
}
//TODO
}
void GravatarDownloadPixmapWidget::slotSearchButton()
{
PimCommon::GravatarResolvUrlJob *job = new PimCommon::GravatarResolvUrlJob(this);
job->setEmail(mLineEdit->text());
//For testing
//job->setUseDefaultPixmap(true);
if (job->canStart()) {
connect(job, SIGNAL(finished(PimCommon::GravatarResolvUrlJob*)), this, SLOT(slotResolvUrlFinish(PimCommon::GravatarResolvUrlJob*)));
job->start();
......
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