Plasma
packagestructure.h
Go to the documentation of this file.
00001 /****************************************************************************** 00002 * Copyright 2007 by Aaron Seigo <aseigo@kde.org> * 00003 * * 00004 * This library is free software; you can redistribute it and/or * 00005 * modify it under the terms of the GNU Library General Public * 00006 * License as published by the Free Software Foundation; either * 00007 * version 2 of the License, or (at your option) any later version. * 00008 * * 00009 * This library is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00012 * Library General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU Library General Public License * 00015 * along with this library; see the file COPYING.LIB. If not, write to * 00016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00017 * Boston, MA 02110-1301, USA. * 00018 *******************************************************************************/ 00019 00020 #ifndef PLASMA_PACKAGESTRUCTURE_H 00021 #define PLASMA_PACKAGESTRUCTURE_H 00022 00023 #include <QtCore/QStringList> 00024 #include <QtCore/QSharedData> 00025 00026 #include <kgenericfactory.h> 00027 #include <klocale.h> 00028 #include <ksharedptr.h> 00029 00030 #include <plasma/version.h> 00031 #include "packagemetadata.h" 00032 00033 class KConfigBase; 00034 00035 namespace Plasma 00036 { 00037 00038 class PackageStructurePrivate; 00039 00072 class PLASMA_EXPORT PackageStructure : public QObject, public QSharedData 00073 { 00074 Q_OBJECT 00075 00076 public: 00077 typedef KSharedPtr<PackageStructure> Ptr; 00078 00084 explicit PackageStructure(QObject *parent = 0, 00085 const QString &type = i18nc("A non-functional package", "Invalid")); 00086 00090 virtual ~PackageStructure(); 00091 00095 PackageStructure &operator=(const PackageStructure &rhs); 00096 00105 static PackageStructure::Ptr load(const QString &packageFormat); 00106 00110 QString type() const; 00111 00115 QList<const char*> directories() const; 00116 00120 QList<const char*> requiredDirectories() const; 00121 00125 QList<const char*> files() const; 00126 00130 QList<const char*> requiredFiles() const; 00131 00143 void addDirectoryDefinition(const char *key, const QString &path, const QString &name); 00144 00156 void addFileDefinition(const char *key, const QString &path, const QString &name); 00157 00163 void removeDefinition(const char *key); 00164 00169 QString path(const char *key) const; 00170 00177 QStringList searchPath(const char *key) const; 00178 00186 QStringList entryList(const char *key); 00187 00191 QString name(const char *key) const; 00192 00201 void setRequired(const char *key, bool required); 00202 00206 bool isRequired(const char *key) const; 00207 00215 void setDefaultMimetypes(QStringList mimetypes); 00216 00225 void setMimetypes(const char *key, QStringList mimetypes); 00226 00230 QStringList mimetypes(const char *key) const; 00231 00236 void setPath(const QString &path); 00237 00241 QString path() const; 00242 00246 void read(const KConfigBase *config); 00247 00251 void write(KConfigBase *config) const; 00252 00262 virtual bool installPackage(const QString &archivePath, const QString &packageRoot); 00263 00271 virtual bool uninstallPackage(const QString &packageName, const QString &packageRoot); 00272 00285 virtual void createNewWidgetBrowser(QWidget *parent = 0); 00286 00291 KDE_DEPRECATED QString contentsPrefix() const; 00292 00298 QStringList contentsPrefixPaths() const; 00299 00303 QString defaultPackageRoot() const; 00304 00308 QString servicePrefix() const; 00309 00313 void setServicePrefix(const QString &servicePrefix); 00314 00318 virtual PackageMetadata metadata(); 00319 00324 bool allowExternalPaths() const; 00325 00326 Q_SIGNALS: 00330 void newWidgetBrowserFinished(); 00331 00332 protected: 00338 void setAllowExternalPaths(bool allow); 00339 00349 KDE_DEPRECATED void setContentsPrefix(const QString &prefix); 00350 00362 void setContentsPrefixPaths(const QStringList &prefixPaths); 00363 00367 void setDefaultPackageRoot(const QString &packageRoot); 00368 00373 virtual void pathChanged(); 00374 00375 private: 00376 PackageStructurePrivate * const d; 00377 }; 00378 00382 #define K_EXPORT_PLASMA_PACKAGESTRUCTURE(libname, classname) \ 00383 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \ 00384 K_EXPORT_PLUGIN(factory("plasma_packagestructure_" #libname)) \ 00385 K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION) 00386 00387 } // Plasma namespace 00388 #endif
KDE 4.6 API Reference