1
/* This file is part of the KDE project
2
Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org>
3
Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org>
4
Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org>
5
Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk>
7
This library is free software; you can redistribute it and/or
8
modify it under the terms of the GNU Library General Public
9
License version 2 as published by the Free Software Foundation.
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., 59 Temple Place - Suite 330,
19
Boston, MA 02111-1307, USA.
22
#ifndef FILESELECTOR_WIDGET_H
23
#define FILESELECTOR_WIDGET_H
30
#include <kdiroperator.h>
33
class KDevPartController;
34
class FileSelectorPart;
35
class KActionCollection;
36
class KActionSelector;
52
The KDev file selector presents a directory view, in which the default action is
53
to open the activated file.
54
Additinally, a toolbar for managing the kdiroperator widget + sync that to
55
the directory of the current file is available, as well as a filter widget
56
allowing to filter the displayed files using a name filter.
59
/* I think this fix for not moving toolbars is better */
60
class KDevFileSelectorToolBar: public KToolBar
64
KDevFileSelectorToolBar(QWidget *parent);
65
virtual ~KDevFileSelectorToolBar();
67
virtual void setMovingEnabled( bool b );
70
class KDevFileSelectorToolBarParent: public QFrame
74
KDevFileSelectorToolBarParent(QWidget *parent);
75
~KDevFileSelectorToolBarParent();
76
void setToolBar(KDevFileSelectorToolBar *tb);
79
KDevFileSelectorToolBar *m_tb;
82
virtual void resizeEvent ( QResizeEvent * );
85
class KDevDirOperator: public KDirOperator
89
KDevDirOperator(FileSelectorPart *part, const KURL &urlName=KURL(), QWidget *parent=0, const char *name=0)
90
:KDirOperator(urlName, parent, name), m_part(part)
95
virtual void activatedMenu (const KFileItem *fi, const QPoint &pos);
98
FileSelectorPart *m_part;
101
class KDevFileSelector : public QWidget
105
friend class KFSConfigPage;
108
/* When to sync to current document directory */
109
enum AutoSyncEvent { DocumentChanged=1, DocumentOpened=2, GotVisible=4 };
111
KDevFileSelector( FileSelectorPart *part, KDevMainWindow *mainWindow=0, KDevPartController *partController=0,
112
QWidget * parent = 0, const char * name = 0 );
115
void readConfig( KConfig *, const QString & );
116
void writeConfig( KConfig *, const QString & );
117
void setupToolbar( KConfig * );
118
void setView( KFile::FileView );
119
KDevDirOperator *dirOperator(){ return dir; }
120
KActionCollection *actionCollection() { return mActionCollection; };
123
void slotFilterChange(const QString&);
125
void setDir( const QString& url ) { setDir( KURL( url ) ); };
128
void cmbPathActivated( const KURL& u );
129
void cmbPathReturnPressed( const QString& u );
130
void dirUrlEntered( const KURL& u );
131
void dirFinishedLoading();
132
void setActiveDocumentDir();
134
void btnFilterClick();
136
void autoSync( KParts::Part * );
137
void initialDirChangeHack();
139
void focusInEvent( QFocusEvent * );
140
void showEvent( QShowEvent * );
141
bool eventFilter( QObject *, QEvent * );
142
KURL activeDocumentUrl();
145
class KDevFileSelectorToolBar *toolbar;
146
KActionCollection *mActionCollection;
147
class KBookmarkHandler *bookmarkHandler;
148
KURLComboBox *cmbPath;
149
KDevDirOperator * dir;
150
class KAction *acSyncDir;
151
KHistoryCombo * filter;
152
class QToolButton *btnFilter;
154
FileSelectorPart *m_part;
155
KDevMainWindow *mainwin;
156
KDevPartController *partController;
159
int autoSyncEvents; // enabled autosync events
160
QString waitingUrl; // maybe display when we gets visible
166
A popup widget presenting a listbox with checkable items
167
representing the mime types available in the current directory, and
168
providing a name filter based on those.
172
Config page for file selector.
173
Allows for configuring the toolbar, the history length
174
of the path and file filter combos, and how to handle
177
class KFSConfigPage : public QWidget
181
KFSConfigPage( QWidget* parent=0, const char *name=0, KDevFileSelector *kfs=0);
182
virtual ~KFSConfigPage() {};
185
virtual void apply();
186
virtual void reload();
187
virtual void slotChanged();
192
KDevFileSelector *fileSelector;
194
//class QListBox *lbAvailableActions, *lbUsedActions;
195
KActionSelector *acSel;
196
class QSpinBox *sbPathHistLength, *sbFilterHistLength;
197
class QCheckBox *cbSyncOpen, *cbSyncActive, *cbSyncShow;
198
class QCheckBox *cbSesLocation, *cbSesFilter;