File indexing completed on 2024-10-27 04:51:07
0001 /* 0002 SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "editor/kmcomposerwin.h" 0010 #include "kmail_private_export.h" 0011 #include <KMime/Message> 0012 #include <QObject> 0013 struct KMAILTESTS_TESTS_EXPORT OpenComposerSettings { 0014 OpenComposerSettings() = default; 0015 0016 OpenComposerSettings(const QString &to, 0017 const QString &cc, 0018 const QString &bcc, 0019 const QString &subject, 0020 const QString &body, 0021 bool hidden, 0022 const QString &messageFile, 0023 const QStringList &attachmentPaths, 0024 const QStringList &customHeaders, 0025 const QString &replyTo, 0026 const QString &inReplyTo, 0027 const QString &identity) 0028 : mAttachmentPaths(attachmentPaths) 0029 , mCustomHeaders(customHeaders) 0030 , mTo(to) 0031 , mCc(cc) 0032 , mBcc(bcc) 0033 , mSubject(subject) 0034 , mBody(body) 0035 , mMessageFile(messageFile) 0036 , mReplyTo(replyTo) 0037 , mInReplyTo(inReplyTo) 0038 , mIdentity(identity) 0039 , mHidden(hidden) 0040 { 0041 } 0042 0043 QStringList mAttachmentPaths; 0044 QStringList mCustomHeaders; 0045 QString mTo; 0046 QString mCc; 0047 QString mBcc; 0048 QString mSubject; 0049 QString mBody; 0050 QString mMessageFile; 0051 QString mReplyTo; 0052 QString mInReplyTo; 0053 QString mIdentity; 0054 bool mHidden = false; 0055 }; 0056 0057 class KMAILTESTS_TESTS_EXPORT OpenComposerJob : public QObject 0058 { 0059 Q_OBJECT 0060 public: 0061 explicit OpenComposerJob(QObject *parent = nullptr); 0062 ~OpenComposerJob() override; 0063 void start(); 0064 0065 void setOpenComposerSettings(const OpenComposerSettings &openComposerSettings); 0066 0067 private: 0068 void slotOpenComposer(); 0069 OpenComposerSettings mOpenComposerSettings; 0070 KMime::Message::Ptr mMsg = nullptr; 0071 KMail::Composer::TemplateContext mContext = KMail::Composer::New; 0072 uint mIdentityId = 0; 0073 };