20 #ifndef KACLEDITWIDGET_P_H
21 #define KACLEDITWIDGET_P_H
23 #include <config-acl.h>
25 #if defined(HAVE_POSIX_ACL) || defined(Q_MOC_RUN)
30 #include <QTreeWidget>
31 #include <QtCore/QHash>
37 class KACLListViewItem;
51 friend class KACLListViewItem;
63 enum EntryType { User = 1,
71 KACLListView(
QWidget* parent = 0 );
74 bool hasMaskEntry()
const {
return m_hasMask; }
75 bool hasDefaultEntries()
const;
76 bool allowDefaults()
const {
return m_allowDefaults; }
77 void setAllowDefaults(
bool v ) { m_allowDefaults = v; }
78 unsigned short maskPermissions()
const;
79 void setMaskPermissions(
unsigned short maskPerms );
80 acl_perm_t maskPartialPermissions()
const;
81 void setMaskPartialPermissions( acl_perm_t maskPerms );
83 bool maskCanBeDeleted()
const;
84 bool defaultMaskCanBeDeleted()
const;
86 const KACLListViewItem* findDefaultItemByType( EntryType type )
const;
87 const KACLListViewItem* findItemByType( EntryType type,
88 bool defaults =
false )
const;
89 unsigned short calculateMaskValue(
bool defaults )
const;
90 void calculateEffectiveRights();
92 QStringList allowedUsers(
bool defaults, KACLListViewItem *allowedItem = 0 );
93 QStringList allowedGroups(
bool defaults, KACLListViewItem *allowedItem = 0 );
95 const KACL getACL()
const {
return getACL(); }
98 const KACL getDefaultACL()
const {
return getDefaultACL(); }
101 QPixmap getYesPixmap()
const {
return *m_yesPixmap; }
102 QPixmap getYesPartialPixmap()
const {
return *m_yesPartialPixmap; }
106 void slotEditEntry();
107 void slotRemoveEntry();
108 void setACL(
const KACL &anACL );
109 void setDefaultACL(
const KACL &anACL );
117 void fillItemsFromACL(
const KACL &pACL,
bool defaults =
false );
118 KACL itemsToACL(
bool defaults )
const;
122 unsigned short m_mask;
124 bool m_allowDefaults;
131 class EditACLEntryDialog :
public KDialog
135 EditACLEntryDialog( KACLListView *listView, KACLListViewItem *item,
140 int allowedTypes = KACLListView::AllTypes,
141 int allowedDefaultTypes = KACLListView::AllTypes,
142 bool allowDefault =
false );
143 KACLListViewItem* item()
const {
return m_item; }
148 void slotUpdateAllowedUsersAndGroups();
149 void slotUpdateAllowedTypes();
151 KACLListView *m_listView;
152 KACLListViewItem *m_item;
158 int m_allowedDefaultTypes;
171 KACLListViewItem(
QTreeWidget* parent, KACLListView::EntryType type,
172 unsigned short value,
175 virtual ~KACLListViewItem();
179 void calcEffectiveRights();
181 bool isDeletable()
const;
182 bool isAllowedToChangeType()
const;
184 void togglePerm( acl_perm_t perm );
188 int column,
int width,
int alignment );
191 void updatePermPixmaps();
194 KACLListView::EntryType
type;
195 unsigned short value;
201 KACLListView* m_pACLListView;
The KACL class encapsulates a POSIX Access Control List.