libplasma
package.h
Go to the documentation of this file.00001 /****************************************************************************** 00002 * Copyright 2007 by Aaron Seigo <aseigo@kde.org> * 00003 * Copyright 2007 by Riccardo Iaconelli <riccardo@kde.org> * 00004 * * 00005 * This library is free software; you can redistribute it and/or * 00006 * modify it under the terms of the GNU Library General Public * 00007 * License as published by the Free Software Foundation; either * 00008 * version 2 of the License, or (at your option) any later version. * 00009 * * 00010 * This library is distributed in the hope that it will be useful, * 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00013 * Library General Public License for more details. * 00014 * * 00015 * You should have received a copy of the GNU Library General Public License * 00016 * along with this library; see the file COPYING.LIB. If not, write to * 00017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * 00018 * Boston, MA 02110-1301, USA. * 00019 *******************************************************************************/ 00020 00021 #ifndef PLASMA_PACKAGE_H 00022 #define PLASMA_PACKAGE_H 00023 00024 #include <QtCore/QStringList> 00025 00026 #include <plasma/plasma_export.h> 00027 #include <plasma/packagestructure.h> 00028 00029 namespace Plasma 00030 { 00031 00036 class PackageMetadata; 00037 class PackagePrivate; 00038 00039 class PLASMA_EXPORT Package 00040 { 00041 public: 00049 Package(const QString& packageRoot, const QString& package, 00050 PackageStructure::Ptr structure); 00051 00058 Package(const QString &packagePath, PackageStructure::Ptr structure); 00059 00060 //TODO for 4.1: be able to load an uninstalled/uncompressed file. 00061 00062 ~Package(); 00063 00068 bool isValid() const; 00069 00078 QString filePath(const char* fileType, const QString& filename) const; 00079 00088 QString filePath(const char* fileType) const; 00089 00097 QStringList entryList(const char* fileType) const; 00098 00102 const PackageMetadata *metadata() const; 00103 00107 const QString path() const; 00108 00112 const PackageStructure::Ptr structure() const; 00113 00121 static QStringList listInstalled(const QString &packageRoot); 00122 00131 static bool installPackage(const QString &package, 00132 const QString &packageRoot); 00133 00140 static bool registerPackage(const PackageMetadata &data, const QString &iconPath); 00141 00152 static bool createPackage(const PackageMetadata &metadata, 00153 const QString &source, 00154 const QString &destination, 00155 const QString &icon = QString()); 00156 00157 private: 00158 Q_DISABLE_COPY(Package) 00159 PackagePrivate * const d; 00160 }; 00161 00162 } // Namespace 00163 00164 #endif 00165