• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdelibs
  • Sitemap
  • Contact Us
 

KIO

slaveinterface.h

Go to the documentation of this file.
00001 /* This file is part of the KDE project
00002    Copyright (C) 2000 David Faure <faure@kde.org>
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 __kio_slaveinterface_h
00021 #define __kio_slaveinterface_h
00022 
00023 #include <unistd.h>
00024 #include <sys/types.h>
00025 
00026 #include <QtCore/QObject>
00027 #include <QtNetwork/QHostInfo>
00028 
00029 #include <kio/global.h>
00030 #include <kio/udsentry.h>
00031 #include <kio/authinfo.h>
00032 
00033 class KUrl;
00034 
00035 namespace KIO {
00036 
00037 class Connection;
00038 // better there is one ...
00039 class SlaveInterfacePrivate;
00040 
00041   // Definition of enum Command has been moved to global.h
00042 
00046  enum Info {
00047    INF_TOTAL_SIZE = 10,
00048    INF_PROCESSED_SIZE = 11,
00049    INF_SPEED,
00050    INF_REDIRECTION = 20,
00051    INF_MIME_TYPE = 21,
00052    INF_ERROR_PAGE = 22,
00053    INF_WARNING = 23,
00054    INF_GETTING_FILE, // Deprecated
00055    INF_UNUSED = 25, // now unused
00056    INF_INFOMESSAGE,
00057    INF_META_DATA,
00058    INF_NETWORK_STATUS,
00059    INF_MESSAGEBOX,
00060    INF_POSITION
00061    // add new ones here once a release is done, to avoid breaking binary compatibility
00062  };
00063 
00067  enum Message {
00068    MSG_DATA = 100,
00069    MSG_DATA_REQ,
00070    MSG_ERROR,
00071    MSG_CONNECTED,
00072    MSG_FINISHED,
00073    MSG_STAT_ENTRY, // 105
00074    MSG_LIST_ENTRIES,
00075    MSG_RENAMED, // unused
00076    MSG_RESUME,
00077    MSG_SLAVE_STATUS,
00078    MSG_SLAVE_ACK, // 110
00079    MSG_NET_REQUEST,
00080    MSG_NET_DROP,
00081    MSG_NEED_SUBURL_DATA,
00082    MSG_CANRESUME,
00083    MSG_AUTH_KEY, // 115 // deprecated.
00084    MSG_DEL_AUTH_KEY, // deprecated.
00085    MSG_OPENED,
00086    MSG_WRITTEN,
00087    MSG_HOST_INFO_REQ
00088    // add new ones here once a release is done, to avoid breaking binary compatibility
00089  };
00090 
00098 class KIO_EXPORT SlaveInterface : public QObject
00099 {
00100     Q_OBJECT
00101 
00102 protected:
00103     SlaveInterface(SlaveInterfacePrivate &dd, QObject *parent = 0);
00104 public:
00105     virtual ~SlaveInterface();
00106 
00107     void setConnection( Connection* connection );
00108     Connection *connection() const;
00109 
00110     // Send our answer to the MSG_RESUME (canResume) request
00111     // (to tell the "put" job whether to resume or not)
00112     void sendResumeAnswer( bool resume );
00113 
00114     void setOffset( KIO::filesize_t offset );
00115     KIO::filesize_t offset() const;
00116 
00117 Q_SIGNALS:
00119     // Messages sent by the slave
00121 
00122     void data( const QByteArray & );
00123     void dataReq( );
00124     void error( int , const QString & );
00125     void connected();
00126     void finished();
00127     void slaveStatus(pid_t, const QByteArray&, const QString &, bool);
00128     void listEntries( const KIO::UDSEntryList& );
00129     void statEntry( const KIO::UDSEntry& );
00130     void needSubUrlData();
00131 
00132     void canResume( KIO::filesize_t );
00133 
00134     void open();
00135     void written( KIO::filesize_t );
00136 
00138     // Info sent by the slave
00140     void metaData( const KIO::MetaData & );
00141     void totalSize( KIO::filesize_t );
00142     void processedSize( KIO::filesize_t );
00143     void redirection( const KUrl& );
00144     void position( KIO::filesize_t );
00145 
00146     void speed( unsigned long );
00147     void errorPage();
00148     void mimeType( const QString & );
00149     void warning( const QString & );
00150     void infoMessage( const QString & );
00151     //void connectFinished(); //it does not get emitted anywhere
00152 
00153 protected:
00155     // Dispatching
00157 
00158     virtual bool dispatch();
00159     virtual bool dispatch( int _cmd, const QByteArray &data );
00160 
00161     void messageBox( int type, const QString &text, const QString &caption,
00162                      const QString &buttonYes, const QString &buttonNo );
00163 
00164     void messageBox( int type, const QString &text, const QString &caption,
00165                      const QString &buttonYes, const QString &buttonNo,
00166                      const QString &dontAskAgainName );
00167 
00168     // I need to identify the slaves
00169     void requestNetwork( const QString &, const QString &);
00170     void dropNetwork( const QString &, const QString &);
00171 
00172 protected Q_SLOTS:
00173     void calcSpeed();
00174 protected:
00175     SlaveInterfacePrivate* const d_ptr;
00176     Q_DECLARE_PRIVATE(SlaveInterface)
00177 private:
00178     Q_PRIVATE_SLOT(d_func(), void slotHostInfo(QHostInfo))
00179 };
00180 
00181 }
00182 
00183 // moved to udesentry.cpp!!!
00184 // KIO_EXPORT QDataStream &operator <<(QDataStream &s, const KIO::UDSEntry &e );
00185 // KIO_EXPORT QDataStream &operator >>(QDataStream &s, KIO::UDSEntry &e );
00186 
00187 #endif

KIO

Skip menu "KIO"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal