This file is indexed.

/usr/include/libtomahawk/AtticaManager.h is in libtomahawk-dev 0.8.4+dfsg1-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 *
 *   Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
 *
 *   Tomahawk is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   Tomahawk is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef ATTICAMANAGER_H
#define ATTICAMANAGER_H

#include <QObject>
#include <QHash>
#include <QPixmap>
#include <QNetworkReply>

#include "DllMacro.h"
#include "accounts/Account.h"

#include <attica/provider.h>
#include <attica/providermanager.h>
#include <attica/content.h>

namespace Tomahawk {
namespace Accounts {
class AtticaResolverAccount;
}
}

class BinaryInstallerHelper;

class DLLEXPORT AtticaManager : public QObject
{
    Q_OBJECT
public:
    enum ResolverState {
        Uninstalled = 0,
        Installing,
        Installed,
        NeedsUpgrade,
        Upgrading,
        Failed
    };

    struct Resolver {
        QString version, scriptPath;
        int userRating; // 0-100
        ResolverState state;
        QPixmap* pixmap;
        bool binary;

        // internal
        bool pixmapDirty;

        Resolver( const QString& v, const QString& path, int userR, ResolverState s, bool isBinary )
            : version( v ), scriptPath( path ), userRating( userR ), state( s ), pixmap( 0 ), binary( isBinary ), pixmapDirty( false )
        {
        }
        Resolver() : userRating( -1 ), state( Uninstalled ), pixmap( 0 ), binary( false ), pixmapDirty( false ) {}
    };

    typedef QHash< QString, AtticaManager::Resolver > StateHash;

    static AtticaManager* instance()
    {
        if ( !s_instance )
            s_instance = new AtticaManager();

        return s_instance;
    }

    /**
     * Delete the AtticaManager if initialised.
     *
     * Note that <code>delete AtticaManager::instance()</code> will create an
     * instance if none existed before.
     */
    static void deleteInstace()
    {
        if ( s_instance )
        {
            delete s_instance;
        }
    }

    explicit AtticaManager ( QObject* parent = 0 );
    virtual ~AtticaManager();

    bool resolversLoaded() const;

    Attica::Content::List resolvers() const;
    Attica::Content resolverForId( const QString& id ) const;

    ResolverState resolverState( const Attica::Content& resolver ) const;
    QPixmap iconForResolver( const Attica::Content& id ); // Looks up in icon cache

    void uninstallResolver( const Attica::Content& resolver );
    void uninstallResolver( const QString& pathToResolver );
    QString pathFromId( const QString& resolverId ) const;

    void uploadRating( const Attica::Content& c );
    bool userHasRated( const Attica::Content& c ) const;

    /**
      If the resolver coming from libattica has a native custom c++ account
      as well. For example the last.fm & spotify accounts.
      */
    bool hasCustomAccountForAttica( const QString& id ) const;
    Tomahawk::Accounts::Account* customAccountForAttica( const QString& id ) const;
    void registerCustomAccount( const QString& atticaId, Tomahawk::Accounts::Account* account );

    AtticaManager::Resolver resolverData( const QString& atticaId ) const;

public slots:
    void installResolver( const Attica::Content& resolver, bool autoCreateAccount = true );
    void installResolverWithHandler( const Attica::Content& resolver, Tomahawk::Accounts::AtticaResolverAccount* handler );

    void upgradeResolver( const Attica::Content& resolver );

signals:
    void resolversLoaded( const Attica::Content::List& resolvers );

    void resolverStateChanged( const QString& resolverId );
    void resolverInstalled( const QString& resolverId );
    void resolverUninstalled( const QString& resolverId );
    void resolverInstallationFailed( const QString& resolverId );

    void resolverIconUpdated( const QString& resolverId );

    void startedInstalling( const QString& resolverId );

private slots:
    void providerFetched( QNetworkReply* reply );
    void providerError( QNetworkReply::NetworkError );
    void providerAdded( const Attica::Provider& );
    void categoriesReturned( Attica::BaseJob* );
    void resolversList( Attica::BaseJob* );
    void binaryResolversList( Attica::BaseJob* );
    void resolverDownloadFinished( QNetworkReply* );
    void payloadFetched();

    void loadPixmapsFromCache();
    void savePixmapsToCache();
    void resolverIconFetched();

    void syncServerData();

private:
    void doResolverRemove( const QString& id ) const;
    void doInstallResolver(  const Attica::Content& resolver, bool autoCreate, Tomahawk::Accounts::AtticaResolverAccount* handler );
    void fetchMissingIcons();
    QString hostname() const;

    Attica::ProviderManager m_manager;

    Attica::Provider m_resolverProvider;
    Attica::Content::List m_resolvers;
    StateHash m_resolverStates;

    int m_resolverJobsLoaded;
    QMap< QString, Tomahawk::Accounts::Account* > m_customAccounts;

    static AtticaManager* s_instance;

    friend class ::BinaryInstallerHelper;
};

class DLLEXPORT CustomAtticaAccount : public Tomahawk::Accounts::Account
{
    Q_OBJECT
public:
    virtual ~CustomAtticaAccount() {}

    virtual Attica::Content atticaContent() const = 0;

protected:
    // No, you can't.
    CustomAtticaAccount( const QString& id ) : Tomahawk::Accounts::Account( id ) {}
};

Q_DECLARE_METATYPE( Attica::Content );
#endif // ATTICAMANAGER_H