File indexing completed on 2024-12-01 10:39:48
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "servererrorinfo.h" 0008 0009 #include <QLocale> 0010 0011 quint64 ServerErrorInfo::identifierId = 0; 0012 ServerErrorInfo::ServerErrorInfo() 0013 { 0014 createUniqueIdentifier(); 0015 setDateTime(QDateTime::currentDateTime()); 0016 } 0017 0018 ServerErrorInfo::~ServerErrorInfo() = default; 0019 0020 QDebug operator<<(QDebug d, const ServerErrorInfo &t) 0021 { 0022 d << " Account Name " << t.accountName(); 0023 d << " Message " << t.message(); 0024 d << " DateTime " << t.dateTime(); 0025 d << " identifier " << t.identifier(); 0026 return d; 0027 } 0028 0029 QString ServerErrorInfo::accountName() const 0030 { 0031 return mAccountName; 0032 } 0033 0034 void ServerErrorInfo::setAccountName(const QString &newAccountName) 0035 { 0036 mAccountName = newAccountName; 0037 } 0038 0039 QString ServerErrorInfo::message() const 0040 { 0041 return mMessage; 0042 } 0043 0044 void ServerErrorInfo::setMessage(const QString &newMessage) 0045 { 0046 mMessage = newMessage; 0047 } 0048 0049 QDateTime ServerErrorInfo::dateTime() const 0050 { 0051 return mDateTime; 0052 } 0053 0054 void ServerErrorInfo::setDateTime(const QDateTime &newDateTime) 0055 { 0056 if (mDateTime != newDateTime) { 0057 mDateTime = newDateTime; 0058 QLocale l; 0059 mDateTimeStr = l.toString(mDateTime, QLocale::LongFormat); 0060 } 0061 } 0062 0063 QString ServerErrorInfo::identifier() const 0064 { 0065 return mIdentifier; 0066 } 0067 0068 void ServerErrorInfo::createUniqueIdentifier() 0069 { 0070 identifierId++; 0071 mIdentifier = QString::number(identifierId); 0072 } 0073 0074 QString ServerErrorInfo::dateTimeStr() const 0075 { 0076 return mDateTimeStr; 0077 } 0078 0079 #include "moc_servererrorinfo.cpp"