/usr/include/KF5/KIOFileWidgets/kabstractviewadapter.h is in libkf5kio-dev 5.44.0-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 | /*******************************************************************************
* Copyright (C) 2008 by Fredrik Höglund <fredrik@kde.org> *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 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 *
* Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public License *
* along with this library; see the file COPYING.LIB. If not, write to *
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
* Boston, MA 02110-1301, USA. *
*******************************************************************************/
#ifndef KABSTRACTVIEWADAPTER_H
#define KABSTRACTVIEWADAPTER_H
#include <QObject>
#include "kiofilewidgets_export.h"
class QAbstractItemModel;
class QModelIndex;
class QPalette;
class QRect;
class QSize;
/*
* TODO KF6 Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize NOTIFY iconSizeChanged)
* TODO KF6 virtual void setIconSize(const QSize &size);
* TODO KF6 iconSizeChanged();
*
* TODO KF6:
* KAbstractViewAdapter exists to allow KFilePreviewGenerator to be
* reused with new kinds of views. Unfortunately it doesn't cover
* all use cases that would be useful right now, in particular there
* are no change notifications for the properties it has getters for.
* This requires view implementations to e.g. call updateIcons() on
* the generator when the icon size changes, which means updating two
* entities (the generator and the adapter) instead of only one.
* In KF6 we should make iconSize a Q_PROPERTY with a virtual setter
* and a change notification signal, and make KFilePreviewGenerator
* listen to that signal.
* A related problem is that while the adapter is supposed to inter-
* face a view to the generator, it is sometimes the generator that
* is responsible for instanciating the adapter: KDirOperator in this
* framework uses the KFilePreviewGenerator constructor that doesn't
* take an adapter instance, which makes the generator instanciate a
* KIO::DefaultViewAdapter internally, which it doesn't expose to the
* outside. That means even when a setIconSize() is added,
* KDirOperator won't be able to call it on the adapter. This mis-
* design needs to be addressed as well so all change notifications
* can run through the adapter, also for the DefaultViewAdapter
* implementation (though for this specific example, perhaps Qt will
* one day give us a NOTIFY for QAbstractItemView::iconSize that the
* DefaultViewAdapter can use, obviating the need for KDirOperator
* to do anything except call setIconSize on its QAbstractItemView).
*/
/**
* @class KAbstractViewAdapter kabstractviewadapter.h <KAbstractViewAdapter>
*
* Interface used by KFilePreviewGenerator to generate previews
* for files. The interface allows KFilePreviewGenerator to be
* independent from the view implementation.
*/
class KIOFILEWIDGETS_EXPORT KAbstractViewAdapter : public QObject
{
public:
enum Signal { ScrollBarValueChanged, IconSizeChanged };
KAbstractViewAdapter(QObject *parent) : QObject(parent) {}
virtual ~KAbstractViewAdapter() {}
virtual QAbstractItemModel *model() const = 0;
virtual QSize iconSize() const = 0;
virtual QPalette palette() const = 0;
virtual QRect visibleArea() const = 0;
virtual QRect visualRect(const QModelIndex &index) const = 0;
virtual void connect(Signal signal, QObject *receiver, const char *slot) = 0;
};
#endif
|