File indexing completed on 2024-04-21 04:57:05

0001 /* This file is part of the KDE project
0002 
0003    Copyright (C) 2007 by Lukas Appelhans <l.appelhans@gmx.de>
0004    Copyright (C) 2008 by Javier Goday <jgoday@gmail.com>
0005 
0006    This program is free software; you can redistribute it and/or
0007    modify it under the terms of the GNU General Public
0008    License as published by the Free Software Foundation; either
0009    version 2 of the License, or (at your option) any later version.
0010 */
0011 #ifndef TRANSFERHISTORYSTORE_SQLITE_P_H
0012 #define TRANSFERHISTORYSTORE_SQLITE_P_H
0013 
0014 #ifdef HAVE_SQLITE
0015 
0016 #include "transferhistorystore.h"
0017 
0018 #include <QList>
0019 #include <QSqlDatabase>
0020 
0021 class TransferHistoryItem;
0022 class SQLiteStore : public TransferHistoryStore
0023 {
0024     Q_OBJECT
0025 public:
0026     SQLiteStore(const QString &database);
0027     ~SQLiteStore() override;
0028 
0029 public Q_SLOTS:
0030     void load() override;
0031     void clear() override;
0032     void saveItem(const TransferHistoryItem &item) override;
0033     void saveItems(const QList<TransferHistoryItem> &items) override;
0034     void deleteItem(const TransferHistoryItem &item) override;
0035 
0036 private:
0037     QSqlDatabase sql();
0038     void createTables();
0039 
0040 private:
0041     QString m_dbName;
0042     QSqlDatabase m_sql;
0043 };
0044 #endif
0045 #endif