| 559 | } |
| 560 | |
| 561 | QString ProjectFileDialog::getExistingDirectory(const QString &caption, bool trailingSlash) |
| 562 | { |
| 563 | const QFileInfo inf(mProjectFile->getFilename()); |
| 564 | const QString projectPath = inf.absolutePath(); |
| 565 | QString selectedDir = QFileDialog::getExistingDirectory(this, |
| 566 | caption, |
| 567 | projectPath); |
| 568 | |
| 569 | if (selectedDir.isEmpty()) |
| 570 | return QString(); |
| 571 | |
| 572 | // Check if the path is relative to project file's path and if so |
| 573 | // make it a relative path instead of absolute path. |
| 574 | const QDir dir(projectPath); |
| 575 | const QString relpath(dir.relativeFilePath(selectedDir)); |
| 576 | if (!relpath.startsWith("../..")) |
| 577 | selectedDir = relpath; |
| 578 | |
| 579 | // Trailing slash.. |
| 580 | if (trailingSlash && !selectedDir.endsWith('/')) |
| 581 | selectedDir += '/'; |
| 582 | |
| 583 | return selectedDir; |
| 584 | } |
| 585 | |
| 586 | void ProjectFileDialog::browseBuildDir() |
| 587 | { |
nothing calls this directly
no test coverage detected