rename file

Andreas Pakulat apaku at gmx.de
Sun Nov 15 09:12:58 UTC 2009


On 15.11.09 01:24:45, Aleix Pol wrote:
> hi,
> we discussed with milian about moving the default renameFile/Folder to the
> default iprojectfilemanager implementation.
> 
> the code would look like that:
> 
> bool IProjectFileManager::renameFile(ProjectFileItem* it, const KUrl&
> newUrl)
> {
>     KIO::CopyJob* job=KIO::move(it->url(), newUrl);
>     bool ret=KIO::NetAccess::synchronousRun(job, 0);
> 
>     if(ret) {
>         it->project()->removeFromFileSet(IndexedString(it->url()));
>         it->setText(newUrl.fileName(KUrl::IgnoreTrailingSlash));
>         it->setUrl(newUrl);
>         it->project()->addToFileSet(IndexedString(it->url()));
>     }
>     return ret;
> }
> 
> The problem is that if we use it, we have to make kdevprojectinterface to
> link against language.

How about having an AbstractFileManager subclass that has this
implementation? Maybe I'm doing too much Java these days, but an IXXX for
me is something that has only pure virtual methods (except the destructor).

I'm not sure wether my linking-background is correct, but IIRC you could
make the above method purely inline and wouldn't need linking against
language then - only plugins actually using the method would need that
then. (i.e. plugins using project for something else wouldn't need to link
language)

On the other hand, just linking against language is not a big deal anyway,
as long as its not in the public API of the project library. Because then
plugins won't link against language themselves.

Andreas

-- 
You are fairminded, just and loving.




More information about the KDevelop-devel mailing list