File indexing completed on 2025-03-09 04:54:12
0001 /* 0002 SPDX-FileCopyrightText: 2011 Martin Bednár <serafean@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "messagecore_export.h" 0010 0011 #include "attachmentloadjob.h" 0012 0013 #include <QUrl> 0014 #include <memory> 0015 namespace MessageCore 0016 { 0017 /** 0018 * @brief The AttachmentFromUrlBaseJob class 0019 */ 0020 class MESSAGECORE_EXPORT AttachmentFromUrlBaseJob : public AttachmentLoadJob 0021 { 0022 Q_OBJECT 0023 0024 public: 0025 explicit AttachmentFromUrlBaseJob(const QUrl &url = QUrl(), QObject *parent = nullptr); 0026 ~AttachmentFromUrlBaseJob() override; 0027 0028 /** 0029 * Returns the url that will be loaded as attachment. 0030 */ 0031 [[nodiscard]] QUrl url() const; 0032 0033 /** 0034 * Returns the maximum size the attachment is allowed to have. 0035 */ 0036 [[nodiscard]] qint64 maximumAllowedSize() const; 0037 0038 /** 0039 * Sets the @p url of the folder that will be loaded as attachment. 0040 */ 0041 void setUrl(const QUrl &url); 0042 0043 /** 0044 * Sets the maximum @p size the attachment is allowed to have. 0045 */ 0046 void setMaximumAllowedSize(qint64 size); 0047 0048 protected Q_SLOTS: 0049 void doStart() override = 0; 0050 0051 private: 0052 //@cond PRIVATE 0053 class AttachmentFromUrlBaseJobPrivate; 0054 std::unique_ptr<AttachmentFromUrlBaseJobPrivate> const d; 0055 }; 0056 }