File indexing completed on 2024-12-15 04:51:46
0001 /* 0002 SPDX-FileCopyrightText: 2013-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #include "noteschangerecorder.h" 0007 0008 #include <Akonadi/ChangeRecorder> 0009 #include <Akonadi/CollectionFetchScope> 0010 #include <Akonadi/ItemFetchScope> 0011 #include <Akonadi/NoteUtils> 0012 0013 #include "attributes/notealarmattribute.h" 0014 #include "attributes/notedisplayattribute.h" 0015 #include "attributes/notelockattribute.h" 0016 0017 using namespace NoteShared; 0018 0019 NotesChangeRecorder::NotesChangeRecorder(QObject *parent) 0020 : QObject(parent) 0021 , mChangeRecorder(new Akonadi::ChangeRecorder(this)) 0022 { 0023 Akonadi::ItemFetchScope scope; 0024 scope.fetchFullPayload(true); // Need to have full item when adding it to the internal data structure 0025 scope.fetchAttribute<NoteShared::NoteLockAttribute>(); 0026 scope.fetchAttribute<NoteShared::NoteDisplayAttribute>(); 0027 scope.fetchAttribute<NoteShared::NoteAlarmAttribute>(); 0028 0029 mChangeRecorder->setItemFetchScope(scope); 0030 mChangeRecorder->fetchCollection(true); 0031 mChangeRecorder->fetchCollectionStatistics(true); 0032 mChangeRecorder->setCollectionMonitored(Akonadi::Collection::root()); 0033 mChangeRecorder->collectionFetchScope().setIncludeStatistics(true); 0034 mChangeRecorder->setMimeTypeMonitored(Akonadi::NoteUtils::noteMimeType()); 0035 } 0036 0037 NotesChangeRecorder::~NotesChangeRecorder() = default; 0038 0039 Akonadi::ChangeRecorder *NotesChangeRecorder::changeRecorder() const 0040 { 0041 return mChangeRecorder; 0042 } 0043 0044 #include "moc_noteschangerecorder.cpp"