~sil2100/unity-2d/bump_new_nux_libunity

« back to all changes in this revision

Viewing changes to launcher/UnityApplications/webfavorite.h

  • Committer: Florian Boucault
  • Date: 2011-02-10 14:40:03 UTC
  • mfrom: (359.2.44 maverick)
  • Revision ID: florian@boucault.net-20110210144003-6hhny3axzwvty3h2
Merged from 'maverick' branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2011 Canonical, Ltd.
 
3
 *
 
4
 * Authors:
 
5
 *  Olivier Tilloy <olivier.tilloy@canonical.com>
 
6
 *
 
7
 * This program is free software; you can redistribute it and/or modify
 
8
 * it under the terms of the GNU General Public License as published by
 
9
 * the Free Software Foundation; version 3.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
#ifndef WebFavorite_H
 
21
#define WebFavorite_H
 
22
 
 
23
#include <QObject>
 
24
#include <QUrl>
 
25
#include <QString>
 
26
#include <QStringList>
 
27
 
 
28
class QNetworkReply;
 
29
 
 
30
class WebFavorite : public QObject
 
31
{
 
32
    Q_OBJECT
 
33
 
 
34
public:
 
35
    WebFavorite(const QUrl& url, QObject* parent=0);
 
36
    ~WebFavorite();
 
37
 
 
38
    const QString& desktopFile() const;
 
39
 
 
40
private:
 
41
    QUrl m_url;
 
42
    QString m_desktopFile;
 
43
 
 
44
    uint m_redirects;
 
45
    QStringList m_favicons;
 
46
    QStringList::iterator m_current_favicon;
 
47
 
 
48
    static QString computeUrlHash(const QUrl& url);
 
49
 
 
50
    void writeDesktopFile(const QByteArray& contents) const;
 
51
    void modifyDesktopFile(const QString& key, const QString& value) const;
 
52
 
 
53
    void fetchPage();
 
54
    void tryNextFavicon();
 
55
 
 
56
private Q_SLOTS:
 
57
    void slotFetchPageFinished(QNetworkReply*);
 
58
    void slotFetchFaviconFinished(QNetworkReply*);
 
59
};
 
60
 
 
61
#endif // WebFavorite_H
 
62