File indexing completed on 2024-05-12 05:17:13
0001 /* 0002 SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "getquotajob.h" 0008 0009 #include <KLocalizedString> 0010 0011 #include "quotajobbase_p.h" 0012 #include "response_p.h" 0013 #include "session_p.h" 0014 0015 namespace KIMAP 0016 { 0017 class GetQuotaJobPrivate : public QuotaJobBasePrivate 0018 { 0019 public: 0020 GetQuotaJobPrivate(Session *session, const QString &name) 0021 : QuotaJobBasePrivate(session, name) 0022 { 0023 } 0024 ~GetQuotaJobPrivate() 0025 { 0026 } 0027 0028 QByteArray root; 0029 }; 0030 } 0031 0032 using namespace KIMAP; 0033 0034 GetQuotaJob::GetQuotaJob(Session *session) 0035 : QuotaJobBase(*new GetQuotaJobPrivate(session, i18n("GetQuota"))) 0036 { 0037 } 0038 0039 GetQuotaJob::~GetQuotaJob() 0040 { 0041 } 0042 0043 void GetQuotaJob::doStart() 0044 { 0045 Q_D(GetQuotaJob); 0046 // XXX: [alexmerry, 2010-07-24]: should d->root be quoted properly? 0047 d->tags << d->sessionInternal()->sendCommand("GETQUOTA", '\"' + d->root + '\"'); 0048 } 0049 0050 void GetQuotaJob::handleResponse(const Response &response) 0051 { 0052 Q_D(GetQuotaJob); 0053 if (handleErrorReplies(response) == NotHandled) { 0054 if (response.content.size() >= 4 && response.content[1].toString() == "QUOTA") { 0055 d->quota = d->readQuota(response.content[3]); 0056 } 0057 } 0058 } 0059 0060 void GetQuotaJob::setRoot(const QByteArray &root) 0061 { 0062 Q_D(GetQuotaJob); 0063 d->root = root; 0064 } 0065 0066 QByteArray GetQuotaJob::root() const 0067 { 0068 Q_D(const GetQuotaJob); 0069 return d->root; 0070 } 0071 0072 #include "moc_getquotajob.cpp"