2
* Copyright (C) 2012 - 2015 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
4
* This library is free software; you can redistribute it and/or
5
* modify it under the terms of the GNU Lesser General Public
6
* License as published by the Free Software Foundation; either
7
* version 2.1 of the License, or (at your option) any later version.
9
* This library is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
* Lesser General Public License for more details.
14
* You should have received a copy of the GNU Lesser General Public
15
* License along with this library; if not, write to the Free Software
16
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21
#ifndef FM_PLACESVIEW_H
22
#define FM_PLACESVIEW_H
24
#include "libfmqtglobals.h"
31
class PlacesModelItem;
33
class LIBFM_QT_API PlacesView : public QTreeView {
37
explicit PlacesView(QWidget* parent = 0);
38
virtual ~PlacesView();
40
void setCurrentPath(FmPath* path);
41
FmPath* currentPath() {
45
// libfm-gtk compatible alias
50
void chdir(FmPath* path) {
54
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
55
void setIconSize(const QSize &size) {
56
// The signal QAbstractItemView::iconSizeChanged is only available after Qt 5.5.
57
// To simulate the effect for older Qt versions, we override setIconSize().
58
QAbstractItemView::setIconSize(size);
59
onIconSizeChanged(size);
64
void chdirRequested(int type, FmPath* path);
67
void onClicked(const QModelIndex & index);
68
void onPressed(const QModelIndex & index);
69
void onIconSizeChanged(const QSize & size);
70
// void onMountOperationFinished(GError* error);
73
void onOpenNewWindow();
78
void onUnmountVolume();
80
void onUnmountMount();
82
void onMoveBookmarkUp();
83
void onMoveBookmarkDown();
84
void onDeleteBookmark();
85
void onRenameBookmark();
88
void drawBranches ( QPainter * painter, const QRect & rect, const QModelIndex & index ) const {
89
// override this method to inhibit drawing of the branch grid lines by Qt.
92
virtual void dragMoveEvent(QDragMoveEvent* event);
93
virtual void dropEvent(QDropEvent* event);
94
virtual void contextMenuEvent(QContextMenuEvent* event);
96
virtual void commitData(QWidget * editor);
99
void onEjectButtonClicked(PlacesModelItem* item);
100
void activateRow(int type, const QModelIndex& index);
104
FmPath* currentPath_;
109
#endif // FM_PLACESVIEW_H