diff --git a/messagecomposer/src/attachment/attachmentcontrollerbase.h b/messagecomposer/src/attachment/attachmentcontrollerbase.h index 9e078c06..9cee63fc 100644 --- a/messagecomposer/src/attachment/attachmentcontrollerbase.h +++ b/messagecomposer/src/attachment/attachmentcontrollerbase.h @@ -1,115 +1,115 @@ /* * This file is part of KMail. * Copyright (c) 2009 Constantin Berzan * * Parts based on KMail code by: * Various authors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef KMAIL_ATTACHMENTCONTROLLERBASE_H -#define KMAIL_ATTACHMENTCONTROLLERBASE_H +#ifndef MESSAGECOMPOSER_ATTACHMENTCONTROLLERBASE_H +#define MESSAGECOMPOSER_ATTACHMENTCONTROLLERBASE_H #include #include #include #include #include #include #include "messagecomposer_export.h" class KActionCollection; class QAction; namespace MessageComposer { class AttachmentModel; /** * @brief The AttachmentControllerBase class */ class MESSAGECOMPOSER_EXPORT AttachmentControllerBase : public QObject { Q_OBJECT public: AttachmentControllerBase(MessageComposer::AttachmentModel *model, QWidget *wParent, KActionCollection *actionCollection); ~AttachmentControllerBase(); void createActions(); // TODO dnd stuff... void setSelectedParts(const MessageCore::AttachmentPart::List &selectedParts); void setAttachOwnVcard(bool attachVcard); Q_REQUIRED_RESULT bool attachOwnVcard() const; void setIdentityHasOwnVcard(bool state); public Q_SLOTS: /// model sets these void setEncryptEnabled(bool enabled); void setSignEnabled(bool enabled); /// compression is async... void compressAttachment(const MessageCore::AttachmentPart::Ptr &part, bool compress); void showContextMenu(); void openAttachment(const MessageCore::AttachmentPart::Ptr &part); void viewAttachment(const MessageCore::AttachmentPart::Ptr &part); void editAttachment(MessageCore::AttachmentPart::Ptr part, MessageViewer::EditorWatcher::OpenWithOption option = MessageViewer::EditorWatcher::NoOpenWithDialog); void editAttachmentWith(const MessageCore::AttachmentPart::Ptr &part); void saveAttachmentAs(const MessageCore::AttachmentPart::Ptr &part); void attachmentProperties(const MessageCore::AttachmentPart::Ptr &part); void showAddAttachmentFileDialog(); void showAddAttachmentCompressedDirectoryDialog(); /// sets sign, encrypt, shows properties dialog if so configured void addAttachment(const MessageCore::AttachmentPart::Ptr &part); void addAttachment(const QUrl &url); void addAttachmentUrlSync(const QUrl &url); void addAttachments(const QList &urls); void showAttachPublicKeyDialog(); void showAttachVcard(); void showAttachClipBoard(); virtual void attachMyPublicKey(); Q_SIGNALS: void actionsCreated(); void refreshSelection(); void showAttachment(KMime::Content *content, const QByteArray &charset); void selectedAllAttachment(); void addOwnVcard(bool); void fileAttached(); protected: void exportPublicKey(const QString &fingerprint); void enableAttachPublicKey(bool enable); void enableAttachMyPublicKey(bool enable); void byteArrayToRemoteFile(const QByteArray &aData, const QUrl &aURL, bool overwrite = false); void openWith(const KService::Ptr &offer = KService::Ptr()); private: void attachFiles(const QList &urls, const QString &encoding); void attachDirectory(const QUrl &url); void slotPutResult(KJob *job); void slotOpenWithDialog(); void slotOpenWithAction(QAction *act); private: class Private; Private *const d; }; } // -#endif // KMAIL_ATTACHMENTCONTROLLERBASE_H +#endif diff --git a/messagecomposer/src/attachment/attachmentmodel.h b/messagecomposer/src/attachment/attachmentmodel.h index d2815d6c..e6b0e667 100644 --- a/messagecomposer/src/attachment/attachmentmodel.h +++ b/messagecomposer/src/attachment/attachmentmodel.h @@ -1,126 +1,126 @@ /* * This file is part of KMail. * Copyright (c) 2009 Constantin Berzan * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef KMAIL_ATTACHMENTMODEL_H -#define KMAIL_ATTACHMENTMODEL_H +#ifndef MESSAGECOMPOSER_ATTACHMENTMODEL_H +#define MESSAGECOMPOSER_ATTACHMENTMODEL_H #include "messagecomposer_export.h" #include #include #include #include namespace MessageComposer { /** * @brief The AttachmentModel class */ class MESSAGECOMPOSER_EXPORT AttachmentModel : public QAbstractItemModel { Q_OBJECT public: enum { AttachmentPartRole = Qt::UserRole, NameRole, SizeRole, EncodingRole, MimeTypeRole, CompressRole, EncryptRole, SignRole, AutoDisplayRole }; /** * @todo: get rid of columns and use the roles instead. */ enum Column { NameColumn, SizeColumn, EncodingColumn, MimeTypeColumn, CompressColumn, EncryptColumn, SignColumn, AutoDisplayColumn, LastColumn ///< @internal }; explicit AttachmentModel(QObject *parent); ~AttachmentModel() override; bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) override; Q_REQUIRED_RESULT QMimeData *mimeData(const QModelIndexList &indexes) const override; Q_REQUIRED_RESULT QStringList mimeTypes() const override; Q_REQUIRED_RESULT Qt::DropActions supportedDropActions() const override; /// for the save/discard warning Q_REQUIRED_RESULT bool isModified() const; void setModified(bool modified); Q_REQUIRED_RESULT bool isEncryptEnabled() const; void setEncryptEnabled(bool enabled); Q_REQUIRED_RESULT bool isSignEnabled() const; void setSignEnabled(bool enabled); Q_REQUIRED_RESULT bool isEncryptSelected() const; /// sets for all void setEncryptSelected(bool selected); Q_REQUIRED_RESULT bool isSignSelected() const; /// sets for all void setSignSelected(bool selected); Q_REQUIRED_RESULT bool isAutoDisplayEnabled() const; void setAutoDisplayEnabled(bool enabled); QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; Q_REQUIRED_RESULT bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; void addAttachment(const MessageCore::AttachmentPart::Ptr &part); Q_REQUIRED_RESULT bool updateAttachment(const MessageCore::AttachmentPart::Ptr &part); Q_REQUIRED_RESULT bool replaceAttachment(const MessageCore::AttachmentPart::Ptr &oldPart, const MessageCore::AttachmentPart::Ptr &newPart); Q_REQUIRED_RESULT bool removeAttachment(const MessageCore::AttachmentPart::Ptr &part); Q_REQUIRED_RESULT MessageCore::AttachmentPart::List attachments() const; Q_REQUIRED_RESULT Qt::ItemFlags flags(const QModelIndex &index) const override; Q_REQUIRED_RESULT QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override; Q_REQUIRED_RESULT QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; Q_REQUIRED_RESULT QModelIndex parent(const QModelIndex &index) const override; Q_REQUIRED_RESULT int rowCount(const QModelIndex &parent = QModelIndex()) const override; Q_REQUIRED_RESULT int columnCount(const QModelIndex &parent = QModelIndex()) const override; Q_SIGNALS: void encryptEnabled(bool enabled); void signEnabled(bool enabled); void autoDisplayEnabled(bool enabled); void attachUrlsRequested(const QList &urls); void attachItemsRequester(const Akonadi::Item::List &); void attachmentRemoved(MessageCore::AttachmentPart::Ptr part); void attachmentCompressRequested(MessageCore::AttachmentPart::Ptr part, bool compress); private: class Private; friend class Private; Private *const d; }; } // -#endif // KMAIL_ATTACHMENTMODEL_H +#endif diff --git a/messagecomposer/src/composer-ng/richtextcomposerng.h b/messagecomposer/src/composer-ng/richtextcomposerng.h index 80c7d538..1d32a134 100644 --- a/messagecomposer/src/composer-ng/richtextcomposerng.h +++ b/messagecomposer/src/composer-ng/richtextcomposerng.h @@ -1,68 +1,68 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef RICHTEXTCOMPOSERNG_H -#define RICHTEXTCOMPOSERNG_H +#ifndef MESSAGECOMPOSER_RICHTEXTCOMPOSERNG_H +#define MESSAGECOMPOSER_RICHTEXTCOMPOSERNG_H #include "messagecomposer_export.h" #include #include #include namespace PimCommon { class AutoCorrection; } namespace MessageComposer { class TextPart; class RichTextComposerSignatures; class RichTextComposerNgPrivate; /** * @brief The RichTextComposerNg class * @author Laurent Montel */ class MESSAGECOMPOSER_EXPORT RichTextComposerNg : public KPIMTextEdit::RichTextComposer { Q_OBJECT public: explicit RichTextComposerNg(QWidget *parent = nullptr); ~RichTextComposerNg() override; Q_REQUIRED_RESULT PimCommon::AutoCorrection *autocorrection() const; void setAutocorrection(PimCommon::AutoCorrection *autocorrect); void setAutocorrectionLanguage(const QString &lang); void fillComposerTextPart(MessageComposer::TextPart *textPart); Q_REQUIRED_RESULT MessageComposer::RichTextComposerSignatures *composerSignature() const; void insertSignature(const KIdentityManagement::Signature &signature, KIdentityManagement::Signature::Placement placement, KIdentityManagement::Signature::AddedText addedText); Q_REQUIRED_RESULT QString toCleanHtml() const; void forceAutoCorrection(bool selectedText = false) override; Q_REQUIRED_RESULT virtual MessageComposer::PluginEditorConvertTextInterface::ConvertTextStatus convertPlainText(MessageComposer::TextPart *textPart); protected: bool processModifyText(QKeyEvent *event) override; private: RichTextComposerNgPrivate *const d; }; } -#endif // RICHTEXTCOMPOSERNG_H +#endif diff --git a/messagecomposer/src/composer-ng/richtextcomposersignatures.h b/messagecomposer/src/composer-ng/richtextcomposersignatures.h index edcf16c8..dfa7ca76 100644 --- a/messagecomposer/src/composer-ng/richtextcomposersignatures.h +++ b/messagecomposer/src/composer-ng/richtextcomposersignatures.h @@ -1,50 +1,50 @@ /* Copyright (C) 2015-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef RICHTEXTCOMPOSERSIGNATURES_H -#define RICHTEXTCOMPOSERSIGNATURES_H +#ifndef MESSAGECOMPOSER_RICHTEXTCOMPOSERSIGNATURES_H +#define MESSAGECOMPOSER_RICHTEXTCOMPOSERSIGNATURES_H #include #include "messagecomposer_export.h" namespace KIdentityManagement { class Signature; } namespace MessageComposer { class RichTextComposerNg; /** * @brief The RichTextComposerSignatures class * @author Laurent Montel */ class MESSAGECOMPOSER_EXPORT RichTextComposerSignatures : public QObject { Q_OBJECT public: explicit RichTextComposerSignatures(MessageComposer::RichTextComposerNg *composer, QObject *parent = nullptr); ~RichTextComposerSignatures(); void cleanWhitespace(const KIdentityManagement::Signature &sig); Q_REQUIRED_RESULT bool replaceSignature(const KIdentityManagement::Signature &oldSig, const KIdentityManagement::Signature &newSig); private: class RichTextComposerSignaturesPrivate; RichTextComposerSignaturesPrivate *const d; }; } -#endif // RICHTEXTCOMPOSERSIGNATURES_H +#endif diff --git a/messagecomposer/src/composer/composerattachmentinterface.h b/messagecomposer/src/composer/composerattachmentinterface.h index fb676cab..853f23e6 100644 --- a/messagecomposer/src/composer/composerattachmentinterface.h +++ b/messagecomposer/src/composer/composerattachmentinterface.h @@ -1,57 +1,57 @@ /* Copyright (C) 2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef COMPOSERATTACHMENTINTERFACE_H -#define COMPOSERATTACHMENTINTERFACE_H +#ifndef MESSAGECOMPOSER_COMPOSERATTACHMENTINTERFACE_H +#define MESSAGECOMPOSER_COMPOSERATTACHMENTINTERFACE_H #include "messagecomposer_export.h" #include namespace MessageComposer { class ComposerViewBase; /** * @brief The ComposerAttachmentInterface class * @author Laurent Montel */ class MESSAGECOMPOSER_EXPORT ComposerAttachmentInterface { public: ComposerAttachmentInterface(); ~ComposerAttachmentInterface(); Q_REQUIRED_RESULT QStringList fileNames() const; void setFileNames(const QStringList &fileName); Q_REQUIRED_RESULT int count() const; void setCount(int count); Q_REQUIRED_RESULT QStringList namesAndSize() const; void setNamesAndSize(const QStringList &nameAndSize); Q_REQUIRED_RESULT QStringList names() const; void setNames(const QStringList &name); private: QStringList mFileNames; QStringList mNamesAndSize; QStringList mNames; int mCount = 0; }; } -#endif // COMPOSERATTACHMENTINTERFACE_H +#endif diff --git a/messagecomposer/src/composer/composerviewbase.h b/messagecomposer/src/composer/composerviewbase.h index a7cdd9c9..7e7db1d1 100644 --- a/messagecomposer/src/composer/composerviewbase.h +++ b/messagecomposer/src/composer/composerviewbase.h @@ -1,379 +1,379 @@ /* Copyright (C) 2010 Klaralvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Copyright (c) 2010 Leo Franchi This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef COMPOSER_VIEW_BASE_H -#define COMPOSER_VIEW_BASE_H +#ifndef MESSAGECOMPOSER_COMPOSER_VIEW_BASE_H +#define MESSAGECOMPOSER_COMPOSER_VIEW_BASE_H #include "messagecomposer_export.h" #include "messagecomposer/messagesender.h" #include "MessageComposer/Recipient" #include #include #include #include #include #include class QTimer; class KJob; class QWidget; namespace Sonnet { class DictionaryComboBox; } namespace SendLater { class SendLaterInfo; } namespace Akonadi { class CollectionComboBox; } namespace MailTransport { class TransportComboBox; class MessageQueueJob; } namespace KIdentityManagement { class IdentityCombo; class Identity; class IdentityManager; } namespace Kleo { class KeyResolver; } namespace MessageComposer { class RecipientsEditor; class RichTextComposerNg; class InfoPart; class GlobalPart; class Composer; class AttachmentControllerBase; class AttachmentModel; class SignatureController; /** * @brief The ComposerViewBase class */ class MESSAGECOMPOSER_EXPORT ComposerViewBase : public QObject { Q_OBJECT public: explicit ComposerViewBase(QObject *parent = nullptr, QWidget *widget = nullptr); ~ComposerViewBase() override; enum Confirmation { LetUserConfirm, NoConfirmationNeeded }; enum MissingAttachment { NoMissingAttachmentFound, FoundMissingAttachmentAndSending, FoundMissingAttachmentAndAddedAttachment, FoundMissingAttachmentAndCancel }; enum FailedType { Sending, AutoSave }; /** * Set the message to be opened in the composer window, and set the internal data structures to * keep track of it. */ void setMessage(const KMime::Message::Ptr &newMsg, bool allowDecryption); void updateTemplate(const KMime::Message::Ptr &msg); /** * Send the message with the specified method, saving it in the specified folder. */ void send(MessageComposer::MessageSender::SendMethod method, MessageComposer::MessageSender::SaveIn saveIn, bool checkMailDispatcher = true); /** * Returns true if there is at least one composer job running. */ Q_REQUIRED_RESULT bool isComposing() const; /** * Add the given attachment to the message. */ void addAttachment(const QUrl &url, const QString &comment, bool sync); void addAttachment(const QString &name, const QString &filename, const QString &charset, const QByteArray &data, const QByteArray &mimeType); void addAttachmentPart(KMime::Content *part); MessageComposer::Composer *createSimpleComposer(); /** * Header fields in recipients editor. */ Q_REQUIRED_RESULT QString to() const; Q_REQUIRED_RESULT QString cc() const; Q_REQUIRED_RESULT QString bcc() const; Q_REQUIRED_RESULT QString from() const; Q_REQUIRED_RESULT QString replyTo() const; Q_REQUIRED_RESULT QString subject() const; /** * The following are for setting the various options and widgets in the * composer. */ void setAttachmentModel(MessageComposer::AttachmentModel *model); Q_REQUIRED_RESULT MessageComposer::AttachmentModel *attachmentModel(); void setAttachmentController(MessageComposer::AttachmentControllerBase *controller); Q_REQUIRED_RESULT MessageComposer::AttachmentControllerBase *attachmentController(); void setRecipientsEditor(MessageComposer::RecipientsEditor *recEditor); Q_REQUIRED_RESULT MessageComposer::RecipientsEditor *recipientsEditor(); void setSignatureController(MessageComposer::SignatureController *sigController); Q_REQUIRED_RESULT MessageComposer::SignatureController *signatureController(); void setIdentityCombo(KIdentityManagement::IdentityCombo *identCombo); Q_REQUIRED_RESULT KIdentityManagement::IdentityCombo *identityCombo(); void setIdentityManager(KIdentityManagement::IdentityManager *identMan); Q_REQUIRED_RESULT KIdentityManagement::IdentityManager *identityManager(); void setEditor(MessageComposer::RichTextComposerNg *editor); Q_REQUIRED_RESULT MessageComposer::RichTextComposerNg *editor() const; void setTransportCombo(MailTransport::TransportComboBox *transpCombo); Q_REQUIRED_RESULT MailTransport::TransportComboBox *transportComboBox() const; void setFccCombo(Akonadi::CollectionComboBox *fcc); Q_REQUIRED_RESULT Akonadi::CollectionComboBox *fccCombo() const; void setFcc(const Akonadi::Collection &id); Q_REQUIRED_RESULT Sonnet::DictionaryComboBox *dictionary() const; void setDictionary(Sonnet::DictionaryComboBox *dictionary); /** * Widgets for editing differ in client classes, so * values are set before sending. */ void setFrom(const QString &from); void setSubject(const QString &subject); /** * The following are various settings the user can modify when composing a message. If they are not set, * the default values will be used. */ void setCryptoOptions(bool sign, bool encrypt, Kleo::CryptoMessageFormat format, bool neverEncryptDrafts = false); void setCharsets(const QList< QByteArray > &charsets); void setMDNRequested(bool mdnRequested); void setUrgent(bool urgent); void setAutoSaveInterval(int interval); void setCustomHeader(const QMap &customHeader); /** * Enables/disables autosaving depending on the value of the autosave * interval. */ void updateAutoSave(); /** * Sets the filename to use when autosaving something. This is used when the client recovers * the autosave files: It calls this method, so that the composer uses the same filename again. * That way, the recovered autosave file is properly cleaned up in cleanupAutoSave(): */ void setAutoSaveFileName(const QString &fileName); /** * Stop autosaving and delete the autosaved message. */ void cleanupAutoSave(); void setParentWidgetForGui(QWidget *); /** * Check if the mail has references to attachments, but no attachments are added to it. * If missing attachments are found, a dialog to add new attachments is shown. * @param attachmentKeywords a list with the keywords that indicate an attachment should be present * @return NoMissingAttachmentFound, if there is attachment in email * FoundMissingAttachmentAndCancelSending, if mail might miss attachment but sending * FoundMissingAttachmentAndAddedAttachment, if mail might miss attachment and we added an attachment * FoundMissingAttachmentAndCancel, if mail might miss attachment and cancel sending */ ComposerViewBase::MissingAttachment checkForMissingAttachments(const QStringList &attachmentKeywords); Q_REQUIRED_RESULT bool hasMissingAttachments(const QStringList &attachmentKeywords); void setSendLaterInfo(SendLater::SendLaterInfo *info); Q_REQUIRED_RESULT SendLater::SendLaterInfo *sendLaterInfo() const; void saveMailSettings(); Q_REQUIRED_RESULT QDate followUpDate() const; void setFollowUpDate(const QDate &followUpDate); void clearFollowUp(); Q_REQUIRED_RESULT Akonadi::Collection followUpCollection() const; void setFollowUpCollection(const Akonadi::Collection &followUpCollection); Q_REQUIRED_RESULT KMime::Message::Ptr msg() const; bool requestDeleveryConfirmation() const; void setRequestDeleveryConfirmation(bool requestDeleveryConfirmation); public Q_SLOTS: void identityChanged(const KIdentityManagement::Identity &ident, const KIdentityManagement::Identity &oldIdent, bool msgCleared = false); /** * Save the message. */ void autoSaveMessage(); Q_SIGNALS: /** * Message sending completed successfully. */ void sentSuccessfully(Akonadi::Item::Id id); /** * Message sending failed with given error message. */ void failed(const QString &errorMessage, MessageComposer::ComposerViewBase::FailedType type = Sending); /** * The composer was modified. This can happen behind the users' back * when, for example, and autosaved message was recovered. */ void modified(bool isModified); /** * Enabling or disabling HTML in the editor is affected * by various client options, so when that would otherwise happen, * hand it off to the client to enact it for real. */ void disableHtml(MessageComposer::ComposerViewBase::Confirmation); void enableHtml(); private Q_SLOTS: void slotEmailAddressResolved(KJob *); void slotSendComposeResult(KJob *); void slotQueueResult(KJob *job); void slotCreateItemResult(KJob *); void slotAutoSaveComposeResult(KJob *job); void slotFccCollectionCheckResult(KJob *job); void slotSaveMessage(KJob *job); private: Akonadi::Collection defaultSpecialTarget() const; /** * Searches the mime tree, where root is the root node, for embedded images, * extracts them froom the body and adds them to the editor. */ void collectImages(KMime::Content *root); bool inlineSigningEncryptionSelected(); /** * Applies the user changes to the message object of the composer * and signs/encrypts the message if activated. * Disables the controls of the composer window. */ void readyForSending(); enum RecipientExpansion { UseExpandedRecipients, UseUnExpandedRecipients }; QList< MessageComposer::Composer * > generateCryptoMessages(bool &wasCanceled); void fillGlobalPart(MessageComposer::GlobalPart *globalPart); void fillInfoPart(MessageComposer::InfoPart *part, RecipientExpansion expansion); void queueMessage(const KMime::Message::Ptr &message, MessageComposer::Composer *composer); void saveMessage(const KMime::Message::Ptr &message, MessageComposer::MessageSender::SaveIn saveIn); void fillQueueJobHeaders(MailTransport::MessageQueueJob *qjob, KMime::Message::Ptr message, const MessageComposer::InfoPart *infoPart); QStringList cleanEmailList(const QStringList &emails); void saveRecentAddresses(const KMime::Message::Ptr &ptr); void updateRecipients(const KIdentityManagement::Identity &ident, const KIdentityManagement::Identity &oldIdent, MessageComposer::Recipient::Type type); void markAllAttachmentsForSigning(bool sign); void markAllAttachmentsForEncryption(bool encrypt); bool determineWhetherToSign(bool doSignCompletely, Kleo::KeyResolver *keyResolver, bool signSomething, bool &result, bool &canceled); bool determineWhetherToEncrypt(bool doEncryptCompletely, Kleo::KeyResolver *keyResolver, bool encryptSomething, bool signSomething, bool &result, bool &canceled); /** * Writes out autosave data to the disk from the KMime::Message message. * Also appends the msgNum to the filename as a message can have a number of * KMime::Messages */ void writeAutoSaveToDisk(const KMime::Message::Ptr &message); /** * Returns the autosave interval in milliseconds (as needed for QTimer). */ int autoSaveInterval() const; /** * Initialize autosaving (timer and filename). */ void initAutoSave(); void addFollowupReminder(const QString &messageId); KMime::Message::Ptr m_msg; MessageComposer::AttachmentControllerBase *m_attachmentController = nullptr; MessageComposer::AttachmentModel *m_attachmentModel = nullptr; MessageComposer::SignatureController *m_signatureController = nullptr; MessageComposer::RecipientsEditor *m_recipientsEditor = nullptr; KIdentityManagement::IdentityCombo *m_identityCombo = nullptr; KIdentityManagement::IdentityManager *m_identMan = nullptr; MessageComposer::RichTextComposerNg *m_editor = nullptr; MailTransport::TransportComboBox *m_transport = nullptr; Sonnet::DictionaryComboBox *m_dictionary = nullptr; Akonadi::CollectionComboBox *m_fccCombo = nullptr; Akonadi::Collection m_fccCollection; QWidget *m_parentWidget = nullptr; // List of active composer jobs. For example, saving as draft, autosaving and printing // all create a composer, which is added to this list as long as it is active. // Used mainly to prevent closing the window if a composer is active QList< MessageComposer::Composer * > m_composers; bool m_sign = false; bool m_encrypt = false; bool m_neverEncrypt = false; bool m_mdnRequested = false; bool m_urgent = false; bool m_requestDeleveryConfirmation = false; Kleo::CryptoMessageFormat m_cryptoMessageFormat; QString mExpandedFrom; QString m_from; QString m_subject; QStringList mExpandedTo, mExpandedCc, mExpandedBcc, mExpandedReplyTo; QList< QByteArray > m_charsets; QMap m_customHeader; int m_pendingQueueJobs = 0; QTimer *m_autoSaveTimer = nullptr; QString m_autoSaveUUID; bool m_autoSaveErrorShown = false; // Stops an error message being shown every time autosave is executed. int m_autoSaveInterval; MessageComposer::MessageSender::SendMethod mSendMethod; MessageComposer::MessageSender::SaveIn mSaveIn; QDate mFollowUpDate; Akonadi::Collection mFollowUpCollection; SendLater::SendLaterInfo *mSendLaterInfo = nullptr; }; } // namespace #endif diff --git a/messagecomposer/src/composer/composerviewinterface.h b/messagecomposer/src/composer/composerviewinterface.h index aa8cf3a0..73dbb8f7 100644 --- a/messagecomposer/src/composer/composerviewinterface.h +++ b/messagecomposer/src/composer/composerviewinterface.h @@ -1,55 +1,55 @@ /* Copyright (C) 2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef COMPOSERVIEWINTERFACE_H -#define COMPOSERVIEWINTERFACE_H +#ifndef MESSAGECOMPOSER_COMPOSERVIEWINTERFACE_H +#define MESSAGECOMPOSER_COMPOSERVIEWINTERFACE_H #include "messagecomposer_export.h" #include #include namespace MessageComposer { class ComposerViewBase; /** * @brief The ComposerViewInterface class * @author Laurent Montel */ class MESSAGECOMPOSER_EXPORT ComposerViewInterface { public: explicit ComposerViewInterface(ComposerViewBase *composerView); ~ComposerViewInterface(); Q_REQUIRED_RESULT QString subject() const; Q_REQUIRED_RESULT QString to() const; Q_REQUIRED_RESULT QString cc() const; Q_REQUIRED_RESULT QString from() const; Q_REQUIRED_RESULT MessageComposer::ComposerAttachmentInterface attachments(); Q_REQUIRED_RESULT QString shortDate() const; Q_REQUIRED_RESULT QString longDate() const; Q_REQUIRED_RESULT QString shortTime() const; Q_REQUIRED_RESULT QString longTime() const; Q_REQUIRED_RESULT QString insertDayOfWeek() const; private: ComposerViewBase *mComposerView = nullptr; }; } #endif // COMPOSERVIEWINTERFACE_H diff --git a/messagecomposer/src/composer/keyresolver.h b/messagecomposer/src/composer/keyresolver.h index bee37a42..fd5540c8 100644 --- a/messagecomposer/src/composer/keyresolver.h +++ b/messagecomposer/src/composer/keyresolver.h @@ -1,315 +1,315 @@ /* -*- c++ -*- keyresolver.h This file is part of libkleopatra, the KDE keymanagement library Copyright (c) 2004 Klarälvdalens Datakonsult AB Based on kpgp.h Copyright (C) 2001,2002 the KPGP authors See file libkdenetwork/AUTHORS.kpgp for details Libkleopatra is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Libkleopatra is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA In addition, as a special exception, the copyright holders give permission to link the code of this program with any edition of the Qt library by Trolltech AS, Norway (or with modified versions of Qt that use the same license as Qt), and distribute linked combinations including the two. You must obey the GNU General Public License in all respects for all of the code used other than Qt. If you modify this file, you may extend this exception to your version of the file, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ -#ifndef KLEO_KEYRESOLVER_H -#define KLEO_KEYRESOLVER_H +#ifndef MESSAGECOMPOSER_KLEO_KEYRESOLVER_H +#define MESSAGECOMPOSER_KLEO_KEYRESOLVER_H #include "messagecomposer_export.h" #include #include #include #include class QStringList; namespace Kleo { enum Result { Failure = 0, Ok = 1, Canceled = 2 }; /** \short A class to resolve signing/encryption keys w.r.t. per-recipient preferences \section Step 1: Set the information needed The constructor takes some basic options as arguments, such as whether or not encryption was actually requested. Recipient and sender information is then set by using \c setEncryptToSelfKeys(), \c setSigningKeys(), \c setPrimaryRecipients() (To/Cc) and \c setSecondaryRecipients() (Bcc). \section Step 2: Lookup and check per-recipient crypto preferences / Opportunistic Encryption First, \c checkSigningPreferences() goes through all recipient's signing preferences, to determine whether or not to sign. It also takes into account the available signing keys and whether or not the user explicitly requested signing. \c checkEncryptionPreferences() does the same for encryption preferences. If opportunistic encryption is enabled, recipients without encryption preferences set are treated as if they had a preference of \c AskWheneverPossible. In both cases an Action code is returned, with the following meanings:
Conflict
A conflict was detected. E.g. one recipient's preference was set to "always encrypt", while another one's preference was set to "never encrypt". You should ask the user what to do.
DoIt, DontDoIt
Do/Don't sign/encrypt
Ask
(Some) crypto preferences request to prompt the user, so do it.
Impossible
Signing or encryption is impossible, e.g. due to missing keys or unsupported formats.
\section Step 3: Resolve all keys. In case signing or encryption was implicitly or explicitly requested by the user, \c resolveAllKeys() tries to find signing keys for each required format, as well as encryption keys for all recipients (incl. the sender, if encrypt-to-self is set). \section Step 4: Get signing keys. If, after key resolving, signing is still requested and apparently possible, you can get the result of all this by iterating over the available message formats and retrieving the set of signing keys to use with a call to \c signingKeys(). \section Step 5: Get encryption key sets. If after key resolving, encryption is still requested and apparently possible, you can get the result of all this by calling \c encryptionItems() with the current message format at hand as its argument. This will return a list of recipient-list/key-list pairs that each describe a copy of the (possibly signed) message to be encrypted independantly. Note that it's only necessary to sign the message once for each message format, although it might be necessary to create more than one message when encrypting. This is because encryption allows the recipients to learn about the other recipients the message was encrypted to, so each secondary (BCC) recipient need a copy of it's own to hide the other secondary recipients. */ class KeyResolver { public: KeyResolver(bool encToSelf, bool showApproval, bool oppEncryption, unsigned int format, int encrKeyNearExpiryThresholdDays, int signKeyNearExpiryThresholdDays, int encrRootCertNearExpiryThresholdDays, int signRootCertNearExpiryThresholdDays, int encrChainCertNearExpiryThresholdDays, int signChainCertNearExpiryThresholdDays); ~KeyResolver(); struct ContactPreferences { ContactPreferences(); Kleo::EncryptionPreference encryptionPreference; Kleo::SigningPreference signingPreference; Kleo::CryptoMessageFormat cryptoMessageFormat; QStringList pgpKeyFingerprints; QStringList smimeCertFingerprints; }; struct Item : public KeyApprovalDialog::Item { Item() : KeyApprovalDialog::Item() , signPref(UnknownSigningPreference) , format(AutoFormat) , needKeys(true) { } Item(const QString &a, EncryptionPreference e, SigningPreference s, CryptoMessageFormat f) : KeyApprovalDialog::Item(a, std::vector(), e) , signPref(s) , format(f) , needKeys(true) { } Item(const QString &a, const std::vector &k, EncryptionPreference e, SigningPreference s, CryptoMessageFormat f) : KeyApprovalDialog::Item(a, k, e) , signPref(s) , format(f) , needKeys(false) { } SigningPreference signPref; CryptoMessageFormat format; bool needKeys; }; /** Set the fingerprints of keys to be used for encrypting to self. Also looks them up and complains if they're not usable or found. */ Q_REQUIRED_RESULT Kleo::Result setEncryptToSelfKeys(const QStringList &fingerprints); /** Set the fingerprints of keys to be used for signing. Also looks them up and complains if they're not usable or found. */ Q_REQUIRED_RESULT Kleo::Result setSigningKeys(const QStringList &fingerprints); /** Set the list of primary (To/CC) recipient addresses. Also looks up possible keys, but doesn't interact with the user. */ void setPrimaryRecipients(const QStringList &addresses); /** Set the list of secondary (BCC) recipient addresses. Also looks up possible keys, but doesn't interact with the user. */ void setSecondaryRecipients(const QStringList &addresses); /** Determine whether to sign or not, depending on the per-recipient signing preferences, as well as the availability of usable signing keys. */ Q_REQUIRED_RESULT Action checkSigningPreferences(bool signingRequested) const; /** Determine whether to encrypt or not, depending on the per-recipient encryption preferences, as well as the availability of usable encryption keys. */ Q_REQUIRED_RESULT Action checkEncryptionPreferences(bool encryptionRequested) const; /** Queries the user for missing keys and displays a key approval dialog if needed. */ Q_REQUIRED_RESULT Kleo::Result resolveAllKeys(bool &signingRequested, bool &encryptionRequested); /** @return the signing keys to use (if any) for the given message format. */ Q_REQUIRED_RESULT std::vector signingKeys(CryptoMessageFormat f) const; struct SplitInfo { SplitInfo() { } SplitInfo(const QStringList &r) : recipients(r) { } SplitInfo(const QStringList &r, const std::vector &k) : recipients(r) , keys(k) { } QStringList recipients; std::vector keys; }; /** @return the found distinct sets of items for format \a f. The returned vector will contain more than one item only if secondary recipients have been specified. */ Q_REQUIRED_RESULT std::vector encryptionItems(CryptoMessageFormat f) const; private: void dump() const; std::vector getEncryptionItems(const QStringList &recipients); std::vector getEncryptionKeys(const QString &recipient, bool quiet) const; Kleo::Result showKeyApprovalDialog(bool &finalySendUnencrypted); bool encryptionPossible() const; bool signingPossible() const; Kleo::Result resolveEncryptionKeys(bool signingRequested, bool &finalySendUnencrypted); Kleo::Result resolveSigningKeysForEncryption(); Kleo::Result resolveSigningKeysForSigningOnly(); Kleo::Result checkKeyNearExpiry(const GpgME::Key &key, const char *dontAskAgainName, bool mine, bool sign, bool ca = false, int recurse_limit = 100, const GpgME::Key &orig_key = GpgME::Key::null) const; void collapseAllSplitInfos(); void addToAllSplitInfos(const std::vector &keys, unsigned int formats); void addKeys(const std::vector &items, CryptoMessageFormat f); void addKeys(const std::vector &items); QStringList allRecipients() const; std::vector signingKeysFor(CryptoMessageFormat f) const; std::vector encryptToSelfKeysFor(CryptoMessageFormat f) const; std::vector lookup(const QStringList &patterns, bool secret = false) const; bool haveTrustedEncryptionKey(const QString &person) const; std::vector selectKeys(const QString &person, const QString &msg, const std::vector &selectedKeys = std::vector()) const; QStringList keysForAddress(const QString &address) const; void setKeysForAddress(const QString &address, const QStringList &pgpKeyFingerprints, const QStringList &smimeCertFingerprints) const; bool encryptToSelf() const; bool showApprovalDialog() const; int encryptKeyNearExpiryWarningThresholdInDays() const; int signingKeyNearExpiryWarningThresholdInDays() const; int encryptRootCertNearExpiryWarningThresholdInDays() const; int signingRootCertNearExpiryWarningThresholdInDays() const; int encryptChainCertNearExpiryWarningThresholdInDays() const; int signingChainCertNearExpiryWarningThresholdInDays() const; ContactPreferences lookupContactPreferences(const QString &address) const; void saveContactPreference(const QString &email, const ContactPreferences &pref) const; private: class EncryptionPreferenceCounter; friend class ::Kleo::KeyResolver::EncryptionPreferenceCounter; class SigningPreferenceCounter; friend class ::Kleo::KeyResolver::SigningPreferenceCounter; struct Private; Private *d; bool mEncryptToSelf; const bool mShowApprovalDialog : 1; const bool mOpportunisticEncyption : 1; const unsigned int mCryptoMessageFormats; const int mEncryptKeyNearExpiryWarningThreshold; const int mSigningKeyNearExpiryWarningThreshold; const int mEncryptRootCertNearExpiryWarningThreshold; const int mSigningRootCertNearExpiryWarningThreshold; const int mEncryptChainCertNearExpiryWarningThreshold; const int mSigningChainCertNearExpiryWarningThreshold; }; } // namespace Kleo -#endif // KLEO_KEYRESOLVER_H +#endif diff --git a/messagecomposer/src/composer/signaturecontroller.h b/messagecomposer/src/composer/signaturecontroller.h index c2ba175e..638952fa 100644 --- a/messagecomposer/src/composer/signaturecontroller.h +++ b/messagecomposer/src/composer/signaturecontroller.h @@ -1,105 +1,105 @@ /* * Copyright (c) 2010 Volker Krause * * Based on kmail/kmcomposewin.cpp * Copyright (c) 2009 Constantin Berzan * * Based on KMail code by: * Copyright (c) 1997 Markus Wuebben * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef MESSAGECOMPSER_SIGNATURECONTROLLER_H -#define MESSAGECOMPSER_SIGNATURECONTROLLER_H +#ifndef MESSAGECOMPOSER_SIGNATURECONTROLLER_H +#define MESSAGECOMPOSER_SIGNATURECONTROLLER_H #include "messagecomposer_export.h" #include #include namespace KIdentityManagement { class IdentityCombo; } namespace MessageComposer { class RichTextComposerNg; class SignatureControllerPrivate; /** * @brief The SignatureController class * Controls signature (the footer thing, not the crypto thing) operations * happening on a KMEditor triggered by identity selection or menu actions. * @since 4.5 */ class MESSAGECOMPOSER_EXPORT SignatureController : public QObject { Q_OBJECT public: explicit SignatureController(QObject *parent = nullptr); ~SignatureController(); void setEditor(MessageComposer::RichTextComposerNg *editor); void setIdentityCombo(KIdentityManagement::IdentityCombo *combo); /** Temporarily disable identity tracking, useful for initial loading for example. */ void suspend(); /** Resume identity change tracking after a previous call to suspend(). */ void resume(); /** Adds the given signature to the editor, taking user preferences into account. */ void applySignature(const KIdentityManagement::Signature &signature); public Q_SLOTS: /** * Append signature to the end of the text in the editor. */ void appendSignature(); /** * Prepend signature at the beginning of the text in the editor. */ void prependSignature(); /** * Insert signature at the cursor position of the text in the editor. */ void insertSignatureAtCursor(); void cleanSpace(); Q_SIGNALS: /** * A HTML signature is about to be inserted, so enable HTML support in the editor. */ void enableHtml(); void signatureAdded(); private: /** * Helper to insert the signature of the current identity arbitrarily * in the editor, connecting slot functions to KMeditor::insertSignature(). * @param placement the position of the signature */ void insertSignatureHelper(KIdentityManagement::Signature::Placement placement); private Q_SLOTS: void identityChanged(uint id); private: SignatureControllerPrivate *const d; }; } #endif diff --git a/messagecomposer/src/followupreminder/followupremindercreatejob.h b/messagecomposer/src/followupreminder/followupremindercreatejob.h index 589b4705..9f2bd058 100644 --- a/messagecomposer/src/followupreminder/followupremindercreatejob.h +++ b/messagecomposer/src/followupreminder/followupremindercreatejob.h @@ -1,65 +1,65 @@ /* Copyright (C) 2014-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef FOLLOWUPREMINDERCREATEJOB_H -#define FOLLOWUPREMINDERCREATEJOB_H +#ifndef MESSAGECOMPOSER_FOLLOWUPREMINDERCREATEJOB_H +#define MESSAGECOMPOSER_FOLLOWUPREMINDERCREATEJOB_H #include #include #include #include #include "FollowupReminder/FollowUpReminderInfo" #include #include "messagecomposer_export.h" namespace MessageComposer { class FollowupReminderCreateJobPrivate; /** * @brief The FollowupReminderCreateJob class * @author Laurent Montel */ class MESSAGECOMPOSER_EXPORT FollowupReminderCreateJob : public KJob { Q_OBJECT public: explicit FollowupReminderCreateJob(QObject *parent = nullptr); ~FollowupReminderCreateJob() override; void setFollowUpReminderDate(const QDate &date); void setOriginalMessageItemId(Akonadi::Item::Id value); void setMessageId(const QString &messageId); void setTo(const QString &to); void setSubject(const QString &subject); void setCollectionToDo(const Akonadi::Collection &collection); void start() override; private Q_SLOTS: void slotCreateNewTodo(KJob *job); private: void writeFollowupReminderInfo(); FollowupReminderCreateJobPrivate *const d; }; } -#endif // FOLLOWUPREMINDERCREATEJOB_H +#endif diff --git a/messagecomposer/src/followupreminder/followupreminderselectdatedialog.h b/messagecomposer/src/followupreminder/followupreminderselectdatedialog.h index c7dd64b7..921390b3 100644 --- a/messagecomposer/src/followupreminder/followupreminderselectdatedialog.h +++ b/messagecomposer/src/followupreminder/followupreminderselectdatedialog.h @@ -1,55 +1,55 @@ /* Copyright (C) 2014-2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef FOLLOWUPREMINDERSELECTDATEDIALOG_H -#define FOLLOWUPREMINDERSELECTDATEDIALOG_H +#ifndef MESSAGECOMPOSER_FOLLOWUPREMINDERSELECTDATEDIALOG_H +#define MESSAGECOMPOSER_FOLLOWUPREMINDERSELECTDATEDIALOG_H #include #include #include #include "messagecomposer_export.h" class QAbstractItemModel; namespace MessageComposer { class FollowUpReminderSelectDateDialogPrivate; /** * @brief The FollowUpReminderSelectDateDialog class * @author Laurent Montel */ class MESSAGECOMPOSER_EXPORT FollowUpReminderSelectDateDialog : public QDialog { Q_OBJECT public: explicit FollowUpReminderSelectDateDialog(QWidget *parent = nullptr, QAbstractItemModel *model = nullptr); ~FollowUpReminderSelectDateDialog() override; Q_REQUIRED_RESULT QDate selectedDate() const; void accept() override; Akonadi::Collection collection() const; private Q_SLOTS: void slotDateChanged(); void updateOkButton(); private: FollowUpReminderSelectDateDialogPrivate *const d; }; } -#endif // FOLLOWUPREMINDERSELECTDATEDIALOG_H +#endif diff --git a/messagecomposer/src/helper/messagefactoryforwardjob.h b/messagecomposer/src/helper/messagefactoryforwardjob.h index ac0ed9cf..b109f7d7 100644 --- a/messagecomposer/src/helper/messagefactoryforwardjob.h +++ b/messagecomposer/src/helper/messagefactoryforwardjob.h @@ -1,65 +1,65 @@ /* Copyright (C) 2017-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef MESSAGEFACTORYFORWARDJOB_H -#define MESSAGEFACTORYFORWARDJOB_H +#ifndef MESSAGECOMPOSER_MESSAGEFACTORYFORWARDJOB_H +#define MESSAGECOMPOSER_MESSAGEFACTORYFORWARDJOB_H #include #include #include namespace KIdentityManagement { class IdentityManager; } namespace MessageComposer { class MessageFactoryForwardJob : public QObject { Q_OBJECT public: explicit MessageFactoryForwardJob(QObject *parent = nullptr); ~MessageFactoryForwardJob(); void start(); void setMsg(const KMime::Message::Ptr &msg); void setTemplate(const QString &tmpl); void setSelection(const QString &selection); void setOrigMsg(const KMime::Message::Ptr &origMsg); void setIdentityManager(KIdentityManagement::IdentityManager *identityManager); void setCollection(const Akonadi::Collection &collection); Q_SIGNALS: void forwardDone(const KMime::Message::Ptr &msg); private: void slotParsingDone(); QString mSelection; QString mTemplate; KMime::Message::Ptr mMsg = nullptr; KMime::Message::Ptr mOrigMsg = nullptr; Akonadi::Collection mCollection; KIdentityManagement::IdentityManager *mIdentityManager = nullptr; }; } -#endif // MESSAGEFACTORYFORWARDJOB_H +#endif diff --git a/messagecomposer/src/helper/messagefactoryreplyjob.h b/messagecomposer/src/helper/messagefactoryreplyjob.h index 9a131b11..d3db7152 100644 --- a/messagecomposer/src/helper/messagefactoryreplyjob.h +++ b/messagecomposer/src/helper/messagefactoryreplyjob.h @@ -1,66 +1,66 @@ /* Copyright (C) 2017-2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef MESSAGEFACTORYREPLYJOB_H -#define MESSAGEFACTORYREPLYJOB_H +#ifndef MESSAGECOMPOSER_MESSAGEFACTORYREPLYJOB_H +#define MESSAGECOMPOSER_MESSAGEFACTORYREPLYJOB_H #include #include #include #include namespace MessageComposer { class MessageFactoryReplyJob : public QObject { Q_OBJECT public: explicit MessageFactoryReplyJob(QObject *parent = nullptr); ~MessageFactoryReplyJob(); void start(); void setMsg(const KMime::Message::Ptr &msg); void setTemplate(const QString &tmpl); void setSelection(const QString &selection); void setOrigMsg(const KMime::Message::Ptr &origMsg); void setIdentityManager(KIdentityManagement::IdentityManager *identityManager); void setReplyAll(bool replyAll); void setCollection(const Akonadi::Collection &collection); Q_SIGNALS: void replyDone(const KMime::Message::Ptr &msg, bool replyAll); private: void slotReplyDone(); QString mSelection; QString mTemplate; KMime::Message::Ptr mMsg = nullptr; KMime::Message::Ptr mOrigMsg = nullptr; Akonadi::Collection mCollection; bool mReplyAll = false; KIdentityManagement::IdentityManager *mIdentityManager = nullptr; }; } -#endif // MESSAGEFACTORYREPLYJOB_H +#endif diff --git a/messagecomposer/src/helper/messagehelper.h b/messagecomposer/src/helper/messagehelper.h index 8d240137..fee5023c 100644 --- a/messagecomposer/src/helper/messagehelper.h +++ b/messagecomposer/src/helper/messagehelper.h @@ -1,65 +1,65 @@ /* Copyright (C) 2009 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.net Copyright (c) 2009 Andras Mantia This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef KMAIL_MESSAGE_HELPER_H -#define KMAIL_MESSAGE_HELPER_H +#ifndef MESSAGECOMPOSER_MESSAGE_HELPER_H +#define MESSAGECOMPOSER_MESSAGE_HELPER_H #include "messagecomposer_export.h" #include #include #include namespace KIdentityManagement { class IdentityManager; } namespace KMime { class Message; } /** * Contains random helper methods when dealing with messages. * TODO: cleanup and organize, along with similar methods in messageviewer. */ namespace MessageHelper { /** Initialize header fields. Should be called on new messages if they are not set manually. E.g. before composing. Calling of setAutomaticFields(), see below, is still required. */ void MESSAGECOMPOSER_EXPORT initHeader(const KMime::Message::Ptr &message, const KIdentityManagement::IdentityManager *identMan, uint id = 0); /** Set the from, to, cc, bcc, encryption etc headers as specified in the * given identity. */ void applyIdentity(const KMime::Message::Ptr &message, const KIdentityManagement::IdentityManager *identMan, uint id); /** Initialize headers fields according to the identity and the transport header of the given original message */ void initFromMessage(const KMime::Message::Ptr &msg, const KMime::Message::Ptr &orgiMsg, KIdentityManagement::IdentityManager *, uint id, bool idHeaders = true); MESSAGECOMPOSER_EXPORT KMime::Types::AddrSpecList extractAddrSpecs(const KMime::Message::Ptr &msg, const QByteArray &header); /** Set fields that are either automatically set (Message-id) or that do not change from one message to another (MIME-Version). Call this method before sending *after* all changes to the message are done because this method does things different if there are attachments / multiple body parts. */ void setAutomaticFields(const KMime::Message::Ptr &msg, bool isMultipart = false); } #endif diff --git a/messagecomposer/src/snippet/convertsnippetvariablemenu.h b/messagecomposer/src/snippet/convertsnippetvariablemenu.h index d5d198f3..ecbe55a4 100644 --- a/messagecomposer/src/snippet/convertsnippetvariablemenu.h +++ b/messagecomposer/src/snippet/convertsnippetvariablemenu.h @@ -1,44 +1,48 @@ /* Copyright (C) 2019 Montel Laurent This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CONVERTSNIPPETVARIABLEMENU_H #define CONVERTSNIPPETVARIABLEMENU_H #include #include "messagecomposer_export.h" #include class QMenu; namespace MessageComposer { +/** + * @brief The ConvertSnippetVariableMenu class + * @author Laurent Montel + */ class MESSAGECOMPOSER_EXPORT ConvertSnippetVariableMenu : public QObject { Q_OBJECT public: explicit ConvertSnippetVariableMenu(QWidget *parentWidget, QObject *parent = nullptr); ~ConvertSnippetVariableMenu(); QMenu *menu() const; Q_SIGNALS: void insertVariable(MessageComposer::ConvertSnippetVariablesUtil::VariableType type); private: void initializeMenu(); QWidget *mParentWidget = nullptr; QMenu *mMenu = nullptr; }; } #endif // CONVERTSNIPPETVARIABLEMENU_H diff --git a/messagecomposer/src/snippet/convertsnippetvariablesjob.h b/messagecomposer/src/snippet/convertsnippetvariablesjob.h index a2ba25cd..0365c6e1 100644 --- a/messagecomposer/src/snippet/convertsnippetvariablesjob.h +++ b/messagecomposer/src/snippet/convertsnippetvariablesjob.h @@ -1,54 +1,58 @@ /* Copyright (C) 2019 Laurent Montel This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CONVERTSNIPPETVARIABLESJOB_H #define CONVERTSNIPPETVARIABLESJOB_H #include #include "messagecomposer_export.h" namespace MessageComposer { class ComposerViewInterface; +/** + * @brief The ConvertSnippetVariablesJob class + * @author Laurent Montel + */ class MESSAGECOMPOSER_EXPORT ConvertSnippetVariablesJob : public QObject { Q_OBJECT public: explicit ConvertSnippetVariablesJob(QObject *parent = nullptr); ~ConvertSnippetVariablesJob(); void start(); void setText(const QString &str); Q_REQUIRED_RESULT QString text() const; MessageComposer::ComposerViewInterface *composerViewInterface() const; void setComposerViewInterface(MessageComposer::ComposerViewInterface *composerViewInterface); static Q_REQUIRED_RESULT QString convertVariables(MessageComposer::ComposerViewInterface *composerView, const QString &text); Q_REQUIRED_RESULT bool canStart() const; Q_SIGNALS: void textConverted(const QString &str); private: static QString getFirstNameFromEmail(QString address); static QString getLastNameFromEmail(QString address); static QString getNameFromEmail(QString address); QString mText; MessageComposer::ComposerViewInterface *mComposerViewInterface = nullptr; }; } #endif // CONVERTVARIABLESJOB_H