File indexing completed on 2024-11-24 04:43:01
0001 /* 0002 SPDX-FileCopyrightText: 2015-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <Akonadi/Item> 0010 #include <QObject> 0011 #include <QUrl> 0012 namespace Gravatar 0013 { 0014 class GravatarResolvUrlJob; 0015 } 0016 namespace KABGravatar 0017 { 0018 class GravatarUpdateJob : public QObject 0019 { 0020 Q_OBJECT 0021 public: 0022 explicit GravatarUpdateJob(QObject *parent = nullptr); 0023 ~GravatarUpdateJob() override; 0024 0025 void start(); 0026 [[nodiscard]] bool canStart() const; 0027 0028 [[nodiscard]] QString email() const; 0029 void setEmail(const QString &email); 0030 0031 [[nodiscard]] Akonadi::Item item() const; 0032 void setItem(const Akonadi::Item &item); 0033 0034 Q_SIGNALS: 0035 void resolvedUrl(const QUrl &url); 0036 void gravatarPixmap(const QPixmap &pix); 0037 0038 private: 0039 void slotGravatarResolvUrlFinished(Gravatar::GravatarResolvUrlJob *job); 0040 void slotUpdateGravatarDone(KJob *job); 0041 void updatePixmap(const QPixmap &pix); 0042 QString mEmail; 0043 Akonadi::Item mItem; 0044 }; 0045 }