KIMAP

setacljob.cpp
1 /*
2  SPDX-FileCopyrightText: 2009 Andras Mantia <[email protected]>
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 "session_p.h"
14 #include "rfccodecs.h"
15 
16 namespace KIMAP
17 {
18 class SetAclJobPrivate : public AclJobBasePrivate
19 {
20 public:
21  SetAclJobPrivate(Session *session, const QString &name) : AclJobBasePrivate(session, name) {}
22  ~SetAclJobPrivate() { }
23 };
24 }
25 
26 using namespace KIMAP;
27 
28 SetAclJob::SetAclJob(Session *session)
29  : AclJobBase(*new SetAclJobPrivate(session, i18n("SetAcl")))
30 {
31 }
32 
33 SetAclJob::~SetAclJob()
34 {
35 }
36 
37 void SetAclJob::doStart()
38 {
39  Q_D(SetAclJob);
40  QByteArray r = Acl::rightsToString(d->rightList);
41  if (d->modifier == Add) {
42  r.prepend('+');
43  } else if (d->modifier == Remove) {
44  r.prepend('-');
45  }
46  d->tags << d->sessionInternal()->sendCommand("SETACL", '\"' + KIMAP::encodeImapFolderName(d->mailBox.toUtf8()) + "\" \"" + d->id + "\" \"" + r + '\"');
47 }
48 
50 {
51  Q_D(SetAclJob);
52  d->setRights(modifier, rights);
53 }
54 
55 void SetAclJob::setIdentifier(const QByteArray &identifier)
56 {
57  Q_D(SetAclJob);
58  d->setIdentifier(identifier);
59 }
60 
62 {
63  Q_D(SetAclJob);
64  return d->identifier();
65 }
This file is part of the IMAP support library and defines the RfcCodecs class.
QByteArray identifier()
The identifier that rights will be associated with.
Definition: setacljob.cpp:61
KIMAP_EXPORT QByteArray rightsToString(Rights rights)
Convert a set of rights into text format.
Definition: acl.cpp:78
QByteArray & prepend(char ch)
void setRights(AclModifier modifier, Acl::Rights rights)
Sets the rights that will be changed for the identifier.
Definition: setacljob.cpp:49
QString i18n(const char *text, const TYPE &arg...)
AclModifier
Used when subclassing to specify how the ACL will be modified.
Definition: acljobbase.h:45
Sets the rights that correspond to an identifier on a mailbox.
Definition: setacljob.h:31
Definition: acl.cpp:12
void setIdentifier(const QByteArray &identifier)
Sets the identifier the rights will be modified for.
Definition: setacljob.cpp:55
Base class for jobs that operate on mailbox ACLs.
Definition: acljobbase.h:31
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Wed Oct 28 2020 23:16:14 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.