File indexing completed on 2024-05-12 16:42:44
0001 /* 0002 SPDX-FileCopyrightText: 2013-2015 Christian Dávid <christian-david@web.de> 0003 SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef ONLINEJOBMESSAGE_H 0008 #define ONLINEJOBMESSAGE_H 0009 0010 #include "kmm_mymoney_export.h" 0011 0012 #include <qglobal.h> 0013 0014 class QDateTime; 0015 0016 namespace eMyMoney { 0017 namespace OnlineJob { 0018 enum class MessageType; 0019 } 0020 } 0021 0022 /** 0023 * @brief Represents a log message for onlineJobs 0024 */ 0025 class onlineJobMessagePrivate; 0026 class KMM_MYMONEY_EXPORT onlineJobMessage 0027 { 0028 Q_DECLARE_PRIVATE(onlineJobMessage) 0029 onlineJobMessagePrivate * d_ptr; 0030 0031 public: 0032 explicit onlineJobMessage(eMyMoney::OnlineJob::MessageType type, 0033 QString sender, 0034 QString message, 0035 QDateTime timestamp); 0036 0037 explicit onlineJobMessage(eMyMoney::OnlineJob::MessageType type, 0038 QString sender, 0039 QString message); 0040 0041 onlineJobMessage(const onlineJobMessage & other); 0042 onlineJobMessage(onlineJobMessage && other); 0043 onlineJobMessage & operator=(onlineJobMessage other); 0044 friend void swap(onlineJobMessage& first, onlineJobMessage& second); 0045 ~onlineJobMessage(); 0046 0047 bool isDebug() const; 0048 bool isLog() const; 0049 bool isInformation() const; 0050 bool isWarning() const; 0051 bool isError() const; 0052 bool isPersistant() const; 0053 0054 /** @see messageType */ 0055 eMyMoney::OnlineJob::MessageType type() const; 0056 0057 /** 0058 * @brief Who "wrote" this message? 0059 * 0060 * Could be "OnlinePlugin" or "Bank" 0061 */ 0062 QString sender() const; 0063 0064 /** 0065 * @brief What happend? 0066 */ 0067 QString message() const; 0068 0069 /** @brief DateTime of message */ 0070 QDateTime timestamp() const; 0071 0072 /** 0073 * @brief Set an error code of the plugin 0074 */ 0075 void setSenderErrorCode(const QString& errorCode); 0076 QString senderErrorCode(); 0077 0078 private: 0079 onlineJobMessage(); 0080 }; 0081 0082 inline void swap(onlineJobMessage& first, onlineJobMessage& second) // krazy:exclude=inline 0083 { 0084 using std::swap; 0085 swap(first.d_ptr, second.d_ptr); 0086 } 0087 0088 inline onlineJobMessage::onlineJobMessage(onlineJobMessage && other) : onlineJobMessage() // krazy:exclude=inline 0089 { 0090 swap(*this, other); 0091 } 0092 0093 inline onlineJobMessage & onlineJobMessage::operator=(onlineJobMessage other) // krazy:exclude=inline 0094 { 0095 swap(*this, other); 0096 return *this; 0097 } 0098 0099 #endif // ONLINEJOBMESSAGE_H