Messagelib

attachmentpropertiesdialog.h
1/*
2 SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
3
4 Based on KMail code by various authors (kmmsgpartdlg).
5
6 SPDX-License-Identifier: LGPL-2.0-or-later
7*/
8
9#pragma once
10
11#include "messagecore_export.h"
12
13#include "attachmentpart.h"
14
15#include <QDialog>
16
17namespace MessageCore
18{
19/**
20 * @short A dialog for editing attachment properties.
21 *
22 * @author Constantin Berzan <exit3219@gmail.com>
23 */
24class MESSAGECORE_EXPORT AttachmentPropertiesDialog : public QDialog
25{
27
28public:
29 /**
30 * Creates a new attachment properties dialog.
31 *
32 * @param part The attachment part which properties to change.
33 * @param readOnly Whether the dialog should be in read-only mode.
34 * @param parent The parent object.
35 */
36 explicit AttachmentPropertiesDialog(const AttachmentPart::Ptr &part, bool readOnly = false, QWidget *parent = nullptr);
37
38 /**
39 * Creates a new attachment properties dialog.
40 *
41 * @param content The mime content that represents the attachment which properties to change.
42 * @param parent The parent object.
43 *
44 * @note This converts the KMime::Content to an AttachmentPart internally.
45 * Therefore, saving the changes to the KMime::Content is not supported,
46 * and the dialog is in readOnly mode.
47 */
48 explicit AttachmentPropertiesDialog(const KMime::Content *content, QWidget *parent = nullptr);
49
50 /**
51 * Destroys the attachment properties dialog.
52 */
54
55 /**
56 * Returns the modified attachment.
57 */
58 [[nodiscard]] AttachmentPart::Ptr attachmentPart() const;
59
60 /**
61 * Sets whether the encryption status of the attachment can be changed.
62 */
63 void setEncryptEnabled(bool enabled);
64
65 /**
66 * Returns whether the encryption status of the attachment can be changed.
67 */
68 [[nodiscard]] bool isEncryptEnabled() const;
69
70 /**
71 * Sets whether the signature status of the attachment can be changed.
72 */
73 void setSignEnabled(bool enabled);
74
75 /**
76 * Returns whether the signature status of the attachment can be changed.
77 */
78 [[nodiscard]] bool isSignEnabled() const;
79
80public Q_SLOTS:
81 void accept() override;
82 void slotHelp();
83
84private:
85 //@cond PRIVATE
86 class AttachmentPropertiesDialogPrivate;
87 std::unique_ptr<AttachmentPropertiesDialogPrivate> const d;
88 //@endcond
89};
90}
QSharedPointer< AttachmentPart > Ptr
Defines a pointer to an attachment object.
AttachmentPart::Ptr attachmentPart() const
Returns the modified attachment.
bool isEncryptEnabled() const
Returns whether the encryption status of the attachment can be changed.
AttachmentPropertiesDialog(const AttachmentPart::Ptr &part, bool readOnly=false, QWidget *parent=nullptr)
Creates a new attachment properties dialog.
void setSignEnabled(bool enabled)
Sets whether the signature status of the attachment can be changed.
~AttachmentPropertiesDialog() override
Destroys the attachment properties dialog.
void setEncryptEnabled(bool enabled)
Sets whether the encryption status of the attachment can be changed.
bool isSignEnabled() const
Returns whether the signature status of the attachment can be changed.
QDialog(QWidget *parent, Qt::WindowFlags f)
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
QObject * parent() const const
QWidget(QWidget *parent, Qt::WindowFlags f)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:47:39 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.