2007-06-17 02:25:16 +02:00
|
|
|
/******************************************************************************
|
2007-11-02 16:30:53 +01:00
|
|
|
* Copyright 2007 by Riccardo Iaconelli <riccardo@kde.org> *
|
2007-06-17 02:25:16 +02:00
|
|
|
* *
|
|
|
|
* This library 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 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 *
|
|
|
|
* Library General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Library General Public License *
|
|
|
|
* along with this library; see the file COPYING.LIB. If not, write to *
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
|
|
|
|
* Boston, MA 02110-1301, USA. *
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef PACKAGEMETADATA_H
|
|
|
|
#define PACKAGEMETADATA_H
|
|
|
|
|
2007-07-15 00:40:00 +02:00
|
|
|
#include <QtCore/QString>
|
2007-06-17 02:25:16 +02:00
|
|
|
|
2007-06-17 02:33:44 +02:00
|
|
|
#include <plasma/plasma_export.h>
|
2007-06-17 02:29:53 +02:00
|
|
|
|
2007-06-17 02:25:16 +02:00
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2008-07-01 20:56:43 +02:00
|
|
|
class PackageMetadataPrivate;
|
|
|
|
|
2007-06-17 02:29:53 +02:00
|
|
|
class PLASMA_EXPORT PackageMetadata
|
2007-06-17 02:25:16 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Default constructor
|
|
|
|
**/
|
|
|
|
PackageMetadata();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructs a metadata object using the values in the file at path
|
|
|
|
*
|
|
|
|
* @param path path to a metadata.desktop file
|
|
|
|
**/
|
|
|
|
PackageMetadata(const QString& path);
|
|
|
|
~PackageMetadata();
|
|
|
|
|
2008-04-26 17:37:42 +02:00
|
|
|
bool isValid() const;
|
2007-06-17 02:25:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Writes out the metadata to filename, which should be a .desktop
|
|
|
|
* file. It writes out the information in a format that is compatible
|
|
|
|
* with KPluginInfo
|
|
|
|
* @see KPluginInfo
|
|
|
|
*
|
|
|
|
* @arg filename path to the file to write to
|
|
|
|
**/
|
2008-04-26 17:48:47 +02:00
|
|
|
void write(const QString& filename) const;
|
2007-06-17 02:25:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Reads in metadata from a file, which should be a .desktop
|
|
|
|
* file. It writes out the information in a format that is compatible
|
|
|
|
* with KPluginInfo
|
|
|
|
* @see KPluginInfo
|
|
|
|
*
|
|
|
|
* @arg filename path to the file to write to
|
|
|
|
**/
|
2007-12-02 13:04:57 +01:00
|
|
|
void read(const QString &filename);
|
2007-06-17 02:25:16 +02:00
|
|
|
|
2007-07-20 06:14:13 +02:00
|
|
|
QString name() const;
|
|
|
|
QString description() const;
|
|
|
|
QString serviceType() const;
|
|
|
|
QString author() const;
|
|
|
|
QString email() const;
|
|
|
|
QString version() const;
|
|
|
|
QString website() const;
|
|
|
|
QString license() const;
|
|
|
|
QString application() const;
|
|
|
|
QString requiredVersion() const;
|
2008-02-29 09:14:32 +01:00
|
|
|
QString pluginName() const;
|
2008-04-29 18:24:14 +02:00
|
|
|
QString implementationApi() const;
|
2007-06-17 02:25:16 +02:00
|
|
|
|
2007-07-20 06:14:13 +02:00
|
|
|
QString type() const;
|
2007-06-17 02:25:16 +02:00
|
|
|
|
2008-05-18 19:44:36 +02:00
|
|
|
/**
|
|
|
|
* Set the name of the package used to displayed
|
|
|
|
* a short describing name.
|
|
|
|
*/
|
2007-06-17 02:25:16 +02:00
|
|
|
void setName(const QString &);
|
2008-05-18 19:44:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the description used to provide some general
|
|
|
|
* information what the package is about.
|
|
|
|
*/
|
2007-06-17 02:25:16 +02:00
|
|
|
void setDescription(const QString &);
|
2008-05-18 19:44:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the service-type which defines the X-KDE-ServiceTypes
|
|
|
|
* type within the desktop file. If not defined this
|
|
|
|
* defaults to "Plasma/Applet,Plasma/Containment" in the
|
|
|
|
* desktop file.
|
|
|
|
*/
|
2007-07-20 06:14:13 +02:00
|
|
|
void setServiceType(const QString &);
|
2008-05-18 19:44:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the name of the author of the package.
|
|
|
|
*/
|
2007-06-17 02:25:16 +02:00
|
|
|
void setAuthor(const QString &);
|
2008-05-18 19:44:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the E-Mail address of the author or of the project
|
|
|
|
* that provided the package.
|
|
|
|
*/
|
2007-06-17 02:25:16 +02:00
|
|
|
void setEmail(const QString &);
|
2008-05-18 19:44:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the version of the package.
|
|
|
|
*/
|
2007-06-17 02:25:16 +02:00
|
|
|
void setVersion(const QString &);
|
2008-05-18 19:44:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the website URL where the package is hosted or
|
|
|
|
* where additional details about the project are available.
|
|
|
|
*/
|
2007-06-17 02:25:16 +02:00
|
|
|
void setWebsite(const QString &);
|
2008-05-18 19:44:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the license the package is distributed under.
|
|
|
|
*/
|
2007-06-17 02:25:16 +02:00
|
|
|
void setLicense(const QString &);
|
2008-05-18 19:44:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the name of the application this package may
|
|
|
|
* belongs to. This is used only for display purposes
|
|
|
|
* so far.
|
|
|
|
*/
|
2007-06-17 02:25:16 +02:00
|
|
|
void setApplication(const QString &);
|
2008-05-18 19:44:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the required version. See also the setVersion()
|
|
|
|
* method.
|
|
|
|
*/
|
2007-06-17 02:25:16 +02:00
|
|
|
void setRequiredVersion(const QString &);
|
2008-05-18 19:44:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the type of the package. If not defined this
|
|
|
|
* defaults to "Service" in the desktop file.
|
|
|
|
*/
|
2007-06-17 02:25:16 +02:00
|
|
|
void setType(const QString& type);
|
2008-05-18 19:44:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the plugin name of the package.
|
|
|
|
*
|
|
|
|
* The plugin name is used to locate the package;
|
|
|
|
* @code
|
|
|
|
* QString serviceName("plasma-applet-" + data.pluginName());
|
|
|
|
* QString service = KStandardDirs::locateLocal("services", serviceName + ".desktop");
|
|
|
|
* @endcode
|
|
|
|
*/
|
2008-02-29 09:14:32 +01:00
|
|
|
void setPluginName(const QString& name);
|
2008-05-18 19:44:36 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the implementation API string. This is used for
|
|
|
|
* display purposes only so far.
|
|
|
|
*/
|
2008-04-29 18:24:14 +02:00
|
|
|
void setImplementationApi(const QString& language);
|
2007-06-17 02:25:16 +02:00
|
|
|
|
|
|
|
private:
|
2008-07-01 20:56:43 +02:00
|
|
|
PackageMetadataPrivate * const d;
|
2007-06-17 02:25:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|