Messagelib

attachmentloadjob.h
1 /*
2  SPDX-FileCopyrightText: 2009 Constantin Berzan <[email protected]>
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 
15 namespace MessageCore
16 {
17 /**
18  * @short A base class for jobs to load attachments from different sources.
19  *
20  * @author Constantin Berzan <[email protected]>
21  */
22 class MESSAGECORE_EXPORT AttachmentLoadJob : public KJob
23 {
24  Q_OBJECT
25 
26 public:
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  */
37  ~AttachmentLoadJob() override;
38 
39  /**
40  * Starts the attachment load job.
41  */
42  void start() override;
43 
44  /**
45  * Returns the loaded attachment.
46  */
47  Q_REQUIRED_RESULT AttachmentPart::Ptr attachmentPart() const;
48 
49 protected:
50  /**
51  * Subclasses use this method to set the loaded @p part.
52  */
53  void setAttachmentPart(const AttachmentPart::Ptr &part);
54 
55 protected Q_SLOTS:
56  virtual void doStart() = 0;
57 
58 private:
59  //@cond PRIVATE
60  class AttachmentLoadJobPrivate;
61  std::unique_ptr<AttachmentLoadJobPrivate> const d;
62  //@endcond
63 };
64 }
65 
A base class for jobs to load attachments from different sources.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Oct 18 2021 23:16:53 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.