Version: 9.16.0
SUIT_FileDlg.h
Go to the documentation of this file.
1// Copyright (C) 2007-2026 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
33class QLabel;
34class QLineEdit;
35class QComboBox;
36class QPushButton;
37class QUrl;
39
41{
42 Q_OBJECT
43
44public:
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 QStringList&,
107 QString&,
108 const QString& = QString(),
109 const bool = true,
110 SUIT_FileValidator* = 0 );
111 static QStringList getOpenFileNames( QWidget*,
112 const QString&,
113 const QString&,
114 const QString& = QString(),
115 const bool = true,
116 SUIT_FileValidator* = 0 );
117
118 static QString getExistingDirectory( QWidget*,
119 const QString&,
120 const QString& = QString(),
121 const bool = true,
122 SUIT_FileValidator* = 0 );
123
124 static QString getLastVisitedPath();
125
126protected:
127 virtual bool event( QEvent* );
128 QLineEdit* lineEdit() const;
129 virtual bool acceptData();
130 QString addExtension( const QString& ) const;
131 bool processPath( const QString& );
132 void addFilter( const QString& );
133 static bool hasWildCards( const QString& );
134
135protected slots:
136 void accept();
137 void quickDir( const QString& );
138 void addQuickDir();
139
140private:
141 void polish();
142 void updateSideBar();
143
144private:
148 QPushButton* myQuickButton;
149 QStringList myUrls;
151 static QString myLastVisitedPath;
152};
153
154#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:148
static QString myLastVisitedPath
last visited path
Definition: SUIT_FileDlg.h:151
QComboBox * myQuickCombo
quick dir panel: combo box
Definition: SUIT_FileDlg.h:147
QLabel * myQuickLab
quick dir panel: label
Definition: SUIT_FileDlg.h:146
bool myCheckPermissions
check permissions option
Definition: SUIT_FileDlg.h:150
QStringList myUrls
sidebar urls
Definition: SUIT_FileDlg.h:149
SUIT_FileValidator * myValidator
file validator
Definition: SUIT_FileDlg.h:145
Provides functionality to check the file or directory existance and permissions.
Definition: SUIT_FileValidator.h:35