Messagelib

attachmentloadjob.h
1/*
2 SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "messagecore_export.h"
10
11#include "attachmentpart.h"
12
13#include <KJob>
14
15namespace MessageCore
16{
17/**
18 * @short A base class for jobs to load attachments from different sources.
19 *
20 * @author Constantin Berzan <exit3219@gmail.com>
21 */
22class MESSAGECORE_EXPORT AttachmentLoadJob : public KJob
23{
25
26public:
27 /**
28 * Creates a new attachment load job.
29 *
30 * @param parent The parent object.
31 */
32 explicit AttachmentLoadJob(QObject *parent = nullptr);
33
34 /**
35 * Destroys the attachment load job.
36 */
38
39 /**
40 * Starts the attachment load job.
41 */
42 void start() override;
43
44 /**
45 * Returns the loaded attachment.
46 */
47 [[nodiscard]] AttachmentPart::Ptr attachmentPart() const;
48
49protected:
50 /**
51 * Subclasses use this method to set the loaded @p part.
52 */
53 void setAttachmentPart(const AttachmentPart::Ptr &part);
54
55protected Q_SLOTS:
56 virtual void doStart() = 0;
57
58private:
59 //@cond PRIVATE
60 class AttachmentLoadJobPrivate;
61 std::unique_ptr<AttachmentLoadJobPrivate> const d;
62 //@endcond
63};
64}
KJob(QObject *parent=nullptr)
AttachmentPart::Ptr attachmentPart() const
Returns the loaded attachment.
void setAttachmentPart(const AttachmentPart::Ptr &part)
Subclasses use this method to set the loaded part.
AttachmentLoadJob(QObject *parent=nullptr)
Creates a new attachment load job.
~AttachmentLoadJob() override
Destroys the attachment load job.
QSharedPointer< AttachmentPart > Ptr
Defines a pointer to an attachment object.
Q_SCRIPTABLE Q_NOREPLY void start()
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 31 2025 12:05:41 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.