File indexing completed on 2024-05-12 05:17:17
0001 /* 0002 SPDX-FileCopyrightText: 2009 Andras Mantia <amantia@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "setacljob.h" 0008 0009 #include <KLocalizedString> 0010 0011 #include "acljobbase_p.h" 0012 #include "response_p.h" 0013 #include "rfccodecs.h" 0014 #include "session_p.h" 0015 0016 namespace KIMAP 0017 { 0018 class SetAclJobPrivate : public AclJobBasePrivate 0019 { 0020 public: 0021 SetAclJobPrivate(Session *session, const QString &name) 0022 : AclJobBasePrivate(session, name) 0023 { 0024 } 0025 ~SetAclJobPrivate() 0026 { 0027 } 0028 }; 0029 } 0030 0031 using namespace KIMAP; 0032 0033 SetAclJob::SetAclJob(Session *session) 0034 : AclJobBase(*new SetAclJobPrivate(session, i18n("SetAcl"))) 0035 { 0036 } 0037 0038 SetAclJob::~SetAclJob() 0039 { 0040 } 0041 0042 void SetAclJob::doStart() 0043 { 0044 Q_D(SetAclJob); 0045 QByteArray r = Acl::rightsToString(d->rightList); 0046 if (d->modifier == Add) { 0047 r.prepend('+'); 0048 } else if (d->modifier == Remove) { 0049 r.prepend('-'); 0050 } 0051 d->tags << d->sessionInternal()->sendCommand("SETACL", '\"' + KIMAP::encodeImapFolderName(d->mailBox.toUtf8()) + "\" \"" + d->id + "\" \"" + r + '\"'); 0052 } 0053 0054 void SetAclJob::setRights(AclModifier modifier, Acl::Rights rights) 0055 { 0056 Q_D(SetAclJob); 0057 d->setRights(modifier, rights); 0058 } 0059 0060 void SetAclJob::setIdentifier(const QByteArray &identifier) 0061 { 0062 Q_D(SetAclJob); 0063 d->setIdentifier(identifier); 0064 } 0065 0066 QByteArray SetAclJob::identifier() 0067 { 0068 Q_D(SetAclJob); 0069 return d->identifier(); 0070 } 0071 0072 #include "moc_setacljob.cpp"