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

List:       kde-devel
Subject:    Re: File size of a put operation in an IOSlave
From:       David Faure <faure () kde ! org>
Date:       2007-03-16 17:16:28
Message-ID: 200703161816.29374.faure () kde ! org
[Download RAW message or body]

On Friday 16 March 2007, Craig Howard wrote:
> KDE3 did not provide a way to get the size and I haven't seen KDE4 add that 
> capability.  I think it could be made standard to pass the file size through 
> the metadata, but that seems wrong.  

Since the information isn't necessary to all implementations, and since it can't \
always be passed along, I think metadata actually fits the bill quite well.
I thought we already passed it when known, but indeed we don't; I was confusing with
FileCopyJob::setSourceSize(), which is used inside kio but not passed to the slave \
(see below).

Worse: FileCopyJob starts the put before we start the get, so we really can't pass \
the size to put before the get job tells us. Which also means the put implementation \
can't ask too early :/

Vague idea of the beginning of a patch:
The first hunk is about passing the source size from setSourceSize() to the put job,
the other half of the work would be to pass along the value from totalSize() of the \
get job. But in both cases, we have to check the metadata actually makes it to the \
put job, it might be too late to set metadata at that point....

Index: job.cpp
===================================================================
--- job.cpp     (revision 637688)
+++ job.cpp     (working copy)
@@ -1788,8 +1788,10 @@ void FileCopyJob::slotCanResume( KIO::Jo
             m_getJob->addMetaData( "errorPage", "false" );
             m_getJob->addMetaData( "AllowCompressedPage", "false" );
             // Set size in subjob. This helps if the slave doesn't emit totalSize.
-            if ( d->m_sourceSize != (KIO::filesize_t)-1 )
+            if ( d->m_sourceSize != (KIO::filesize_t)-1 ) {
                 m_getJob->slotTotalSize( d->m_sourceSize );
+                m_putJob->addMetaData("size", d->m_sourceSize);
+            }
             if (offset)
             {
                 //kdDebug(7007) << "Setting metadata for resume to " << (unsigned \
long) offset << endl; @@ -1808,6 +1810,7 @@ void FileCopyJob::slotCanResume( KIO::Jo
             connectSubjob( m_getJob ); // Progress info depends on get
             m_getJob->resume(); // Order a beer

+            // TODO connect to m_getJob's totalSize signal, and do \
m_putJob->addMetaData("size", ....) there  connect( m_getJob, \
SIGNAL(data(KIO::Job*,const QByteArray&)),  SLOT( slotData(KIO::Job*,const \
                QByteArray&)) );
             connect( m_getJob, SIGNAL(mimetype(KIO::Job*,const QString&) ),

-- 
David Faure, faure@kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
 
> > Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


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

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