blob: eff1e585ff51d70044feb20bd2f40978dd8b418c (
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
|
/***************************************************************************
krecursivelister.h - description
-------------------
begin : Fri Aug 31 2001
copyright : (C) 2001 by Jonathon Sim
email : jonathonsim@iname.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef KRECURSIVELISTER_H
#define KRECURSIVELISTER_H
#include <tqwidget.h>
#include <tqobject.h>
#include <kdirlister.h>
#include <tdefileitem.h>
#include <tqguardedptr.h>
/**A convienience class that recursively lists a directory
*@author Jonathon Sim
*
* Modified by Dominik Seichter to support a name filter,
* dir only mode, support for showing hidden files on demand
* and support for listing directories along with files.
*/
class KRecursiveLister : public TQObject {
Q_OBJECT
public:
KRecursiveLister(TQObject *parent=0, const char *name=0);
~KRecursiveLister();
/** Returns the list of fileitems found. */
const KFileItemList & items();
/** sets wether hidden files shall be listed */
inline void setShowingDotFiles( bool dotfiles );
/** filter to be used */
inline void setNameFilter( const TQString & filter );
/** list only directories */
inline void setDirOnlyMode( bool dirsOnly );
/** Starts listing the specified url */
void openURL(const KURL& url);
/** Stops the listing */
void stop();
/** Returns the subdirectories found by the listing */
const KFileItemList& dirs();
void cleanUp();
signals: // Signals
/** Listing is complete */
void completed();
protected slots: // Protected slots
/** handles completion of a listing. */
void slotListingComplete();
void listNextDirectory();
protected: // Protected methods
/** Starts listing the specified url */
void startListing(const KURL& url);
//Protected variables
KFileItemList filelist; //Files found at url
KFileItemList dirlist; //Dirs remaining to list
KFileItemList dirtree;
KFileItemList allItems;
TQGuardedPtr<KDirLister> lister; //The current KDirLister
bool m_hidden;
bool m_dirs;
TQString m_filter;
};
void KRecursiveLister::setShowingDotFiles( bool dotfiles )
{
m_hidden = dotfiles;
}
void KRecursiveLister::setNameFilter( const TQString & filter )
{
m_filter = filter;
}
void KRecursiveLister::setDirOnlyMode( bool dirsOnly )
{
m_dirs = dirsOnly;
}
#endif
|