This file is indexed.

/usr/include/qgis/qgsmaplayeractionregistry.h is in libqgis-dev 2.8.6+dfsg-1build1.

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
/***************************************************************************
    qgsmaplayeractionregistry.h
    ---------------------------
    begin                : January 2014
    copyright            : (C) 2014 by Nyall Dawson
    email                : nyall dot dawson at gmail dot com
 ***************************************************************************
 *                                                                         *
 *   This program 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 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef QGSMAPLAYERACTIONREGISTRY_H
#define QGSMAPLAYERACTIONREGISTRY_H

#include <QObject>
#include <QList>
#include <QMap>
#include <QAction>

#include "qgsmaplayer.h"

class QgsFeature;

/**
* An action which can run on map layers
*/
class GUI_EXPORT QgsMapLayerAction : public QAction
{
    Q_OBJECT
    Q_FLAGS( Availability )

  public:
    enum Target
    {
      Layer = 1,
      SingleFeature = 2,
      MultipleFeatures = 4,
      AllActions = Layer | SingleFeature | MultipleFeatures
    };
    Q_DECLARE_FLAGS( Targets, Target )

    //! Creates a map layer action which can run on any layer
    //! @note using AllActions as a target probably does not make a lot of sense. This default action was settled for API compatiblity reasons.
    QgsMapLayerAction( QString name, QObject *parent, Targets targets = AllActions, QIcon icon = QIcon() );

    //! Creates a map layer action which can run only on a specific layer
    QgsMapLayerAction( QString name, QObject *parent, QgsMapLayer* layer, Targets targets = AllActions, QIcon icon = QIcon() );

    //! Creates a map layer action which can run on a specific type of layer
    QgsMapLayerAction( QString name, QObject *parent, QgsMapLayer::LayerType layerType, Targets targets = AllActions, QIcon icon = QIcon() );

    ~QgsMapLayerAction();

    /** True if action can run using the specified layer */
    bool canRunUsingLayer( QgsMapLayer* layer ) const;

    /** Triggers the action with the specified layer and list of feature. */
    void triggerForFeatures( QgsMapLayer* layer, const QList<QgsFeature> featureList );

    /** Triggers the action with the specified layer and feature. */
    void triggerForFeature( QgsMapLayer* layer, const QgsFeature* feature );

    /** Triggers the action with the specified layer. */
    void triggerForLayer( QgsMapLayer* layer );

    /** Define the targets of the action */
    void setTargets( Targets targets ) {mTargets = targets;}
    /** Return availibity of action */
    const Targets& targets() const {return mTargets;}

  signals:
    /** Triggered when action has been run for a specific list of features */
    void triggeredForFeatures( QgsMapLayer* layer, const QList<QgsFeature> featureList );

    /** Triggered when action has been run for a specific feature */
    void triggeredForFeature( QgsMapLayer* layer, const QgsFeature& feature );

    /** Triggered when action has been run for a specific layer */
    void triggeredForLayer( QgsMapLayer* layer );

  private:

    // true if action is only valid for a single layer
    bool mSingleLayer;
    // layer if action is only valid for a single layer
    QgsMapLayer* mActionLayer;

    // true if action is only valid for a specific layer type
    bool mSpecificLayerType;
    // layer type if action is only valid for a specific layer type
    QgsMapLayer::LayerType mLayerType;

    // determine if the action can be run on layer and/or single feature and/or multiple features
    Targets mTargets;
};

Q_DECLARE_OPERATORS_FOR_FLAGS( QgsMapLayerAction::Targets )

/**
* This class tracks map layer actions
*/
class GUI_EXPORT QgsMapLayerActionRegistry : public QObject
{
    Q_OBJECT

  public:
    //! Returns the instance pointer, creating the object on the first call
    static QgsMapLayerActionRegistry * instance();

    ~QgsMapLayerActionRegistry();

    /**Adds a map layer action to the registry*/
    void addMapLayerAction( QgsMapLayerAction * action );

    /**Returns the map layer actions which can run on the specified layer*/
    QList<QgsMapLayerAction *> mapLayerActions( QgsMapLayer* layer, QgsMapLayerAction::Targets targets = QgsMapLayerAction::AllActions );

    /**Removes a map layer action from the registry*/
    bool removeMapLayerAction( QgsMapLayerAction *action );

    /**Sets the default action for a layer*/
    void setDefaultActionForLayer( QgsMapLayer* layer, QgsMapLayerAction* action );
    /**Returns the default action for a layer*/
    QgsMapLayerAction * defaultActionForLayer( QgsMapLayer* layer );

  protected:
    //! protected constructor
    QgsMapLayerActionRegistry( QObject * parent = 0 );

    QList< QgsMapLayerAction* > mMapLayerActionList;

  signals:
    /** Triggered when an action is added or removed from the registry */
    void changed();

  private:

    static QgsMapLayerActionRegistry *mInstance;

    QMap< QgsMapLayer*, QgsMapLayerAction* > mDefaultLayerActionMap;

};

#endif // QGSMAPLAYERACTIONREGISTRY_H