| 480 | } |
| 481 | |
| 482 | void ImportProjectDialog::fileNameChanged(const QString& name) { |
| 483 | QString fileName{name}; |
| 484 | |
| 485 | // make relative path |
| 486 | #ifdef HAVE_WINDOWS |
| 487 | if (!fileName.isEmpty() && fileName.at(1) != QLatin1Char(':')) |
| 488 | #else |
| 489 | if (!fileName.isEmpty() && fileName.at(0) != QLatin1Char('/')) |
| 490 | #endif |
| 491 | fileName = QDir::homePath() + QStringLiteral("/") + fileName; |
| 492 | |
| 493 | bool fileExists = QFile::exists(fileName); |
| 494 | if (!fileExists) { |
| 495 | // file doesn't exist -> delete the content preview that is still potentially |
| 496 | // available from the previously selected file |
| 497 | delete ui.tvPreview->model(); |
| 498 | ui.tvPreview->setModel(nullptr); |
| 499 | m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); |
| 500 | return; |
| 501 | } |
| 502 | |
| 503 | refreshPreview(); |
| 504 | } |
| 505 | |
| 506 | void ImportProjectDialog::newFolder() { |
| 507 | const QString& path = m_cbFileName->currentText(); |
nothing calls this directly
no test coverage detected