00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SCQTFILEEDIT_H
00021 #define SCQTFILEEDIT_H
00022
00023 #include <qdir.h>
00024 #include <qobject.h>
00025 #include <qpixmap.h>
00026 #include <qstring.h>
00027 #include <qlistview.h>
00028 #include <qcombobox.h>
00029 #include <qtimer.h>
00030
00031 #include "scqtfiledlg.h"
00032
00033 #define MAXDIRCOMBOCOUNT 8
00034 #define MAXTYPECOMBOCOUNT 8
00035
00040 class ScQtFileEditDlg : public ScQtFileDlg, QDir
00041 {
00042 Q_OBJECT
00043 public:
00044 ScQtFileEditDlg( QWidget *parent=0, const char *name=0,
00045 const QString &path="/", const QString &filter="*" );
00046 ~ScQtFileEditDlg();
00047 QString getResult( );
00048 QString getFileName( );
00049 void readIt( );
00050 void setAutoExtension( bool ex=false );
00051 void allowMkDir( bool mkdir=false );
00052 void setNFilter( bool ff=false );
00053 void setFSorting( bool ff=false );
00054 void setMode( int mode=QDir::All );
00055
00056 private slots:
00057 void slotOK( );
00058 void slotCancel( );
00059 void slotDoubleClicked( QListViewItem *item=0 );
00060 void slotSelectionChanged( QListViewItem *item=0 );
00061 void slotDirComboBoxChanged( int item );
00062 void slotTypeComboBoxChanged( int item );
00063 void slotFileTextChanged( const QString &txt="" );
00064 void slotShowDir();
00065 void slotMkDir();
00066
00067 protected:
00068 QTimer showTimer;
00069 bool mkdirflag, fsorting, fnfilter;
00070 int fmode;
00071 const QFileInfoList *qfil;
00072 bool rFlag, exflag;
00073 QString bpath, bfilter, filename;
00074 QString dirstr,linkstr, filestr;
00075 QPixmap *fileIcon, *dirIcon, *linkIcon, *cdToParentIcon;
00076 const QFileInfoList *readDir( const QString &path="/", const QString &filter="*" );
00077 int checkComboEntryExists( QComboBox *com=0, const QString &str="" );
00078 void insDirCombo( const QString &str="" );
00079 void insTypeCombo( const QString &str="" );
00080 void initDirCombo( const QString &str="" );
00081 void initTypeCombo( const QString &str="" );
00082 void autoExtension( );
00083
00084 };
00085
00086 class ScQtFileEdit : public QObject
00087 {
00088 Q_OBJECT
00089 public:
00090 ScQtFileEdit( QWidget *parent=0, const char *name=0 );
00091 ~ScQtFileEdit();
00092 static void resize( int width, int height );
00093 static QString getOpenFileName( QWidget *parent=0, const char *name=0,
00094 const QString &path="/", const QString &filter="*" );
00095 static QString getSaveAsFileName( QWidget *parent=0, const char *name=0,
00096 const QString &path="/", const QString &filter="*" );
00097 static QString getDirName( QWidget *parent=0, const char *name=0,
00098 const QString &path="/" );
00099 static QString mkDir( QWidget *parent=0, const char *name=0,
00100 const QString &path="/", const QString &filter="*" );
00101
00102 protected:
00103
00104 };
00105
00106 #endif