KIMAP

getquotajob.cpp
1 /*
2  SPDX-FileCopyrightText: 2009 Andras Mantia <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6 
7 #include "getquotajob.h"
8 
9 #include <KLocalizedString>
10 
11 #include "quotajobbase_p.h"
12 #include "response_p.h"
13 #include "session_p.h"
14 
15 namespace KIMAP
16 {
17 class GetQuotaJobPrivate : public QuotaJobBasePrivate
18 {
19 public:
20  GetQuotaJobPrivate(Session *session, const QString &name)
21  : QuotaJobBasePrivate(session, name)
22  {
23  }
24  ~GetQuotaJobPrivate()
25  {
26  }
27 
28  QByteArray root;
29 };
30 }
31 
32 using namespace KIMAP;
33 
34 GetQuotaJob::GetQuotaJob(Session *session)
35  : QuotaJobBase(*new GetQuotaJobPrivate(session, i18n("GetQuota")))
36 {
37 }
38 
39 GetQuotaJob::~GetQuotaJob()
40 {
41 }
42 
43 void GetQuotaJob::doStart()
44 {
46  // XXX: [alexmerry, 2010-07-24]: should d->root be quoted properly?
47  d->tags << d->sessionInternal()->sendCommand("GETQUOTA", '\"' + d->root + '\"');
48 }
49 
50 void GetQuotaJob::handleResponse(const Response &response)
51 {
53  if (handleErrorReplies(response) == NotHandled) {
54  if (response.content.size() >= 4 && response.content[1].toString() == "QUOTA") {
55  d->quota = d->readQuota(response.content[3]);
56  }
57  }
58 }
59 
61 {
63  d->root = root;
64 }
65 
67 {
68  Q_D(const GetQuotaJob);
69  return d->root;
70 }
71 
72 #include "moc_getquotajob.cpp"
QByteArray root() const
The quota root that resource limit information will be fetched for.
Definition: getquotajob.cpp:66
Base class for jobs that operate on mailbox quotas.
Definition: quotajobbase.h:28
QString i18n(const char *text, const TYPE &arg...)
Gets resource limits for a quota root.
Definition: getquotajob.h:36
void setRoot(const QByteArray &root)
Set the quota root to get the resource limits for.
Definition: getquotajob.cpp:60
const char * name(StandardAction id)
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Sun Dec 10 2023 03:48:59 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.