Not crap after all...
[amarok.git] / src / filebrowser.h
blobc8d1001178e05ade1a193d80ccb58646fe2f9bac
1 /* This file is part of the KDE project
2 Copyright (C) 2004 Max Howell
3 Copyright (C) 2004 Mark Kretschmann <markey@web.de>
4 Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
5 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
6 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
7 Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk>
9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public
11 License version 2 as published by the Free Software Foundation.
13 This library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Library General Public License for more details.
18 You should have received a copy of the GNU Library General Public License
19 along with this library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
21 Boston, MA 02110-1301, USA.
24 #ifndef FILESELECTOR_WIDGET_H
25 #define FILESELECTOR_WIDGET_H
27 #include <kvbox.h> //baseclass
28 //Added by qt3to4:
29 #include <QDropEvent>
30 #include <kdiroperator.h> //some inline functions
31 #include <ktoolbar.h> //baseclass
32 #include <kurl.h> //stack allocated
34 class KLineEdit;
35 class QTimer;
36 class KActionCollection;
37 class KFileItem;
38 class KFileView;
39 class KUrlComboBox;
40 class Medium;
42 //Hi! I think we ripped this from Kate, since then it's been modified somewhat
45 The KDev file selector presents a directory view, in which the default action is
46 to open the activated file.
47 Additinally, a toolbar for managing the kdiroperator widget + sync that to
48 the directory of the current file is available, as well as a filter widget
49 allowing to filter the displayed files using a name filter.
53 class FileBrowser : public KVBox
55 Q_OBJECT
57 enum MenuId { MakePlaylist, SavePlaylist, MediaDevice, AppendToPlaylist, QueueTrack, QueueTracks, SelectAllFiles, BurnCd, MoveToCollection, CopyToCollection, OrganizeFiles, EditTags };
59 public:
60 explicit FileBrowser( const char *name = 0, Medium *medium = 0 );
61 ~FileBrowser();
63 KUrl url() const { return m_dir->url(); }
65 public slots:
66 void setUrl( const KUrl &url );
67 void setUrl( const QString &url );
68 void setFilter( const QString& );
69 void dropped( const KFileItem*, QDropEvent*, const KUrl::List& );
71 private slots:
72 void activate( const KFileItem* );
73 void contextMenuActivated( int );
74 void gotoCurrentFolder();
75 void prepareContextMenu();
76 void selectAll();
77 void slotViewChanged( KFileView* );
78 void urlChanged( const KUrl& );
80 private:
81 KUrl::List selectedItems();
82 void playlistFromURLs( const KUrl::List &urls );
84 KUrlComboBox *m_combo;
85 KDirOperator *m_dir;
86 KLineEdit *m_filter;
87 Medium *m_medium;
92 #include <kfileitem.h> //KFileItemList
93 #include <QRegExp>
95 class KDirLister;
96 class KURLView;
97 class QLineEdit;
98 class Q3ListViewItem;
100 ///@author Max Howell
101 ///@short Widget for recursive searching of current FileBrowser location
103 class SearchPane : public KVBox
105 Q_OBJECT
107 public:
108 SearchPane( FileBrowser *parent );
110 private slots:
111 void toggle( bool );
112 void urlChanged( const KUrl& );
113 void searchTextChanged( const QString &text );
114 void searchMatches( const KFileItemList& );
115 void searchComplete();
116 void _searchComplete();
117 void activate( Q3ListViewItem* );
119 private:
120 KUrl searchURL() const { return static_cast<FileBrowser*>(parentWidget())->url(); }
122 KLineEdit *m_lineEdit;
123 KURLView *m_listView;
124 KDirLister *m_lister;
125 QRegExp m_filter;
126 KUrl::List m_dirs;
129 #endif