kate
katefileselector.h
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
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 <qvbox.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 class KFileView;
00039 
00040 
00041 
00042 
00043 
00044 
00045 
00046 
00047 
00048 
00049 class KateFileSelectorToolBar: public KToolBar
00050 {
00051     Q_OBJECT
00052 public:
00053     KateFileSelectorToolBar(QWidget *parent);
00054     virtual ~KateFileSelectorToolBar();
00055 
00056      virtual void setMovingEnabled( bool b );
00057 };
00058 
00059 class KateFileSelectorToolBarParent: public QFrame
00060 {
00061     Q_OBJECT
00062 public:
00063     KateFileSelectorToolBarParent(QWidget *parent);
00064     ~KateFileSelectorToolBarParent();
00065     void setToolBar(KateFileSelectorToolBar *tb);
00066 private:
00067     KateFileSelectorToolBar *m_tb;
00068 protected:
00069     virtual void resizeEvent ( QResizeEvent * );
00070 };
00071 
00072 class KateFileSelector : public QVBox
00073 {
00074   Q_OBJECT
00075 
00076   friend class KFSConfigPage;
00077 
00078   public:
00079     
00080     enum AutoSyncEvent { DocumentChanged=1, GotVisible=2 };
00081 
00082     KateFileSelector( KateMainWindow *mainWindow=0, KateViewManager *viewManager=0,
00083                       QWidget * parent = 0, const char * name = 0 );
00084     ~KateFileSelector();
00085 
00086     void readConfig( KConfig *, const QString & );
00087     void writeConfig( KConfig *, const QString & );
00088     void setupToolbar( KConfig * );
00089     void setView( KFile::FileView );
00090     KDirOperator *dirOperator(){ return dir; }
00091     KActionCollection *actionCollection() { return mActionCollection; };
00092 
00093   public slots:
00094     void slotFilterChange(const QString&);
00095     void setDir(KURL);
00096     void setDir( const QString& url ) { setDir( KURL( url ) ); };
00097     void kateViewChanged();
00098     void selectorViewChanged( KFileView * );
00099 
00100   private slots:
00101     void cmbPathActivated( const KURL& u );
00102     void cmbPathReturnPressed( const QString& u );
00103     void dirUrlEntered( const KURL& u );
00104     void dirFinishedLoading();
00105     void setActiveDocumentDir();
00106     void btnFilterClick();
00107 
00108   protected:
00109     void focusInEvent( QFocusEvent * );
00110     void showEvent( QShowEvent * );
00111     bool eventFilter( QObject *, QEvent * );
00112     void initialDirChangeHack();
00113 
00114   private:
00115     class KateFileSelectorToolBar *toolbar;
00116     KActionCollection *mActionCollection;
00117     class KBookmarkHandler *bookmarkHandler;
00118     KURLComboBox *cmbPath;
00119     KDirOperator * dir;
00120     class KAction *acSyncDir;
00121     KHistoryCombo * filter;
00122     class QToolButton *btnFilter;
00123 
00124     KateMainWindow *mainwin;
00125     KateViewManager *viewmanager;
00126 
00127     QString lastFilter;
00128     int autoSyncEvents; 
00129     QString waitingUrl; 
00130     QString waitingDir;
00131 };
00132 
00133 
00134 
00135 
00136 
00137 
00138 
00139 
00140 
00141 
00142 
00143 
00144 
00145 
00146 class KFSConfigPage : public Kate::ConfigPage {
00147   Q_OBJECT
00148   public:
00149     KFSConfigPage( QWidget* parent=0, const char *name=0, KateFileSelector *kfs=0);
00150     virtual ~KFSConfigPage() {};
00151 
00152     virtual void apply();
00153     virtual void reload();
00154 
00155   private slots:
00156     void slotMyChanged();
00157 
00158   private:
00159     void init();
00160 
00161     KateFileSelector *fileSelector;
00162     KActionSelector *acSel;
00163     class QSpinBox *sbPathHistLength, *sbFilterHistLength;
00164     class QCheckBox *cbSyncActive, *cbSyncShow;
00165     class QCheckBox *cbSesLocation, *cbSesFilter;
00166 
00167     bool m_changed;
00168 };
00169 
00170 
00171 #endif //__KATE_FILESELECTOR_H__
00172