24 #include <config-acl.h>
28 #include <qpushbutton.h>
29 #include <QButtonGroup>
31 #include <qradiobutton.h>
32 #include <qcombobox.h>
34 #include <qcheckbox.h>
36 #include <QStackedWidget>
37 #include <QMouseEvent>
38 #include <QHeaderView>
47 #ifdef HAVE_ACL_LIBACL_H
48 # include <acl/libacl.h>
58 const char* pixmapName;
60 } s_itemAttributes[] = {
62 {
I18N_NOOP(
"Owning Group" ),
"group-grey", 0 },
63 {
I18N_NOOP(
"Others" ),
"others-grey", 0 },
66 {
I18N_NOOP(
"Named Group" ),
"group", 0 },
69 class KACLEditWidget::KACLEditWidgetPrivate
72 KACLEditWidgetPrivate()
77 void _k_slotUpdateButtons();
79 KACLListView *m_listView;
85 KACLEditWidget::KACLEditWidget(
QWidget *parent )
86 :
QWidget(parent), d(new KACLEditWidgetPrivate)
90 d->m_listView =
new KACLListView(
this);
92 connect(d->m_listView->selectionModel(),
95 SLOT(_k_slotUpdateButtons()));
99 vbox->addWidget(d->m_AddBtn);
100 d->m_AddBtn->setObjectName(
QLatin1String(
"add_entry_button"));
101 connect(d->m_AddBtn, SIGNAL(clicked()), d->m_listView, SLOT(slotAddEntry()));
103 vbox->addWidget(d->m_EditBtn);
104 d->m_EditBtn->setObjectName(
QLatin1String(
"edit_entry_button"));
105 connect(d->m_EditBtn, SIGNAL(clicked()), d->m_listView, SLOT(slotEditEntry()));
107 vbox->addWidget(d->m_DelBtn);
108 d->m_DelBtn->setObjectName(
QLatin1String(
"delete_entry_button"));
109 connect(d->m_DelBtn, SIGNAL(clicked()), d->m_listView, SLOT(slotRemoveEntry()));
110 vbox->addItem(
new QSpacerItem( 10, 10, QSizePolicy::Fixed, QSizePolicy::Expanding ) );
111 d->_k_slotUpdateButtons();
114 KACLEditWidget::~KACLEditWidget()
119 void KACLEditWidget::KACLEditWidgetPrivate::_k_slotUpdateButtons()
121 bool atLeastOneIsNotDeletable =
false;
122 bool atLeastOneIsNotAllowedToChangeType =
false;
123 int selectedCount = 0;
126 while ( it.hasNext() ) {
127 KACLListViewItem *item =
static_cast<KACLListViewItem*
>( it.next() );
129 if ( !item->isDeletable() )
130 atLeastOneIsNotDeletable =
true;
131 if ( !item->isAllowedToChangeType() )
132 atLeastOneIsNotAllowedToChangeType =
true;
134 m_EditBtn->setEnabled( selectedCount && !atLeastOneIsNotAllowedToChangeType );
135 m_DelBtn->setEnabled( selectedCount && !atLeastOneIsNotDeletable );
138 KACL KACLEditWidget::getACL()
const
140 return d->m_listView->getACL();
143 KACL KACLEditWidget::getDefaultACL()
const
145 return d->m_listView->getDefaultACL();
148 void KACLEditWidget::setACL(
const KACL &acl )
150 return d->m_listView->
setACL(acl);
153 void KACLEditWidget::setDefaultACL(
const KACL &acl )
155 return d->m_listView->setDefaultACL(acl);
158 void KACLEditWidget::setAllowDefaults(
bool value )
160 d->m_listView->setAllowDefaults(value);
163 KACLListViewItem::KACLListViewItem(
QTreeWidget* parent,
164 KACLListView::EntryType _type,
165 unsigned short _value,
bool defaults,
168 type( _type ), value( _value ), isDefault( defaults ),
169 qualifier( _qualifier ), isPartial( false )
171 m_pACLListView = qobject_cast<KACLListView*>( parent );
176 KACLListViewItem::~ KACLListViewItem()
181 QString KACLListViewItem::key()
const
190 case KACLListView::User:
193 case KACLListView::Group:
196 case KACLListView::Others:
199 case KACLListView::Mask:
202 case KACLListView::NamedUser:
203 key +=
'E' + text( 1 );
205 case KACLListView::NamedGroup:
206 key +=
'F' + text( 1 );
215 bool KACLListViewItem::operator< (
const QTreeWidgetItem& other )
const
217 return key() <
static_cast<const KACLListViewItem&
>(other).key();
222 int column,
int width,
int alignment )
225 setForeground(
QColor( 0, 0, 255 ) );
230 setForeground(
QColor( 100, 100, 100 ) );
233 QTreeWidgetItem::paintCell( p, mycg, column, width, alignment );
235 KACLListViewItem *below =0;
237 below =
static_cast<KACLListViewItem*
>( itemBelow() );
238 const bool lastUser = type == KACLListView::NamedUser && below && below->type == KACLListView::NamedGroup;
239 const bool lastNonDefault = !isDefault && below && below->isDefault;
240 if ( type == KACLListView::Mask || lastUser || lastNonDefault )
242 p->
setPen(
QPen( Qt::gray, 0, Qt::DotLine ) );
243 if ( type == KACLListView::Mask )
245 p->
drawLine( 0, height() - 1, width - 1, height() - 1 );
251 void KACLListViewItem::updatePermPixmaps()
253 unsigned int partialPerms = value;
255 if ( value & ACL_READ )
256 setIcon( 2, m_pACLListView->getYesPixmap() );
257 else if ( partialPerms & ACL_READ )
258 setIcon( 2, m_pACLListView->getYesPartialPixmap() );
260 setIcon( 2,
QIcon() );
262 if ( value & ACL_WRITE )
263 setIcon( 3, m_pACLListView->getYesPixmap() );
264 else if ( partialPerms & ACL_WRITE )
265 setIcon( 3, m_pACLListView->getYesPartialPixmap() );
267 setIcon( 3,
QIcon() );
269 if ( value & ACL_EXECUTE )
270 setIcon( 4, m_pACLListView->getYesPixmap() );
271 else if ( partialPerms & ACL_EXECUTE )
272 setIcon( 4, m_pACLListView->getYesPartialPixmap() );
274 setIcon( 4,
QIcon() );
277 void KACLListViewItem::repaint()
282 case KACLListView::User:
283 idx = KACLListView::OWNER_IDX;
285 case KACLListView::Group:
286 idx = KACLListView::GROUP_IDX;
288 case KACLListView::Others:
289 idx = KACLListView::OTHERS_IDX;
291 case KACLListView::Mask:
292 idx = KACLListView::MASK_IDX;
294 case KACLListView::NamedUser:
295 idx = KACLListView::NAMED_USER_IDX;
297 case KACLListView::NamedGroup:
298 idx = KACLListView::NAMED_GROUP_IDX;
301 idx = KACLListView::OWNER_IDX;
304 setText( 0,
i18n(s_itemAttributes[idx].label) );
305 setIcon( 0, *s_itemAttributes[idx].pixmap );
307 setText( 0, text( 0 ) +
i18n(
" (Default)" ) );
308 setText( 1, qualifier );
313 void KACLListViewItem::calcEffectiveRights()
319 if ( m_pACLListView->hasMaskEntry()
320 && ( type == KACLListView::NamedUser
321 || type == KACLListView::Group
322 || type == KACLListView::NamedGroup )
326 strEffective[0] = ( m_pACLListView->maskPermissions() & value & ACL_READ ) ?
'r' :
'-';
327 strEffective[1] = ( m_pACLListView->maskPermissions() & value & ACL_WRITE ) ?
'w' :
'-';
328 strEffective[2] = ( m_pACLListView->maskPermissions() & value & ACL_EXECUTE ) ?
'x' :
'-';
348 strEffective[0] = ( value & ACL_READ ) ?
'r' :
'-';
349 strEffective[1] = ( value & ACL_WRITE ) ?
'w' :
'-';
350 strEffective[2] = ( value & ACL_EXECUTE ) ?
'x' :
'-';
362 setText( 5, strEffective );
365 bool KACLListViewItem::isDeletable()
const
367 bool isMaskAndDeletable =
false;
368 if (type == KACLListView::Mask ) {
369 if ( !isDefault && m_pACLListView->maskCanBeDeleted() )
370 isMaskAndDeletable =
true;
371 else if ( isDefault && m_pACLListView->defaultMaskCanBeDeleted() )
372 isMaskAndDeletable =
true;
374 return type != KACLListView::User &&
375 type != KACLListView::Group &&
376 type != KACLListView::Others &&
377 ( type != KACLListView::Mask || isMaskAndDeletable );
380 bool KACLListViewItem::isAllowedToChangeType()
const
382 return type != KACLListView::User &&
383 type != KACLListView::Group &&
384 type != KACLListView::Others &&
385 type != KACLListView::Mask;
388 void KACLListViewItem::togglePerm( acl_perm_t perm )
391 if ( type == KACLListView::Mask && !isDefault ) {
392 m_pACLListView->setMaskPermissions( value );
394 calcEffectiveRights();
416 EditACLEntryDialog::EditACLEntryDialog( KACLListView *listView, KACLListViewItem *item,
421 int allowedTypes,
int allowedDefaultTypes,
424 m_listView( listView ), m_item( item ), m_users( users ), m_groups( groups ),
425 m_defaultUsers( defaultUsers ), m_defaultGroups( defaultGroups ),
426 m_allowedTypes( allowedTypes ), m_allowedDefaultTypes( allowedDefaultTypes ),
429 setObjectName(
"edit_entry_dialog" );
431 setCaption(
i18n(
"Edit ACL Entry" ) );
432 setButtons( KDialog::Ok | KDialog::Cancel );
433 setDefaultButton( KDialog::Ok );
436 setMainWidget( page );
444 if ( allowDefaults ) {
445 m_defaultCB =
new QCheckBox(
i18n(
"Default for new files in this folder"), page );
448 connect( m_defaultCB, SIGNAL(toggled(
bool)),
449 this, SLOT(slotUpdateAllowedUsersAndGroups()) );
450 connect( m_defaultCB, SIGNAL(toggled(
bool)),
451 this, SLOT(slotUpdateAllowedTypes()) );
457 m_buttonGroup->addButton( ownerType );
458 m_buttonIds.insert( ownerType, KACLListView::User );
462 m_buttonGroup->addButton( owningGroupType );
463 m_buttonIds.insert( owningGroupType, KACLListView::Group );
467 m_buttonGroup->addButton( othersType );
468 m_buttonIds.insert( othersType, KACLListView::Others );
472 m_buttonGroup->addButton( maskType );
473 m_buttonIds.insert( maskType, KACLListView::Mask );
477 m_buttonGroup->addButton( namedUserType );
478 m_buttonIds.insert( namedUserType, KACLListView::NamedUser );
482 m_buttonGroup->addButton( namedGroupType );
483 m_buttonIds.insert( namedGroupType, KACLListView::NamedGroup );
494 m_widgetStack->addWidget( usersBox );
496 KHBox *groupsBox =
new KHBox( m_widgetStack );
497 m_widgetStack->addWidget( groupsBox );
500 m_usersCombo =
new KComboBox( usersBox );
501 m_usersCombo->setEditable(
false );
503 usersLabel->
setBuddy( m_usersCombo );
506 m_groupsCombo =
new KComboBox( groupsBox );
507 m_groupsCombo->setEditable(
false );
509 groupsLabel->
setBuddy( m_groupsCombo );
512 m_buttonIds.key( m_item->type )->setChecked(
true );
514 m_defaultCB->setChecked( m_item->isDefault );
515 slotUpdateAllowedTypes();
516 slotSelectionChanged( m_buttonIds.key( m_item->type ) );
517 slotUpdateAllowedUsersAndGroups();
518 if ( m_item->type == KACLListView::NamedUser ) {
519 m_usersCombo->setItemText( m_usersCombo->currentIndex(), m_item->qualifier );
520 }
else if ( m_item->type == KACLListView::NamedGroup ) {
521 m_groupsCombo->setItemText( m_groupsCombo->currentIndex(), m_item->qualifier );
525 m_buttonIds.key( KACLListView::NamedUser )->setChecked(
true );
526 slotUpdateAllowedTypes();
527 slotSelectionChanged( m_buttonIds.key( KACLListView::NamedUser ) );
528 slotUpdateAllowedUsersAndGroups();
530 incrementInitialSize(
QSize( 100, 0 ) );
531 connect(
this,SIGNAL(okClicked()),
this, SLOT(slotOk()));
534 void EditACLEntryDialog::slotUpdateAllowedTypes()
536 int allowedTypes = m_allowedTypes;
537 if ( m_defaultCB && m_defaultCB->isChecked() ) {
538 allowedTypes = m_allowedDefaultTypes;
540 for (
int i=1; i < KACLListView::AllTypes; i=i*2 ) {
541 if ( allowedTypes & i )
542 m_buttonIds.key( i )->show();
544 m_buttonIds.key( i )->hide();
548 void EditACLEntryDialog::slotUpdateAllowedUsersAndGroups()
550 const QString oldUser = m_usersCombo->currentText();
551 const QString oldGroup = m_groupsCombo->currentText();
552 m_usersCombo->
clear();
553 m_groupsCombo->clear();
554 if ( m_defaultCB && m_defaultCB->isChecked() ) {
555 m_usersCombo->addItems( m_defaultUsers );
556 if ( m_defaultUsers.contains( oldUser ) )
557 m_usersCombo->setItemText( m_usersCombo->currentIndex(), oldUser );
558 m_groupsCombo->addItems( m_defaultGroups );
559 if ( m_defaultGroups.contains( oldGroup ) )
560 m_groupsCombo->setItemText( m_groupsCombo->currentIndex(), oldGroup );
562 m_usersCombo->addItems( m_users );
563 if ( m_users.contains( oldUser ) )
564 m_usersCombo->setItemText( m_usersCombo->currentIndex(), oldUser );
565 m_groupsCombo->addItems( m_groups );
566 if ( m_groups.contains( oldGroup ) )
567 m_groupsCombo->setItemText( m_groupsCombo->currentIndex(), oldGroup );
570 void EditACLEntryDialog::slotOk()
572 KACLListView::EntryType type =
static_cast<KACLListView::EntryType
>( m_buttonIds[m_buttonGroup->checkedButton()] );
577 if ( type == KACLListView::NamedUser )
578 qualifier = m_usersCombo->currentText();
579 if ( type == KACLListView::NamedGroup )
580 qualifier = m_groupsCombo->currentText();
583 m_item =
new KACLListViewItem( m_listView, type, ACL_READ | ACL_WRITE | ACL_EXECUTE,
false, qualifier );
586 m_item->qualifier = qualifier;
589 m_item->isDefault = m_defaultCB->isChecked();
595 void EditACLEntryDialog::slotSelectionChanged(
QAbstractButton *button )
597 switch ( m_buttonIds[ button ] ) {
598 case KACLListView::User:
599 case KACLListView::Group:
600 case KACLListView::Others:
601 case KACLListView::Mask:
602 m_widgetStack->setEnabled(
false );
604 case KACLListView::NamedUser:
605 m_widgetStack->setEnabled(
true );
606 m_widgetStack->setCurrentIndex( 0 );
608 case KACLListView::NamedGroup:
609 m_widgetStack->setEnabled(
true );
610 m_widgetStack->setCurrentIndex( 1 );
618 KACLListView::KACLListView(
QWidget* parent )
620 m_hasMask( false ), m_allowDefaults( false )
625 headers <<
i18n(
"Type" );
626 headers <<
i18n(
"Name" );
627 headers <<
i18nc(
"read permission",
"r" );
628 headers <<
i18nc(
"write permission",
"w" );
629 headers <<
i18nc(
"execute permission",
"x" );
630 headers <<
i18n(
"Effective" );
631 setHeaderLabels( headers );
633 setSortingEnabled(
false );
634 setSelectionMode( QAbstractItemView::ExtendedSelection );
635 header()->setResizeMode( QHeaderView::ResizeToContents );
636 setRootIsDecorated(
false );
639 for (
int i=0; i < LAST_IDX; ++i ) {
642 m_yesPixmap =
new QPixmap(
":/images/yes.png" );
643 m_yesPartialPixmap =
new QPixmap(
":/images/yespartial.png" );
647 struct passwd *user = 0;
649 while ( ( user = getpwent() ) != 0 ) {
654 struct group *gr = 0;
656 while ( ( gr = getgrent() ) != 0 ) {
668 KACLListView::~KACLListView()
670 for (
int i=0; i < LAST_IDX; ++i ) {
671 delete s_itemAttributes[i].pixmap;
674 delete m_yesPartialPixmap;
677 QStringList KACLListView::allowedUsers(
bool defaults, KACLListViewItem *allowedItem )
682 const KACLListViewItem *item =
static_cast<const KACLListViewItem*
>( *it );
684 if ( item->type != NamedUser || item->isDefault != defaults )
continue;
685 if ( allowedItem && item == allowedItem && allowedItem->isDefault == defaults )
continue;
686 allowedUsers.
removeAll( item->qualifier );
691 QStringList KACLListView::allowedGroups(
bool defaults, KACLListViewItem *allowedItem )
696 const KACLListViewItem *item =
static_cast<const KACLListViewItem*
>( *it );
698 if ( item->type != NamedGroup || item->isDefault != defaults )
continue;
699 if ( allowedItem && item == allowedItem && allowedItem->isDefault == defaults )
continue;
700 allowedGroups.
removeAll( item->qualifier );
702 return allowedGroups;
705 void KACLListView::fillItemsFromACL(
const KACL &pACL,
bool defaults )
709 while ( KACLListViewItem *item = static_cast<KACLListViewItem*>( *it ) ) {
711 if ( item->isDefault == defaults )
714 KACLListViewItem *item =
721 bool hasMask =
false;
724 item =
new KACLListViewItem(
this, Mask, mask, defaults );
730 while ( itu != userList.
end() ) {
731 new KACLListViewItem(
this, NamedUser, (*itu).second, defaults, (*itu).first );
738 while ( itg != groupList.
end() ) {
739 new KACLListViewItem(
this, NamedGroup, (*itg).second, defaults, (*itg).first );
744 void KACLListView::setACL(
const KACL &acl )
749 fillItemsFromACL( m_ACL );
752 calculateEffectiveRights();
755 void KACLListView::setDefaultACL(
const KACL &acl )
759 fillItemsFromACL( m_defaultACL,
true );
760 calculateEffectiveRights();
763 KACL KACLListView::itemsToACL(
bool defaults )
const
766 bool atLeastOneEntry =
false;
772 const KACLListViewItem* item =
static_cast<KACLListViewItem*
>( qlvi );
773 if ( item->isDefault != defaults )
continue;
774 atLeastOneEntry =
true;
775 switch ( item->type ) {
777 newACL.setOwnerPermissions( item->value );
780 newACL.setOwningGroupPermissions( item->value );
783 newACL.setOthersPermissions( item->value );
786 newACL.setMaskPermissions( item->value );
789 users.
append( qMakePair( item->text( 1 ), item->value ) );
792 groups.
append( qMakePair( item->text( 1 ), item->value ) );
798 if ( atLeastOneEntry ) {
799 newACL.setAllUserPermissions( users );
800 newACL.setAllGroupPermissions( groups );
801 if ( newACL.isValid() )
807 KACL KACLListView::getACL()
809 return itemsToACL(
false );
813 KACL KACLListView::getDefaultACL()
815 return itemsToACL(
true );
818 void KACLListView::contentsMousePressEvent(
QMouseEvent * )
859 if ( !pItem )
return;
862 while ( KACLListViewItem* item = static_cast<KACLListViewItem*>( *it ) ) {
864 if ( !item->isSelected() )
continue;
868 item->togglePerm( ACL_READ );
871 item->togglePerm( ACL_WRITE );
874 item->togglePerm( ACL_EXECUTE );
906 void KACLListView::calculateEffectiveRights()
909 KACLListViewItem* pItem;
910 while ( ( pItem = dynamic_cast<KACLListViewItem*>( *it ) ) != 0 )
913 pItem->calcEffectiveRights();
918 unsigned short KACLListView::maskPermissions()
const
924 void KACLListView::setMaskPermissions(
unsigned short maskPerms )
927 calculateEffectiveRights();
931 acl_perm_t KACLListView::maskPartialPermissions()
const
938 void KACLListView::setMaskPartialPermissions( acl_perm_t )
941 calculateEffectiveRights();
944 bool KACLListView::hasDefaultEntries()
const
948 const KACLListViewItem *item =
static_cast<const KACLListViewItem*
>( *it );
950 if ( item->isDefault )
return true;
955 const KACLListViewItem* KACLListView::findDefaultItemByType( EntryType type )
const
957 return findItemByType( type,
true );
960 const KACLListViewItem* KACLListView::findItemByType( EntryType type,
bool defaults )
const
964 const KACLListViewItem *item =
static_cast<const KACLListViewItem*
>( *it );
966 if ( item->isDefault == defaults && item->type == type ) {
974 unsigned short KACLListView::calculateMaskValue(
bool defaults )
const
978 return itemsToACL( defaults ).maskPermissions( dummy );
981 void KACLListView::slotAddEntry()
983 int allowedTypes = NamedUser | NamedGroup;
985 allowedTypes |= Mask;
986 int allowedDefaultTypes = NamedUser | NamedGroup;
987 if ( !findDefaultItemByType( Mask ) )
988 allowedDefaultTypes |= Mask;
989 if ( !hasDefaultEntries() )
990 allowedDefaultTypes |= User |
Group;
991 EditACLEntryDialog dlg(
this, 0,
992 allowedUsers(
false ), allowedGroups(
false ),
993 allowedUsers(
true ), allowedGroups(
true ),
994 allowedTypes, allowedDefaultTypes, m_allowDefaults );
996 KACLListViewItem *item = dlg.item();
998 if ( item->type == Mask && !item->isDefault ) {
1000 m_mask = item->value;
1002 if ( item->isDefault && !hasDefaultEntries() ) {
1004 if ( item->type != User ) {
1005 unsigned short v = findDefaultItemByType( User )->value;
1006 new KACLListViewItem(
this, User, v,
true );
1008 if ( item->type != Group ) {
1009 unsigned short v = findDefaultItemByType( Group )->value;
1010 new KACLListViewItem(
this, Group, v,
true );
1012 if ( item->type != Others ) {
1013 unsigned short v = findDefaultItemByType( Others )->value;
1014 new KACLListViewItem(
this, Others, v,
true );
1017 const KACLListViewItem *defaultMaskItem = findDefaultItemByType( Mask );
1018 if ( item->isDefault && !defaultMaskItem ) {
1019 unsigned short v = calculateMaskValue(
true );
1020 new KACLListViewItem(
this, Mask, v,
true );
1022 if ( !item->isDefault && !m_hasMask &&
1023 ( item->type == Group
1024 || item->type == NamedUser
1025 || item->type == NamedGroup ) ) {
1027 unsigned short v = calculateMaskValue(
false );
1028 new KACLListViewItem(
this, Mask, v,
false );
1032 calculateEffectiveRights();
1033 sortItems( sortColumn(), Qt::AscendingOrder );
1034 setCurrentItem( item );
1037 if ( topLevelItemCount() == 1 )
1038 emit currentItemChanged( item, item );
1041 void KACLListView::slotEditEntry()
1044 if ( !current )
return;
1045 KACLListViewItem *item =
static_cast<KACLListViewItem*
>( current );
1046 int allowedTypes = item->type | NamedUser | NamedGroup;
1047 bool itemWasMask = item->type == Mask;
1048 if ( !m_hasMask || itemWasMask )
1049 allowedTypes |= Mask;
1050 int allowedDefaultTypes = item->type | NamedUser | NamedGroup;
1051 if ( !findDefaultItemByType( Mask ) )
1052 allowedDefaultTypes |= Mask;
1053 if ( !hasDefaultEntries() )
1054 allowedDefaultTypes |= User | Group;
1056 EditACLEntryDialog dlg(
this, item,
1057 allowedUsers(
false, item ), allowedGroups(
false, item ),
1058 allowedUsers(
true, item ), allowedGroups(
true, item ),
1059 allowedTypes, allowedDefaultTypes, m_allowDefaults );
1061 if ( itemWasMask && item->type != Mask ) {
1065 if ( !itemWasMask && item->type == Mask ) {
1066 m_mask = item->value;
1069 calculateEffectiveRights();
1070 sortItems( sortColumn(), Qt::AscendingOrder );
1073 void KACLListView::slotRemoveEntry()
1077 KACLListViewItem *item =
static_cast<KACLListViewItem*
>( *it );
1082 if ( item->type == Mask ) {
1083 bool itemWasDefault = item->isDefault;
1084 if ( !itemWasDefault && maskCanBeDeleted() ) {
1088 }
else if ( itemWasDefault && defaultMaskCanBeDeleted() ) {
1094 if ( !itemWasDefault )
1095 calculateEffectiveRights();
1098 if ( !item->isDefault &&
1099 ( item->type == User
1100 || item->type == Group
1101 || item->type == Others ) ) {
1111 bool KACLListView::maskCanBeDeleted()
const
1113 return !findItemByType( NamedUser ) && !findItemByType( NamedGroup );
1116 bool KACLListView::defaultMaskCanBeDeleted()
const
1118 return !findDefaultItemByType( NamedUser ) && !findDefaultItemByType( NamedGroup );
1121 #include "kacleditwidget.moc"
1122 #include "kacleditwidget_p.moc"
QString i18n(const char *text)
unsigned short ownerPermissions() const
The standard (non-extended) part of an ACL.
const QFont & font() const
QString label(StandardShortcut id)
ACLGroupPermissionsList allGroupPermissions() const
Returns the list of all group permission entries.
void drawLine(const QLineF &line)
bool isValid() const
Returns whether the KACL object represents a valid acl.
QString i18nc(const char *ctxt, const char *text)
void setBuddy(QWidget *buddy)
void setFont(const QFont &font)
void append(const T &value)
void setPen(const QColor &color)
void setObjectName(const QString &name)
int removeAll(const T &value)
void setMargin(int margin)
unsigned short owningGroupPermissions() const
void setItalic(bool enable)
unsigned short maskPermissions(bool &exists) const
Return the entry for the permissions mask if there is one and sets exists to true.
The KACL class encapsulates a POSIX Access Control List.
unsigned short othersPermissions() const
ACLUserPermissionsList allUserPermissions() const
Returns the list of all group permission entries.
static QDebug kWarning(bool cond, int area=KDE_DEFAULT_DEBUG_AREA)
QString fromLatin1(const char *str, int size)
bool setACL(const QString &aclStr)
Sets the whole list from a string.
void addLayout(QLayout *layout, int stretch)