KDE/kdevplatform

Andreas Pakulat apaku at gmx.de
Sat Apr 4 22:27:03 UTC 2009


On 04.04.09 21:05:13, David Nolden wrote:
> SVN commit 949307 by zwabel:
> 
> Add "Open Project for Current Url" functionality, that automatically opens a .kdev4 file if there is one in the parent directories.
> Add menu item.

Hmm, whats the use-case? Opening a file via kdevelop foo.cpp and then
opening the related project? 

What if the .kdev4 file is not inside the source tree - that seems to be
a pretty common thing, IIRC we have at least 2 bugreports complaining
about the fact that kdevelop puts its files into the sourcedir.

Quite frankly with the recently-opened-projects menu and the automatic
reloading, I'm not sure this feature is something we really need. Just
because we can do something technically doesn't mean we should have it.
 
>  M  +5 -0      interfaces/iprojectcontroller.h  
>  M  +2 -2      shell/openprojectdialog.cpp  
>  M  +1 -1      shell/openprojectdialog.h  
>  M  +6 -2      shell/openprojectpage.cpp  
>  M  +1 -1      shell/openprojectpage.h  
>  M  +76 -3     shell/projectcontroller.cpp  
>  M  +9 -2      shell/projectcontroller.h  
>  M  +1 -1      shell/tests/projectcontrollertest.cpp  
> 
> 
> --- trunk/KDE/kdevplatform/interfaces/iprojectcontroller.h #949306:949307
> @@ -88,6 +88,11 @@
>  
>  public Q_SLOTS:
>      /**
> +     * Tries finding a project-file for the given source-url and opens it.
> +     * If no .kdev4 project file is found, the user is asked to import a project.
> +     */
> +        virtual void openProjectForUrl( const KUrl &sourceUrl ) = 0;

What is this member for? All the functionality is inside shell so I
currently don't see the need for this in the public API.

> @@ -354,6 +356,11 @@
>      d->m_recentAction->setWhatsThis(
>          i18n( "<b>Open recent project</b><p>Opens recently opened project.</p>" ) );
>      d->m_recentAction->loadEntries( KConfigGroup(config, "RecentProjects") );
> +    
> +    KAction* openProjectForFileAction = new KAction( this );
> +    ac->addAction("project_open_for_file", openProjectForFileAction);
> +    openProjectForFileAction->setText("Open Project for Current File");
> +    connect( openProjectForFileAction, SIGNAL(triggered(bool)), SLOT(openProjectForUrlSlot(bool)));

There's also a signal without bool parameter, could it be that this is a
bug in kdev4's signal/slot auto-completion ;)

> +void ProjectController::openProjectForUrl(const KUrl& sourceUrl) {
> +    KUrl dirUrl(sourceUrl);
> +    dirUrl.setFileName(QString());

This should be:

KUrl dirUrl = sourceUrl.upUrl();

Andreas

-- 
Better hope the life-inspector doesn't come around while you have your
life in such a mess.




More information about the KDevelop-devel mailing list