Version: 9.15.0
SUIT_FileDlg.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2025 CEA, EDF, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // File : SUIT_FileDlg.h
24 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
25 //
26 #ifndef SUIT_FILEDLG_H
27 #define SUIT_FILEDLG_H
28 
29 #include "SUIT.h"
30 
31 #include <QFileDialog>
32 
33 class QLabel;
34 class QLineEdit;
35 class QComboBox;
36 class QPushButton;
37 class QUrl;
38 class SUIT_FileValidator;
39 
41 {
42  Q_OBJECT
43 
44 public:
45  SUIT_FileDlg( QWidget*, bool, bool = true, bool = true );
46 
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);
54 
55  virtual ~SUIT_FileDlg();
56 
57  bool isOpenDlg() const;
58 
59  bool checkPermissions() const;
60  void setCheckPermissions( const bool );
61 
62  SUIT_FileValidator* validator() const;
63  void setValidator( SUIT_FileValidator* );
64 
65  bool addWidgets( QWidget*, QWidget*, QWidget* );
66 
67  QStringList selectedFiles() const;
68  QString selectedFile() const;
69 
70  void selectFile( const QString& );
71 
72  static QString getLastVisitedDirectory();
73 
74  static QString getFileName( QWidget*,
75  const QString&,
76  const QStringList&,
77  const QString& = QString(),
78  const bool = true,
79  const bool = true,
80  SUIT_FileValidator* = 0 );
81  static QString getFileName( QWidget*,
82  const QString&,
83  const QString&,
84  const QString& = QString(),
85  const bool = true,
86  const bool = true,
87  SUIT_FileValidator* = 0 );
88 
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);
97 
98  static QStringList getOpenFileNames( QWidget*,
99  const QString&,
100  const QStringList&,
101  const QString& = QString(),
102  const bool = true,
103  SUIT_FileValidator* = 0 );
104  static QStringList getOpenFileNames( QWidget*,
105  const QString&,
106  const QString&,
107  const QString& = QString(),
108  const bool = true,
109  SUIT_FileValidator* = 0 );
110 
111  static QString getExistingDirectory( QWidget*,
112  const QString&,
113  const QString& = QString(),
114  const bool = true,
115  SUIT_FileValidator* = 0 );
116 
117  static QString getLastVisitedPath();
118 
119 protected:
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& );
127 
128 protected slots:
129  void accept();
130  void quickDir( const QString& );
131  void addQuickDir();
132 
133 private:
134  void polish();
135  void updateSideBar();
136 
137 private:
141  QPushButton* myQuickButton;
142  QStringList myUrls;
144  static QString myLastVisitedPath;
145 };
146 
147 #endif // SUIT_FILEDLG_H
#define SUIT_EXPORT
Definition: SUIT.h:36
An extension of the Qt Open/Save file dialog box.
Definition: SUIT_FileDlg.h:41
QPushButton * myQuickButton
quick dir panel: button
Definition: SUIT_FileDlg.h:141
static QString myLastVisitedPath
last visited path
Definition: SUIT_FileDlg.h:144
QComboBox * myQuickCombo
quick dir panel: combo box
Definition: SUIT_FileDlg.h:140
QLabel * myQuickLab
quick dir panel: label
Definition: SUIT_FileDlg.h:139
bool myCheckPermissions
check permissions option
Definition: SUIT_FileDlg.h:143
QStringList myUrls
sidebar urls
Definition: SUIT_FileDlg.h:142
SUIT_FileValidator * myValidator
file validator
Definition: SUIT_FileDlg.h:138
Provides functionality to check the file or directory existance and permissions.
Definition: SUIT_FileValidator.h:35