SVN_SILENT made messages (.desktop file)
[kdepim.git] / akonadiconsole / collectionaclpage.cpp
blob15c310180dec93604e77ed126bc960b3edcd24a9
1 /*
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
17 02110-1301, USA.
20 #include "collectionaclpage.h"
22 #include <AkonadiCore/collection.h>
23 #include <QIcon>
24 #include <KLocalizedString>
26 using namespace Akonadi;
28 CollectionAclPage::CollectionAclPage(QWidget *parent) :
29 CollectionPropertiesPage(parent)
31 setPageTitle(i18n("ACL"));
32 ui.setupUi(this);
35 void CollectionAclPage::load(const Collection &col)
37 Collection::Rights rights = col.rights();
38 ui.changeItem->setChecked(rights & Collection::CanChangeItem);
39 ui.createItem->setChecked(rights & Collection::CanCreateItem);
40 ui.deleteItem->setChecked(rights & Collection::CanDeleteItem);
41 ui.linkItem->setChecked(rights & Collection::CanLinkItem);
42 ui.unlinkItem->setChecked(rights & Collection::CanUnlinkItem);
43 ui.changeCollection->setChecked(rights & Collection::CanChangeCollection);
44 ui.createCollection->setChecked(rights & Collection::CanCreateCollection);
45 ui.deleteCollection->setChecked(rights & Collection::CanDeleteCollection);
48 void CollectionAclPage::save(Collection &col)
50 Collection::Rights rights = Collection::ReadOnly;
51 if (ui.changeItem->isChecked()) {
52 rights |= Collection::CanChangeItem;
54 if (ui.createItem->isChecked()) {
55 rights |= Collection::CanCreateItem;
57 if (ui.deleteItem->isChecked()) {
58 rights |= Collection::CanDeleteItem;
60 if (ui.changeCollection->isChecked()) {
61 rights |= Collection::CanChangeCollection;
63 if (ui.createCollection->isChecked()) {
64 rights |= Collection::CanCreateCollection;
66 if (ui.deleteCollection->isChecked()) {
67 rights |= Collection::CanDeleteCollection;
69 if (ui.linkItem->isChecked()) {
70 rights |= Collection::CanLinkItem;
72 if (ui.unlinkItem->isChecked()) {
73 rights |= Collection::CanUnlinkItem;
75 col.setRights(rights);