From 8682f8b3bf6235b77fa80055e5d0a5aa8d976233 Mon Sep 17 00:00:00 2001 From: mzn Date: Fri, 10 Feb 2006 12:59:25 +0000 Subject: [PATCH] Fix for PAL11177( A new quick directory is not saved if there's no "" line ). --- src/Qtx/QtxDirListEditor.cxx | 33 +++++++++++++++++++++++---------- src/Qtx/QtxDirListEditor.h | 2 +- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/src/Qtx/QtxDirListEditor.cxx b/src/Qtx/QtxDirListEditor.cxx index 0532cd77f..9ddfd7c3d 100644 --- a/src/Qtx/QtxDirListEditor.cxx +++ b/src/Qtx/QtxDirListEditor.cxx @@ -206,6 +206,18 @@ QtxDirListEditor::~QtxDirListEditor() */ void QtxDirListEditor::getPathList(QStringList& list) { + // Finish the path editing + if (myEdit) { + validate(true); + + myEdit->deleteLater(); + myBtn->deleteLater(); + myEdit = 0; + myBtn = 0; + myEdited = false; + myDirList->setFocus(); + } + list.clear(); for (unsigned i = 0; i < myDirList->count()-1; i++) list.append(myDirList->text(i)); @@ -224,11 +236,11 @@ void QtxDirListEditor::setPathList(const QStringList& list) { /*! Validates entered path, returns true if OK */ -bool QtxDirListEditor::validate() +bool QtxDirListEditor::validate( const bool quietMode ) { if ( myEdited ) { - QString dirPath = QFileInfo( myEdit->text().stripWhiteSpace() ).absFilePath(); + QString dirPath = QFileInfo( myEdit->text().stripWhiteSpace() ).filePath(); /* #ifndef WNT if ( dirPath.startsWith( "~") ) { @@ -285,20 +297,21 @@ bool QtxDirListEditor::validate() if (found) { if (found != myLastSelected) { // it is forbidden to add directory more then once - QMessageBox::critical(this, - tr("Error"), - tr("Directory already specified."), - tr("Ok")); + if ( !quietMode ) + QMessageBox::critical(this, + tr("Error"), + tr("Directory already specified."), + tr("Ok")); myEdit->setFocus(); return false; } } else { if (!dir.exists()) { - if ( QMessageBox::information(this, - tr("Warning"), - tr("%1\n\nThe directory doesn't exist.\nAdd directory anyway?").arg(dir.absPath()), - tr("Yes"), tr("No"), QString::null, 1, 1) == 1) { + 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::null, 1, 1) == 1) { myEdit->setFocus(); return false; } diff --git a/src/Qtx/QtxDirListEditor.h b/src/Qtx/QtxDirListEditor.h index 95e84228e..7851fc83a 100644 --- a/src/Qtx/QtxDirListEditor.h +++ b/src/Qtx/QtxDirListEditor.h @@ -74,7 +74,7 @@ protected: * \brief Validates entered path * \retval bool - returns status (true if OK) */ - bool validate(); + bool validate( const bool quietMode = false ); /*! * \brief Appends/changes path -- 2.39.2