Commit 0bf80658 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Revert "libravatar will be shutdown in september"

This reverts commit 06867985.
parent cf9f6dac
......@@ -42,8 +42,25 @@ void GravatarConfigureSettingsDialogTest::shouldHaveDefaultValue()
QVBoxLayout *topLayout = dlg.findChild<QVBoxLayout *>(QStringLiteral("toplayout"));
QVERIFY(topLayout);
QDialogButtonBox *buttonBox = dlg.findChild<QDialogButtonBox *>(QStringLiteral("buttonbox"));
QVERIFY(buttonBox);
QLabel *lab = dlg.findChild<QLabel *>(QStringLiteral("gravatarcachesizelabel"));
QVERIFY(lab);
KPluralHandlingSpinBox *gravatarCacheSize = dlg.findChild<KPluralHandlingSpinBox *>(QStringLiteral("gravatarcachesize"));
QVERIFY(gravatarCacheSize);
QCheckBox *useLibravatar = dlg.findChild<QCheckBox *>(QStringLiteral("uselibravatarcheckbox"));
QVERIFY(useLibravatar);
QVERIFY(useLibravatar->isEnabled());
QCheckBox *fallbackGravatar = dlg.findChild<QCheckBox *>(QStringLiteral("fallbackgravatar"));
QVERIFY(fallbackGravatar);
QVERIFY(!fallbackGravatar->isEnabled());
KSeparator *separator = dlg.findChild<KSeparator *>(QStringLiteral("separator"));
QVERIFY(separator);
KSeparator *separator2 = dlg.findChild<KSeparator *>(QStringLiteral("separator2"));
QVERIFY(separator2);
}
QTEST_MAIN(GravatarConfigureSettingsDialogTest)
......@@ -49,6 +49,14 @@ void GravatarDownloadPixmapWidgetTest::shouldHaveDefaultValue()
QLabel *resultLabel = w.findChild<QLabel *>(QStringLiteral("resultlabel"));
QVERIFY(resultLabel);
QCheckBox *useLibravatar = w.findChild<QCheckBox *>(QStringLiteral("uselibravatar"));
QVERIFY(useLibravatar);
QVERIFY(!useLibravatar->isChecked());
QCheckBox *fallBackGravatar = w.findChild<QCheckBox *>(QStringLiteral("fallbackgravatar"));
QVERIFY(fallBackGravatar);
QVERIFY(!fallBackGravatar->isChecked());
}
void GravatarDownloadPixmapWidgetTest::shouldChangeButtonEnableState()
......
......@@ -12,5 +12,11 @@ xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0 http://www.kde.org/sta
<entry name="GravatarCacheSize" type="Int">
<default>20</default>
</entry>
<entry name="FallbackToGravatar" type="Bool">
<default>false</default>
</entry>
<entry name="LibravatarSupportEnabled" type="Bool">
<default>false</default>
</entry>
</group>
</kcfg>
......@@ -46,9 +46,50 @@ GravatarConfigureSettingsDialog::GravatarConfigureSettingsDialog(QWidget *parent
connect(buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, &GravatarConfigureSettingsDialog::slotRestoreDefault);
okButton->setDefault(true);
mGravatarConfigureSettings = new GravatarConfigureSettingsWidget(this);
mGravatarConfigureSettings->setObjectName(QStringLiteral("gravatarconfiguresettings"));
topLayout->addWidget(mGravatarConfigureSettings);
mUseDefaultPixmap = new QCheckBox(i18n("Use Default Image"), this);
mUseDefaultPixmap->setObjectName(QStringLiteral("usedefaultimage"));
topLayout->addWidget(mUseDefaultPixmap);
mUseLibravatar = new QCheckBox(i18n("Use Libravatar"), this);
mUseLibravatar->setObjectName(QStringLiteral("uselibravatarcheckbox"));
topLayout->addWidget(mUseLibravatar);
mFallbackGravatar = new QCheckBox(i18n("Fallback to Gravatar"), this);
mFallbackGravatar->setObjectName(QStringLiteral("fallbackgravatar"));
topLayout->addWidget(mFallbackGravatar);
connect(mUseLibravatar, &QCheckBox::toggled, mFallbackGravatar, &QCheckBox::setEnabled);
mFallbackGravatar->setEnabled(false);
QHBoxLayout *cacheSizeLayout = new QHBoxLayout;
topLayout->addLayout(cacheSizeLayout);
QLabel *lab = new QLabel(i18n("Gravatar Cache Size:"), this);
lab->setObjectName(QStringLiteral("gravatarcachesizelabel"));
cacheSizeLayout->addWidget(lab);
mGravatarCacheSize = new KPluralHandlingSpinBox(this);
mGravatarCacheSize->setMinimum(1);
mGravatarCacheSize->setMaximum(9999);
mGravatarCacheSize->setSuffix(ki18ncp("add space before image", " image", " images"));
mGravatarCacheSize->setObjectName(QStringLiteral("gravatarcachesize"));
cacheSizeLayout->addWidget(mGravatarCacheSize);
cacheSizeLayout->addStretch();
KSeparator *separator = new KSeparator(this);
separator->setObjectName(QStringLiteral("separator"));
topLayout->addWidget(separator);
QHBoxLayout *buttonLayout = new QHBoxLayout;
topLayout->addLayout(buttonLayout);
mClearGravatarCache = new QPushButton(i18n("Clear Gravatar Cache"), this);
mClearGravatarCache->setObjectName(QStringLiteral("cleargravatarcachebutton"));
buttonLayout->addWidget(mClearGravatarCache);
buttonLayout->addStretch();
separator = new KSeparator(this);
separator->setObjectName(QStringLiteral("separator2"));
topLayout->addWidget(separator);
connect(mClearGravatarCache, &QAbstractButton::clicked, this, &GravatarConfigureSettingsDialog::slotClearGravatarCache);
topLayout->addWidget(buttonBox);
load();
}
......
......@@ -42,6 +42,14 @@ GravatarDownloadPixmapWidget::GravatarDownloadPixmapWidget(QWidget *parent)
connect(mLineEdit, &QLineEdit::textChanged, this, &GravatarDownloadPixmapWidget::slotTextChanged);
hbox->addWidget(mLineEdit);
mUseLibravatar = new QCheckBox(i18n("Use Libravatar"));
mUseLibravatar->setObjectName(QStringLiteral("uselibravatar"));
mainLayout->addWidget(mUseLibravatar);
mFallbackGravatar = new QCheckBox(i18n("Fallback to Gravatar"));
mFallbackGravatar->setObjectName(QStringLiteral("fallbackgravatar"));
mainLayout->addWidget(mFallbackGravatar);
mGetPixmapButton = new QPushButton(i18n("&Search"));
mGetPixmapButton->setObjectName(QStringLiteral("searchbutton"));
connect(mGetPixmapButton, &QAbstractButton::clicked, this, &GravatarDownloadPixmapWidget::slotSearchButton);
......@@ -86,6 +94,8 @@ void GravatarDownloadPixmapWidget::slotSearchButton()
job->setEmail(mLineEdit->text());
//For testing
//job->setUseDefaultPixmap(true);
job->setUseLibravatar(mUseLibravatar->isChecked());
job->setFallbackGravatar(mFallbackGravatar->isChecked());
if (job->canStart()) {
connect(job, &GravatarResolvUrlJob::finished, this, &GravatarDownloadPixmapWidget::slotResolvUrlFinish);
job->start();
......
......@@ -47,6 +47,8 @@ private:
QLabel *mResultLabel = nullptr;
QLineEdit *mLineEdit = nullptr;
QPushButton *mGetPixmapButton = nullptr;
QCheckBox *mUseLibravatar = nullptr;
QCheckBox *mFallbackGravatar = nullptr;
};
}
......
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