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

0001 /*
0002     SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "acljobbase.h"
0008 #include "acljobbase_p.h"
0009 #include "response_p.h"
0010 #include "session_p.h"
0011 
0012 #include <KLocalizedString>
0013 
0014 using namespace KIMAP;
0015 
0016 void AclJobBasePrivate::setIdentifier(const QByteArray &identifier)
0017 {
0018     id = identifier;
0019 }
0020 
0021 QByteArray AclJobBasePrivate::identifier() const
0022 {
0023     return id;
0024 }
0025 
0026 bool AclJobBasePrivate::hasRightEnabled(Acl::Right right) const
0027 {
0028     return rightList & right;
0029 }
0030 
0031 void AclJobBasePrivate::setRights(const QByteArray &rights)
0032 {
0033     switch (rights[0]) {
0034     case '+':
0035         modifier = AclJobBase::Add;
0036         break;
0037     case '-':
0038         modifier = AclJobBase::Remove;
0039         break;
0040     default:
0041         modifier = AclJobBase::Change;
0042         break;
0043     }
0044 
0045     rightList = Acl::rightsFromString(rights);
0046 }
0047 
0048 void AclJobBasePrivate::setRights(AclJobBase::AclModifier _modifier, Acl::Rights rights)
0049 {
0050     modifier = _modifier;
0051     // XXX: [alexmerry, 2010-07-24]: this is REALLY unintuitive behaviour
0052     rightList |= rights;
0053 }
0054 
0055 AclJobBase::AclJobBase(Session *session)
0056     : Job(*new AclJobBasePrivate(session, i18n("AclJobBase")))
0057 {
0058 }
0059 
0060 AclJobBase::AclJobBase(JobPrivate &dd)
0061     : Job(dd)
0062 {
0063 }
0064 
0065 AclJobBase::~AclJobBase()
0066 {
0067 }
0068 
0069 void AclJobBase::setMailBox(const QString &mailBox)
0070 {
0071     Q_D(AclJobBase);
0072     d->mailBox = mailBox;
0073 }
0074 
0075 QString AclJobBase::mailBox() const
0076 {
0077     Q_D(const AclJobBase);
0078     return d->mailBox;
0079 }
0080 
0081 #include "moc_acljobbase.cpp"