KDevelop API Documentation

parts/fileselector/fileselector_widget.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project 00002 Copyright (C) 2003 Roberto Raggi <roberto@kdevelop.org> 00003 Copyright (C) 2001 Christoph Cullmann <cullmann@kde.org> 00004 Copyright (C) 2001 Joseph Wenninger <jowenn@kde.org> 00005 Copyright (C) 2001 Anders Lund <anders.lund@lund.tdcadsl.dk> 00006 00007 This library is free software; you can redistribute it and/or 00008 modify it under the terms of the GNU Library General Public 00009 License version 2 as published by the Free Software Foundation. 00010 00011 This library is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 Library General Public License for more details. 00015 00016 You should have received a copy of the GNU Library General Public License 00017 along with this library; see the file COPYING.LIB. If not, write to 00018 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00019 Boston, MA 02111-1307, USA. 00020 */ 00021 00022 #ifndef FILESELECTOR_WIDGET_H 00023 #define FILESELECTOR_WIDGET_H 00024 00025 #include <qwidget.h> 00026 #include <kfile.h> 00027 #include <kurl.h> 00028 #include <ktoolbar.h> 00029 #include <qframe.h> 00030 #include <kdiroperator.h> 00031 00032 class KDevMainWindow; 00033 class KDevPartController; 00034 class FileSelectorPart; 00035 class KActionCollection; 00036 class KActionSelector; 00037 class KDirOperator; 00038 class KURLComboBox; 00039 class KHistoryCombo; 00040 00041 namespace KParts 00042 { 00043 class Part; 00044 } 00045 00046 namespace KTextEditor 00047 { 00048 class Document; 00049 } 00050 00051 /* 00052 The KDev file selector presents a directory view, in which the default action is 00053 to open the activated file. 00054 Additinally, a toolbar for managing the kdiroperator widget + sync that to 00055 the directory of the current file is available, as well as a filter widget 00056 allowing to filter the displayed files using a name filter. 00057 */ 00058 00059 /* I think this fix for not moving toolbars is better */ 00060 class KDevFileSelectorToolBar: public KToolBar 00061 { 00062 Q_OBJECT 00063 public: 00064 KDevFileSelectorToolBar(QWidget *parent); 00065 virtual ~KDevFileSelectorToolBar(); 00066 00067 virtual void setMovingEnabled( bool b ); 00068 }; 00069 00070 class KDevFileSelectorToolBarParent: public QFrame 00071 { 00072 Q_OBJECT 00073 public: 00074 KDevFileSelectorToolBarParent(QWidget *parent); 00075 ~KDevFileSelectorToolBarParent(); 00076 void setToolBar(KDevFileSelectorToolBar *tb); 00077 00078 private: 00079 KDevFileSelectorToolBar *m_tb; 00080 00081 protected: 00082 virtual void resizeEvent ( QResizeEvent * ); 00083 }; 00084 00085 class KDevDirOperator: public KDirOperator 00086 { 00087 Q_OBJECT 00088 public: 00089 KDevDirOperator(FileSelectorPart *part, const KURL &urlName=KURL(), QWidget *parent=0, const char *name=0) 00090 :KDirOperator(urlName, parent, name), m_part(part) 00091 { 00092 } 00093 00094 protected slots: 00095 virtual void activatedMenu (const KFileItem *fi, const QPoint &pos); 00096 00097 private: 00098 FileSelectorPart *m_part; 00099 }; 00100 00101 class KDevFileSelector : public QWidget 00102 { 00103 Q_OBJECT 00104 00105 friend class KFSConfigPage; 00106 00107 public: 00108 /* When to sync to current document directory */ 00109 enum AutoSyncEvent { DocumentChanged=1, DocumentOpened=2, GotVisible=4 }; 00110 00111 KDevFileSelector( FileSelectorPart *part, KDevMainWindow *mainWindow=0, KDevPartController *partController=0, 00112 QWidget * parent = 0, const char * name = 0 ); 00113 ~KDevFileSelector(); 00114 00115 void readConfig( KConfig *, const QString & ); 00116 void writeConfig( KConfig *, const QString & ); 00117 void setupToolbar( KConfig * ); 00118 void setView( KFile::FileView ); 00119 KDevDirOperator *dirOperator(){ return dir; } 00120 KActionCollection *actionCollection() { return mActionCollection; }; 00121 00122 public slots: 00123 void slotFilterChange(const QString&); 00124 void setDir(KURL); 00125 void setDir( const QString& url ) { setDir( KURL( url ) ); }; 00126 00127 private slots: 00128 void cmbPathActivated( const KURL& u ); 00129 void cmbPathReturnPressed( const QString& u ); 00130 void dirUrlEntered( const KURL& u ); 00131 void dirFinishedLoading(); 00132 void setActiveDocumentDir(); 00133 void viewChanged(); 00134 void btnFilterClick(); 00135 void autoSync(); 00136 void autoSync( KParts::Part * ); 00137 void initialDirChangeHack(); 00138 00139 protected: 00140 void focusInEvent( QFocusEvent * ); 00141 void showEvent( QShowEvent * ); 00142 bool eventFilter( QObject *, QEvent * ); 00143 KURL activeDocumentUrl(); 00144 00145 private: 00146 class KDevFileSelectorToolBar *toolbar; 00147 KActionCollection *mActionCollection; 00148 class KBookmarkHandler *bookmarkHandler; 00149 KURLComboBox *cmbPath; 00150 KDevDirOperator * dir; 00151 class KAction *acSyncDir; 00152 KHistoryCombo * filter; 00153 class QToolButton *btnFilter; 00154 00155 FileSelectorPart *m_part; 00156 KDevMainWindow *mainwin; 00157 KDevPartController *partController; 00158 00159 QString lastFilter; 00160 int autoSyncEvents; // enabled autosync events 00161 QString waitingUrl; // maybe display when we gets visible 00162 QString waitingDir; 00163 }; 00164 00165 /* @todo anders 00166 KFSFilterHelper 00167 A popup widget presenting a listbox with checkable items 00168 representing the mime types available in the current directory, and 00169 providing a name filter based on those. 00170 */ 00171 00172 /* 00173 Config page for file selector. 00174 Allows for configuring the toolbar, the history length 00175 of the path and file filter combos, and how to handle 00176 user closed session. 00177 */ 00178 class KFSConfigPage : public QWidget 00179 { 00180 Q_OBJECT 00181 public: 00182 KFSConfigPage( QWidget* parent=0, const char *name=0, KDevFileSelector *kfs=0); 00183 virtual ~KFSConfigPage() {}; 00184 00185 public slots: 00186 virtual void apply(); 00187 virtual void reload(); 00188 virtual void slotChanged(); 00189 00190 private: 00191 void init(); 00192 00193 KDevFileSelector *fileSelector; 00194 bool bDirty; 00195 //class QListBox *lbAvailableActions, *lbUsedActions; 00196 KActionSelector *acSel; 00197 class QSpinBox *sbPathHistLength, *sbFilterHistLength; 00198 class QCheckBox *cbSyncOpen, *cbSyncActive, *cbSyncShow; 00199 class QCheckBox *cbSesLocation, *cbSesFilter; 00200 }; 00201 00202 00203 #endif 00204
KDE Logo
This file is part of the documentation for KDevelop Version 3.0.4.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Oct 19 08:01:51 2004 by doxygen 1.3.7 written by Dimitri van Heesch, © 1997-2003