• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdepimlibs API Reference
  • KDE Home
  • Contact Us
 

KIMAP Library

  • sources
  • kde-4.12
  • kdepimlibs
  • kimap
listrightsjob.cpp
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 "listrightsjob.h"
21 
22 #include <KDE/KLocalizedString>
23 #include <KDE/KDebug>
24 
25 #include "acljobbase_p.h"
26 #include "message_p.h"
27 #include "session_p.h"
28 #include "rfccodecs.h"
29 
30 namespace KIMAP
31 {
32  class ListRightsJobPrivate : public AclJobBasePrivate
33  {
34  public:
35  ListRightsJobPrivate( Session *session, const QString& name ) : AclJobBasePrivate( session, name ), defaultRights( Acl::None ) {}
36  ~ListRightsJobPrivate() { }
37 
38  Acl::Rights defaultRights;
39  QList<Acl::Rights> possibleRights;
40 
41  };
42 }
43 
44 using namespace KIMAP;
45 
46 ListRightsJob::ListRightsJob( Session *session )
47  : AclJobBase( *new ListRightsJobPrivate( session, i18n( "ListRights" ) ) )
48 {
49 
50 }
51 
52 ListRightsJob::~ListRightsJob()
53 {
54 }
55 
56 void ListRightsJob::doStart()
57 {
58  Q_D( ListRightsJob );
59 
60  d->tags << d->sessionInternal()->sendCommand( "LISTRIGHTS", '\"' + KIMAP::encodeImapFolderName( d->mailBox.toUtf8() ) + "\" \"" + d->id + "\"" );
61 }
62 
63 void ListRightsJob::handleResponse( const Message &response )
64 {
65  Q_D( ListRightsJob );
66 
67  if ( handleErrorReplies( response ) == NotHandled ) {
68  if ( response.content.size() >= 4 &&
69  response.content[1].toString() == "LISTRIGHTS" ) {
70  QByteArray s = response.content[4].toString();
71  d->defaultRights = Acl::rightsFromString( s );
72  int i = 5;
73  while ( i < response.content.size() ) {
74  s = response.content[i].toString();
75  d->possibleRights.append( Acl::rightsFromString( s ) );
76  i++;
77  }
78  }
79  }
80 }
81 
82 void ListRightsJob::setIdentifier( const QByteArray &identifier )
83 {
84  Q_D( ListRightsJob );
85  d->setIdentifier( identifier );
86 }
87 
88 QByteArray ListRightsJob::identifier()
89 {
90  Q_D( ListRightsJob );
91  return d->identifier();
92 }
93 
94 Acl::Rights ListRightsJob::defaultRights()
95 {
96  Q_D( ListRightsJob );
97  return d->defaultRights;
98 }
99 
100 QList<Acl::Rights> ListRightsJob::possibleRights()
101 {
102  Q_D( ListRightsJob );
103  return d->possibleRights;
104 }
rfccodecs.h
This file is part of the IMAP support library and defines the RfcCodecs class.
KIMAP::ListRightsJob::defaultRights
Acl::Rights defaultRights()
The rights that will always be assigned to the identifier, regardless of the access control list...
Definition: listrightsjob.cpp:94
KIMAP::ListRightsJob::possibleRights
QList< Acl::Rights > possibleRights()
The rights it is possible to assign to the identifier.
Definition: listrightsjob.cpp:100
KIMAP::ListRightsJob::identifier
QByteArray identifier()
The identifier that will be looked up.
Definition: listrightsjob.cpp:88
KIMAP::Acl::rightsFromString
Rights rightsFromString(const QByteArray &string)
Convert the text form of a set of rights into a Rights bitflag.
Definition: acl.cpp:67
KIMAP::ListRightsJob::setIdentifier
void setIdentifier(const QByteArray &identifier)
Sets the identifier that should be looked up.
Definition: listrightsjob.cpp:82
KIMAP::ListRightsJob
Lists the possible and automatic rights for an identifier on a mailbox.
Definition: listrightsjob.h:48
KIMAP::AclJobBase
Base class for jobs that operate on mailbox ACLs.
Definition: acljobbase.h:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 23:00:08 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIMAP Library

Skip menu "KIMAP Library"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • Related Pages

kdepimlibs API Reference

Skip menu "kdepimlibs API Reference"
  • akonadi
  •   contact
  •   kmime
  •   socialutils
  • kabc
  • kalarmcal
  • kblog
  • kcal
  • kcalcore
  • kcalutils
  • kholidays
  • kimap
  • kldap
  • kmbox
  • kmime
  • kpimidentities
  • kpimtextedit
  • kresources
  • ktnef
  • kxmlrpcclient
  • microblog

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal