+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/
+//
//*********************************************************************************
// SUIT_FileDlg class is the extension of the Qt's Open/Save file dialog box.
// To get the file/directory name(s) call static methods:
QFileDialog( parent, 0, modal ),
myValidator( 0 ),
myQuickCombo( 0 ), myQuickButton( 0 ), myQuickLab( 0 ),
-myOpen( open ),
-myAccepted( false )
+myOpen( open )//,
+//myAccepted( false )
{
+ const QObjectList* child = children();
+ QObjectList::const_iterator anIt = child->begin(), aLast = child->end();
+ for( ; anIt!=aLast; anIt++ )
+ if( (*anIt)->inherits( "QPushButton" ) )
+ {
+ QPushButton* bt = ( QPushButton* )( *anIt );
+ bt->setDefault( false );
+ bt->setAutoDefault( false );
+ }
+
if ( parent->icon() )
setIcon( *parent->icon() );
setSizeGripEnabled( true );
* in file name editor while file name is not acceptable by acceptData()
* (e.g. permission denied)
*/
- if ( !myAccepted ) {
+// if ( !myAccepted ) {
if ( mode() != ExistingFiles ) {
mySelectedFile = QFileDialog::selectedFile();
addExtension();
if ( acceptData() ) {
myLastVisitedPath = dirPath();
QFileDialog::accept();
- myAccepted = true;
+// myAccepted = true;
}
- }
- myAccepted = !myAccepted;
+// }
+// myAccepted = !myAccepted;
}
/*! Closes this dialog and sets the return code to 'Rejected' */
if ( myValidator )
{
if ( isOpenDlg() )
- if ( mode() == ExistingFiles ) {
- QStringList fileNames = selectedFiles();
- for ( int i = 0; i < fileNames.count(); i++ ) {
- if ( !myValidator->canOpen( fileNames[i] ) )
- return false;
- }
- return true;
+ {
+ if ( mode() == ExistingFiles )
+ {
+ QStringList fileNames = selectedFiles();
+ for ( int i = 0; i < (int)fileNames.count(); i++ )
+ {
+ if ( !myValidator->canOpen( fileNames[i] ) )
+ return false;
+ }
+ return true;
}
- else {
- return myValidator->canOpen( selectedFile() );
+ else
+ {
+ return myValidator->canOpen( selectedFile() );
}
- else
+ }
+ else
return myValidator->canSave( selectedFile() );
}
return true;
QRegExp anExtRExp( "^("+ aPattern + ")$" );
// Check if the current file extension matches the pattern
- if ( anExtRExp.match( anExt ) < 0 ) {
+ if ( anExtRExp.match( anExt ) < 0 )
+ {
// find first appropriate extension in the selected filter
// (it should be without wildcard symbols)
- for ( int i = 0; i < extList.count(); i++ ) {
+ for ( int i = 0; i < (int)extList.count(); i++ )
+ {
QString newExt = extList[i].replace( QRegExp( "[\\\\][+]" ),"+" );
int res = newExt.findRev( '.' );
- if ( res >= 0 )
+ if ( res >= 0 )
newExt = newExt.mid( res + 1 );
- if ( newExt.find( QRegExp("[*|?]" ) ) < 0 ) {
+ if ( newExt.find( QRegExp("[*|?]" ) ) < 0 )
+ {
mySelectedFile.stripWhiteSpace();
mySelectedFile += mySelectedFile.endsWith(".") ? newExt : QString(".") + newExt;
break;
QString aPath = dirPath;
if ( !QDir(aPath).exists() ) {
aPath = QDir::homeDirPath();
- /* SUIT_MessageBox::error1(this,
- tr("ERR_ERROR"),
- tr("ERR_DIR_NOT_EXIST").arg(dirPath),
- tr("BUT_OK"));*/
-
+ SUIT_MessageBox::error1(this,
+ tr("ERR_ERROR"),
+ tr("ERR_DIR_NOT_EXIST").arg(dirPath),
+ tr("BUT_OK"));
}
- // else {
+ else
processPath(aPath);
- // }
}
/*!
Called when user presses "Add" button - adds current directory to quick directory