• Skip to content
  • Skip to link menu
KDE 4.1 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 
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 // better there is one ...
00038 class SlaveInterfacePrivate;
00039 
00040   // Definition of enum Command has been moved to global.h
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, // Deprecated
00054    INF_UNUSED = 25, // now unused
00055    INF_INFOMESSAGE,
00056    INF_META_DATA,
00057    INF_NETWORK_STATUS,
00058    INF_MESSAGEBOX,
00059    INF_POSITION
00060    // add new ones here once a release is done, to avoid breaking binary compatibility
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, // 105
00073    MSG_LIST_ENTRIES,
00074    MSG_RENAMED, // unused
00075    MSG_RESUME,
00076    MSG_SLAVE_STATUS,
00077    MSG_SLAVE_ACK, // 110
00078    MSG_NET_REQUEST,
00079    MSG_NET_DROP,
00080    MSG_NEED_SUBURL_DATA,
00081    MSG_CANRESUME,
00082    MSG_AUTH_KEY, // 115 // deprecated.
00083    MSG_DEL_AUTH_KEY, // deprecated.
00084    MSG_OPENED,
00085    MSG_WRITTEN
00086    // add new ones here once a release is done, to avoid breaking binary compatibility
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     // Send our answer to the MSG_RESUME (canResume) request
00109     // (to tell the "put" job whether to resume or not)
00110     void sendResumeAnswer( bool resume );
00111 
00112     void setOffset( KIO::filesize_t offset );
00113     KIO::filesize_t offset() const;
00114 
00115 Q_SIGNALS:
00117     // Messages sent by the slave
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     // Info sent by the slave
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     //void connectFinished(); //it does not get emitted anywhere
00150 
00151 protected:
00153     // Dispatching
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     // I need to identify the slaves
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 // moved to udesentry.cpp!!!
00181 // KIO_EXPORT QDataStream &operator <<(QDataStream &s, const KIO::UDSEntry &e );
00182 // KIO_EXPORT QDataStream &operator >>(QDataStream &s, KIO::UDSEntry &e );
00183 
00184 #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
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
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