1 // Copyright (C) 2007-2024 CEA, EDF, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File : SUIT_FileDlg.h
24 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
26 #ifndef SUIT_FILEDLG_H
27 #define SUIT_FILEDLG_H
31 #include <QFileDialog>
38 class SUIT_FileValidator;
40 class SUIT_EXPORT SUIT_FileDlg : public QFileDialog
45 SUIT_FileDlg( QWidget*, bool, bool = true, bool = true );
47 SUIT_FileDlg(QWidget* parent,
48 const QString& initial,
49 const QStringList& filters,
50 const QString& caption = QString(),
51 const bool open = true,
52 const bool showQuickDir = true,
53 SUIT_FileValidator* validator = 0);
55 virtual ~SUIT_FileDlg();
57 bool isOpenDlg() const;
59 bool checkPermissions() const;
60 void setCheckPermissions( const bool );
62 SUIT_FileValidator* validator() const;
63 void setValidator( SUIT_FileValidator* );
65 bool addWidgets( QWidget*, QWidget*, QWidget* );
67 QStringList selectedFiles() const;
68 QString selectedFile() const;
70 void selectFile( const QString& );
72 static QString getLastVisitedDirectory();
74 static QString getFileName( QWidget*,
77 const QString& = QString(),
80 SUIT_FileValidator* = 0 );
81 static QString getFileName( QWidget*,
84 const QString& = QString(),
87 SUIT_FileValidator* = 0 );
89 static QString getFileName(QWidget* parent,
90 const QString& initial,
91 const QStringList& filters,
92 QString& selectedFilter,
93 const QString& caption = QString(),
94 const bool open = true,
95 const bool showQuickDir = true,
96 SUIT_FileValidator* validator = 0);
98 static QStringList getOpenFileNames( QWidget*,
101 const QString& = QString(),
103 SUIT_FileValidator* = 0 );
104 static QStringList getOpenFileNames( QWidget*,
107 const QString& = QString(),
109 SUIT_FileValidator* = 0 );
111 static QString getExistingDirectory( QWidget*,
113 const QString& = QString(),
115 SUIT_FileValidator* = 0 );
117 static QString getLastVisitedPath();
120 virtual bool event( QEvent* );
121 QLineEdit* lineEdit() const;
122 virtual bool acceptData();
123 QString addExtension( const QString& ) const;
124 bool processPath( const QString& );
125 void addFilter( const QString& );
126 static bool hasWildCards( const QString& );
130 void quickDir( const QString& );
135 void updateSideBar();
138 SUIT_FileValidator* myValidator; //!< file validator
139 QLabel* myQuickLab; //!< quick dir panel: label
140 QComboBox* myQuickCombo; //!< quick dir panel: combo box
141 QPushButton* myQuickButton; //!< quick dir panel: button
142 QStringList myUrls; //!< sidebar urls
143 bool myCheckPermissions; //!< check permissions option
144 static QString myLastVisitedPath; //!< last visited path
147 #endif // SUIT_FILEDLG_H