themefile.h

00001 /****************************************************************************
00002 *  themefile.h - Theme file handling
00003 *
00004 *  Copyright (C) 2003 Hans Karlsson <karlsson.h@home.se>
00005 *  Copyright (C) 2003-2004 Adam Geitgey <adam@rootnode.org>
00006 *  Copyright (c) 2004 Petri Damstén <damu@iki.fi>
00007 *
00008 *  This file is part of SuperKaramba.
00009 *
00010 *  SuperKaramba is free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  SuperKaramba is distributed in the hope that it will be useful,
00016 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 *  GNU General Public License for more details.
00019 *
00020 *  You should have received a copy of the GNU General Public License
00021 *  along with SuperKaramba; if not, write to the Free Software
00022 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00023 ****************************************************************************/
00024 #ifndef THEMEFILE_H
00025 #define THEMEFILE_H
00026 
00027 #include <kurl.h>
00028 #include <qstring.h>
00029 #include <qcstring.h>
00030 #include <qpixmap.h>
00031 #include <qfile.h>
00032 #include <qvaluevector.h>
00033 
00034 class LineParser;
00035 class QTextStream;
00036 class ThemeLocale;
00037 class ZipFile;
00038 
00042 class ThemeFile
00043 {
00044   public:
00045     typedef QValueVector<ThemeFile> List;
00046 
00047     ThemeFile(const KURL& url = KURL());
00048     ~ThemeFile();
00049 
00050     bool isZipTheme() const { return m_zipTheme; };
00051     const QString& name() const { return m_name; };
00052     const QString& version() const { return m_version; };
00053     const QString& license() const { return m_license; };
00054     const QString& id() const { return m_id; };
00055     const QString& mo() const { return m_mo; };
00056     const QString& file() const { return m_file; };
00057     const QString& pythonModule() const { return m_python; };
00058     bool pythonModuleExists() const;
00059     const QString& path() const { return m_path; };
00060     const QString& description() const { return m_description; };
00061     const QString& author() const { return m_author; };
00062     const QString& authorEmail() const { return m_authorEmail; };
00063     const QString& homepage() const { return m_homepage; };
00064     QPixmap icon() const;
00065     bool exists() const;
00066     bool isThemeFile(const QString& filename) const;
00067     bool isValid() const;
00068     QByteArray readThemeFile(const QString& filename) const;
00069     bool fileExists(const QString& filename) const;
00070     const ThemeLocale* locale() const { return m_locale; };
00071     bool canUninstall() const;
00072 
00073     bool set(const KURL& url);
00074     bool open();
00075     bool nextLine(LineParser& parser);
00076     bool close();
00077 
00078     static bool isZipFile(const QString& filename);
00079     static QString canonicalFile(const QString& file);
00080 
00081   private:
00082     void parseXml();
00083     void mkdir(QDir dir);
00084 
00085     QString m_path;
00086     bool m_zipTheme;
00087     QString m_file;
00088     QString m_id;
00089     QString m_mo;
00090     QString m_name;
00091     QString m_theme;
00092     QString m_python;
00093     QString m_icon;
00094     QString m_version;
00095     QString m_license;
00096     QTextStream* m_stream;
00097     QByteArray m_ba;
00098     QFile m_fl;
00099     QString m_description;
00100     QString m_author;
00101     QString m_authorEmail;
00102     QString m_homepage;
00103     ThemeLocale* m_locale;
00104     ZipFile* m_zip;
00105 };
00106 
00107 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys