2011-04-28 17:51:51 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2011 Marco Martin <mart@kde.org>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this program; if not, write to the
|
|
|
|
* Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef STORAGETHREAD_H
|
|
|
|
#define STORAGETHREAD_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <QThread>
|
|
|
|
#include <QSqlDatabase>
|
2011-04-28 23:10:33 +02:00
|
|
|
#include <QWeakPointer>
|
2011-04-28 17:51:51 +02:00
|
|
|
|
2011-04-28 18:40:02 +02:00
|
|
|
#include "storage_p.h"
|
2011-04-28 17:51:51 +02:00
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
|
|
|
class StorageThread : public QThread
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
StorageThread(QObject *parent = 0);
|
|
|
|
~StorageThread();
|
|
|
|
|
|
|
|
void run();
|
|
|
|
|
2011-04-28 18:40:02 +02:00
|
|
|
static Plasma::StorageThread *self();
|
2011-04-28 17:51:51 +02:00
|
|
|
|
2012-12-21 18:56:00 +01:00
|
|
|
void closeDb();
|
|
|
|
|
2011-04-28 17:51:51 +02:00
|
|
|
public Q_SLOTS:
|
2011-09-19 08:01:40 +02:00
|
|
|
void save(QWeakPointer<StorageJob> caller, const QVariantHash ¶meters);
|
|
|
|
void retrieve(QWeakPointer<StorageJob> caller, const QVariantHash ¶meters);
|
|
|
|
void deleteEntry(QWeakPointer<StorageJob> caller, const QVariantHash ¶meters);
|
|
|
|
void expire(QWeakPointer<StorageJob> caller, const QVariantHash ¶meters);
|
2011-04-28 17:51:51 +02:00
|
|
|
|
|
|
|
Q_SIGNALS:
|
2011-04-28 21:31:11 +02:00
|
|
|
void newResult(StorageJob* caller, const QVariant &result);
|
2011-04-28 17:51:51 +02:00
|
|
|
|
|
|
|
private:
|
2011-04-28 23:10:33 +02:00
|
|
|
void initializeDb(StorageJob* caller);
|
2011-04-28 17:51:51 +02:00
|
|
|
QSqlDatabase m_db;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|