Akonadi

itemmonitor.cpp
1/*
2 SPDX-FileCopyrightText: 2007-2008 Tobias Koenig <tokoe@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.0-or-later
5*/
6
7#include "itemmonitor.h"
8#include "itemmonitor_p.h"
9
10#include "itemfetchscope.h"
11
12using namespace Akonadi;
13
15 : d(new ItemMonitorPrivate(this))
16{
17}
18
20
21void ItemMonitor::setItem(const Item &item)
22{
23 if (item == d->mItem) {
24 return;
25 }
26
27 d->mMonitor->setItemMonitored(d->mItem, false);
28
29 d->mItem = item;
30
31 d->mMonitor->setItemMonitored(d->mItem, true);
32
33 if (!d->mItem.isValid()) {
35 return;
36 }
37
38 // start initial fetch of the new item
39 auto job = new ItemFetchJob(d->mItem);
40 job->setFetchScope(fetchScope());
41
42 d->connect(job, &ItemFetchJob::result, d.get(), [this](KJob *job) {
43 d->initialFetchDone(job);
44 });
45}
46
48{
49 return d->mItem;
50}
51
53{
54 Q_UNUSED(item)
55}
56
60
62{
63 d->mMonitor->setItemFetchScope(fetchScope);
64}
65
67{
68 return d->mMonitor->itemFetchScope();
69}
70
71#include "moc_itemmonitor_p.cpp"
Job that fetches items from the Akonadi storage.
Specifies which parts of an item should be fetched from the Akonadi storage.
void setItem(const Item &item)
Sets the item that shall be monitored.
Item item() const
Returns the currently monitored item.
virtual ~ItemMonitor()
Destroys the item monitor.
void setFetchScope(const ItemFetchScope &fetchScope)
Sets the item fetch scope.
virtual void itemRemoved()
This method is called whenever the monitored item has been removed.
ItemFetchScope & fetchScope()
Returns the item fetch scope.
virtual void itemChanged(const Item &item)
This method is called whenever the monitored item has changed.
ItemMonitor()
Creates a new item monitor.
Represents a PIM item stored in Akonadi storage.
Definition item.h:100
void result(KJob *job)
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:31:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.