Buteo Synchronization Framework
DeletedItemsIdStorage.h
1 /*
2  * This file is part of buteo-syncfw package
3  *
4  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
5  *
6  * Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * version 2.1 as published by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  *
22  */
23 #ifndef DELETEDITEMSIDSTORAGE_H
24 #define DELETEDITEMSIDSTORAGE_H
25 
26 #include <QSqlDatabase>
27 #include <QDateTime>
28 
29 namespace Buteo {
30 
35 {
36 public:
37 
42 
47 
54  bool init(const QString &aDbFile);
55 
60  bool uninit();
61 
68  bool getSnapshot(QList<QString> &aItems, QList<QDateTime> &aCreationTimes) const;
69 
76  bool setSnapshot(const QList<QString> &aItems, const QList<QDateTime> &aCreationTimes);
77 
84  void addDeletedItem(const QString &aItem, const QDateTime &aCreationTime, const QDateTime &aDeleteTime);
85 
92  void addDeletedItems(const QList<QString> &aItems, const QList<QDateTime> &aCreationTimes,
93  const QList<QDateTime> &aDeleteTimes);
94 
101  bool getDeletedItems(QList<QString> &aItems, const QDateTime &aTime);
102 
103 protected:
104 
110 
116 
117 private:
118 
119  QSqlDatabase iDb;
120  QString iConnectionName;
121 };
122 
123 }
124 
125 #endif
Persistent storage for storing deleted item IDs.
Definition: DeletedItemsIdStorage.h:35
bool getSnapshot(QList< QString > &aItems, QList< QDateTime > &aCreationTimes) const
Retrieves persistently stored snapshot of item id's.
Definition: DeletedItemsIdStorage.cpp:81
void addDeletedItem(const QString &aItem, const QDateTime &aCreationTime, const QDateTime &aDeleteTime)
Adds a deleted item to backend.
Definition: DeletedItemsIdStorage.cpp:158
bool init(const QString &aDbFile)
Initializes backend.
Definition: DeletedItemsIdStorage.cpp:41
~DeletedItemsIdStorage()
Destructor.
Definition: DeletedItemsIdStorage.cpp:36
bool uninit()
Uninitializes backend.
Definition: DeletedItemsIdStorage.cpp:68
bool getDeletedItems(QList< QString > &aItems, const QDateTime &aTime)
Returns the deleted items after given time.
Definition: DeletedItemsIdStorage.cpp:225
bool setSnapshot(const QList< QString > &aItems, const QList< QDateTime > &aCreationTimes)
Store a snapshot of item id's persistently.
Definition: DeletedItemsIdStorage.cpp:104
bool ensureDeletedItemsExists()
Checks whether item id table exists and creates it if needed.
Definition: DeletedItemsIdStorage.cpp:268
DeletedItemsIdStorage()
Contructor.
Definition: DeletedItemsIdStorage.cpp:31
void addDeletedItems(const QList< QString > &aItems, const QList< QDateTime > &aCreationTimes, const QList< QDateTime > &aDeleteTimes)
Adds deleted items to backend.
Definition: DeletedItemsIdStorage.cpp:181
bool ensureItemSnapshotExists()
Checks whether snapshot table exists and creates it if needed.
Definition: DeletedItemsIdStorage.cpp:251