~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to plasma/generic/scriptengines/webkit/bundle.h

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (c) 2007 Zack Rusin <zack@kde.org>
 
3
 
 
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:
 
10
 
 
11
The above copyright notice and this permission notice shall be included in
 
12
all copies or substantial portions of the Software.
 
13
 
 
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.
 
21
 */
 
22
#ifndef BUNDLE_H
 
23
#define BUNDLE_H
 
24
 
 
25
#include <KZip>
 
26
#include <KTempDir>
 
27
 
 
28
#include <Plasma/PackageStructure>
 
29
 
 
30
class KArchiveDirectory;
 
31
 
 
32
class Bundle : public Plasma::PackageStructure
 
33
{
 
34
    Q_OBJECT
 
35
public:
 
36
    Bundle(const QString &path);
 
37
    Bundle(const QByteArray &data);
 
38
    Bundle(QObject *parent, QVariantList args);
 
39
    ~Bundle();
 
40
 
 
41
    bool isValid() const;
 
42
 
 
43
    void setData(const QByteArray &fn);
 
44
    QByteArray data() const;
 
45
 
 
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;
 
54
 
 
55
protected:
 
56
    void pathChanged();
 
57
 
 
58
private:
 
59
    bool extractArchive(const KArchiveDirectory *dir, const QString &path);
 
60
    bool extractInfo();
 
61
 
 
62
    bool parsePlist(const QString &loc);
 
63
    bool parseConfigXml(const QString &loc);
 
64
 
 
65
    void initTempDir();
 
66
 
 
67
    bool open();
 
68
    bool close();
 
69
    bool installPackage(const QString &archivePath, const QString &packageRoot);
 
70
 
 
71
private:
 
72
    QByteArray   m_data;
 
73
    bool      m_isValid;
 
74
    KTempDir *m_tempDir;
 
75
 
 
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;
 
84
};
 
85
 
 
86
#endif