Mercurial > retraceit
diff src/folderselectdialog.cpp @ 79:ca8d3cfe8ba1 1.0.0
Do not check path existence while typing
Checking if a path exists can be expensive especially
for network paths. So we only do this now once the
user hits "Go"
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 16 Jun 2015 12:36:37 +0200 |
parents | de148cd023a1 |
children | 90c297a2a3dd |
line wrap: on
line diff
--- a/src/folderselectdialog.cpp Tue Jun 16 12:35:16 2015 +0200 +++ b/src/folderselectdialog.cpp Tue Jun 16 12:36:37 2015 +0200 @@ -79,6 +79,8 @@ folderChangeArea->addWidget(mGoButton); connect(mGoButton, &QPushButton::clicked, this, &FolderSelectDialog::goClicked); + connect(mPathLineEdit, &QLineEdit::returnPressed, this, + &FolderSelectDialog::goClicked); } mFilterWidget = new FilterWidget(mSortModel); @@ -118,21 +120,22 @@ void FolderSelectDialog::pathLineChanged() { const QString path = mPathLineEdit->text(); - qDebug() << "path: " << path; if (path.isEmpty()) { mGoButton->setEnabled(false); return; } - QDir dir(path); - if (dir.exists()) { - mGoButton->setEnabled(true); - return; - } - mGoButton->setEnabled(false); + mGoButton->setEnabled(true); } void FolderSelectDialog::goClicked() { + const QString path = mPathLineEdit->text(); + QDir dir(path); + if (!dir.exists()) { + QMessageBox::warning(this, tr("Error!"), tr("Failed to access directory: '%1'").arg(path)); + mGoButton->setEnabled(false); + return; + } setFolder(mPathLineEdit->text()); QSettings settings; /* assuming go is only available in root folder mode */