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