1 | /* |
2 | * Copyright (c) 2009 Volker Krause <vkrause@kde.org> |
3 | * |
4 | * This library is free software; you can redistribute it and/or |
5 | * modify it under the terms of the GNU Lesser General Public |
6 | * License as published by the Free Software Foundation; either |
7 | * version 2.1 of the License, or (at your option) any later version. |
8 | * |
9 | * This library is distributed in the hope that it will be useful, |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | * Lesser General Public License for more details. |
13 | * |
14 | * You should have received a copy of the GNU Lesser General Public |
15 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
16 | */ |
17 | |
18 | #ifndef AKONADI_COLLECTIONATTRIBUTESSYNCHRONIZATIONJOB_H |
19 | #define AKONADI_COLLECTIONATTRIBUTESSYNCHRONIZATIONJOB_H |
20 | |
21 | #include "akonadi_export.h" |
22 | |
23 | #include <kjob.h> |
24 | |
25 | namespace Akonadi { |
26 | |
27 | class Collection; |
28 | class CollectionAttributesSynchronizationJobPrivate; |
29 | |
30 | /** |
31 | * @short Job that synchronizes the attributes of a collection. |
32 | * |
33 | * This job will trigger a resource to synchronize the attributes of |
34 | * a collection based on what the backend is reporting to store them in the |
35 | * Akonadi storage. |
36 | * |
37 | * Example: |
38 | * |
39 | * @code |
40 | * using namespace Akonadi; |
41 | * |
42 | * const Collection collection = ...; |
43 | * |
44 | * CollectionAttributesSynchronizationJob *job = new CollectionAttributesSynchronizationJob( collection ); |
45 | * connect( job, SIGNAL(result(KJob*)), SLOT(synchronizationFinished(KJob*)) ); |
46 | * |
47 | * @endcode |
48 | * |
49 | * @note This is a KJob not an Akonadi::Job, so it wont auto-start! |
50 | * |
51 | * @author Volker Krause <vkrause@kde.org> |
52 | * @since 4.6 |
53 | */ |
54 | class AKONADI_EXPORT CollectionAttributesSynchronizationJob : public KJob |
55 | { |
56 | Q_OBJECT |
57 | |
58 | public: |
59 | /** |
60 | * Creates a new synchronization job for the given collection. |
61 | * |
62 | * @param collection The collection to synchronize. |
63 | */ |
64 | explicit CollectionAttributesSynchronizationJob(const Collection &collection, QObject *parent = 0); |
65 | |
66 | /** |
67 | * Destroys the synchronization job. |
68 | */ |
69 | ~CollectionAttributesSynchronizationJob(); |
70 | |
71 | /* reimpl */ |
72 | void start(); |
73 | |
74 | private: |
75 | //@cond PRIVATE |
76 | CollectionAttributesSynchronizationJobPrivate *const d; |
77 | friend class CollectionAttributesSynchronizationJobPrivate; |
78 | |
79 | Q_PRIVATE_SLOT(d, void slotSynchronized(qlonglong)) |
80 | Q_PRIVATE_SLOT(d, void slotTimeout()) |
81 | //@endcond |
82 | }; |
83 | |
84 | } |
85 | |
86 | #endif |
87 | |