00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef KMACLJOBS_H
00033 #define KMACLJOBS_H
00034
00035 #include <kio/job.h>
00036 #include <qvaluevector.h>
00037
00038 namespace KMail {
00039
00041 struct ACLListEntry {
00042 ACLListEntry() {}
00043 ACLListEntry( const QString& u, const QString& irl, int p )
00044 : userId( u ), internalRightsList( irl ), permissions( p ), changed( false ) {}
00045 QString userId;
00046 QString internalRightsList;
00047 int permissions;
00048 bool changed;
00049 };
00050
00051 typedef QValueVector<ACLListEntry> ACLList;
00052
00060 namespace ACLJobs {
00061
00065 enum ACLPermissions {
00066 List = 1,
00067 Read = 2,
00068 WriteFlags = 4,
00069 Insert = 8,
00070 Create = 16,
00071 Delete = 32,
00072 Administer = 64,
00073 Post = 128,
00074 WriteSeenFlag = 256,
00075
00076 AllWrite = List | Read | WriteFlags | Insert | Post | Create | Delete | WriteSeenFlag,
00077
00078 All = List | Read | WriteFlags | Insert | Post | Create | Delete | Administer | WriteSeenFlag
00079 };
00081 KIO::SimpleJob* setACL( KIO::Slave* slave, const KURL& url, const QString& user, unsigned int permissions );
00082
00083 class DeleteACLJob;
00085 DeleteACLJob* deleteACL( KIO::Slave* slave, const KURL& url, const QString& user );
00086
00087 class GetACLJob;
00089 GetACLJob* getACL( KIO::Slave* slave, const KURL& url );
00090
00091 class GetUserRightsJob;
00093 GetUserRightsJob* getUserRights( KIO::Slave* slave, const KURL& url );
00094
00095 class MultiSetACLJob;
00097 MultiSetACLJob* multiSetACL( KIO::Slave* slave, const KURL& url, const ACLList& acl );
00098
00100 class GetACLJob : public KIO::SimpleJob
00101 {
00102 Q_OBJECT
00103 public:
00104 GetACLJob( const KURL& url, const QByteArray &packedArgs,
00105 bool showProgressInfo );
00106
00107 const ACLList& entries() const { return m_entries; }
00108
00109 protected slots:
00110 void slotInfoMessage( KIO::Job*, const QString& );
00111 private:
00112 ACLList m_entries;
00113 };
00114
00116 class GetUserRightsJob : public KIO::SimpleJob
00117 {
00118 Q_OBJECT
00119 public:
00120 GetUserRightsJob( const KURL& url, const QByteArray &packedArgs,
00121 bool showProgressInfo );
00122 unsigned int permissions() const { return m_permissions; }
00123
00124 protected slots:
00125 void slotInfoMessage( KIO::Job*, const QString& );
00126 private:
00127 unsigned int m_permissions;
00128 };
00129
00132 class DeleteACLJob : public KIO::SimpleJob
00133 {
00134 Q_OBJECT
00135 public:
00136 DeleteACLJob( const KURL& url, const QString& userId,
00137 const QByteArray &packedArgs,
00138 bool showProgressInfo );
00139
00140 QString userId() const { return mUserId; }
00141
00142 private:
00143 QString mUserId;
00144 };
00145
00147 class MultiSetACLJob : public KIO::Job {
00148 Q_OBJECT
00149
00150 public:
00151 MultiSetACLJob( KIO::Slave* slave, const KURL& url, const ACLList& acl, bool showProgressInfo );
00152
00153 signals:
00154
00155
00156 void aclChanged( const QString& userId, int permissions );
00157
00158 protected slots:
00159 virtual void slotStart();
00160 virtual void slotResult( KIO::Job *job );
00161
00162 private:
00163 KIO::Slave* mSlave;
00164 const KURL mUrl;
00165 const ACLList mACLList;
00166 ACLList::const_iterator mACLListIterator;
00167 };
00168
00169
00170 #ifndef NDEBUG
00171 QString permissionsToString( unsigned int permissions );
00172 #endif
00173 }
00174
00175 }
00176
00177 #endif