Buteo Synchronization Framework: DeletedItemsIdStorage.h Source File

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
34 class DeletedItemsIdStorage
35 {
36 public:
37
41 DeletedItemsIdStorage();
42
46 ~DeletedItemsIdStorage();
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
109 bool ensureItemSnapshotExists();
110
115 bool ensureDeletedItemsExists();
116
117 private:
118
119 QSqlDatabase iDb;
120 QString iConnectionName;
121 };
122
123 }
124
125 #endif
Buteo::DeletedItemsIdStorage
Persistent storage for storing deleted item IDs.
Definition: DeletedItemsIdStorage.h:35
Buteo::DeletedItemsIdStorage::getSnapshot
bool getSnapshot(QList< QString > &aItems, QList< QDateTime > &aCreationTimes) const
Retrieves persistently stored snapshot of item id's.
Definition: DeletedItemsIdStorage.cpp:81
Buteo::DeletedItemsIdStorage::addDeletedItem
void addDeletedItem(const QString &aItem, const QDateTime &aCreationTime, const QDateTime &aDeleteTime)
Adds a deleted item to backend.
Definition: DeletedItemsIdStorage.cpp:158
Buteo::DeletedItemsIdStorage::init
bool init(const QString &aDbFile)
Initializes backend.
Definition: DeletedItemsIdStorage.cpp:41
Buteo::DeletedItemsIdStorage::~DeletedItemsIdStorage
~DeletedItemsIdStorage()
Destructor.
Definition: DeletedItemsIdStorage.cpp:36
Buteo::DeletedItemsIdStorage::uninit
bool uninit()
Uninitializes backend.
Definition: DeletedItemsIdStorage.cpp:68
Buteo::DeletedItemsIdStorage::getDeletedItems
bool getDeletedItems(QList< QString > &aItems, const QDateTime &aTime)
Returns the deleted items after given time.
Definition: DeletedItemsIdStorage.cpp:225
Buteo::DeletedItemsIdStorage::setSnapshot
bool setSnapshot(const QList< QString > &aItems, const QList< QDateTime > &aCreationTimes)
Store a snapshot of item id's persistently.
Definition: DeletedItemsIdStorage.cpp:104
Buteo::DeletedItemsIdStorage::ensureDeletedItemsExists
bool ensureDeletedItemsExists()
Checks whether item id table exists and creates it if needed.
Definition: DeletedItemsIdStorage.cpp:268
Buteo::DeletedItemsIdStorage::DeletedItemsIdStorage
DeletedItemsIdStorage()
Contructor.
Definition: DeletedItemsIdStorage.cpp:31
Buteo::DeletedItemsIdStorage::addDeletedItems
void addDeletedItems(const QList< QString > &aItems, const QList< QDateTime > &aCreationTimes, const QList< QDateTime > &aDeleteTimes)
Adds deleted items to backend.
Definition: DeletedItemsIdStorage.cpp:181
Buteo::DeletedItemsIdStorage::ensureItemSnapshotExists
bool ensureItemSnapshotExists()
Checks whether snapshot table exists and creates it if needed.
Definition: DeletedItemsIdStorage.cpp:251
QList< QString >