Salome HOME
NRI : Merge from V1_2.
[modules/kernel.git] / src / SALOMEGUI / QAD_FileDlg.h
1 //  SALOME SALOMEGUI : implementation of desktop and GUI kernel
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : QAD_FileDlg.h
8 //  Author : 
9 //  Module : SALOME
10 //  $Header$
11
12 #ifndef QAD_FILEDIALOG_H
13 #define QAD_FILEDIALOG_H
14
15 #include <qfiledialog.h>
16 #include <qcombobox.h>
17 #include "QAD.h"
18 #include "QAD_FileValidator.h"
19
20 class QAD_EXPORT QAD_FileDlg : public QFileDialog
21 {
22     Q_OBJECT
23
24 public:
25     QAD_FileDlg( QWidget* parent, bool open, bool showQuickDir = true, bool modal = true );
26     ~QAD_FileDlg();
27
28 public:    
29     bool               isOpenDlg()    const;    
30     QString            selectedFile() const;
31
32     void               setValidator( QAD_FileValidator* );
33
34     static QString     getFileName( QWidget*           parent, 
35                                     const QString&     initial, 
36                                     const QStringList& filters, 
37                                     const QString&     caption,
38                                     bool               open,
39                                     bool               showQuickDir = true,
40                                     QAD_FileValidator* validator = 0);
41     static QString     getExistingDirectory ( QWidget*       parent,
42                                               const QString& initial,
43                                               const QString& caption, 
44                                               bool           showQuickDir = true);
45 private:
46     bool               acceptData();
47     void               addExtension();
48     bool               processPath( const QString& path );
49
50 protected slots:
51     void               accept();        
52     void               reject(); 
53     void               quickDir(const QString&);
54
55 protected:
56     bool               myOpen;             /* open/save selector  */      
57     QString            mySelectedFile;     /* selected filename   */    
58     QAD_FileValidator* myValidator;        /* file validator      */
59     static QString     myLastVisitedPath;  /* last visited path   */
60     QComboBox*         myQuickCombo;       /* quick dir combo box */
61
62 };
63
64 #endif