DeletedItemsIdStorage.h
/*
* This file is part of buteo-syncfw package
*
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Contact: Sateesh Kavuri <sateesh.kavuri@nokia.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*
*/
#ifndef DELETEDITEMSIDSTORAGE_H
#define DELETEDITEMSIDSTORAGE_H
#include <QSqlDatabase>
#include <QDateTime>
namespace Buteo {
class DeletedItemsIdStorage
{
public:
DeletedItemsIdStorage();
~DeletedItemsIdStorage();
bool init(const QString &aDbFile);
bool uninit();
bool getSnapshot(QList<QString> &aItems, QList<QDateTime> &aCreationTimes) const;
bool setSnapshot(const QList<QString> &aItems, const QList<QDateTime> &aCreationTimes);
void addDeletedItem(const QString &aItem, const QDateTime &aCreationTime, const QDateTime &aDeleteTime);
void addDeletedItems(const QList<QString> &aItems, const QList<QDateTime> &aCreationTimes,
const QList<QDateTime> &aDeleteTimes);
bool getDeletedItems(QList<QString> &aItems, const QDateTime &aTime);
protected:
bool ensureItemSnapshotExists();
bool ensureDeletedItemsExists();
private:
QSqlDatabase iDb;
QString iConnectionName;
};
}
#endif
Buteo::DeletedItemsIdStorage::getSnapshot
bool getSnapshot(QList< QString > &aItems, QList< QDateTime > &aCreationTimes) const
Retrieves persistently stored snapshot of item id's.
Definition DeletedItemsIdStorage.cpp:82
Buteo::DeletedItemsIdStorage::addDeletedItem
void addDeletedItem(const QString &aItem, const QDateTime &aCreationTime, const QDateTime &aDeleteTime)
Adds a deleted item to backend.
Definition DeletedItemsIdStorage.cpp:159
Buteo::DeletedItemsIdStorage::init
bool init(const QString &aDbFile)
Initializes backend.
Definition DeletedItemsIdStorage.cpp:43
Buteo::DeletedItemsIdStorage::~DeletedItemsIdStorage
~DeletedItemsIdStorage()
Destructor.
Definition DeletedItemsIdStorage.cpp:38
Buteo::DeletedItemsIdStorage::uninit
bool uninit()
Uninitializes backend.
Definition DeletedItemsIdStorage.cpp:69
Buteo::DeletedItemsIdStorage::getDeletedItems
bool getDeletedItems(QList< QString > &aItems, const QDateTime &aTime)
Returns the deleted items after given time.
Definition DeletedItemsIdStorage.cpp:227
Buteo::DeletedItemsIdStorage::setSnapshot
bool setSnapshot(const QList< QString > &aItems, const QList< QDateTime > &aCreationTimes)
Store a snapshot of item id's persistently.
Definition DeletedItemsIdStorage.cpp:105
Buteo::DeletedItemsIdStorage::ensureDeletedItemsExists
bool ensureDeletedItemsExists()
Checks whether item id table exists and creates it if needed.
Definition DeletedItemsIdStorage.cpp:270
Buteo::DeletedItemsIdStorage::DeletedItemsIdStorage
DeletedItemsIdStorage()
Contructor.
Definition DeletedItemsIdStorage.cpp:33
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:183
Buteo::DeletedItemsIdStorage::ensureItemSnapshotExists
bool ensureItemSnapshotExists()
Checks whether snapshot table exists and creates it if needed.
Definition DeletedItemsIdStorage.cpp:253
QList
Definition SyncBackupAdaptor.h:40