Back to index

salome-gui  6.5.0
SUIT_FileDlg.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File   : SUIT_FileDlg.cxx
00024 // Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
00025 //
00076 #include "SUIT_FileDlg.h"
00077 
00078 #include "SUIT_Tools.h"   
00079 #include "SUIT_Session.h"
00080 #include "SUIT_MessageBox.h"
00081 #include "SUIT_ResourceMgr.h"
00082 #include "SUIT_FileValidator.h"
00083 #include "Qtx.h"
00084 
00085 #include <QDir>
00086 #include <QEvent>
00087 #include <QRegExp>
00088 #include <QLabel>
00089 #include <QComboBox>
00090 #include <QPushButton>
00091 #include <QGridLayout>
00092 #include <QApplication>
00093 #include <QListView>
00094 #include <QLineEdit>
00095 // GDD
00096 #include <QUrl>
00097 #include <QDesktopServices>
00098 
00107 const bool IGNORE_NON_MATCHING_EXTENSION = true;
00108 
00109 QString SUIT_FileDlg::myLastVisitedPath;
00110 
00118 SUIT_FileDlg::SUIT_FileDlg( QWidget* parent, bool open, bool showQuickDir, bool modal )
00119 : QFileDialog( parent ),
00120   myValidator( 0 ),
00121   myQuickLab( 0 ),
00122   myQuickCombo( 0 ),
00123   myQuickButton( 0 ),
00124   myCheckPermissions( true )
00125 {
00126   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
00127   
00128   setModal( modal );
00129   setSizeGripEnabled( true );
00130   if ( parent )
00131     setWindowIcon( parent->windowIcon() );
00132 
00133   // GDD
00134   myUrls.insert(0,QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::ApplicationsLocation)));
00135   myUrls.insert(0,QUrl::fromLocalFile(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)));
00136   setSidebarUrls(myUrls);
00137 
00138   // add quick directories widgets
00139   if ( showQuickDir ) {
00140     myQuickLab    = new QLabel( tr( "LAB_QUICK_PATH" ), this );
00141     myQuickCombo  = new QComboBox( this );
00142     myQuickButton = new QPushButton( tr( "BUT_ADD_PATH" ), this );
00143     
00144     if ( addWidgets( myQuickLab, myQuickCombo, myQuickButton ) ) {
00145       connect( myQuickCombo,  SIGNAL( activated( const QString& ) ), this, SLOT( quickDir( const QString& ) ) );
00146       connect( myQuickButton, SIGNAL( clicked() ),                   this, SLOT( addQuickDir() ) );
00147 
00148       // retrieve directories list from the resources
00149       QStringList dirList;
00150   
00151       if ( resMgr )
00152         dirList = resMgr->stringValue( "FileDlg", "QuickDirList" ).split( ';', QString::SkipEmptyParts );
00153 
00154       if ( dirList.isEmpty() ) 
00155         dirList << QDir::homePath();
00156 
00157       // GDD
00158       for ( int i = 0; i < dirList.count(); i++ ) {
00159         myQuickCombo->addItem( dirList[i] );
00160         myUrls.append(QUrl::fromLocalFile(dirList[i]));
00161       }
00162 
00163       // GDD
00164       setSidebarUrls(myUrls);
00165       
00166     }
00167     else {
00168       delete myQuickLab;    myQuickLab = 0;
00169       delete myQuickCombo;  myQuickCombo = 0;
00170       delete myQuickButton; myQuickButton = 0;
00171     }
00172   }
00173 
00174   setAcceptMode( open ? AcceptOpen: AcceptSave );
00175   setWindowTitle( open ? tr( "INF_DESK_DOC_OPEN" ) : tr( "INF_DESK_DOC_SAVE" ) );
00176 
00177   bool showCurrentDirInitial = resMgr ? resMgr->booleanValue( "FileDlg", "ShowCurDirInitial", false ) : false;
00178 
00179   // If last visited path doesn't exist -> switch to the first preferred path
00180   if ( !myLastVisitedPath.isEmpty() ) {
00181     if ( !processPath( myLastVisitedPath ) && showQuickDir )
00182       processPath( myQuickCombo->itemText( 0 ) );
00183   }
00184   else if ( showCurrentDirInitial ) {
00185     processPath( QDir::currentPath() );
00186   }
00187   else if ( showQuickDir ) {
00188     processPath( myQuickCombo->itemText( 0 ) );
00189   }
00190 
00191   // set default file validator
00192   myValidator = new SUIT_FileValidator( this );
00193 }
00194 
00198 SUIT_FileDlg::~SUIT_FileDlg() 
00199 {
00200   setValidator( 0 );
00201 }
00202 
00203 
00208 bool SUIT_FileDlg::isOpenDlg() const
00209 {
00210   return acceptMode() == AcceptOpen;
00211 }
00212 
00218 bool SUIT_FileDlg::checkPermissions() const
00219 {
00220   return myCheckPermissions;
00221 }
00222 
00232 void SUIT_FileDlg::setCheckPermissions( const bool checkPerm )
00233 {
00234   myCheckPermissions = checkPerm;
00235 }
00236 
00242 SUIT_FileValidator* SUIT_FileDlg::validator() const
00243 {
00244   return myValidator;
00245 }
00246 
00255 void SUIT_FileDlg::setValidator( SUIT_FileValidator* v )
00256 {
00257   if ( myValidator && myValidator->parent() == this )
00258     delete myValidator;
00259   myValidator = v;
00260 }
00261 
00282 bool SUIT_FileDlg::addWidgets( QWidget* l, QWidget* w, QWidget* b )
00283 {
00284   QGridLayout* grid = ::qobject_cast<QGridLayout*>( layout() );
00285   if ( grid ) {
00286     int row = grid->rowCount();
00287     int columns = grid->columnCount();
00288     if ( l ) 
00289       grid->addWidget( l, row, 0 );
00290     if ( w )
00291       grid->addWidget( w, row, 1, 1, columns-2 );
00292     if ( b )
00293       grid->addWidget( b, row, columns-1 );
00294     return true;
00295   }
00296   return false;
00297 }
00298 
00303 QStringList SUIT_FileDlg::selectedFiles() const
00304 {
00305   QStringList files = QFileDialog::selectedFiles();
00306   if ( fileMode() != DirectoryOnly && fileMode() != Directory ) {
00307     QMutableListIterator<QString> it( files );
00308     while ( it.hasNext() ) {
00309       QString f = it.next();
00310       QFileInfo finfo( f );
00311       if ( !finfo.isDir() )
00312         it.setValue( addExtension( f ) );
00313     }
00314   }
00315   return files;
00316 }
00317 
00322 QString SUIT_FileDlg::selectedFile() const
00323 {
00324   QStringList files = selectedFiles();
00325   return files.count() > 0 ? files[0] : QString();
00326 }
00327 
00336 QString SUIT_FileDlg::getLastVisitedDirectory()
00337 {
00338   return myLastVisitedPath;
00339 }
00340 
00346 bool SUIT_FileDlg::event( QEvent* e )
00347 {
00348   bool res = QFileDialog::event( e );
00349 
00350   if ( e->type() == QEvent::Polish )
00351     polish();
00352 
00353   return res;
00354 }
00355 
00360 QLineEdit* SUIT_FileDlg::lineEdit() const
00361 {
00362   QLineEdit* ebox = 0;
00363   QList<QLineEdit*> editBoxes = findChildren<QLineEdit*>();
00364   QGridLayout* grid = ::qobject_cast<QGridLayout*>( layout() );
00365   if ( grid ) {
00366     int idx = 10000;
00367     for ( int i = 0; i < editBoxes.count(); i++ ) {
00368       int widx = grid->indexOf( editBoxes[ i ] );
00369       if ( widx >= 0 )
00370         idx = qMin( idx, widx );
00371     }
00372     if ( grid->itemAt( idx )  )
00373       ebox = qobject_cast<QLineEdit*>( grid->itemAt( idx )->widget() );
00374   }
00375   return ebox;
00376 }
00377 
00392 bool SUIT_FileDlg::acceptData()
00393 {    
00394   QStringList files = selectedFiles();
00395   if ( files.isEmpty() )
00396     return false;
00397 
00398   // special case for ".."
00399   if ( lineEdit() ) {
00400     QString txt = lineEdit()->text();
00401     if ( txt == ".." ) {
00402       QDir dir = directory();
00403       if ( dir.cdUp() ) {
00404         setDirectory( dir );
00405         bool block = lineEdit()->blockSignals( true );
00406         lineEdit()->setText( ".." );
00407         lineEdit()->selectAll();
00408         lineEdit()->setFocus( Qt::OtherFocusReason );
00409         lineEdit()->blockSignals( block );
00410         return false;
00411       }
00412     }
00413     else if ( fileMode() != DirectoryOnly ) {
00414       QStringList fs = txt.split( " ", QString::SkipEmptyParts );
00415       for ( int i = 0; i < fs.count(); i++ ) {
00416         QString wc = fs.at( i );
00417         if ( wc.startsWith( "\"" ) && wc.endsWith( "\"" ) )
00418           wc = wc.mid( 1, wc.length()-2 );
00419         if ( hasWildCards( wc ) ) {
00420           addFilter( wc );
00421           lineEdit()->clear();
00422           return false;
00423         }
00424       }
00425     }
00426   }
00427 
00428   // special case for wildcards
00429   for ( int i = 0; i < files.count(); ++i ) {
00430   }
00431 
00432   bool bOk = true;
00433 
00434   switch ( fileMode() ) {
00435   case DirectoryOnly:
00436   case Directory: 
00437     {
00438       QString fn = files.first();
00439       if ( validator() ) {
00440         bOk = isOpenDlg() ? validator()->canReadDir( fn, checkPermissions() ) : 
00441                             validator()->canWriteDir( fn, checkPermissions() );
00442       }
00443       break;
00444     }
00445   case AnyFile: 
00446     {
00447       QString fn = files.first();
00448       QFileInfo info( fn );
00449       if ( info.isDir() ) {
00450         setDirectory( info.absoluteFilePath() );
00451         if ( lineEdit() ) {
00452           lineEdit()->selectAll();
00453           lineEdit()->setFocus( Qt::OtherFocusReason );
00454         }
00455         return false;
00456       }
00457       // validation is not required
00458       if ( validator() ) {
00459         bOk = isOpenDlg() ? validator()->canOpen( fn, checkPermissions() ) : 
00460                             validator()->canSave( fn, checkPermissions() );
00461       }
00462       break;
00463     }
00464   case ExistingFile:
00465   case ExistingFiles: 
00466     {
00467       for ( int i = 0; i < files.count(); ++i ) {
00468         QFileInfo info( files.at( i ) );
00469         if ( info.isDir() ) {
00470           setDirectory( info.absoluteFilePath() );
00471           if ( lineEdit() ) {
00472             lineEdit()->selectAll();
00473             lineEdit()->setFocus( Qt::OtherFocusReason );
00474           }
00475           return false;
00476         }
00477         if ( validator() ) {
00478           bOk = isOpenDlg() ? validator()->canOpen( files.at( i ), checkPermissions() ) : 
00479                               validator()->canSave( files.at( i ), checkPermissions() );
00480         if ( !bOk )
00481           return false;
00482         }
00483       }
00484       break;
00485     }
00486   }
00487 
00488   if ( bOk )
00489     emit filesSelected( files );
00490 
00491   return bOk;
00492 }
00493 
00502 QString SUIT_FileDlg::addExtension( const QString& fileName ) const
00503 {
00504   QString fname = fileName.trimmed();
00505 
00506   // check if file name entered is empty
00507   if ( fname.isEmpty() )
00508     return fileName;
00509 
00510   // current file extension
00511   QString anExt = "." + SUIT_Tools::extension( fname ).trimmed();
00512 
00513   // If the file already has extension and it does not match the filter there are two choices:
00514   // - to leave it 'as is'
00515   // - to ignore it
00516   // The behavior is defined by IGNORE_NON_MATCHING_EXTENSION constant
00517   if ( anExt != "." && !IGNORE_NON_MATCHING_EXTENSION )
00518     return fileName;
00519 
00520   QRegExp r( QString::fromLatin1("\\(?[a-zA-Z0-9.*? +;#|]*\\)?$") );
00521   int index = r.indexIn( selectedFilter().trimmed() );
00522 
00523   if ( QFileInfo( fileName ).exists() )
00524     return fileName; // if file exists return as is
00525 
00526   if ( index >= 0 ) {            
00527     // Create wildcard regular expression basing on selected filter 
00528     // in order to validate a file extension.
00529     // Due to transformations from the filter list (*.txt *.*xx *.c++ SUIT*.* ) we 
00530     // will have the pattern (\.txt|\..*xx|\.c\+\+|\..*) (as we validate extension only, 
00531     // we remove everything except extension mask from the pattern
00532     QString wildcard = selectedFilter().mid( index, r.matchedLength() ).trimmed();
00533     // replace '|' and ';' separators by space symbol and also brackets if there are some
00534     wildcard.replace( QRegExp( "[\\|;|(|)]" )," " ); 
00535 
00536     QString aPattern = wildcard.replace( QRegExp( "(^| )(\\s*)[0-9a-zA-Z*_?]*\\."), " \\." ).trimmed().
00537                                          replace( QRegExp( "\\s+" ), "|" ).replace( QRegExp( "[?]" ),".?" ).
00538                                          replace( QRegExp( "[*]" ),".*" ).replace( QRegExp( "[+]" ),"\\+" );
00539 
00540     // now we get the list of all extension masks and remove all which does not contain wildcard symbols
00541     QStringList extList = aPattern.split( "|", QString::SkipEmptyParts );
00542     for ( int i = extList.count() - 1; i >= 0; i-- ) {
00543       if ( !extList[i].contains( "." ) )
00544         extList.removeAt( i );
00545     }
00546     aPattern = extList.join( "|" );
00547 
00548     // finalize pattern
00549     QRegExp anExtRExp( "^("+ aPattern + ")$" );
00550 
00551     // Check if the current file extension matches the pattern
00552     if ( !anExtRExp.exactMatch( anExt ) ) {
00553       // find first appropriate extension in the selected filter 
00554       // (it should be without wildcard symbols)
00555       for ( int i = 0; i < extList.count(); i++ ) {
00556         QString newExt = extList[i].replace( QRegExp( "[\\\\][+]" ),"+" );
00557         int res = newExt.lastIndexOf( '.' );
00558         if ( res >= 0 )
00559           newExt = newExt.mid( res + 1 );
00560         if ( newExt.indexOf( QRegExp("[*|?]" ) ) < 0 ) {
00561           fname += fname.endsWith( "." ) ? newExt : QString( "." ) + newExt;
00562           return fname;
00563         }
00564       }
00565     }
00566   }
00567   return fileName;
00568 }
00569 
00576 bool SUIT_FileDlg::processPath( const QString& path )
00577 {
00578   if ( !path.isNull() ) {
00579     QFileInfo fi( path );
00580     if ( fi.exists() ) {
00581       if ( fi.isFile() )
00582         selectFile( path );
00583       else if ( fi.isDir() )
00584         setDirectory( path );
00585       return true;
00586     }
00587     QString dirPath = SUIT_Tools::dir( path, false );
00588     if ( !dirPath.isEmpty() && QFileInfo( dirPath ).exists() )
00589       setDirectory( dirPath );
00590     selectFile( SUIT_Tools::file( path ) );
00591     return true;
00592   }
00593   return false;
00594 }
00595 
00600 void SUIT_FileDlg::addFilter( const QString& filter )
00601 {
00602   QStringList flist = filters();
00603   if ( !flist.contains( filter ) ) {
00604     flist << filter;
00605     setFilters( flist );
00606   }
00607   selectFilter( filter );
00608 }
00609 
00615 bool SUIT_FileDlg::hasWildCards( const QString& s )
00616 {
00617   return s.contains( QRegExp("[*|?]") );
00618 }
00619 
00627 void SUIT_FileDlg::accept()
00628 {
00629   if ( acceptData() ) {
00630     myLastVisitedPath = directory().path();
00631     QDialog::accept();        
00632   }
00633 }
00634 
00642 void SUIT_FileDlg::quickDir( const QString& dirPath )
00643 {
00644   if ( !QDir( dirPath ).exists() )
00645     SUIT_MessageBox::critical( this, tr( "ERR_ERROR" ), tr( "ERR_DIR_NOT_EXIST" ).arg( dirPath ) );
00646   else
00647     processPath( dirPath );
00648 }
00649 
00655 void SUIT_FileDlg::addQuickDir()
00656 {
00657   QString dp = directory().path();
00658   if ( !dp.isEmpty() ) {
00659     QDir dir( dp );
00660 
00661     QStringList dirList;
00662 
00663     SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
00664     if ( resMgr )
00665       dirList = resMgr->stringValue( "FileDlg", "QuickDirList" ).split( ';', QString::SkipEmptyParts );
00666 
00667     bool found = false;
00668     bool emptyAndHome = false;
00669     if ( dirList.count() > 0 ) {
00670       for ( int i = 0; i < dirList.count() && !found; i++ )  {
00671         QDir aDir( dirList[i] );
00672         if ( ( aDir.canonicalPath().isNull() && dirList[i] == dir.absolutePath() ) ||
00673              ( !aDir.canonicalPath().isNull() && aDir.exists() &&  
00674              aDir.canonicalPath() == dir.canonicalPath() ) ) {
00675           found = true;
00676         }
00677       }
00678     }
00679     else {
00680       emptyAndHome = dir.canonicalPath() == QDir( QDir::homePath() ).canonicalPath();
00681     }
00682 
00683     if ( !found ) {
00684       dirList.append( dp );
00685       resMgr->setValue( "FileDlg", "QuickDirList", dirList.join( ";" ) );
00686       // GDD
00687       if ( !emptyAndHome ) {
00688         myQuickCombo->addItem( dp );
00689         myUrls.append(QUrl::fromLocalFile( dp ));
00690         setSidebarUrls(myUrls);
00691       }
00692     }
00693   }
00694 }
00695 
00699 void SUIT_FileDlg::polish()
00700 {
00701   QList<QPushButton*> buttons = findChildren<QPushButton*>();
00702 
00703   int maxBtnWidth = 0;
00704 
00705   for ( QList<QPushButton*>::const_iterator it = buttons.begin(); 
00706         it != buttons.end(); ++it )
00707     maxBtnWidth = qMax( maxBtnWidth, (*it)->sizeHint().width() );
00708 
00709   for ( QList<QPushButton*>::const_iterator it = buttons.begin(); 
00710         it != buttons.end(); ++it ) {
00711     (*it)->setDefault( false );
00712     (*it)->setAutoDefault( false );
00713     (*it)->setFixedWidth( maxBtnWidth );
00714   }
00715 
00716   QList<QListView*> views = findChildren<QListView*>();
00717   for ( QList<QListView*>::const_iterator it = views.begin(); 
00718         it != views.end(); ++it ) {
00719     (*it)->setViewMode( QListView::ListMode );
00720   }
00721 }
00722 
00757 QString SUIT_FileDlg::getFileName( QWidget* parent, const QString& initial, 
00758                                    const QStringList& filters, const QString& caption, 
00759                                    const bool open, const bool showQuickDir,
00760                                    SUIT_FileValidator* validator )
00761 {            
00762   SUIT_FileDlg fd( parent, open, showQuickDir, true );    
00763 
00764   fd.setFileMode( open ? ExistingFile : AnyFile );
00765 
00766   QString tmpfilename = initial;
00767   tmpfilename = tmpfilename.simplified();
00768   tmpfilename = tmpfilename.replace(QRegExp("\\*"), "" ).replace(QRegExp("\\?"), "" );
00769 
00770   if ( filters.isEmpty() )
00771     fd.setFilter( tr( "ALL_FILES_FILTER" ) ); // All files (*)
00772   else
00773     fd.setFilters( filters );
00774 
00775   if ( !caption.isEmpty() )
00776     fd.setWindowTitle( caption );
00777 
00778   if ( !tmpfilename.isEmpty() )
00779     fd.processPath( tmpfilename );
00780 
00781   if ( validator )
00782     fd.setValidator( validator );
00783 
00784   QString filename;
00785 
00786   if ( fd.exec() == QDialog::Accepted )
00787     filename = fd.selectedFile();
00788 
00789   QApplication::processEvents();
00790 
00791   return filename;
00792 }
00793 
00830 QString SUIT_FileDlg::getFileName( QWidget* parent, const QString& initial, 
00831                                    const QString& filters, const QString& caption, 
00832                                    const bool open, const bool showQuickDir,
00833                                    SUIT_FileValidator* validator )
00834 {
00835   return getFileName( parent, initial, filters.split( ";;", QString::SkipEmptyParts ), 
00836                       caption, open, showQuickDir, validator );
00837 }
00838 
00868 QStringList SUIT_FileDlg::getOpenFileNames( QWidget* parent, const QString& initial,
00869                                             const QStringList& filters, const QString& caption,
00870                                             const bool showQuickDir, 
00871                                             SUIT_FileValidator* validator )
00872 {            
00873   SUIT_FileDlg fd( parent, true, showQuickDir, true );
00874 
00875   fd.setFileMode( ExistingFiles );
00876 
00877   if ( filters.isEmpty() )
00878     fd.setFilter( tr( "ALL_FILES_FILTER" ) ); // All files (*)
00879   else
00880     fd.setFilters( filters );
00881 
00882   if ( !caption.isEmpty() )
00883     fd.setWindowTitle( caption );
00884 
00885   if ( !initial.isEmpty() )
00886     fd.processPath( initial );
00887 
00888   if ( validator )
00889     fd.setValidator( validator );
00890 
00891   QStringList filenames;
00892 
00893   if ( fd.exec() == QDialog::Accepted )
00894     filenames = fd.selectedFiles();
00895 
00896   QApplication::processEvents();
00897 
00898   return filenames;
00899 }
00900 
00932 QStringList SUIT_FileDlg::getOpenFileNames( QWidget* parent, const QString& initial,
00933                                             const QString& filters, const QString& caption,
00934                                             const bool showQuickDir,
00935                                             SUIT_FileValidator* validator )
00936 {
00937   return getOpenFileNames( parent, initial, filters.split( ";;", QString::SkipEmptyParts ), 
00938                            caption, showQuickDir, validator );
00939 }
00940 
00966 QString SUIT_FileDlg::getExistingDirectory( QWidget* parent, const QString& initial,
00967                                             const QString& caption, const bool showQuickDir,
00968                                             SUIT_FileValidator* validator )
00969 {
00970   SUIT_FileDlg fd( parent, true, showQuickDir, true );
00971 
00972   fd.setFileMode( DirectoryOnly );
00973 
00974   if ( !caption.isEmpty() )
00975     fd.setWindowTitle( caption );
00976 
00977   if ( !initial.isEmpty() )
00978     fd.processPath( initial );
00979   
00980   if ( validator )
00981     fd.setValidator( validator );
00982 
00983   QString dirname;
00984 
00985   if ( fd.exec() == QDialog::Accepted )
00986     dirname = fd.selectedFile();
00987 
00988   QApplication::processEvents();
00989 
00990   return dirname;
00991 }
00992 
00997 QString SUIT_FileDlg::getLastVisitedPath()
00998 {
00999   return myLastVisitedPath;
01000 }
01001 
01011 void SUIT_FileDlg::selectFile( const QString& f )
01012 {
01013   QFileDialog::selectFile( QFileInfo( f ).baseName() );
01014   if ( !Qtx::dir( f, false ).isEmpty() )
01015     setDirectory( QFileInfo( f ).absolutePath() );
01016 }