Changeset View
Changeset View
Standalone View
Standalone View
resources/google-groupware/googleresourcestate.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | Copyright (c) 2020 Igor Poboiko <igor.poboiko@gmail.com> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or modify it | ||||
5 | under the terms of the GNU Library General Public License as published by | ||||
6 | the Free Software Foundation; either version 2 of the License, or (at your | ||||
7 | option) any later version. | ||||
8 | | ||||
9 | This library is distributed in the hope that it will be useful, but WITHOUT | ||||
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||||
12 | License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU Library General Public License | ||||
15 | along with this library; see the file COPYING.LIB. If not, write to the | ||||
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||||
17 | 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | #ifndef GOOGLERESOURCESTATE_H | ||||
21 | #define GOOGLERESOURCESTATE_H | ||||
22 | | ||||
23 | #include "googleresourcestateinterface.h" | ||||
24 | | ||||
25 | class GoogleResource; | ||||
26 | | ||||
27 | class GoogleResourceState : public GoogleResourceStateInterface | ||||
28 | { | ||||
29 | public: | ||||
30 | explicit GoogleResourceState(GoogleResource *resource); | ||||
31 | ~GoogleResourceState() = default; | ||||
32 | | ||||
33 | // Items handling | ||||
34 | void itemRetrieved(const Akonadi::Item &item) override; | ||||
35 | void itemsRetrieved(const Akonadi::Item::List &items) override; | ||||
36 | void itemsRetrievedIncremental(const Akonadi::Item::List &changed, const Akonadi::Item::List &removed) override; | ||||
37 | void itemsRetrievalDone() override; | ||||
38 | void setTotalItems(int) override; | ||||
39 | void itemChangeCommitted(const Akonadi::Item &item) override; | ||||
40 | void itemsChangesCommitted(const Akonadi::Item::List &items) override; | ||||
41 | Akonadi::Item::List currentItems() override; | ||||
42 | | ||||
43 | // Collections handling | ||||
44 | void collectionsRetrieved(const Akonadi::Collection::List &collections) override; | ||||
45 | void collectionAttributesRetrieved(const Akonadi::Collection &collection) override; | ||||
46 | void collectionChangeCommitted(const Akonadi::Collection &collection) override; | ||||
47 | void collectionsRetrievedFromHandler(const Akonadi::Collection::List &collections) override; | ||||
48 | Akonadi::Collection currentCollection() override; | ||||
49 | | ||||
50 | // Tags handling | ||||
51 | void tagsRetrieved(const Akonadi::Tag::List &tags, const QHash<QString, Akonadi::Item::List> &) override; | ||||
52 | void tagChangeCommitted(const Akonadi::Tag &tag) override; | ||||
53 | | ||||
54 | // Relations handling | ||||
55 | void relationsRetrieved(const Akonadi::Relation::List &tags) override; | ||||
56 | | ||||
57 | // FreeBusy handling | ||||
58 | void freeBusyRetrieved(const QString &email, const QString &freeBusy, bool success, const QString &errorText) override; | ||||
59 | void handlesFreeBusy(const QString &email, bool handles) override; | ||||
60 | | ||||
61 | // Result reporting | ||||
62 | void changeProcessed() override; | ||||
63 | void cancelTask(const QString &errorString) override; | ||||
64 | void deferTask() override; | ||||
65 | void taskDone() override; | ||||
66 | | ||||
67 | void emitStatus(int status, const QString &message) override; | ||||
68 | void emitError(const QString &message) override; | ||||
69 | void emitWarning(const QString &message) override; | ||||
70 | void emitPercent(int percent) override; | ||||
71 | | ||||
72 | // Other | ||||
73 | void scheduleCustomTask(QObject *receiver, const char *method, const QVariant &argument) override; | ||||
74 | | ||||
75 | // Google-specific stuff | ||||
76 | bool canPerformTask() override; | ||||
77 | bool handleError(KGAPI2::Job *job, bool _cancelTask) override; | ||||
78 | private: | ||||
79 | GoogleResource *m_resource = nullptr; | ||||
80 | }; | ||||
81 | | ||||
82 | #endif // GOOGLERESOURCESTATE_H |