2010-07-12 22:51:12 +02:00
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
// storage.h //
|
|
|
|
// //
|
|
|
|
// Copyright (C) 2010 Brian Pritchett <batenkaitos@gmail.com> //
|
2010-10-22 14:29:35 +02:00
|
|
|
// Copyright (C) 2010 Marco Martin <mart@kde.org> //
|
2010-07-12 22:51:12 +02:00
|
|
|
// //
|
|
|
|
// This library is free software; you can redistribute it and/or //
|
|
|
|
// modify it under the terms of the GNU Lesser General Public //
|
|
|
|
// License as published by the Free Software Foundation; either //
|
|
|
|
// version 2.1 of the License, or (at your option) any later version. //
|
|
|
|
// //
|
|
|
|
// 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 Street, Fifth Floor, Boston, MA //
|
|
|
|
// 02110-1301 USA //
|
|
|
|
/////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef PLASMA_STORAGE_H
|
|
|
|
#define PLASMA_STORAGE_H
|
|
|
|
|
2010-10-01 18:58:15 +02:00
|
|
|
#include <QSqlDatabase>
|
|
|
|
|
2010-07-13 07:55:31 +02:00
|
|
|
#include <plasma/service.h>
|
|
|
|
#include <plasma/servicejob.h>
|
2010-07-12 22:51:12 +02:00
|
|
|
|
|
|
|
//Begin StorageJob
|
|
|
|
class StorageJob : public Plasma::ServiceJob
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2011-09-24 15:54:44 +02:00
|
|
|
Q_PROPERTY(QVariantHash data READ data WRITE setData)
|
|
|
|
|
2010-07-12 22:51:12 +02:00
|
|
|
public:
|
|
|
|
StorageJob(const QString& destination,
|
|
|
|
const QString& operation,
|
|
|
|
const QMap<QString, QVariant>& parameters,
|
|
|
|
QObject *parent = 0);
|
2011-01-07 00:26:14 +01:00
|
|
|
~StorageJob();
|
2011-04-28 16:30:44 +02:00
|
|
|
void setData(const QVariantHash &data);
|
|
|
|
QVariantHash data() const;
|
2010-07-12 22:51:12 +02:00
|
|
|
void start();
|
2011-04-28 21:31:11 +02:00
|
|
|
QString clientName() const;
|
|
|
|
|
|
|
|
protected Q_SLOTS:
|
|
|
|
void resultSlot(StorageJob *job, const QVariant &result);
|
2011-04-28 14:14:11 +02:00
|
|
|
|
2010-10-01 18:58:15 +02:00
|
|
|
private:
|
2010-10-23 14:04:24 +02:00
|
|
|
QString m_clientName;
|
2011-04-28 14:14:11 +02:00
|
|
|
QVariantHash m_data;
|
2010-07-12 22:51:12 +02:00
|
|
|
};
|
|
|
|
//End StorageJob
|
|
|
|
|
2011-04-28 18:40:02 +02:00
|
|
|
Q_DECLARE_METATYPE(StorageJob *)
|
2011-04-28 23:10:33 +02:00
|
|
|
Q_DECLARE_METATYPE(QWeakPointer<StorageJob>)
|
2011-04-28 18:40:02 +02:00
|
|
|
|
2010-07-12 22:51:12 +02:00
|
|
|
class Storage : public Plasma::Service
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2011-04-28 15:19:07 +02:00
|
|
|
Storage(QObject *parent = 0);
|
2010-07-12 22:51:12 +02:00
|
|
|
~Storage();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Plasma::ServiceJob* createJob(const QString &operation, QMap<QString, QVariant> ¶meters);
|
|
|
|
|
|
|
|
private:
|
2010-10-23 14:04:24 +02:00
|
|
|
QString m_clientName;
|
2010-07-12 22:51:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif //PLASMA_STORAGE_H
|