Backport r950340 | aacid | 2009-04-06 23:21:18 +0200 (Mon, 06 Apr 2009) | 4 lines
[kdepim.git] / kmail / folderdialogacltab.h
blob18de27e529e73fded686f8f22dd4fcb7af33baac
1 // -*- mode: C++; c-file-style: "gnu" -*-
2 /**
3 * folderdialogacltab.h
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
30 * your version.
32 #ifndef FOLDERDIALOGACLTAB_H
33 #define FOLDERDIALOGACLTAB_H
35 #include "kmfolderdialog.h"
36 #include "kmfoldertype.h"
37 class KJob;
38 class KMFolderImap;
39 class KPushButton;
40 class QStackedWidget;
41 class KHBox;
42 class QGroupBox;
43 class QButtonGroup;
44 class QTreeWidget;
45 class QTreeWidgetItem;
46 class QLabel;
47 namespace KIO { class Job; }
49 namespace KMail {
51 enum IMAPUserIdFormat { FullEmail, UserName };
53 struct ACLListEntry;
54 typedef QVector<KMail::ACLListEntry> ACLList;
56 class ImapAccountBase;
58 /**
59 * "New Access Control Entry" dialog.
60 * Internal class, only used by FolderDialogACLTab
62 class ACLEntryDialog :public KDialog {
63 Q_OBJECT
65 public:
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;
74 private slots:
75 void slotSelectAddresses();
76 void slotChanged();
78 private:
79 QButtonGroup* mButtonGroup;
80 KLineEdit* mUserIdLineEdit;
81 IMAPUserIdFormat mUserIdFormat;
84 /**
85 * "Access Control" tab in the folder dialog
86 * Internal class, only used by KMFolderDialog
88 class FolderDialogACLTab : public FolderDialogTab
90 Q_OBJECT
92 public:
93 FolderDialogACLTab( KMFolderDialog* dlg, QWidget* parent );
95 virtual void load();
96 virtual bool save();
97 virtual AcceptStatus accept();
99 static bool supports( KMFolder* refFolder );
101 private slots:
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
115 void slotAddACL();
116 void slotEditACL();
117 void slotRemoveACL();
119 void slotChanged( bool b );
121 private:
122 KUrl imapURL() const;
123 void initializeWithValuesFromFolder( KMFolder* folder );
124 void startListing();
125 void loadListView( const KMail::ACLList& aclList );
126 void loadFinished( const KMail::ACLList& aclList );
127 void addACLs( const QStringList& userIds, unsigned int permissions );
129 private:
130 // The widget containing the ACL widgets (listview and buttons)
131 KHBox* mACLWidget;
132 //class ListView;
133 class ListViewItem;
134 QTreeWidget* mListView;
135 KPushButton* mAddACL;
136 KPushButton* mEditACL;
137 KPushButton* mRemoveACL;
139 QStringList mRemovedACLs;
140 QString mImapPath;
141 ImapAccountBase* mImapAccount;
142 int mUserRights;
143 KMFolderType mFolderType;
144 ACLList mInitialACLList;
145 ACLList mACLList; // to be set
146 IMAPUserIdFormat mUserIdFormat;
148 QLabel* mLabel;
149 QStackedWidget* mStack;
150 KMFolderDialog* mDlg;
152 bool mChanged;
153 bool mAccepting; // i.e. close when done
154 bool mSaving;
157 } // end of namespace KMail
159 #endif /* FOLDERDIALOGACLTAB_H */