Development/Tutorials/Plasma4/PackageStructure: Difference between revisions
(Created page with '==Abstract== PackageStructure defines what is in a Package. This information is used to create packages and provides a way to programatically refer to the contents. It's also use...') |
mNo edit summary |
||
Line 39: | Line 39: | ||
===The Header File=== | ===The Header File=== | ||
'''testpackage.h''' | |||
<code cppqt> | <code cppqt> | ||
#ifndef TESTPACKAGE_H | #ifndef TESTPACKAGE_H |
Revision as of 07:43, 17 March 2011
Abstract
PackageStructure defines what is in a Package. This information is used to create packages and provides a way to programatically refer to the contents. It's also used to provide an installation profile for you Packages.
The plasmapkg
This tool is used to get information about Packages and install, remove or upgrade them. Run
plasmapkg --help
to get a list of available options.
The Code
The Desktop File
Every PackageStructure needs a desktop file to tell plasma what package it's defining:
plasma-packagestructure-test.desktop
[Desktop Entry]
Name=Test
Comment=Test Package Structure
Type=Service
X-KDE-ServiceTypes=Plasma/PackageStructure
X-KDE-PluginInfo-Name=Plasma/Test
X-KDE-Library=plasma_packagestructure_test
X-KDE-PluginInfo-Author=Farhad Hedayati Fard
[email protected]
X-KDE-PluginInfo-Name=test
X-KDE-PluginInfo-Version=0.1
X-KDE-PluginInfo-Website=http://plasma.kde.org/
X-KDE-PluginInfo-License=GPLv3+
X-KDE-PluginInfo-EnabledByDefault=true
X-Plasma-PackageFileFilter=*.test
X-Plasma-PackageFileMimetypes=application/zip
The most important fields are:
- Name, Comment and Type fields, which are required for all desktop files.
- X-KDE-ServiceTypes field which tells plasma that this is a PackageStructure
- X-KDE-PluginInfo-Name field which should be identical to the name used in your code (discussed later).
- X-KDE-Library field which tells plasma how to load/install the packages with this package structure.
- X-KDE-PluginInfo-Name field which should be identical to the name of dataengine/plasmoid that uses this PackageStructure.
The Header File
testpackage.h
- ifndef TESTPACKAGE_H
- define TESTPACKAGE_H
// We need this header since we are inheriting it
- include <plasma/packagestructure.h>
/**
This PackageStructe provides an structure for packages used by the test
DataEngine.
- /
class TestPackage : public Plasma::PackageStructure
{
public:
// Every PackageStructure needs an explicit constructor with these arguments
explicit TestPackage( QObject *parent = 0, const QVariantList& args = QVariantList() );
};
- endif // TESTPACKAGE_H