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

improve gravatar support. Create application test

parent e42ee4aa
......@@ -164,6 +164,7 @@ add_subdirectory(sendmail/tests)
add_subdirectory(sendvcards/autotests)
add_subdirectory(printing/grantlee/autotests)
add_subdirectory(gravatar/autotests)
add_subdirectory(gravatar/tests)
if(QGPGME_FOUND)
target_link_libraries(kaddressbookprivate ${QGPGME_LIBRARIES})
......
......@@ -10,4 +10,5 @@ add_akonadi_isolated_test_advanced( gravatarcreatejobtest.cpp "../job/gravatarcr
add_akonadi_isolated_test_advanced( gravatarupdatejobtest.cpp "../job/gravatarupdatejob.cpp" "kaddressbookprivate;pimcommon;kabc")
add_akonadi_isolated_test_advanced( gravatarcreatewidgettest.cpp "../widgets/gravatarcreatewidget.cpp" "kaddressbookprivate;pimcommon")
add_akonadi_isolated_test_advanced( gravatarcreatedialogtest.cpp "../widgets/gravatarcreatedialog.cpp;../widgets/gravatarcreatewidget.cpp" "kaddressbookprivate;pimcommon")
add_akonadi_isolated_test_advanced( gravatarupdatedialogtest.cpp "../widgets/gravatarupdatedialog.cpp;../widgets/gravatarupdatewidget.cpp" "kaddressbookprivate;pimcommon")
add_akonadi_isolated_test_advanced( gravatarupdatewidgettest.cpp "../widgets/gravatarupdatewidget.cpp" "kaddressbookprivate;pimcommon")
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "gravatarupdatedialogtest.h"
#include "../widgets/gravatarupdatedialog.h"
#include "../widgets/gravatarupdatewidget.h"
#include <QDialogButtonBox>
#include <qtest_kde.h>
GravatarUpdateDialogTest::GravatarUpdateDialogTest(QObject *parent)
: QObject(parent)
{
}
GravatarUpdateDialogTest::~GravatarUpdateDialogTest()
{
}
void GravatarUpdateDialogTest::shouldHaveDefaultValue()
{
KABGravatar::GravatarUpdateDialog dlg;
KABGravatar::GravatarUpdateWidget *w = dlg.findChild<KABGravatar::GravatarUpdateWidget *>(QLatin1String("gravatarupdatewidget"));
QVERIFY(w);
QDialogButtonBox *buttonBox = dlg.findChild<QDialogButtonBox *>(QLatin1String("buttonbox"));
QVERIFY(buttonBox);
}
QTEST_KDEMAIN(GravatarUpdateDialogTest, GUI)
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef GRAVATARUPDATEDIALOGTEST_H
#define GRAVATARUPDATEDIALOGTEST_H
#include <QObject>
class GravatarUpdateDialogTest : public QObject
{
Q_OBJECT
public:
explicit GravatarUpdateDialogTest(QObject *parent = 0);
~GravatarUpdateDialogTest();
private Q_SLOTS:
void shouldHaveDefaultValue();
};
#endif // GRAVATARUPDATEDIALOGTEST_H
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "gravatarupdatewidgettest.h"
#include <qtest_kde.h>
GravatarUpdateWidgetTest::GravatarUpdateWidgetTest(QObject *parent)
: QObject(parent)
{
}
GravatarUpdateWidgetTest::~GravatarUpdateWidgetTest()
{
}
QTEST_KDEMAIN(GravatarUpdateWidgetTest, GUI)
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef GRAVATARUPDATEWIDGETTEST_H
#define GRAVATARUPDATEWIDGETTEST_H
#include <QObject>
class GravatarUpdateWidgetTest : public QObject
{
Q_OBJECT
public:
explicit GravatarUpdateWidgetTest(QObject *parent = 0);
~GravatarUpdateWidgetTest();
};
#endif // GRAVATARUPDATEWIDGETTEST_H
include_directories(${CMAKE_SOURCE_DIR}/kaddressbook/
)
set(gravatarcreatedialog_gui_SRCS gravatarcreatedialog_gui.cpp ../widgets/gravatarcreatedialog.cpp ../widgets/gravatarcreatewidget.cpp ../job/gravatarcreatejob.cpp)
kde4_add_executable(gravatarcreatedialog_gui TEST ${gravatarcreatedialog_gui_SRCS})
target_link_libraries(gravatarcreatedialog_gui
${QT_QTGUI_LIBRARY}
${KDE4_KDECORE_LIBS}
${KDE4_KDEUI_LIBS}
pimcommon
)
/*
Copyright (c) 2015 Montel Laurent <montel@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "../widgets/gravatarcreatedialog.h"
#include <KLocalizedString>
#include <QApplication>
int main (int argc, char **argv)
{
QApplication app(argc, argv);
KABGravatar::GravatarCreateDialog *w = new KABGravatar::GravatarCreateDialog;
w->show();
app.exec();
delete w;
return 0;
}
......@@ -46,6 +46,11 @@ GravatarCreateWidget::GravatarCreateWidget(QWidget *parent)
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(mSearchGravatar, 1, 0);
}
......@@ -78,8 +83,10 @@ void GravatarCreateWidget::slotSearchGravatarFinished(PimCommon::GravatarResolvU
{
if (job) {
if (job->hasGravatar()) {
//TODO show gravatar result!
mResultGravatar->setPixmap(job->pixmap());
} else {
//KF5 add i18n
mResultGravatar->setText(QLatin1String("No Gravatar Found."));
}
}
//TODO
}
......@@ -41,6 +41,7 @@ private:
QString mEmail;
QLabel *mEmailLab;
QPushButton *mSearchGravatar;
QLabel *mResultGravatar;
};
}
......
......@@ -16,17 +16,27 @@
*/
#include "gravatarupdatedialog.h"
#include "gravatarupdatewidget.h"
#include <QVBoxLayout>
#include <KLocalizedString>
#include <KConfigGroup>
#include <KGlobal>
#include <KSharedConfig>
#include <QDialogButtonBox>
using namespace KABGravatar;
GravatarUpdateDialog::GravatarUpdateDialog(QWidget *parent)
: QDialog(parent)
{
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mGravatarUpdateWidget = new GravatarUpdateWidget(this);
mGravatarUpdateWidget->setObjectName(QLatin1String("gravatarupdatewidget"));
mainLayout->addWidget(mGravatarUpdateWidget);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
buttonBox->setObjectName(QLatin1String("buttonbox"));
mainLayout->addWidget(buttonBox);
readConfig();
}
......
......@@ -20,6 +20,7 @@
#include <QDialog>
namespace KABGravatar {
class GravatarUpdateWidget;
class GravatarUpdateDialog : public QDialog
{
Q_OBJECT
......@@ -29,6 +30,7 @@ public:
private:
void readConfig();
void writeConfig();
GravatarUpdateWidget *mGravatarUpdateWidget;
};
}
#endif // GRAVATARUPDATEDIALOG_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