From b6819df660624492d83895ec1256c38e05f6c644 Mon Sep 17 00:00:00 2001 From: dmv Date: Thu, 20 Nov 2008 13:14:33 +0000 Subject: [PATCH] Qt4 porting. Save and Open operations are incorrect when unreadable symbol is used in name. --- src/SUIT/SUIT_FileDlg.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/SUIT/SUIT_FileDlg.cxx b/src/SUIT/SUIT_FileDlg.cxx index 7572fba75..863b06590 100755 --- a/src/SUIT/SUIT_FileDlg.cxx +++ b/src/SUIT/SUIT_FileDlg.cxx @@ -731,6 +731,10 @@ QString SUIT_FileDlg::getFileName( QWidget* parent, const QString& initial, fd.setFileMode( open ? ExistingFile : AnyFile ); + QString filename = initial; + filename.simplified(); + filename = filename.replace(QRegExp("\\*"), "" ).replace(QRegExp("\\?"), "" ); + if ( filters.isEmpty() ) fd.setFilter( tr( "ALL_FILES_FILTER" ) ); // All files (*) else @@ -739,14 +743,12 @@ QString SUIT_FileDlg::getFileName( QWidget* parent, const QString& initial, if ( !caption.isEmpty() ) fd.setWindowTitle( caption ); - if ( !initial.isEmpty() ) - fd.processPath( initial ); + if ( !filename.isEmpty() ) + fd.processPath( filename ); if ( validator ) fd.setValidator( validator ); - QString filename; - if ( fd.exec() == QDialog::Accepted ) filename = fd.selectedFile(); -- 2.39.2