Messagelib

attachmentcontrollerbase.h
1/*
2 * This file is part of KMail.
3 * SPDX-FileCopyrightText: 2009 Constantin Berzan <exit3219@gmail.com>
4 *
5 * Parts based on KMail code by:
6 * Various authors.
7 *
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
10
11#pragma once
12
13#include "messagecomposer_export.h"
14
15#include "editorwatcher.h"
16
17#include <QObject>
18#include <QUrl>
19
20#include <KService>
21#include <MessageCore/AttachmentPart>
22
24class QAction;
25class KJob;
27{
28class AttachmentModel;
29/**
30 * @brief The AttachmentControllerBase class
31 */
32class MESSAGECOMPOSER_EXPORT AttachmentControllerBase : public QObject
33{
34 Q_OBJECT
35
36public:
39
40 void createActions();
41
42 // TODO dnd stuff...
43
44 void setSelectedParts(const MessageCore::AttachmentPart::List &selectedParts);
45
46 void setAttachOwnVcard(bool attachVcard);
47 [[nodiscard]] bool attachOwnVcard() const;
48 void setIdentityHasOwnVcard(bool state);
49
50public Q_SLOTS:
51 /// model sets these
52 void setEncryptEnabled(bool enabled);
53 void setSignEnabled(bool enabled);
54 /// compression is async...
55 void compressAttachment(const MessageCore::AttachmentPart::Ptr &part, bool compress);
56 void showContextMenu();
57 void openAttachment(const MessageCore::AttachmentPart::Ptr &part);
58 void viewAttachment(const MessageCore::AttachmentPart::Ptr &part);
59 void editAttachment(MessageCore::AttachmentPart::Ptr part,
60 MessageComposer::EditorWatcher::OpenWithOption option = MessageComposer::EditorWatcher::NoOpenWithDialog);
61 void editAttachmentWith(const MessageCore::AttachmentPart::Ptr &part);
62 void saveAttachmentAs(const MessageCore::AttachmentPart::Ptr &part);
63 void attachmentProperties(const MessageCore::AttachmentPart::Ptr &part);
64 void showAddAttachmentFileDialog();
65 void showAddAttachmentCompressedDirectoryDialog();
66 /// sets sign, encrypt, shows properties dialog if so configured
67 void addAttachment(const MessageCore::AttachmentPart::Ptr &part);
68 void addAttachment(const QUrl &url);
69 void addAttachmentUrlSync(const QUrl &url);
70 void addAttachments(const QList<QUrl> &urls);
71 void showAttachPublicKeyDialog();
72 void showAttachVcard();
73 void showAttachClipBoard();
74 virtual void attachMyPublicKey();
75
76Q_SIGNALS:
77 void actionsCreated();
78 void refreshSelection();
79 void showAttachment(KMime::Content *content, const QByteArray &charset);
80 void selectedAllAttachment();
81 void addOwnVcard(bool);
82 void fileAttached();
83
84protected:
85 void exportPublicKey(const QString &fingerprint);
86 void enableAttachPublicKey(bool enable);
87 void enableAttachMyPublicKey(bool enable);
88 void byteArrayToRemoteFile(const QByteArray &aData, const QUrl &aURL, bool overwrite = false);
89 void openWith(const KService::Ptr &offer = KService::Ptr());
90
91private:
92 MESSAGECOMPOSER_NO_EXPORT void attachDirectory(const QUrl &url);
93 MESSAGECOMPOSER_NO_EXPORT void slotPutResult(KJob *job);
94 MESSAGECOMPOSER_NO_EXPORT void slotOpenWithDialog();
95 MESSAGECOMPOSER_NO_EXPORT void slotOpenWithAction(QAction *act);
96
97private:
98 class AttachmentControllerBasePrivate;
99 std::unique_ptr<AttachmentControllerBasePrivate> const d;
100};
101} //
The AttachmentModel class.
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:33:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.