summaryrefslogtreecommitdiffstats
path: root/amarok/src/filebrowser.h
blob: fb3eea0bb155adb069c0eb7a00677dfd3a8219b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/* This file is part of the KDE project
   Copyright (C) 2004 Max Howell
   Copyright (C) 2004 Mark Kretschmann <markey@web.de>
   Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
   Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
   Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
   Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

   This library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef FILESELECTOR_WIDGET_H
#define FILESELECTOR_WIDGET_H

#include <tqvbox.h>        //baseclass
#include <tdediroperator.h> //some inline functions
#include <tdetoolbar.h>     //baseclass
#include <kurl.h>         //stack allocated

class ClickLineEdit;
class TQTimer;
class TDEActionCollection;
class KFileItem;
class KFileView;
class KURLComboBox;
class Medium;

//Hi! I think we ripped this from Kate, since then it's been modified somewhat

/*
    The KDev file selector presents a directory view, in which the default action is
    to open the activated file.
    Additinally, a toolbar for managing the kdiroperator widget + sync that to
    the directory of the current file is available, as well as a filter widget
    allowing to filter the displayed files using a name filter.
*/


class FileBrowser : public TQVBox
{
    Q_OBJECT
  

    enum MenuId { MakePlaylist, SavePlaylist, MediaDevice, AppendToPlaylist, QueueTrack, QueueTracks, SelectAllFiles, BurnCd, MoveToCollection, CopyToCollection, OrganizeFiles, EditTags };

public:
    FileBrowser( const char *name = 0, Medium *medium = 0 );
   ~FileBrowser();

    KURL url() const { return m_dir->url(); }

public slots:
    void setUrl( const KURL &url );
    void setUrl( const TQString &url );
    void setFilter( const TQString& );
    void dropped( const KFileItem*, TQDropEvent*, const KURL::List& );

private slots:
    void activate( const KFileItem* );
    void contextMenuActivated( int );
    void gotoCurrentFolder();
    void prepareContextMenu();
    void selectAll();
    void slotViewChanged( KFileView* );
    void urlChanged( const KURL& );

private:
    KURL::List selectedItems();
    void playlistFromURLs( const KURL::List &urls );

    KURLComboBox  *m_combo;
    KDirOperator  *m_dir;
    ClickLineEdit *m_filter;
    Medium        *m_medium;
};



#include <tdefileitem.h> //KFileItemList
#include <tqregexp.h>

class KDirLister;
class KURLView;
class TQLineEdit;
class TQListViewItem;

///@author Max Howell
///@short Widget for recursive searching of current FileBrowser location

class SearchPane : public TQVBox
{
    Q_OBJECT
  

public:
    SearchPane( FileBrowser *parent );

private slots:
    void toggle( bool );
    void urlChanged( const KURL& );
    void searchTextChanged( const TQString &text );
    void searchMatches( const KFileItemList& );
    void searchComplete();
    void _searchComplete();
    void activate( TQListViewItem* );

private:
    KURL searchURL() const { return static_cast<FileBrowser*>(parentWidget())->url(); }

    TQLineEdit  *m_lineEdit;
    KURLView   *m_listView;
    KDirLister *m_lister;
    TQRegExp     m_filter;
    KURL::List  m_dirs;
};

#endif