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 <tdeio/slavebase.h> 00024 #include <tdeio/jobclasses.h> 00025 00026 #include <tqobject.h> 00027 00028 namespace TDEIO 00029 { 00030 00031 class ForwardingSlaveBasePrivate; 00032 00088 class TDEIO_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 virtual void localURL(const KURL& remoteURL); 00123 00124 protected: 00137 virtual bool rewriteURL(const KURL &url, KURL &newURL)=0; 00138 00149 virtual void prepareUDSEntry(TDEIO::UDSEntry &entry, 00150 bool listing=false) const; 00151 00156 KURL processedURL() const { return m_processedURL; } 00157 00162 KURL requestedURL() const { return m_requestedURL; } 00163 00164 private: 00165 KURL m_processedURL; 00166 KURL m_requestedURL; 00167 ForwardingSlaveBasePrivate *d; 00168 00169 bool internalRewriteURL(const KURL &url, KURL &newURL); 00170 00171 void connectJob(Job *job); 00172 void connectSimpleJob(SimpleJob *job); 00173 void connectListJob(ListJob *job); 00174 void connectTransferJob(TransferJob *job); 00175 void connectLocalURLJob(LocalURLJob *job); 00176 00177 private slots: 00178 // TDEIO::Job 00179 void slotResult(TDEIO::Job *job); 00180 void slotWarning(TDEIO::Job *job, const TQString &msg); 00181 void slotInfoMessage(TDEIO::Job *job, const TQString &msg); 00182 void slotTotalSize(TDEIO::Job *job, TDEIO::filesize_t size); 00183 void slotProcessedSize(TDEIO::Job *job, TDEIO::filesize_t size); 00184 void slotSpeed(TDEIO::Job *job, unsigned long bytesPerSecond); 00185 00186 // TDEIO::SimpleJob subclasses 00187 void slotRedirection(TDEIO::Job *job, const KURL &url); 00188 00189 // TDEIO::ListJob 00190 void slotEntries(TDEIO::Job *job, const TDEIO::UDSEntryList &entries); 00191 00192 // TDEIO::TransferJob 00193 void slotData(TDEIO::Job *job, const TQByteArray &data); 00194 void slotDataReq(TDEIO::Job *job, TQByteArray &data); 00195 void slotMimetype (TDEIO::Job *job, const TQString &type); 00196 void slotCanResume (TDEIO::Job *job, TDEIO::filesize_t offset); 00197 00198 // TDEIO::LocalURLJob 00199 void slotLocalURL(TDEIO::LocalURLJob *, const KURL&, bool); 00200 }; 00201 00202 } 00203 00204 #endif