1 // -*- mode: C++; c-file-style: "gnu" -*-
5 * Copyright (c) 2004 David Faure <faure@kde.org>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 * In addition, as a special exception, the copyright holders give
22 * permission to link the code of this program with any edition of
23 * the Qt library by Trolltech AS, Norway (or with modified versions
24 * of Qt that use the same license as Qt), and distribute linked
25 * combinations including the two. You must obey the GNU General
26 * Public License in all respects for all of the code used other than
27 * Qt. If you modify this file, you may extend this exception to
28 * your version of the file, but you are not obligated to do so. If
29 * you do not wish to do so, delete this exception statement from
32 #ifndef FOLDERDIALOGACLTAB_H
33 #define FOLDERDIALOGACLTAB_H
35 #include "kmfolderdialog.h"
36 #include "kmfoldertype.h"
45 class QTreeWidgetItem
;
47 namespace KIO
{ class Job
; }
51 enum IMAPUserIdFormat
{ FullEmail
, UserName
};
54 typedef QVector
<KMail::ACLListEntry
> ACLList
;
56 class ImapAccountBase
;
59 * "New Access Control Entry" dialog.
60 * Internal class, only used by FolderDialogACLTab
62 class ACLEntryDialog
:public KDialog
{
66 ACLEntryDialog( IMAPUserIdFormat userIdFormat
, const QString
& caption
, QWidget
* parent
);
68 void setValues( const QString
& userId
, unsigned int permissions
);
70 QString
userId() const;
71 QStringList
userIds() const;
72 unsigned int permissions() const;
75 void slotSelectAddresses();
79 QButtonGroup
* mButtonGroup
;
80 KLineEdit
* mUserIdLineEdit
;
81 IMAPUserIdFormat mUserIdFormat
;
85 * "Access Control" tab in the folder dialog
86 * Internal class, only used by KMFolderDialog
88 class FolderDialogACLTab
: public FolderDialogTab
93 FolderDialogACLTab( KMFolderDialog
* dlg
, QWidget
* parent
);
97 virtual AcceptStatus
accept();
99 static bool supports( KMFolder
* refFolder
);
102 // Network (KIO) slots
103 void slotConnectionResult( int, const QString
& );
104 void slotReceivedACL( KMFolder
*, KIO::Job
*, const KMail::ACLList
& );
105 void slotMultiSetACLResult(KJob
*);
106 void slotACLChanged( const QString
&, int );
107 void slotReceivedUserRights( KMFolder
* folder
);
108 void slotDirectoryListingFinished(KMFolderImap
*);
110 // User (QTreeWidget) slots
111 void slotEditACL( QTreeWidgetItem
* );
112 void slotSelectionChanged();
114 // User (pushbuttons) slots
117 void slotRemoveACL();
119 void slotChanged( bool b
);
122 KUrl
imapURL() const;
123 void initializeWithValuesFromFolder( KMFolder
* folder
);
125 void loadListView( const KMail::ACLList
& aclList
);
126 void loadFinished( const KMail::ACLList
& aclList
);
127 void addACLs( const QStringList
& userIds
, unsigned int permissions
);
130 // The widget containing the ACL widgets (listview and buttons)
134 QTreeWidget
* mListView
;
135 KPushButton
* mAddACL
;
136 KPushButton
* mEditACL
;
137 KPushButton
* mRemoveACL
;
139 QStringList mRemovedACLs
;
141 ImapAccountBase
* mImapAccount
;
143 KMFolderType mFolderType
;
144 ACLList mInitialACLList
;
145 ACLList mACLList
; // to be set
146 IMAPUserIdFormat mUserIdFormat
;
149 QStackedWidget
* mStack
;
150 KMFolderDialog
* mDlg
;
153 bool mAccepting
; // i.e. close when done
157 } // end of namespace KMail
159 #endif /* FOLDERDIALOGACLTAB_H */