Salome HOME
Porting to Mandrake 10.1 and new products:
[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 <qcombobox.h>
16 #include <qpushbutton.h>
17
18 #include <qfiledialogP.h>
19
20 #include "QAD.h"
21 #include "QAD_FileValidator.h"
22
23 class QAD_EXPORT QAD_FileDlg : public QFileDialogP
24 {
25     Q_OBJECT
26
27 public:
28     QAD_FileDlg( QWidget* parent, bool open, bool showQuickDir = true, bool modal = true );
29     virtual ~QAD_FileDlg();
30
31 public:    
32     bool               isOpenDlg()    const;    
33     QString            selectedFile() const;
34
35     void               setValidator( QAD_FileValidator* );
36
37     static QString     getFileName( QWidget*           parent, 
38                                     const QString&     initial, 
39                                     const QStringList& filters, 
40                                     const QString&     caption,
41                                     bool               open,
42                                     bool               showQuickDir = true,
43                                     QAD_FileValidator* validator = 0);
44     static QStringList getOpenFileNames( QWidget*           parent, 
45                                          const QString&     initial, 
46                                          const QStringList& filters, 
47                                          const QString&     caption,
48                                          bool               showQuickDir = true, 
49                                          QAD_FileValidator* validator = 0);
50     static QString     getExistingDirectory ( QWidget*       parent,
51                                               const QString& initial,
52                                               const QString& caption, 
53                                               bool           showQuickDir = true);
54
55 protected:
56   virtual bool         acceptData();
57                             
58 private:
59     void               addExtension();
60     bool               processPath( const QString& path );
61
62 protected slots:
63     void               accept();        
64     void               reject(); 
65     void               quickDir(const QString&);
66     void               addQuickDir();
67
68 protected:
69     bool               myOpen;             /* open/save selector   */      
70     QString            mySelectedFile;     /* selected filename    */    
71     QAD_FileValidator* myValidator;        /* file validator       */
72     static QString     myLastVisitedPath;  /* last visited path    */
73     QComboBox*         myQuickCombo;       /* quick dir combo box  */
74     QPushButton*       myQuickButton;      /* quick dir add button */
75 };
76
77 #endif