Commit 1a9c46b0 authored by David Faure's avatar David Faure

Stricter use of constness for Attribute, preparing for changes in akonadi

parent f915d3fa
......@@ -127,7 +127,7 @@ void AclModifyJob::slotModifyAcl()
}
}
bool AclModifyJob::canAdministrate(PimCommon::ImapAclAttribute *attribute, const Akonadi::Collection &collection) const
bool AclModifyJob::canAdministrate(const PimCommon::ImapAclAttribute *attribute, const Akonadi::Collection &collection) const
{
if (!attribute || !collection.isValid()) {
return false;
......@@ -184,10 +184,11 @@ void AclModifyJob::setCurrentRight(const QMap<QByteArray, KIMAP::Acl::Rights> &c
void AclModifyJob::changeAcl(const Akonadi::Collection &collection)
{
if (collection.hasAttribute<PimCommon::ImapAclAttribute>()) {
PimCommon::ImapAclAttribute *attribute = collection.attribute<PimCommon::ImapAclAttribute>();
if (canAdministrate(attribute, collection)) {
Akonadi::Collection mutableCollection = collection;
PimCommon::ImapAclAttribute *attribute = mutableCollection.attribute<PimCommon::ImapAclAttribute>();
if (canAdministrate(attribute, mutableCollection)) {
attribute->setRights(mNewRight);
Akonadi::CollectionModifyJob *modifyJob = new Akonadi::CollectionModifyJob(collection);
Akonadi::CollectionModifyJob *modifyJob = new Akonadi::CollectionModifyJob(mutableCollection);
connect(modifyJob, &KJob::result, this, &AclModifyJob::slotModifyDone);
}
} else {
......@@ -218,7 +219,7 @@ void AclModifyJob::slotFetchCollectionFinished(const Akonadi::Collection::List &
QStringList folderNames;
for (const Akonadi::Collection &col : collectionList) {
if (col.hasAttribute<PimCommon::ImapAclAttribute>()) {
PimCommon::ImapAclAttribute *attribute = col.attribute<PimCommon::ImapAclAttribute>();
const PimCommon::ImapAclAttribute *attribute = col.attribute<PimCommon::ImapAclAttribute>();
if (canAdministrate(attribute, col)) {
QString fullName;
bool parentFound;
......
......@@ -49,7 +49,7 @@ private:
void slotFetchCollectionFailed();
void changeAcl(const Akonadi::Collection &collection);
void checkNewCollection();
bool canAdministrate(PimCommon::ImapAclAttribute *attribute, const Akonadi::Collection &collection) const;
bool canAdministrate(const PimCommon::ImapAclAttribute *attribute, const Akonadi::Collection &collection) const;
void searchContact();
void slotModifyAcl();
void slotGroupSearchResult(KJob *job);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment