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 "rfccodecs.h"
14 #include "session_p.h"
15 
16 namespace KIMAP
17 {
18 class SetAclJobPrivate : public AclJobBasePrivate
19 {
20 public:
21  SetAclJobPrivate(Session *session, const QString &name)
22  : AclJobBasePrivate(session, name)
23  {
24  }
25  ~SetAclJobPrivate()
26  {
27  }
28 };
29 }
30 
31 using namespace KIMAP;
32 
33 SetAclJob::SetAclJob(Session *session)
34  : AclJobBase(*new SetAclJobPrivate(session, i18n("SetAcl")))
35 {
36 }
37 
38 SetAclJob::~SetAclJob()
39 {
40 }
41 
42 void SetAclJob::doStart()
43 {
44  Q_D(SetAclJob);
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 {
56  Q_D(SetAclJob);
57  d->setRights(modifier, rights);
58 }
59 
60 void SetAclJob::setIdentifier(const QByteArray &identifier)
61 {
62  Q_D(SetAclJob);
63  d->setIdentifier(identifier);
64 }
65 
67 {
68  Q_D(SetAclJob);
69  return d->identifier();
70 }
71 
72 #include "moc_setacljob.cpp"
AclModifier
Used when subclassing to specify how the ACL will be modified.
Definition: acljobbase.h:43
QByteArray identifier()
The identifier that rights will be associated with.
Definition: setacljob.cpp:66
void setIdentifier(const QByteArray &identifier)
Sets the identifier the rights will be modified for.
Definition: setacljob.cpp:60
Sets the rights that correspond to an identifier on a mailbox.
Definition: setacljob.h:29
Base class for jobs that operate on mailbox ACLs.
Definition: acljobbase.h:29
QByteArray & prepend(char ch)
void setRights(AclModifier modifier, Acl::Rights rights)
Sets the rights that will be changed for the identifier.
Definition: setacljob.cpp:54
QString i18n(const char *text, const TYPE &arg...)
const char * name(StandardAction id)
Provides handlers for various RFC/MIME encodings.
KIMAP_EXPORT QByteArray rightsToString(Rights rights)
Convert a set of rights into text format.
Definition: acl.cpp:77
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.