File indexing completed on 2024-05-12 05:12:55

0001 /*
0002   SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <QObject>
0010 #include <QUrl>
0011 
0012 #include "akregator_export.h"
0013 class QTemporaryFile;
0014 class KJob;
0015 namespace MimeTreeParser
0016 {
0017 class AttachmentTemporaryFilesDirs;
0018 }
0019 namespace Akregator
0020 {
0021 class AKREGATOR_EXPORT DownloadArticleJob : public QObject
0022 {
0023     Q_OBJECT
0024 public:
0025     explicit DownloadArticleJob(QObject *parent = nullptr);
0026     ~DownloadArticleJob() override;
0027 
0028     void start();
0029 
0030     void setArticleUrl(const QUrl &articleUrl);
0031     void setTitle(const QString &title);
0032 
0033     void forceCleanupTemporaryFile();
0034 
0035     void setText(const QString &text);
0036 
0037 private Q_SLOTS:
0038     void slotUrlSaveResult(KJob *job);
0039 
0040 private:
0041     void sendAttachment();
0042     QUrl mArticleUrl;
0043     QString mTitle;
0044     QString mText;
0045     QTemporaryFile *mTemporaryFile = nullptr;
0046     MimeTreeParser::AttachmentTemporaryFilesDirs *mAttachmentTemporaryFile = nullptr;
0047 };
0048 }