KIMAP2

acljobbase.cpp
1 /*
2  Copyright (c) 2009 Andras Mantia <[email protected]>
3 
4  This library is free software; you can redistribute it and/or modify it
5  under the terms of the GNU Library General Public License as published by
6  the Free Software Foundation; either version 2 of the License, or (at your
7  option) any later version.
8 
9  This library is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12  License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to the
16  Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  02110-1301, USA.
18 */
19 
20 #include "acljobbase.h"
21 #include "acljobbase_p.h"
22 #include "message_p.h"
23 #include "session_p.h"
24 
25 using namespace KIMAP2;
26 
27 void AclJobBasePrivate::setIdentifier(const QByteArray &identifier)
28 {
29  id = identifier;
30 }
31 
32 QByteArray AclJobBasePrivate::identifier() const
33 {
34  return id;
35 }
36 
37 bool AclJobBasePrivate::hasRightEnabled(Acl::Right right)
38 {
39  return rightList & right;
40 }
41 
42 void AclJobBasePrivate::setRights(const QByteArray &rights)
43 {
44  switch (rights[0]) {
45  case '+':
46  modifier = AclJobBase::Add;
47  break;
48  case '-':
49  modifier = AclJobBase::Remove;
50  break;
51  default:
52  modifier = AclJobBase::Change;
53  break;
54  }
55 
56  rightList = Acl::rightsFromString(rights);
57 }
58 
59 void AclJobBasePrivate::setRights(AclJobBase::AclModifier _modifier, Acl::Rights rights)
60 {
61  modifier = _modifier;
62  rightList = rights;
63 }
64 
65 AclJobBase::AclJobBase(Session *session)
66  : Job(*new AclJobBasePrivate(session, "AclJobBase"))
67 {
68 }
69 
70 AclJobBase::AclJobBase(JobPrivate &dd)
71  : Job(dd)
72 {
73 
74 }
75 
76 AclJobBase::~AclJobBase()
77 {
78 }
79 
80 void AclJobBase::setMailBox(const QString &mailBox)
81 {
82  Q_D(AclJobBase);
83  d->mailBox = mailBox;
84 }
85 
87 {
88  Q_D(const AclJobBase);
89  return d->mailBox;
90 }
QTextStream & right(QTextStream &stream)
Base class for jobs that operate on mailbox ACLs.
Definition: acljobbase.h:44
QString mailBox() const
The mailbox that will be acted upon.
Definition: acljobbase.cpp:86
void setMailBox(const QString &mailBox)
Set the mailbox to act on.
Definition: acljobbase.cpp:80
KIMAP2_EXPORT Rights rightsFromString(const QByteArray &string)
Convert the text form of a set of rights into a Rights bitflag.
Definition: acl.cpp:69
AclModifier
Used when subclassing to specify how the ACL will be modified.
Definition: acljobbase.h:58
Right
Possible rights that can be held on a mailbox.
Definition: acl.h:39
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Aug 14 2022 04:16:09 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.