PCManFM-Qt
placesview.h
1 /*
2 
3  Copyright (C) 2012 Hong Jen Yee (PCMan) <pcman.tw@gmail.com>
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License along
16  with this program; if not, write to the Free Software Foundation, Inc.,
17  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19 
20 
21 #ifndef FM_PLACESVIEW_H
22 #define FM_PLACESVIEW_H
23 
24 #include "libfmqtglobals.h"
25 #include <QTreeView>
26 #include <libfm/fm.h>
27 
28 namespace Fm {
29 
30 class PlacesModel;
31 class PlacesModelItem;
32 
33 class LIBFM_QT_API PlacesView : public QTreeView {
34 Q_OBJECT
35 
36 public:
37  explicit PlacesView(QWidget* parent = 0);
38  virtual ~PlacesView();
39 
40  void setCurrentPath(FmPath* path);
41  FmPath* currentPath() {
42  return currentPath_;
43  }
44 
45  // libfm-gtk compatible alias
46  FmPath* getCwd() {
47  return currentPath();
48  }
49 
50  void chdir(FmPath* path) {
51  setCurrentPath(path);
52  }
53 
54 Q_SIGNALS:
55  void chdirRequested(int type, FmPath* path);
56 
57 protected Q_SLOTS:
58  void onClicked(const QModelIndex & index);
59  void onPressed(const QModelIndex & index);
60  // void onMountOperationFinished(GError* error);
61 
62  void onEmptyTrash();
63 
64  void onMountVolume();
65  void onUnmountVolume();
66  void onEjectVolume();
67  void onUnmountMount();
68 
69  void onDeleteBookmark();
70  void onRenameBookmark();
71 
72 protected:
73  void drawBranches ( QPainter * painter, const QRect & rect, const QModelIndex & index ) const {
74  // override this method to inhibit drawing of the branch grid lines by Qt.
75  }
76 
77  virtual void dragMoveEvent(QDragMoveEvent* event);
78  virtual void dropEvent(QDropEvent* event);
79  virtual void contextMenuEvent(QContextMenuEvent* event);
80 
81  virtual void commitData(QWidget * editor);
82 
83 private:
84  void onEjectButtonClicked(PlacesModelItem* item);
85  void activateRow(int type, const QModelIndex& index);
86 
87 private:
88  PlacesModel* model_;
89  FmPath* currentPath_;
90 };
91 
92 }
93 
94 #endif // FM_PLACESVIEW_H
Definition: placesmodel.h:38
Definition: appchoosercombobox.cpp:26
Definition: placesmodelitem.h:34
Definition: placesview.h:33