Salome HOME
studyActivated() virtual method has been added
[modules/gui.git] / src / SUIT / SUIT_FileDlg.h
1 #ifndef SUIT_FILEDIALOG_H
2 #define SUIT_FILEDIALOG_H
3
4 #include "SUIT.h"
5
6 #include <qfiledialog.h>
7
8 class QLabel;
9 class QComboBox;
10 class QPushButton;
11 class SUIT_FileValidator;
12
13 class SUIT_EXPORT SUIT_FileDlg : public QFileDialog
14 {
15   Q_OBJECT
16
17 public:
18   SUIT_FileDlg( QWidget*, bool open, bool showQuickDir = true, bool modal = true );
19   virtual ~SUIT_FileDlg();
20
21 public:    
22   bool                isOpenDlg()    const;    
23   QString             selectedFile() const;
24
25   void                setValidator( SUIT_FileValidator* );
26
27   static QString      getFileName( QWidget* parent, const QString& initial, const QStringList& filters, 
28                                    const QString& caption, const bool open, const bool showQuickDir = true,
29                                    SUIT_FileValidator* validator = 0 );
30   static QStringList  getOpenFileNames( QWidget* parent, const QString& initial, const QStringList& filters, 
31                                         const QString& caption, bool showQuickDir = true, 
32                                         SUIT_FileValidator* validator = 0 );
33   static QString      getExistingDirectory( QWidget* parent, const QString& initial,
34                                             const QString& caption, const bool showQuickDir = true );
35
36 public slots:
37   void                polish();
38
39 private:
40   bool                acceptData();
41   void                addExtension();
42   bool                processPath( const QString& path );
43
44 protected slots:
45   void                accept();        
46   void                reject(); 
47   void                quickDir( const QString& );
48   void                addQuickDir();
49
50 protected:
51   bool                myOpen;             /* open/save selector   */      
52   QString             mySelectedFile;     /* selected filename    */    
53   SUIT_FileValidator* myValidator;        /* file validator       */
54   QLabel*             myQuickLab;         /* quick dir combo box  */
55   QComboBox*          myQuickCombo;       /* quick dir combo box  */
56   QPushButton*        myQuickButton;      /* quick dir add button */
57   bool                myAccepted;         /* 'Accepted' flag      */
58
59   static QString      myLastVisitedPath;  /* last visited path    */
60 };
61
62 #endif