1 | /* |
2 | Copyright (c) 2009 Andras Mantia <amantia@kde.org> |
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 | #include <KDE/KLocalizedString> |
26 | #include <KDE/KDebug> |
27 | |
28 | using namespace KIMAP; |
29 | |
30 | void AclJobBasePrivate::setIdentifier( const QByteArray &identifier ) |
31 | { |
32 | id = identifier; |
33 | } |
34 | |
35 | QByteArray AclJobBasePrivate::identifier() const |
36 | { |
37 | return id; |
38 | } |
39 | |
40 | bool AclJobBasePrivate::hasRightEnabled(Acl::Right right) |
41 | { |
42 | return rightList & right; |
43 | } |
44 | |
45 | void AclJobBasePrivate::setRights(const QByteArray& rights) |
46 | { |
47 | switch ( rights[0] ) { |
48 | case '+': |
49 | modifier = AclJobBase::Add; |
50 | break; |
51 | case '-': |
52 | modifier = AclJobBase::Remove; |
53 | break; |
54 | default: |
55 | modifier = AclJobBase::Change; |
56 | break; |
57 | } |
58 | |
59 | rightList = Acl::rightsFromString( rights ); |
60 | } |
61 | |
62 | void AclJobBasePrivate::setRights(AclJobBase::AclModifier _modifier, Acl::Rights rights) |
63 | { |
64 | modifier = _modifier; |
65 | // XXX: [alexmerry, 2010-07-24]: this is REALLY unintuitive behaviour |
66 | rightList|= rights; |
67 | } |
68 | |
69 | AclJobBase::AclJobBase( Session *session ) |
70 | : Job( *new AclJobBasePrivate( session, i18n( "AclJobBase" ) ) ) |
71 | { |
72 | } |
73 | |
74 | AclJobBase::AclJobBase( JobPrivate &dd ) |
75 | : Job( dd ) |
76 | { |
77 | |
78 | } |
79 | |
80 | AclJobBase::~AclJobBase() |
81 | { |
82 | } |
83 | |
84 | void AclJobBase::setMailBox( const QString &mailBox ) |
85 | { |
86 | Q_D( AclJobBase ); |
87 | d->mailBox = mailBox; |
88 | } |
89 | |
90 | QString AclJobBase::mailBox() const |
91 | { |
92 | Q_D( const AclJobBase ); |
93 | return d->mailBox; |
94 | } |
95 | |