8#include "collectionaclpage.h"
11#include "aclmanager.h"
12#include "collectionaclwidget.h"
13#include "imapaclattribute.h"
14#include <Akonadi/Collection>
15#include <KLocalizedString>
20class PimCommon::CollectionAclPagePrivate
23 CollectionAclPagePrivate() =
default;
25 CollectionAclWidget *mCollectionAclWidget =
nullptr;
28CollectionAclPage::CollectionAclPage(
QWidget *parent)
29 : CollectionPropertiesPage(parent)
30 , d(new
PimCommon::CollectionAclPagePrivate)
32 setObjectName(
"PimCommon::CollectionAclPage"_L1);
34 setPageTitle(
i18nc(
"@title:tab Access Control settings page.",
"Access Control"));
38CollectionAclPage::~CollectionAclPage() =
default;
40void CollectionAclPage::init()
42 auto layout =
new QHBoxLayout(
this);
43 layout->setContentsMargins({});
44 d->mCollectionAclWidget =
new CollectionAclWidget(
this);
45 layout->addWidget(d->mCollectionAclWidget);
48bool CollectionAclPage::canHandle(
const Akonadi::Collection &collection)
const
50 return collection.
hasAttribute<PimCommon::ImapAclAttribute>();
53void CollectionAclPage::load(
const Akonadi::Collection &collection)
55 d->mCollectionAclWidget->aclManager()->setCollection(collection);
58void CollectionAclPage::save(Akonadi::Collection &collection)
60 d->mCollectionAclWidget->aclManager()->save(d->mCollectionAclWidget->recursive());
64 const auto origCol = d->mCollectionAclWidget->aclManager()->collection();
65 collection.
addAttribute(origCol.attribute<PimCommon::ImapAclAttribute>()->clone());
68#include "moc_collectionaclpage.cpp"
void addAttribute(Attribute *attribute)
bool hasAttribute() const
QString i18nc(const char *context, const char *text, const TYPE &arg...)
void init(KXmlGuiWindow *window, KGameDifficulty *difficulty=nullptr)