KIMAP

setacljob.cpp
1/*
2 SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "setacljob.h"
8
9#include <KLocalizedString>
10
11#include "acljobbase_p.h"
12#include "response_p.h"
13#include "rfccodecs.h"
14#include "session_p.h"
15
16namespace KIMAP
17{
18class SetAclJobPrivate : public AclJobBasePrivate
19{
20public:
21 SetAclJobPrivate(Session *session, const QString &name)
22 : AclJobBasePrivate(session, name)
23 {
24 }
25 ~SetAclJobPrivate()
26 {
27 }
28};
29}
30
31using namespace KIMAP;
32
33SetAclJob::SetAclJob(Session *session)
34 : AclJobBase(*new SetAclJobPrivate(session, i18n("SetAcl")))
35{
36}
37
38SetAclJob::~SetAclJob()
39{
40}
41
42void SetAclJob::doStart()
43{
45 QByteArray r = Acl::rightsToString(d->rightList);
46 if (d->modifier == Add) {
47 r.prepend('+');
48 } else if (d->modifier == Remove) {
49 r.prepend('-');
50 }
51 d->tags << d->sessionInternal()->sendCommand("SETACL", '\"' + KIMAP::encodeImapFolderName(d->mailBox.toUtf8()) + "\" \"" + d->id + "\" \"" + r + '\"');
52}
53
55{
57 d->setRights(modifier, rights);
58}
59
60void SetAclJob::setIdentifier(const QByteArray &identifier)
61{
63 d->setIdentifier(identifier);
64}
65
67{
69 return d->identifier();
70}
71
72#include "moc_setacljob.cpp"
Base class for jobs that operate on mailbox ACLs.
Definition acljobbase.h:30
AclModifier
Used when subclassing to specify how the ACL will be modified.
Definition acljobbase.h:43
Sets the rights that correspond to an identifier on a mailbox.
Definition setacljob.h:30
void setRights(AclModifier modifier, Acl::Rights rights)
Sets the rights that will be changed for the identifier.
Definition setacljob.cpp:54
void setIdentifier(const QByteArray &identifier)
Sets the identifier the rights will be modified for.
Definition setacljob.cpp:60
QByteArray identifier()
The identifier that rights will be associated with.
Definition setacljob.cpp:66
QString i18n(const char *text, const TYPE &arg...)
KIMAP_EXPORT QByteArray rightsToString(Rights rights)
Convert a set of rights into text format.
Definition acl.cpp:77
QString name(StandardAction id)
QByteArray & prepend(QByteArrayView ba)
This file is part of the IMAP support library and defines the RfcCodecs class.
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:17 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.