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

List:       kde-commits
Subject:    branches/work/kio_virtualfile/kio/kio
From:       Allan Sandfeld Jensen <kde () carewolf ! com>
Date:       2006-07-05 13:29:50
Message-ID: 1152106190.077827.31301.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 558486 by carewolf:

Add KIO-file related commands


 M  +12 -0     global.h  
 M  +11 -0     slavebase.cpp  
 M  +14 -0     slavebase.h  
 M  +3 -0      slaveinterface.cpp  
 M  +3 -1      slaveinterface.h  


--- branches/work/kio_virtualfile/kio/kio/global.h #558485:558486
@@ -167,11 +167,23 @@
     CMD_CONFIG = 'U', // 85
     CMD_MULTI_GET = 'V', // 86
     CMD_SETLINKDEST = 'W' // 87
+    CMD_OPEN = 'X' // 88
     // Add new ones here once a release is done, to avoid breaking binary compatibility.
     // Note that protocol-specific commands shouldn't be added here, but should use special.
   };
 
   /**
+   * Commands that can be invoked on a slave-file.
+   */
+  enum FileCommand {
+    CMD_READ = 128,
+    CMD_STREAM = 129,
+    CMD_STOP = 130,
+    CMD_SEEK = 131,
+    CMD_CLOSE = 132
+  }
+
+  /**
    * Error codes that can be emitted by KIO.
    */
   enum Error {
--- branches/work/kio_virtualfile/kio/kio/slavebase.cpp #558485:558486
@@ -396,6 +396,15 @@
    m_pConnection->send( MSG_DATA_REQ );
 }
 
+void SlaveBase::data( void* fd )
+{
+   if (!mOutgoingMetaData.isEmpty())
+      sendMetaData();
+   slaveWriteError = false;
+   m_pConnection->send( MSG_FILE, fd );
+   if (slaveWriteError) exit();
+}
+
 void SlaveBase::error( int _errid, const QString &_text )
 {
     mIncomingMetaData.clear(); // Clear meta data
@@ -732,6 +741,8 @@
 { error(  ERR_UNSUPPORTED_ACTION, unsupportedActionErrorString(mProtocol, CMD_LISTDIR)); }
 void SlaveBase::get(KUrl const & )
 { error(  ERR_UNSUPPORTED_ACTION, unsupportedActionErrorString(mProtocol, CMD_GET)); }
+void SlaveBase::open(KUrl const & )
+{ error(  ERR_UNSUPPORTED_ACTION, unsupportedActionErrorString(mProtocol, CMD_GET)); }
 void SlaveBase::mimetype(KUrl const &url)
 { get(url); }
 void SlaveBase::rename(KUrl const &, KUrl const &, bool)
--- branches/work/kio_virtualfile/kio/kio/slavebase.h #558485:558486
@@ -91,6 +91,13 @@
     void dataReq( );
 
     /**
+     * Sends file in the slave to the job (i.e. in open).
+     *
+     * @param fd the filehandle
+     */
+    void file( void* fd);
+
+    /**
      * Call to signal an error.
      * This also finishes the job, no need to call finished.
      *
@@ -364,6 +371,13 @@
     virtual void get( const KUrl& url );
 
     /**
+     * open.
+     * @param url the full url for this request. Host, port and user of the URL
+     *        can be assumed to be the same as in the last setHost() call.
+     */
+    virtual void open( const KUrl& url );
+
+    /**
      * put, i.e. write data into a file.
      *
      * @param url where to write the file
--- branches/work/kio_virtualfile/kio/kio/slaveinterface.cpp #558485:558486
@@ -210,6 +210,9 @@
     case MSG_DATA_REQ:
         emit dataReq();
 	break;
+    case MSG_FILE:
+	emit file( rawdata );
+	break;
     case MSG_FINISHED:
 	//kDebug(7007) << "Finished [this = " << this << "]" << endl;
         d->offset = 0;
--- branches/work/kio_virtualfile/kio/kio/slaveinterface.h #558485:558486
@@ -79,7 +79,7 @@
    MSG_CANRESUME,
    MSG_AUTH_KEY, // deprecated.
    MSG_DEL_AUTH_KEY, // deprecated.
-   MSG_CANSEEK
+   MSG_FILE
    // add new ones here once a release is done, to avoid breaking binary compatibility
  };
 
@@ -129,6 +129,8 @@
 
     void canResume( KIO::filesize_t );
 
+    void file( void* );
+
     ///////////
     // Info sent by the slave
     //////////
[prev in list] [next in list] [prev in thread] [next in thread] 

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