2
Copyright (c) 2008 Volker Krause <vkrause@kde.org>
4
This library is free software; you can redistribute it and/or modify it
5
under the terms of the GNU Library General Public License as published by
6
the Free Software Foundation; either version 2 of the License, or (at your
7
option) any later version.
9
This library is distributed in the hope that it will be useful, but WITHOUT
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
12
License for more details.
14
You should have received a copy of the GNU Library General Public License
15
along with this library; see the file COPYING.LIB. If not, write to the
16
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20
#include "collectionaclpage.h"
22
#include <akonadi/collection.h>
24
using namespace Akonadi;
26
CollectionAclPage::CollectionAclPage(QWidget * parent) :
27
CollectionPropertiesPage( parent )
29
setPageTitle( i18n( "ACL" ) );
33
void CollectionAclPage::load(const Collection & col)
35
Collection::Rights rights = col.rights();
36
ui.changeItem->setChecked( rights & Collection::CanChangeItem );
37
ui.createItem->setChecked( rights & Collection::CanCreateItem );
38
ui.deleteItem->setChecked( rights & Collection::CanDeleteItem );
39
ui.changeCollection->setChecked( rights & Collection::CanChangeCollection );
40
ui.createCollection->setChecked( rights & Collection::CanCreateCollection );
41
ui.deleteCollection->setChecked( rights & Collection::CanDeleteCollection );
44
void CollectionAclPage::save(Collection & col)
46
Collection::Rights rights = Collection::ReadOnly;
47
if ( ui.changeItem->isChecked() )
48
rights |= Collection::CanChangeItem;
49
if ( ui.createItem->isChecked() )
50
rights |= Collection::CanCreateItem;
51
if ( ui.deleteItem->isChecked() )
52
rights |= Collection::CanDeleteItem;
53
if ( ui.changeCollection->isChecked() )
54
rights |= Collection::CanChangeCollection;
55
if ( ui.createCollection->isChecked() )
56
rights |= Collection::CanCreateCollection;
57
if ( ui.deleteCollection->isChecked() )
58
rights |= Collection::CanDeleteCollection;
59
col.setRights( rights );
62
#include "collectionaclpage.moc"