00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __kio_slaveinterface_h
00021 #define __kio_slaveinterface_h
00022
00023 #include <unistd.h>
00024 #include <sys/types.h>
00025
00026 #include <QtCore/QObject>
00027
00028 #include <kio/global.h>
00029 #include <kio/udsentry.h>
00030 #include <kio/authinfo.h>
00031
00032 class KUrl;
00033
00034 namespace KIO {
00035
00036 class Connection;
00037
00038 class SlaveInterfacePrivate;
00039
00040
00041
00045 enum Info {
00046 INF_TOTAL_SIZE = 10,
00047 INF_PROCESSED_SIZE = 11,
00048 INF_SPEED,
00049 INF_REDIRECTION = 20,
00050 INF_MIME_TYPE = 21,
00051 INF_ERROR_PAGE = 22,
00052 INF_WARNING = 23,
00053 INF_GETTING_FILE,
00054 INF_UNUSED = 25,
00055 INF_INFOMESSAGE,
00056 INF_META_DATA,
00057 INF_NETWORK_STATUS,
00058 INF_MESSAGEBOX,
00059 INF_POSITION
00060
00061 };
00062
00066 enum Message {
00067 MSG_DATA = 100,
00068 MSG_DATA_REQ,
00069 MSG_ERROR,
00070 MSG_CONNECTED,
00071 MSG_FINISHED,
00072 MSG_STAT_ENTRY,
00073 MSG_LIST_ENTRIES,
00074 MSG_RENAMED,
00075 MSG_RESUME,
00076 MSG_SLAVE_STATUS,
00077 MSG_SLAVE_ACK,
00078 MSG_NET_REQUEST,
00079 MSG_NET_DROP,
00080 MSG_NEED_SUBURL_DATA,
00081 MSG_CANRESUME,
00082 MSG_AUTH_KEY,
00083 MSG_DEL_AUTH_KEY,
00084 MSG_OPENED,
00085 MSG_WRITTEN
00086
00087 };
00088
00096 class KIO_EXPORT SlaveInterface : public QObject
00097 {
00098 Q_OBJECT
00099
00100 protected:
00101 SlaveInterface(SlaveInterfacePrivate &dd, QObject *parent = 0);
00102 public:
00103 virtual ~SlaveInterface();
00104
00105 void setConnection( Connection* connection );
00106 Connection *connection() const;
00107
00108
00109
00110 void sendResumeAnswer( bool resume );
00111
00112 void setOffset( KIO::filesize_t offset );
00113 KIO::filesize_t offset() const;
00114
00115 Q_SIGNALS:
00117
00119
00120 void data( const QByteArray & );
00121 void dataReq( );
00122 void error( int , const QString & );
00123 void connected();
00124 void finished();
00125 void slaveStatus(pid_t, const QByteArray&, const QString &, bool);
00126 void listEntries( const KIO::UDSEntryList& );
00127 void statEntry( const KIO::UDSEntry& );
00128 void needSubUrlData();
00129
00130 void canResume( KIO::filesize_t );
00131
00132 void open();
00133 void written( KIO::filesize_t );
00134
00136
00138 void metaData( const KIO::MetaData & );
00139 void totalSize( KIO::filesize_t );
00140 void processedSize( KIO::filesize_t );
00141 void redirection( const KUrl& );
00142 void position( KIO::filesize_t );
00143
00144 void speed( unsigned long );
00145 void errorPage();
00146 void mimeType( const QString & );
00147 void warning( const QString & );
00148 void infoMessage( const QString & );
00149
00150
00151 protected:
00153
00155
00156 virtual bool dispatch();
00157 virtual bool dispatch( int _cmd, const QByteArray &data );
00158
00159 void messageBox( int type, const QString &text, const QString &caption,
00160 const QString &buttonYes, const QString &buttonNo );
00161
00162 void messageBox( int type, const QString &text, const QString &caption,
00163 const QString &buttonYes, const QString &buttonNo,
00164 const QString &dontAskAgainName );
00165
00166
00167 void requestNetwork( const QString &, const QString &);
00168 void dropNetwork( const QString &, const QString &);
00169
00170 protected Q_SLOTS:
00171 void calcSpeed();
00172
00173 protected:
00174 SlaveInterfacePrivate* const d_ptr;
00175 Q_DECLARE_PRIVATE(SlaveInterface)
00176 };
00177
00178 }
00179
00180
00181
00182
00183
00184 #endif