2009-09-03 01:49:46 +02:00
|
|
|
/*
|
|
|
|
* Copyright © 2009 Rob Scheepmaker <r.scheepmaker@student.utwente.nl>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Library General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2009-11-17 02:53:23 +01:00
|
|
|
#ifndef PLASMA_PACKAGE_P_H
|
|
|
|
#define PLASMA_PACKAGE_P_H
|
|
|
|
|
2009-09-03 01:49:46 +02:00
|
|
|
#include "../plasma.h"
|
|
|
|
#include "../package.h"
|
|
|
|
#include "../service.h"
|
2009-09-02 04:27:16 +02:00
|
|
|
|
2011-05-27 12:26:59 +02:00
|
|
|
#include <QCryptographicHash>
|
2011-07-19 21:52:33 +02:00
|
|
|
#include <QDir>
|
2009-09-02 04:27:16 +02:00
|
|
|
#include <QString>
|
2011-07-22 17:24:40 +02:00
|
|
|
#include <QSharedData>
|
2009-09-02 04:27:16 +02:00
|
|
|
|
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2011-07-15 13:03:56 +02:00
|
|
|
class ContentStructure
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ContentStructure()
|
|
|
|
: directory(false),
|
|
|
|
required(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ContentStructure(const ContentStructure &other)
|
|
|
|
{
|
|
|
|
paths = other.paths;
|
2011-07-21 14:41:01 +02:00
|
|
|
#ifndef PLASMA_NO_PACKAGE_EXTRADATA
|
2011-07-15 13:03:56 +02:00
|
|
|
name = other.name;
|
|
|
|
mimeTypes = other.mimeTypes;
|
2011-07-21 14:41:01 +02:00
|
|
|
#endif
|
2011-07-15 13:03:56 +02:00
|
|
|
directory = other.directory;
|
|
|
|
required = other.required;
|
|
|
|
}
|
|
|
|
|
2011-07-22 17:24:40 +02:00
|
|
|
QString found;
|
2011-07-15 13:03:56 +02:00
|
|
|
QStringList paths;
|
2011-07-21 14:41:01 +02:00
|
|
|
#ifndef PLASMA_NO_PACKAGE_EXTRADATA
|
2011-07-15 13:03:56 +02:00
|
|
|
QString name;
|
|
|
|
QStringList mimeTypes;
|
2011-07-21 14:41:01 +02:00
|
|
|
#endif
|
2011-07-15 13:03:56 +02:00
|
|
|
bool directory : 1;
|
|
|
|
bool required : 1;
|
|
|
|
};
|
|
|
|
|
2011-07-22 17:24:40 +02:00
|
|
|
class PackagePrivate : public QSharedData
|
2009-09-02 04:27:16 +02:00
|
|
|
{
|
|
|
|
public:
|
2011-07-15 13:03:56 +02:00
|
|
|
PackagePrivate();
|
2010-09-03 21:44:28 +02:00
|
|
|
PackagePrivate(const PackagePrivate &other);
|
2009-09-02 04:27:16 +02:00
|
|
|
~PackagePrivate();
|
|
|
|
|
2010-09-03 21:44:28 +02:00
|
|
|
PackagePrivate &operator=(const PackagePrivate &rhs);
|
|
|
|
|
2011-07-15 13:03:56 +02:00
|
|
|
void createPackageMetadata(const QString &path);
|
2011-05-27 12:26:59 +02:00
|
|
|
void updateHash(const QString &basePath, const QString &subPath, const QDir &dir, QCryptographicHash &hash);
|
2011-07-19 21:52:33 +02:00
|
|
|
static bool installPackage(const QString &archivePath, const QString &packageRoot, const QString &servicePrefix);
|
|
|
|
static bool uninstallPackage(const QString &packageName, const QString &packageRoot, const QString &servicePrefix);
|
2009-09-21 23:37:44 +02:00
|
|
|
|
2011-07-19 21:52:33 +02:00
|
|
|
QWeakPointer<PackageStructure> structure;
|
2011-07-15 13:03:56 +02:00
|
|
|
QString path;
|
|
|
|
QStringList contentsPrefixPaths;
|
|
|
|
QString defaultPackageRoot;
|
|
|
|
QString servicePrefix;
|
2011-07-22 17:24:40 +02:00
|
|
|
QHash<QString, QString> discoveries;
|
|
|
|
QHash<QByteArray, ContentStructure> contents;
|
2011-07-21 14:41:01 +02:00
|
|
|
#ifndef PLASMA_NO_PACKAGE_EXTRADATA
|
2011-07-15 13:03:56 +02:00
|
|
|
QStringList mimeTypes;
|
2011-07-21 14:41:01 +02:00
|
|
|
#endif
|
2011-07-15 13:03:56 +02:00
|
|
|
KPluginInfo *metadata;
|
|
|
|
bool externalPaths : 1;
|
|
|
|
bool valid : 1;
|
2009-09-02 04:27:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2009-11-17 02:53:23 +01:00
|
|
|
#endif
|