1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #ifndef SUIT_FILEDIALOG_H
20 #define SUIT_FILEDIALOG_H
24 #include <qfiledialog.h>
29 class SUIT_FileValidator;
31 /*! \class QFileDialog
32 * For more information see <a href="http://doc.trolltech.com">QT documentation</a>.
34 class SUIT_EXPORT SUIT_FileDlg : public QFileDialog
39 SUIT_FileDlg( QWidget*, bool open, bool showQuickDir = true, bool modal = true );
40 virtual ~SUIT_FileDlg();
43 bool isOpenDlg() const;
44 QString selectedFile() const;
46 void setValidator( SUIT_FileValidator* );
48 QString dirPath() const; // QFileDialog::dirPath() has a bug on Linux Debian (1 level up from correct
49 // directory is returned). This redefinition fixes the bug.
51 static QString getFileName( QWidget* parent, const QString& initial, const QStringList& filters,
52 const QString& caption, const bool open, const bool showQuickDir = true,
53 SUIT_FileValidator* validator = 0 );
54 static QStringList getOpenFileNames( QWidget* parent, const QString& initial, const QStringList& filters,
55 const QString& caption, bool showQuickDir = true,
56 SUIT_FileValidator* validator = 0 );
57 static QString getExistingDirectory( QWidget* parent, const QString& initial,
58 const QString& caption, const bool showQuickDir = true );
66 bool processPath( const QString& path );
71 void quickDir( const QString& );
75 bool myOpen; //!< open/save selector
76 QString mySelectedFile; //!< selected filename
77 SUIT_FileValidator* myValidator; //!< file validator
78 QLabel* myQuickLab; //!< quick dir combo box
79 QComboBox* myQuickCombo; //!< quick dir combo box
80 QPushButton* myQuickButton; //!< quick dir add button
83 * \brief flag is used to warkaround the Qt 2.2.2
84 * \bug accept() method is called twice if user presses 'Enter' key
85 * in file name editor while file name is not acceptable by acceptData()
86 * (e.g. permission denied)
89 /*! ASL: this bug can be fixed with help of call setDefault( false )
90 * and setAutoDefault( false ) methods for all QPushButtons of this dialog
93 static QString myLastVisitedPath; //!< last visited path