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 <tqstring.h> 00029 #include <tqcstring.h> 00030 #include <tqpixmap.h> 00031 #include <tqfile.h> 00032 #include <tqvaluevector.h> 00033 00034 class LineParser; 00035 class TQTextStream; 00036 class ThemeLocale; 00037 class ZipFile; 00038 00042 class ThemeFile 00043 { 00044 public: 00045 typedef TQValueVector<ThemeFile> List; 00046 00047 ThemeFile(const KURL& url = KURL()); 00048 ~ThemeFile(); 00049 00050 bool isZipTheme() const { return m_zipTheme; }; 00051 const TQString& name() const { return m_name; }; 00052 const TQString& version() const { return m_version; }; 00053 const TQString& license() const { return m_license; }; 00054 const TQString& id() const { return m_id; }; 00055 const TQString& mo() const { return m_mo; }; 00056 const TQString& file() const { return m_file; }; 00057 const TQString& pythonModule() const { return m_python; }; 00058 bool pythonModuleExists() const; 00059 const TQString& path() const { return m_path; }; 00060 const TQString& description() const { return m_description; }; 00061 const TQString& author() const { return m_author; }; 00062 const TQString& authorEmail() const { return m_authorEmail; }; 00063 const TQString& homepage() const { return m_homepage; }; 00064 TQPixmap icon() const; 00065 bool exists() const; 00066 bool isThemeFile(const TQString& filename) const; 00067 bool isValid() const; 00068 TQByteArray readThemeFile(const TQString& filename) const; 00069 bool fileExists(const TQString& 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 TQString& filename); 00079 static TQString canonicalFile(const TQString& file); 00080 00081 private: 00082 void parseXml(); 00083 void mkdir(TQDir dir); 00084 00085 TQString m_path; 00086 bool m_zipTheme; 00087 TQString m_file; 00088 TQString m_id; 00089 TQString m_mo; 00090 TQString m_name; 00091 TQString m_theme; 00092 TQString m_python; 00093 TQString m_icon; 00094 TQString m_version; 00095 TQString m_license; 00096 TQTextStream* m_stream; 00097 TQByteArray m_ba; 00098 TQFile m_fl; 00099 TQString m_description; 00100 TQString m_author; 00101 TQString m_authorEmail; 00102 TQString m_homepage; 00103 ThemeLocale* m_locale; 00104 ZipFile* m_zip; 00105 }; 00106 00107 #endif