forwardingslavebase.h
00001 /* This file is part of the KDE project 00002 Copyright (c) 2004 Kevin Ottens <ervin ipsquad net> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) any later version. 00008 00009 This library is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public License 00015 along with this library; see the file COPYING.LIB. If not, write to 00016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00017 Boston, MA 02110-1301, USA. 00018 */ 00019 00020 #ifndef _FORWARDING_SLAVE_BASE_H_ 00021 #define _FORWARDING_SLAVE_BASE_H_ 00022 00023 #include <kio/slavebase.h> 00024 #include <kio/jobclasses.h> 00025 00026 #include <tqobject.h> 00027 00028 namespace KIO 00029 { 00030 00031 class ForwardingSlaveBasePrivate; 00032 00088 class KIO_EXPORT ForwardingSlaveBase : public TQObject, public SlaveBase 00089 { 00090 Q_OBJECT 00091 public: 00092 ForwardingSlaveBase(const TQCString &protocol, 00093 const TQCString &poolSocket, 00094 const TQCString &appSocket); 00095 virtual ~ForwardingSlaveBase(); 00096 00097 virtual void get(const KURL &url); 00098 00099 virtual void put(const KURL &url, int permissions, 00100 bool overwrite, bool resume); 00101 00102 virtual void stat(const KURL &url); 00103 00104 virtual void mimetype(const KURL &url); 00105 00106 virtual void listDir(const KURL &url); 00107 00108 virtual void mkdir(const KURL &url, int permissions); 00109 00110 virtual void rename(const KURL &src, const KURL &dest, bool overwrite); 00111 00112 virtual void symlink(const TQString &target, const KURL &dest, 00113 bool overwrite); 00114 00115 virtual void chmod(const KURL &url, int permissions); 00116 00117 virtual void copy(const KURL &src, const KURL &dest, 00118 int permissions, bool overwrite); 00119 00120 virtual void del(const KURL &url, bool isfile); 00121 00122 protected: 00135 virtual bool rewriteURL(const KURL &url, KURL &newURL)=0; 00136 00147 virtual void prepareUDSEntry(KIO::UDSEntry &entry, 00148 bool listing=false) const; 00149 00154 KURL processedURL() const { return m_processedURL; } 00155 00160 KURL requestedURL() const { return m_requestedURL; } 00161 00162 private: 00163 KURL m_processedURL; 00164 KURL m_requestedURL; 00165 ForwardingSlaveBasePrivate *d; 00166 00167 bool internalRewriteURL(const KURL &url, KURL &newURL); 00168 00169 void connectJob(Job *job); 00170 void connectSimpleJob(SimpleJob *job); 00171 void connectListJob(ListJob *job); 00172 void connectTransferJob(TransferJob *job); 00173 00174 private slots: 00175 // KIO::Job 00176 void slotResult(KIO::Job *job); 00177 void slotWarning(KIO::Job *job, const TQString &msg); 00178 void slotInfoMessage(KIO::Job *job, const TQString &msg); 00179 void slotTotalSize(KIO::Job *job, KIO::filesize_t size); 00180 void slotProcessedSize(KIO::Job *job, KIO::filesize_t size); 00181 void slotSpeed(KIO::Job *job, unsigned long bytesPerSecond); 00182 00183 // KIO::SimpleJob subclasses 00184 void slotRedirection(KIO::Job *job, const KURL &url); 00185 00186 // KIO::ListJob 00187 void slotEntries(KIO::Job *job, const KIO::UDSEntryList &entries); 00188 00189 // KIO::TransferJob 00190 void slotData(KIO::Job *job, const TQByteArray &data); 00191 void slotDataReq(KIO::Job *job, TQByteArray &data); 00192 void slotMimetype (KIO::Job *job, const TQString &type); 00193 void slotCanResume (KIO::Job *job, KIO::filesize_t offset); 00194 }; 00195 00196 } 00197 00198 #endif