fix tricky regression noticed by Vyacheslav Tokarev on Google Reader.
[kdelibs.git] / kfile / kfiletreeview.h
blob4bb16a28795a92152fea4bc8e0961118ff411482
1 /*
2 This file is part of the KDE project
4 Copyright (C) 2007 Tobias Koenig <tokoe@kde.org>
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Library General Public
8 License as published by the Free Software Foundation; either
9 version 2 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Library General Public License for more details.
16 You should have received a copy of the GNU Library General Public License
17 along with this library; see the file COPYING.LIB. If not, write to
18 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 Boston, MA 02110-1301, USA.
22 #ifndef KFILETREEVIEW_H
23 #define KFILETREEVIEW_H
25 #include <QtGui/QTreeView>
27 #include <kurl.h>
29 #include <kfile_export.h>
31 /**
32 * The file treeview offers a treeview on the filesystem.
34 class KFILE_EXPORT KFileTreeView : public QTreeView
36 Q_OBJECT
38 public:
39 /**
40 * Creates a new file tree view.
42 KFileTreeView(QWidget *parent = 0);
44 /**
45 * Destroys the file tree view.
47 ~KFileTreeView();
49 /**
50 * Returns the current url.
52 KUrl currentUrl() const;
54 /**
55 * Returns the selected url.
57 KUrl selectedUrl() const;
59 /**
60 * Returns all selected urls.
62 KUrl::List selectedUrls() const;
64 /**
65 * Returns the current root url of the view.
67 KUrl rootUrl() const;
69 public Q_SLOTS:
70 /**
71 * Sets whether the dir-only mode is @p enabled.
73 * In dir-only mode, only directories and subdirectories
74 * are listed in the view.
76 void setDirOnlyMode(bool enabled);
78 /**
79 * Sets whether hidden files shall be listed.
81 void setShowHiddenFiles(bool enabled);
83 /**
84 * Sets the current @p url of the view.
86 void setCurrentUrl(const KUrl &url);
88 /**
89 * Sets the root @p url of the view.
91 * The default is file:///.
93 void setRootUrl(const KUrl &url);
95 Q_SIGNALS:
96 /**
97 * This signal is emitted whenever an @p url has been activated.
99 void activated(const KUrl &url);
102 * This signal is emitted whenever the current @p url has been changed.
104 void currentChanged(const KUrl &url);
106 protected:
107 virtual void contextMenuEvent( QContextMenuEvent* );
109 private:
110 class Private;
111 Private* const d;
113 Q_PRIVATE_SLOT(d, void _k_activated(const QModelIndex&))
114 Q_PRIVATE_SLOT(d, void _k_currentChanged(const QModelIndex&, const QModelIndex&))
115 Q_PRIVATE_SLOT(d, void _k_expanded(const QModelIndex&))
118 #endif