Messagelib

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

KDE's Doxygen guidelines are available online.