Debian Codegraph @

storageplugins/hnotes/NotesStorage.h

raw
1 /*
2 * This file is part of buteo-sync-plugins package
3 *
4 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5 * Copyright (C) 2013 - 2021 Jolla Ltd.
6 *
7 * Contact: Sateesh Kavuri <[email protected]>
8 *
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * version 2.1 as published by the Free Software Foundation.
12 *
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24 #ifndef NOTESSTORAGE_H
25 #define NOTESSTORAGE_H
26
27 #include "NotesBackend.h"
28
29 #include <buteosyncfw5/StoragePlugin.h>
30 #include <buteosyncfw5/StoragePluginLoader.h>
31 #include <buteosyncfw5/ProfileEngineDefs.h>
32
33 /*! \brief Harmattan notes storage plugin
34 *
35 *
36 */
37 class NotesStorage : public Buteo::StoragePlugin
38 {
39
40 public:
41
42 /*! \brief Constructor
43 *
44 * @param aPluginName aPluginName Name of the plugin
45 */
46 NotesStorage( const QString& aPluginName );
47
48 /*! \brief Destructor
49 *
50 */
51 virtual ~NotesStorage();
52
53 /*! \see StoragePlugin::init()
54 *
55 */
56 virtual bool init( const QMap<QString, QString>& aProperties );
57
58 /*! \see StoragePlugin::uninit()
59 *
60 */
61 virtual bool uninit();
62
63 /*! \see StoragePlugin::getAllItems()
64 *
65 */
66 virtual bool getAllItems( QList<Buteo::StorageItem*>& aItems );
67
68 /*! \see StoragePlugin::getAllItemIds()
69 *
70 */
71 virtual bool getAllItemIds( QList<QString>& aItemIds );
72
73 /*! \see StoragePlugin::getNewItems()
74 *
75 */
76 virtual bool getNewItems( QList<Buteo::StorageItem*>& aNewItems, const QDateTime& aTime );
77
78 /*! \see StoragePlugin::getNewItemIds()
79 *
80 */
81 virtual bool getNewItemIds( QList<QString>& aNewItemIds, const QDateTime& aTime );
82
83 /*! \see StoragePlugin::getModifiedItems()
84 *
85 */
86 virtual bool getModifiedItems( QList<Buteo::StorageItem*>& aModifiedItems, const QDateTime& aTime );
87
88 /*! \see StoragePlugin::getModifiedItemIds()
89 *
90 */
91 virtual bool getModifiedItemIds( QList<QString>& aModifiedItemIds, const QDateTime& aTime );
92
93 /*! \see StoragePlugin::getDeletedItemIds()
94 *
95 */
96 virtual bool getDeletedItemIds( QList<QString>& aDeletedItemIds, const QDateTime& aTime );
97
98 /*! \see StoragePlugin::newItem()
99 *
100 */
101 virtual Buteo::StorageItem* newItem();
102
103 /*! \see StoragePlugin::getItem()
104 *
105 */
106 virtual Buteo::StorageItem* getItem( const QString& aItemId );
107
108 /*! \see StoragePlugin::getItems()
109 *
110 */
111 virtual QList<Buteo::StorageItem*> getItems( const QStringList& aItemIdList );
112
113 /*! \see StoragePlugin::addItem()
114 *
115 */
116 virtual OperationStatus addItem( Buteo::StorageItem& aItem );
117
118 /*! \see StoragePlugin::addItems()
119 *
120 */
121 virtual QList<OperationStatus> addItems( const QList<Buteo::StorageItem*>& aItems );
122
123 /*! \see StoragePlugin::modifyItem()
124 *
125 */
126 virtual OperationStatus modifyItem( Buteo::StorageItem& aItem );
127
128 /*! \see StoragePlugin::modifyItems()
129 *
130 */
131 virtual QList<OperationStatus> modifyItems( const QList<Buteo::StorageItem*>& aItems );
132
133 /*! \see StoragePlugin::deleteItem()
134 *
135 */
136 virtual OperationStatus deleteItem( const QString& aItemId );
137
138 /*! \see StoragePlugin::deleteItems()
139 *
140 */
141 virtual QList<OperationStatus> deleteItems( const QList<QString>& aItemIds );
142
143 protected:
144
145 private:
146
147 QDateTime normalizeTime( const QDateTime& aTime ) const;
148
149 QByteArray getCTCaps( const QString& aFilename ) const;
150
151 NotesBackend iBackend;
152
153 bool iCommitNow;
154 };
155
156 class NotesStoragePluginLoader : public Buteo::StoragePluginLoader
157 {
158 Q_OBJECT
159 Q_PLUGIN_METADATA(IID "com.buteo.plugins.storage.NotesStoragePluginLoader")
160 Q_INTERFACES(Buteo::StoragePluginLoader)
161
162 public:
163 /*! \brief Creates notes storage plugin
164 *
165 * @param aPluginName Human-readable name for plugin
166 * @return Notes storage plugin instance
167 */
168 Buteo::StoragePlugin* createPlugin(const QString& aPluginName) override;
169 };
170
171 #endif // NOTESSTORAGE_H