File indexing completed on 2024-05-12 05:17:21

0001 /*
0002     Copyright (c) 2009 Andras Mantia <amantia@kde.org>
0003 
0004     This library is free software; you can redistribute it and/or modify it
0005     under the terms of the GNU Library General Public License as published by
0006     the Free Software Foundation; either version 2 of the License, or (at your
0007     option) any later version.
0008 
0009     This library is distributed in the hope that it will be useful, but WITHOUT
0010     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0011     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
0012     License for more details.
0013 
0014     You should have received a copy of the GNU Library General Public License
0015     along with this library; see the file COPYING.LIB.  If not, write to the
0016     Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0017     02110-1301, USA.
0018 */
0019 
0020 #include "acljobbase.h"
0021 #include "acljobbase_p.h"
0022 #include "message_p.h"
0023 #include "session_p.h"
0024 
0025 using namespace KIMAP2;
0026 
0027 void AclJobBasePrivate::setIdentifier(const QByteArray &identifier)
0028 {
0029     id = identifier;
0030 }
0031 
0032 QByteArray AclJobBasePrivate::identifier() const
0033 {
0034     return id;
0035 }
0036 
0037 bool AclJobBasePrivate::hasRightEnabled(Acl::Right right)
0038 {
0039     return rightList & right;
0040 }
0041 
0042 void AclJobBasePrivate::setRights(const QByteArray &rights)
0043 {
0044     switch (rights[0]) {
0045     case '+':
0046         modifier = AclJobBase::Add;
0047         break;
0048     case '-':
0049         modifier = AclJobBase::Remove;
0050         break;
0051     default:
0052         modifier = AclJobBase::Change;
0053         break;
0054     }
0055 
0056     rightList = Acl::rightsFromString(rights);
0057 }
0058 
0059 void AclJobBasePrivate::setRights(AclJobBase::AclModifier _modifier, Acl::Rights rights)
0060 {
0061     modifier = _modifier;
0062     rightList = rights;
0063 }
0064 
0065 AclJobBase::AclJobBase(Session *session)
0066     : Job(*new AclJobBasePrivate(session, "AclJobBase"))
0067 {
0068 }
0069 
0070 AclJobBase::AclJobBase(JobPrivate &dd)
0071     : Job(dd)
0072 {
0073 
0074 }
0075 
0076 AclJobBase::~AclJobBase()
0077 {
0078 }
0079 
0080 void AclJobBase::setMailBox(const QString &mailBox)
0081 {
0082     Q_D(AclJobBase);
0083     d->mailBox = mailBox;
0084 }
0085 
0086 QString AclJobBase::mailBox() const
0087 {
0088     Q_D(const AclJobBase);
0089     return d->mailBox;
0090 }