Messagelib

attachmentcompressjob.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 #include <memory>
15 
16 namespace MessageCore
17 {
18 /**
19  * @short A job to compress the attachment of an email.
20  *
21  * @author Constantin Berzan <[email protected]>
22  */
23 class MESSAGECORE_EXPORT AttachmentCompressJob : public KJob
24 {
25  Q_OBJECT
26 
27 public:
28  /**
29  * Creates a new attachment compress job.
30  *
31  * @param part The part of the attachment to compress.
32  * @param parent The parent object.
33  */
34  explicit AttachmentCompressJob(const AttachmentPart::Ptr &part, QObject *parent = nullptr);
35 
36  /**
37  * Destroys the attachment compress job.
38  */
39  ~AttachmentCompressJob() override;
40 
41  /**
42  * Starts the attachment compress job.
43  */
44  void start() override;
45 
46  /**
47  * Sets the original @p part of the compressed attachment.
48  */
49  void setOriginalPart(const AttachmentPart::Ptr &part);
50 
51  /**
52  * Returns the original part of the compressed attachment.
53  */
54  Q_REQUIRED_RESULT const AttachmentPart::Ptr originalPart() const;
55 
56  /**
57  * Returns the compressed part of the attachment.
58  *
59  * @note does not delete it unless it failed...
60  */
61  Q_REQUIRED_RESULT AttachmentPart::Ptr compressedPart() const;
62 
63  /**
64  * Returns whether the compressed part is larger than the original part.
65  */
66  Q_REQUIRED_RESULT bool isCompressedPartLarger() const;
67 
68 private:
69  //@cond PRIVATE
70  class AttachmentCompressJobPrivate;
71  std::unique_ptr<AttachmentCompressJobPrivate> const d;
72  //@endcond
73 };
74 }
75 
A job to compress the attachment of an email.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Oct 21 2021 23:16:41 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.