1 // SALOME SALOMEGUI : GUI of VISU module
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : QAD_FileDlg.cxx
10 // $Header: /dn05/salome/CVS/SALOME_ROOT/SALOME/src/VISUGUI/Visu_FileDlg.cxx
13 #include <qapplication.h>
15 #include <qpushbutton.h>
17 #include "QAD_Config.h"
18 #include "VisuGUI_FileDlg.h"
22 bool VisuGUI_FileDlg::IsBuild = false;
27 VisuGUI_FileDlg::VisuGUI_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool modal ) :
28 QAD_FileDlg( parent, open, showQuickDir, modal )
30 myCBuildAll = new QCheckBox( tr("Full loading for current file"), this );
31 QLabel* label = new QLabel("", this);
32 label->setMaximumWidth(0);
33 QPushButton* pb = new QPushButton(this);
34 pb->setMaximumWidth(0);
35 addWidgets( label, myCBuildAll, pb );
36 QString aIsBuild = QAD_CONFIG->getSetting("Visu:BuildResult");
37 if (aIsBuild.isEmpty()? 0 : aIsBuild.toInt()) myCBuildAll->setChecked(true);
43 VisuGUI_FileDlg::~VisuGUI_FileDlg()
48 Processes selection : tries to set given path or filename as selection
50 bool VisuGUI_FileDlg::processPath( const QString& path )
52 if ( !path.isNull() ) {
57 else if ( fi.isDir() )
62 if ( QFileInfo( fi.dirPath() ).exists() ) {
63 setDir( fi.dirPath() );
72 Returns the file name for Open/Save [ static ]
74 QString VisuGUI_FileDlg::getFileName( QWidget* parent,
75 const QString& initial,
76 const QStringList& filters,
77 const QString& caption,
80 QAD_FileValidator* validator )
82 VisuGUI_FileDlg* fd = new VisuGUI_FileDlg( parent, open, showQuickDir, true );
83 if ( !caption.isEmpty() )
84 fd->setCaption( caption );
85 if ( !initial.isEmpty() ) {
86 fd->processPath( initial ); // VSR 24/03/03 check for existing of directory has been added to avoid QFileDialog's bug
88 fd->setFilters( filters );
90 fd->setValidator( validator );
92 QString filename = fd->selectedFile();
94 VisuGUI_FileDlg::IsBuild = fd->IsChecked();
97 qApp->processEvents();
102 bool VisuGUI_FileDlg::IsChecked()
104 return myCBuildAll->isChecked();