[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdevplatform/shell
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2007-09-30 22:07:02
Message-ID: 1191190022.307120.13551.nullmailer () svn ! kde ! org
[Download RAW message or body]

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<ProjectFolderItem*> folder_list = top->folderList();
                 foreach( ProjectFolderItem *folder, folder_list )
                 {
@@ -370,6 +373,19 @@
                             break;
                         }
                     }
+                    QList<ProjectTargetItem*> target_list = top->targetList();
+                    foreach( ProjectTargetItem *target, target_list )
+                    {
+                        QList<ProjectFileItem*> 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;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic