Messagelib

attachmentcompressjob.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#include <memory>
15
16namespace MessageCore
17{
18/**
19 * @short A job to compress the attachment of an email.
20 *
21 * @author Constantin Berzan <exit3219@gmail.com>
22 */
23class MESSAGECORE_EXPORT AttachmentCompressJob : public KJob
24{
25 Q_OBJECT
26
27public:
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 */
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 [[nodiscard]] 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 [[nodiscard]] AttachmentPart::Ptr compressedPart() const;
62
63 /**
64 * Returns whether the compressed part is larger than the original part.
65 */
66 [[nodiscard]] bool isCompressedPartLarger() const;
67
68private:
69 //@cond PRIVATE
70 class AttachmentCompressJobPrivate;
71 std::unique_ptr<AttachmentCompressJobPrivate> const d;
72 //@endcond
73};
74}
A job to compress the attachment of an email.
~AttachmentCompressJob() override
Destroys the attachment compress job.
Q_SCRIPTABLE Q_NOREPLY void start()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.