File indexing completed on 2024-05-12 05:20:37

0001 /*
0002    SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004    SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 #include "kmail_private_export.h"
0009 #include <QDebug>
0010 #include <QUrl>
0011 
0012 class KMAILTESTS_TESTS_EXPORT CommandLineInfo
0013 {
0014 public:
0015     CommandLineInfo();
0016     ~CommandLineInfo();
0017 
0018     void parseCommandLine(const QStringList &args, const QString &workingDir);
0019     [[nodiscard]] QStringList customHeaders() const;
0020 
0021     [[nodiscard]] QList<QUrl> attachURLs() const;
0022 
0023     [[nodiscard]] QString to() const;
0024 
0025     [[nodiscard]] QString cc() const;
0026 
0027     [[nodiscard]] QString bcc() const;
0028 
0029     [[nodiscard]] QString subject() const;
0030 
0031     [[nodiscard]] QString body() const;
0032 
0033     [[nodiscard]] QString inReplyTo() const;
0034 
0035     [[nodiscard]] QString replyTo() const;
0036 
0037     [[nodiscard]] QString identity() const;
0038 
0039     [[nodiscard]] QUrl messageFile() const;
0040 
0041     [[nodiscard]] bool startInTray() const;
0042 
0043     [[nodiscard]] bool mailto() const;
0044 
0045     [[nodiscard]] bool checkMail() const;
0046 
0047     [[nodiscard]] bool viewOnly() const;
0048 
0049     [[nodiscard]] bool calledWithSession() const;
0050 
0051     [[nodiscard]] bool operator==(const CommandLineInfo &other) const;
0052 
0053     void setCustomHeaders(const QStringList &newCustomHeaders);
0054 
0055     void setAttachURLs(const QList<QUrl> &newAttachURLs);
0056 
0057     void setTo(const QString &newTo);
0058 
0059     void setCc(const QString &newCc);
0060 
0061     void setBcc(const QString &newBcc);
0062 
0063     void setSubject(const QString &newSubject);
0064 
0065     void setBody(const QString &newBody);
0066 
0067     void setInReplyTo(const QString &newInReplyTo);
0068 
0069     void setReplyTo(const QString &newReplyTo);
0070 
0071     void setIdentity(const QString &newIdentity);
0072 
0073     void setMessageFile(const QUrl &newMessageFile);
0074 
0075     void setStartInTray(bool newStartInTray);
0076 
0077     void setMailto(bool newMailto);
0078 
0079     void setCheckMail(bool newCheckMail);
0080 
0081     void setViewOnly(bool newViewOnly);
0082 
0083     void setCalledWithSession(bool newCalledWithSession);
0084 
0085 private:
0086     QStringList mCustomHeaders;
0087     QList<QUrl> mAttachURLs;
0088     QString mTo;
0089     QString mCc;
0090     QString mBcc;
0091     QString mSubject;
0092     QString mBody;
0093     QString mInReplyTo;
0094     QString mReplyTo;
0095     QString mIdentity;
0096     QUrl mMessageFile;
0097     bool mStartInTray = false;
0098     bool mMailto = false;
0099     bool mCheckMail = false;
0100     bool mViewOnly = false;
0101     bool mCalledWithSession = false; // for ignoring '-session foo'
0102 };
0103 
0104 Q_DECLARE_TYPEINFO(CommandLineInfo, Q_MOVABLE_TYPE);
0105 KMAILTESTS_TESTS_EXPORT QDebug operator<<(QDebug d, const CommandLineInfo &t);