This file is indexed.

/usr/include/plasma/extender.h is in kdelibs5-dev 4:4.14.2-5+deb8u2.

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
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
/*
 * Copyright 2008, 2009 by Rob Scheepmaker <r.scheepmaker@student.utwente.nl>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA  02110-1301  USA
 */

#ifndef PLASMA_EXTENDER_H
#define PLASMA_EXTENDER_H

#include <QtGui/QGraphicsWidget>

#include "plasma/framesvg.h"
#include "plasma/plasma_export.h"

namespace Plasma
{

class ExtenderGroup;
class ExtenderPrivate;
class ExtenderItem;
class Applet;

/**
 * @class Extender plasma/extender.h <Plasma/Extender>
 *
 * @short Extends applets to allow detachable parts
 *
 * An Extender is a widget that visually extends the normal contents of an applet with
 * additional dynamic widgets called ExtenderItems. These ExtenderItems can be
 * detached by the user and dropped either on another Extender or on the canvas directly.
 *
 * This widget allows using ExtenderItems in your applet. Extender takes care of the presentation
 * of a collection of ExtenderItems and keeps track of ExtenderItems that originate in it.
 *
 * The default Extender implementation displays extender items in a vertical layout with
 * spacers that appear when dropping an ExtenderItem over it.
 *
 * If you wish to have a different presentation of extender items, you can choose to subclass
 * Extender and reimplement the extenderItem* events and, optionally, the saveState function.
 *
 * To use an Extender in you applet, you'll have to instantiate one. A call to extender() in your
 * applet will create an extender on your applet if you haven't got one already. Every applet can
 * contain only one extender. Think of it as a decorator that adds some functionality to applets
 * that require it. Never instantiate an Extender before init() in your applet. This won't work
 * correctly since a scene is required when an Extender is instantiated.
 *
 * As soon as an Extender is instantiated, ExtenderItems contained previously in this Extender are
 * restored using the initExtenderItem function from the applet the items originally came from. For
 * more information on how this works and how to use ExtenderItems in general, see the ExtenderItem
 * API documentation.
 */
class PLASMA_EXPORT Extender : public QGraphicsWidget
{
    Q_OBJECT
    Q_PROPERTY(QString emptyExtenderMessage READ emptyExtenderMessage WRITE setEmptyExtenderMessage)
    Q_PROPERTY(QList<ExtenderItem*> items READ items())
    Q_PROPERTY(QList<ExtenderItem*> attachedItems READ attachedItems())
    Q_PROPERTY(QList<ExtenderItem*> detachedItems READ detachedItems())
    Q_PROPERTY(QList<ExtenderGroup*> groups READ groups())
    Q_PROPERTY(bool empty READ isEmpty())

    public:
        /**
         * Description on how to render the extender's items.
         */
        enum Appearance {
            NoBorders = 0,  /**< Draws no borders on the extender's items. When placed in an applet
                                 on the desktop, use this setting and use the standard margins of
                                 the applet containing this extender. */
            BottomUpStacked = 1, /**< Draws no borders on the topmost extenderitem, but draws the
                                      left, top and right border on subsequent items. When margins
                                      of the containing dialog are set to 0, except for the top
                                      margin, this leads to the 'stacked' look, recommended for
                                      extenders of applet's contained in a panel at the bottom of
                                      the screen. */
            TopDownStacked = 2 /**< Draws no borders on the bottom extenderitem, but draws the
                                    left, bottom and right border on subsequent items. When margins
                                    of the containing dialog are set to 0, except for the bottom
                                    margin, this leads to the 'stacked' look, recommended for
                                    extenders of applet's contained in a panel at the top of
                                    the screen. */
        };

        /**
         * Creates an extender. Note that extender expects applet to have a config(), and needs a
         * scene because of that. So you should only instantiate an extender in init() or later, not
         * in an applet's constructor.
         * The constructor also takes care of restoring ExtenderItems that were contained in this
         * extender before, so ExtenderItems are persistent between sessions.
         * Note that a call to extender() in an applet will instantiate an Extender for you if one
         * isn't already associated with your applet.
         * @param applet The applet this extender is part of. Null is not allowed here.
         */
        explicit Extender(Applet *applet);

        ~Extender();

        /**
         * @param message The text to be shown whenever the applet's extender is empty.
         */
        void setEmptyExtenderMessage(const QString &message);

        /**
         * @return The text to be shown whenever the applet's layout is empty.
         */
        QString emptyExtenderMessage() const;

        /**
         * @returns a list of all extender items (attached AND detached) where the source applet is
         * this applet.
         */
        QList<ExtenderItem*> items() const;

        /**
         * @returns a list of all attached extender items.
         */
        QList<ExtenderItem*> attachedItems() const;

        /**
         * @returns a list of all detached extender items.
         */
        QList<ExtenderItem*> detachedItems() const;

        /**
         * This function can be used for obtaining the extender item specified by name. For checking
         * whether or not an item already exists, you should use hasItem instead: while plasma is
         * starting up, not all detached items might have been instantiated yet. hasItem returns true
         * even if the requested item isn't instantiated yet.
         * @returns the requested item
         */
        Q_INVOKABLE ExtenderItem *item(const QString &name) const;

        /**
         * Extra convenience function for obtaining groups specified by name. This will avoid needed
         * to call item and casting to ExtenderGroup, which is otherwise quite common.
         * @returns the requested group
         * @since 4.3
         */
        Q_INVOKABLE ExtenderGroup *group(const QString &name) const;

        /**
         * This function can be used for easily determining if a certain item is already displayed
         * in an extender item somewhere, so your applet doesn't duplicate this item. This is needed
         * because ExtenderItems are persistent, so you can't blindly add new extender items in all
         * cases.
         * @returns whether or not this item already exists.
         * @since 4.3
         */
        Q_INVOKABLE bool hasItem(const QString &name) const;

        /**
         * @return true if the Extender is visually empty (though it may have items such as
         * empty groups or detached items associatd with it)
         */
        bool isEmpty() const;

        /**
         * Use this function to instruct the extender on how to render its items. Usually you will
         * want to call this function in your applet's constraintsEvent, allthough this is already
         * done for you when using PopupApplet as base class for your applet. Defaults to NoBorders.
         * @param appearance the way this extender should look.
         */
        void setAppearance(Appearance appearance);

        /**
         * @returns the current way of rendering extender items that is used.
         */
        Appearance appearance() const;

        /**
         * @returns a list of groups that are contained in this extender.
         * @since 4.3
         */
        QList<ExtenderGroup*> groups() const;

        /**
         * @returns the Applet this Extender is associated with
         * @since 4.4
         */
        Applet *applet() const;

    protected:
        /**
         * Get's called after an item has been added to this extender. The bookkeeping has already
         * been done when this function get's called. The only thing left to do is put it somewhere
         * appropriate. The default implementation adds the extenderItem to the appropriate place in
         * a QGraphicsLinearLayout.
         * @param item The item that has just been added.
         * @param pos The location the item has been dropped in local coordinates.
         */
        virtual void itemAddedEvent(ExtenderItem *item, const QPointF &pos = QPointF(-1, -1));

        /**
         * Get's called after an item has been removed from this extender. All bookkeeping has
         * already been done when this function get's called.
         * @param item The item that has just been removed.
         */
        virtual void itemRemovedEvent(ExtenderItem *item);

        /**
         * Get's called when an ExtenderItem that get's dragged enters this extender. Default
         * implementation does nothing.
         */
        virtual void itemHoverEnterEvent(ExtenderItem *item);

        /**
         * Gets called when an ExtenderItem is hovering over this extender. Implement this function
         * to give some visual feedback about what will happen when the mouse button is released at
         * that position. The default implementation shows a spacer at the appropriate location in
         * the layout.
         * @param item The item that's hovering over this extender. Most useful for obtaining the
         * size of the spacer.
         * @param pos The location the item is hovering.
         */
        virtual void itemHoverMoveEvent(ExtenderItem *item, const QPointF &pos);

        /**
         * Get's called when an ExtenderItem that was previously hovering over this extender moves
         * away from this extender. The default implementation removes any spacer from the layout.
         */
        virtual void itemHoverLeaveEvent(ExtenderItem *item);

        /**
         * This function get's called for every extender when plasma exits. Implement this function
         * to store the current state of this extender (position in a layout for example), so this
         * can be restored when applet starts again. The default implementation stores the y
         * coordinate of every extender item in the config field extenderItemPos.
         */
        virtual void saveState();

        /**
         * This function get's called on every item to determine which background border's to
         * render.
         * @param item the item for which its position or extender has changed.
         * @return the borders that have to be enabled on its background.
         */
        virtual FrameSvg::EnabledBorders enabledBordersForItem(ExtenderItem *item) const;

        /**
         * Reimplemented from QGraphicsWidget
         */
        QVariant itemChange(GraphicsItemChange change, const QVariant &value);

        /**
         * Reimplemented from QGraphicsWidget
         */
        void resizeEvent(QGraphicsSceneResizeEvent *event);

        /**
         * Reimplemented from QGraphicsWidget
         */
        void mousePressEvent(QGraphicsSceneMouseEvent *event);

        /**
         * Reimplemented from QGraphicsWidget
         */
        void dragEnterEvent(QGraphicsSceneDragDropEvent *event);

        /**
         * Reimplemented from QGraphicsWidget
         */
        void dragMoveEvent(QGraphicsSceneDragDropEvent *event);

        /**
         * Reimplemented from QGraphicsWidget
         */
        void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);

        /**
         * Reimplemented from QGraphicsWidget
         */
        void dropEvent(QGraphicsSceneDragDropEvent *event);

    Q_SIGNALS:
        /**
         * Fires when an extender item is added to this extender.
         */
        void itemAttached(Plasma::ExtenderItem *);

        /**
         * Fires when an extender item is removed from this extender.
         */
        void itemDetached(Plasma::ExtenderItem *);

        /**
         * Fires when an extender's preferred size changes.
         */
        void geometryChanged();

    private:
        ExtenderPrivate *const d;

        Q_PRIVATE_SLOT(d, void delayItemAddedEvent())
        Q_PRIVATE_SLOT(d, void extenderItemDestroyed(Plasma::ExtenderItem *item))
        Q_PRIVATE_SLOT(d, void viewportGeometryChanged(const QRectF &))

        friend class ExtenderPrivate;
        friend class ExtenderGroup;
        friend class ExtenderGroupPrivate;
        friend class ExtenderItem;
        friend class ExtenderItemPrivate;
        //dialog needs access to the extender's applet location.
        friend class DialogPrivate;
        //applet should be able to call saveState();
        friend class Applet;

    };
} // Plasma namespace

#endif //PLASMA_EXTENDER_H