add more spacing
[personal-kdebase.git] / workspace / plasma / scriptengines / webkit / bundle.h
blobe312dace29fa6eeef754e49feef76babf4f9c8cb
1 /*
2 Copyright (c) 2007 Zack Rusin <zack@kde.org>
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
22 #ifndef BUNDLE_H
23 #define BUNDLE_H
25 #include <KZip>
26 #include <KTempDir>
28 #include <Plasma/PackageStructure>
30 class KArchiveDirectory;
32 class Bundle : public Plasma::PackageStructure
34 Q_OBJECT
35 public:
36 Bundle(const QString &path);
37 Bundle(const QByteArray &data);
38 Bundle(QObject *parent, QVariantList args);
39 ~Bundle();
41 bool isValid() const;
43 void setData(const QByteArray &fn);
44 QByteArray data() const;
46 QString bundleId() const;
47 QString name() const;
48 QString version() const;
49 QString description() const;
50 int width() const;
51 int height() const;
52 QString htmlLocation() const;
53 QString iconLocation() const;
55 protected:
56 void pathChanged();
58 private:
59 bool extractArchive(const KArchiveDirectory *dir, const QString &path);
60 bool extractInfo();
62 bool parsePlist(const QString &loc);
63 bool parseConfigXml(const QString &loc);
65 void initTempDir();
67 bool open();
68 bool close();
69 bool installPackage(const QString &archivePath, const QString &packageRoot);
71 private:
72 QByteArray m_data;
73 bool m_isValid;
74 KTempDir *m_tempDir;
76 QString m_bundleId;
77 QString m_name;
78 QString m_version;
79 QString m_description;
80 int m_width;
81 int m_height;
82 QString m_htmlLocation;
83 QString m_iconLocation;
86 #endif