1/* This file is part of the KDE project
2 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
3 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
4 Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk>
5 Copyright (C) 2007 Mirko Stocker <me@misto.ch>
6 Copyright (C) 2009 Dominik Haumann <dhaumann kde org>
7
8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public
10 License version 2 as published by the Free Software Foundation.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
16
17 You should have received a copy of the GNU Library General Public License
18 along with this library; see the file COPYING.LIB. If not, write to
19 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 Boston, MA 02110-1301, USA.
21*/
22
23#ifndef KATE_FILEBROWSER_H
24#define KATE_FILEBROWSER_H
25
26#include <kate/mainwindow.h>
27
28#include <KVBox>
29#include <KFile>
30#include <KUrl>
31
32class QAbstractItemView;
33class KateBookmarkHandler;
34class KAction;
35class KActionCollection;
36class KDirOperator;
37class KFileItem;
38class KHistoryComboBox;
39class KToolBar;
40
41class KUrlNavigator;
42/*
43 The kate file selector presents a directory view, in which the default action is
44 to open the activated file.
45 Additionally, a toolbar for managing the kdiroperator widget + sync that to
46 the directory of the current file is available, as well as a filter widget
47 allowing to filter the displayed files using a name filter.
48*/
49
50class KateFileBrowser : public KVBox
51{
52 Q_OBJECT
53
54 public:
55 explicit KateFileBrowser( Kate::MainWindow *mainWindow = 0,
56 QWidget * parent = 0, const char * name = 0 );
57 ~KateFileBrowser();
58
59 virtual void readSessionConfig( KConfigBase *, const QString & );
60 virtual void writeSessionConfig( KConfigBase *, const QString & );
61
62 void setupToolbar();
63 void setView( KFile::FileView );
64 KDirOperator *dirOperator() { return m_dirOperator; }
65
66 KActionCollection* actionCollection()
67 { return m_actionCollection; }
68
69 public Q_SLOTS:
70 void slotFilterChange(const QString&);
71 void setDir(KUrl);
72 void setDir( const QString& url ) { setDir( KUrl( url ) ); }
73 void selectorViewChanged( QAbstractItemView * );
74
75 private Q_SLOTS:
76 void fileSelected(const KFileItem & /*file*/);
77 void updateDirOperator( const KUrl& u );
78 void updateUrlNavigator( const KUrl& u );
79 void setActiveDocumentDir();
80 void autoSyncFolder();
81
82 protected:
83 KUrl activeDocumentUrl();
84 void openSelectedFiles();
85 void setupActions();
86
87 public:
88 Kate::MainWindow* mainWindow()
89 {
90 return m_mainWindow;
91 }
92 private:
93 KToolBar *m_toolbar;
94 KActionCollection *m_actionCollection;
95 KateBookmarkHandler *m_bookmarkHandler;
96 KUrlNavigator *m_urlNavigator;
97 KDirOperator * m_dirOperator;
98 KHistoryComboBox * m_filter;
99 KAction *m_autoSyncFolder;
100
101 Kate::MainWindow *m_mainWindow;
102};
103
104#endif //KATE_FILEBROWSER_H
105
106// kate: space-indent on; indent-width 2; replace-tabs on;
107