fix tricky regression noticed by Vyacheslav Tokarev on Google Reader.
[kdelibs.git] / kfile / kfileplacesview.h
blob3f685c4908807c2f11171070a85cccc18c9d8d0a
1 /* This file is part of the KDE project
2 Copyright (C) 2007 Kevin Ottens <ervin@kde.org>
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License version 2 as published by the Free Software Foundation.
8 This library is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 Library General Public License for more details.
13 You should have received a copy of the GNU Library General Public License
14 along with this library; see the file COPYING.LIB. If not, write to
15 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 Boston, MA 02110-1301, USA.
19 #ifndef KFILEPLACESVIEW_H
20 #define KFILEPLACESVIEW_H
22 #include <kfile_export.h>
24 #include <QtGui/QListView>
26 #include <kurl.h>
28 class QResizeEvent;
29 class QContextMenuEvent;
31 /**
32 * This class allows to display a KFilePlacesModel.
34 class KFILE_EXPORT KFilePlacesView : public QListView
36 Q_OBJECT
37 public:
38 KFilePlacesView(QWidget *parent = 0);
39 ~KFilePlacesView();
41 /**
42 * If \a enabled is true, it is allowed dropping items
43 * above a place for e. g. copy or move operations. The application
44 * has to take care itself to perform the operation
45 * (see KFilePlacesView::urlsDropped()). If
46 * \a enabled is false, it is only possible adding items
47 * as additional place. Per default dropping on a place is
48 * disabled.
50 void setDropOnPlaceEnabled(bool enabled);
51 bool isDropOnPlaceEnabled() const;
53 /**
54 * If \a enabled is true (the default), items will automatically resize
55 * themselves to fill the view.
57 * @since 4.1
59 void setAutoResizeItemsEnabled(bool enabled);
60 bool isAutoResizeItemsEnabled() const;
62 public Q_SLOTS:
63 void setUrl(const KUrl &url);
64 void setShowAll(bool showAll);
65 virtual QSize sizeHint() const;
66 virtual void setModel(QAbstractItemModel *model);
68 protected:
69 virtual void contextMenuEvent(QContextMenuEvent *event);
70 virtual void resizeEvent(QResizeEvent *event);
71 virtual void showEvent(QShowEvent *event);
72 virtual void hideEvent(QHideEvent *event);
73 virtual void dragEnterEvent(QDragEnterEvent *event);
74 virtual void dragLeaveEvent(QDragLeaveEvent *event);
75 virtual void dragMoveEvent(QDragMoveEvent *event);
76 virtual void dropEvent(QDropEvent *event);
77 virtual void paintEvent(QPaintEvent *event);
79 protected Q_SLOTS:
80 void rowsInserted(const QModelIndex &parent, int start, int end);
81 void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
83 Q_SIGNALS:
84 void urlChanged(const KUrl &url);
86 /**
87 * Is emitted if items are dropped on the place \a dest.
88 * The application has to take care itself about performing the
89 * corresponding action like copying or moving.
91 void urlsDropped(const KUrl &dest, QDropEvent *event, QWidget *parent);
93 private:
94 Q_PRIVATE_SLOT(d, void adaptItemSize())
95 Q_PRIVATE_SLOT(d, void _k_placeClicked(const QModelIndex &))
96 Q_PRIVATE_SLOT(d, void _k_placeEntered(const QModelIndex &))
97 Q_PRIVATE_SLOT(d, void _k_placeLeft(const QModelIndex &))
98 Q_PRIVATE_SLOT(d, void _k_storageSetupDone(const QModelIndex &, bool))
99 Q_PRIVATE_SLOT(d, void _k_adaptItemsUpdate(qreal))
100 Q_PRIVATE_SLOT(d, void _k_itemAppearUpdate(qreal))
101 Q_PRIVATE_SLOT(d, void _k_itemDisappearUpdate(qreal))
102 Q_PRIVATE_SLOT(d, void _k_enableSmoothItemResizing())
103 Q_PRIVATE_SLOT(d, void _k_trashUpdated(KJob *))
104 Q_PRIVATE_SLOT(d, void _k_capacityBarFadeValueChanged())
105 Q_PRIVATE_SLOT(d, void _k_triggerDevicePolling())
107 class Private;
108 Private * const d;
109 friend class Private;
112 #endif