strange FTP behaviour

Jens Herden jens at kdewebdev.org
Fri Jul 23 08:20:15 BST 2004


Hi David!

> > I try to debug a nasty Quanta problem and I came to some observations I
> > don't understand. As they are unrelated to Quanta I will describe them
> > here and hope someone can tell me the background.
> >
> > I have two Konqi windows open. Both show the same folder on a FTP server,
> > in my case running on localhost.
> >
> > 1. If I delete on file in one window the file disappears in the second
> > one. This is fine and expected.
>
> Yes, KDirWatch notification, i.e. a DCOP signal emitted by KIO.
>
> > 2. If I copy a new file into one window via drag and drop the file pops
> > up in the other window. Very good!
>
> Ditto.
>
> > 3. If I open a file in one window with kwrite and make a save as into the
> > displayed folder nothing shows up.
>
> Right. Please try this patch.

I did and it worked great, thank you. 
But then I started thinking about it and I have some questions I'd like to 
ask.
I understand that this patch solves the problem for every software that uses 
parts. And I wonder if this is the right place to fix it? Can't there be a 
solution inside of KIO? That would save the new include in part.cpp and make 
it a more general solution. 
I did look around and found this in kio/job.cpp this:

void SimpleJob::slotFinished( )
{
    // Return slave to the scheduler
    slaveDone();

    if (subjobs.isEmpty())
    {
        if ( !m_error )
        {
            KDirNotify_stub allDirNotify( "*", "KDirNotify*" );
            if ( m_command == CMD_MKDIR )
            {
                KURL urlDir( url() );
                urlDir.setPath( urlDir.directory() );
                allDirNotify.FilesAdded( urlDir );
            }
            else if ( m_command == CMD_RENAME )
            {
                KURL src, dst;
                QDataStream str( m_packedArgs, IO_ReadOnly );
                str >> src >> dst;
                if ( src.directory() == dst.directory() ) // For the user, 
moving isn't renaming. Only renaming is.
                    allDirNotify.FileRenamed( src, dst );
            }

My idea was to add a test for CMD_COPY in the first if statement. This would 
notify for each copy too. 
But I am not familiar with this code and don't know which consequences this 
might have. What do you think?

BTW. why is allDirNotify always created even if the command is not CMD_COPY or 
CMD_RENAME? I guess it would be a bit faster to test first m_command before 
creating allDirNotify.

Thanks again

Jens




More information about the kde-core-devel mailing list