SVN commit 719326 by apaku: Be a bit more robust against failing imports of project files. Fix fileForUrl() by also checking the targets of a given folder as managers might put the files under the targets. M +19 -3 project.cpp --- trunk/KDE/kdevplatform/shell/project.cpp #719325:719326 @@ -259,9 +259,12 @@ if ( d->manager && iface ) { // ProjectModel* model = Core::self()->projectController()->projectModel(); - d->topItem = iface->import( this ); + d->topItem = iface->import( this ); + if( !d->topItem ) + { + return false; + } // model->insertRow( model->rowCount(), d->topItem ); - ImportProjectJob* importJob = new ImportProjectJob( d->topItem, iface ); connect( importJob, SIGNAL( result( KJob* ) ), this, SLOT( importDone( KJob* ) ) ); importJob->start(); //be asynchronous @@ -349,7 +352,7 @@ u = top->url(); if ( u.isParentOf( url ) ) { - ProjectFolderItem *parent = 0L; + ProjectFolderItem *parent = 0; QList folder_list = top->folderList(); foreach( ProjectFolderItem *folder, folder_list ) { @@ -370,6 +373,19 @@ break; } } + QList target_list = top->targetList(); + foreach( ProjectTargetItem *target, target_list ) + { + QList targetfile_list = target->fileList(); + foreach( ProjectFileItem *file, targetfile_list ) + { + if ( file->url() == url ) + { + return file; //we found it + break; + } + } + } return 0; //not in the project } top = parent;