-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2023 CEA, EDF, OPEN CASCADE
//
-// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// 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, or (at your option) any later version.
//
-// 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.
//
-// 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
//
-// 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/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// File: QtxPathListEdit.cxx
// Author: Sergey TELKOV
//
\brief Constructor
\internal
*/
- Editor( QWidget* parent = 0 ) : QtxPathEdit( parent )
+ Editor( QWidget* parent = 0 ) : QtxPathEdit( parent, true )
{
layout()->setSpacing( 0 );
lineEdit()->setFrame( false );
\param option style option
\param index data model index
*/
-QWidget* QtxPathListEdit::Delegate::createEditor( QWidget* parent, const QStyleOptionViewItem& option,
- const QModelIndex& index ) const
+QWidget* QtxPathListEdit::Delegate::createEditor( QWidget* parent, const QStyleOptionViewItem& /*option*/,
+ const QModelIndex& /*index*/ ) const
{
return myPathEdit->createEditor( parent );
}
\param model data model
\param index data model index
*/
-void QtxPathListEdit::Delegate::setModelData( QWidget* editor, QAbstractItemModel* model,
+void QtxPathListEdit::Delegate::setModelData( QWidget* editor, QAbstractItemModel* /*model*/,
const QModelIndex& index ) const
{
myPathEdit->setModelData( editor, index );
\param rect selection rectangle
*/
void QtxPathListEdit::Delegate::drawFocus( QPainter* painter, const QStyleOptionViewItem& option,
- const QRect& rect ) const
+ const QRect& /*rect*/ ) const
{
QItemDelegate::drawFocus( painter, option, option.rect );
}
*/
QtxPathListEdit::QtxPathListEdit( const Qtx::PathType type, QWidget* parent )
: QFrame( parent ),
- myCompleter( 0 ),
myType( type ),
+ myCompleter( 0 ),
myDuplicate( false )
{
initialize();
*/
QtxPathListEdit::QtxPathListEdit( QWidget* parent )
: QFrame( parent ),
- myCompleter( 0 ),
myType( Qtx::PT_OpenFile ),
+ myCompleter( 0 ),
myDuplicate( false )
{
initialize();
if (found) {
if (found != myLastSelected) {
// it is forbidden to add directory more then once
- if ( !quietMode )
- QMessageBox::critical(this,
- tr("Error"),
- tr("Directory already specified."),
- tr("Ok"));
- myEdit->setFocus();
+ if ( !quietMode )
+ QMessageBox::critical(this,
+ tr("Error"),
+ tr("Directory already specified."),
+ tr("Ok"));
+ myEdit->setFocus();
return false;
}
}
else {
if (!dir.exists()) {
- if ( !quietMode && QMessageBox::information(this,
- tr("Warning"),
- tr("%1\n\nThe directory doesn't exist.\nAdd directory anyway?").arg(dir.absPath()),
- tr("Yes"), tr("No"), QString(), 1, 1) == 1) {
- myEdit->setFocus();
+ if ( !quietMode && QMessageBox::information(this,
+ tr("Warning"),
+ tr("%1\n\nThe directory doesn't exist.\nAdd directory anyway?").arg(dir.absPath()),
+ tr("Yes"), tr("No"), QString(), 1, 1) == 1) {
+ myEdit->setFocus();
return false;
- }
+ }
}
// append
appendDir(myLastSelected, dir.absPath());
if ( pathType() == Qtx::PT_SaveFile )
return true;
- bool ok = QFileInfo( str ).exists();
+ QFileInfo aFI = QFileInfo( Qtx::makeEnvVarSubst( str ) );
+ bool ok = aFI.exists();
if ( !ok && msg )
ok = QMessageBox::question( this, tr( "Warning" ), tr( "Path \"%1\" doesn't exist. Add it to list anyway?" ).arg( str ),
QMessageBox::Yes, QMessageBox::No ) == QMessageBox::Yes;
- if ( ok && QFileInfo( str ).exists() )
+ if ( ok && aFI.exists() )
{
switch ( pathType() )
{
case Qtx::PT_OpenFile:
- ok = QFileInfo( str ).isFile();
+ ok = aFI.isFile();
if ( !ok && msg )
QMessageBox::warning( this, tr( "Error" ), tr( "Location \"%1\" doesn't point to file" ).arg( str ) );
break;
case Qtx::PT_Directory:
- ok = QFileInfo( str ).isDir();
+ ok = aFI.isDir();
if ( !ok && msg )
QMessageBox::warning( this, tr( "Error" ), tr( "Location \"%1\" doesn't point to directory" ).arg( str ) );
break;
+ default:
+ break;
}
}