| 377 | } |
| 378 | |
| 379 | bool writeProjectSettingsToConfigFile(const QUrl& projectFileUrl, OpenProjectDialog* dlg) |
| 380 | { |
| 381 | if ( !projectFileUrl.isLocalFile() ) { |
| 382 | QTemporaryFile tmp; |
| 383 | if ( !tmp.open() ) { |
| 384 | return false; |
| 385 | } |
| 386 | if ( !writeNewProjectFile( tmp.fileName(), dlg->projectName(), dlg->selectedUrl().fileName(), dlg->projectManager() ) ) { |
| 387 | return false; |
| 388 | } |
| 389 | // explicitly close file before uploading it, see also: https://bugs.kde.org/show_bug.cgi?id=254519 |
| 390 | tmp.close(); |
| 391 | |
| 392 | auto uploadJob = KIO::file_copy(QUrl::fromLocalFile(tmp.fileName()), projectFileUrl); |
| 393 | KJobWidgets::setWindow(uploadJob, Core::self()->uiControllerInternal()->defaultMainWindow()); |
| 394 | return uploadJob->exec(); |
| 395 | } |
| 396 | // Here and above we take .filename() part of the selectedUrl() to make it relative to the project root, |
| 397 | // thus keeping .kdev file relocatable |
| 398 | return writeNewProjectFile( projectFileUrl.toLocalFile(), dlg->projectName(), dlg->selectedUrl().fileName(), dlg->projectManager() ); |
| 399 | } |
| 400 | |
| 401 | |
| 402 | bool projectFileExists( const QUrl& u ) |
no test coverage detected