kate Library API Documentation

katefileselector.h

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