• Skip to content
  • Skip to link menu
KDE 3.5 API Reference
  • KDE API Reference
  • API Reference
  • 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 <qobject.h>
00027 
00028 #include <kurl.h>
00029 #include <kio/global.h>
00030 #include <kio/authinfo.h>
00031 #include <kdatastream.h>
00032 
00033 namespace KIO {
00034 
00035 class Connection;
00036 // better there is one ...
00037 class SlaveInterfacePrivate;
00038 
00039   // Definition of enum Command has been moved to global.h
00040 
00044  enum Info {
00045    INF_TOTAL_SIZE = 10,
00046    INF_PROCESSED_SIZE = 11,
00047    INF_SPEED,
00048    INF_REDIRECTION = 20,
00049    INF_MIME_TYPE = 21,
00050    INF_ERROR_PAGE = 22,
00051    INF_WARNING = 23,
00052    INF_GETTING_FILE, // Deprecated
00053    INF_NEED_PASSWD = 25,
00054    INF_INFOMESSAGE,
00055    INF_META_DATA,
00056    INF_NETWORK_STATUS,
00057    INF_MESSAGEBOX
00058    // add new ones here once a release is done, to avoid breaking binary compatibility
00059  };
00060 
00064  enum Message {
00065    MSG_DATA = 100,
00066    MSG_DATA_REQ,
00067    MSG_ERROR,
00068    MSG_CONNECTED,
00069    MSG_FINISHED,
00070    MSG_STAT_ENTRY,
00071    MSG_LIST_ENTRIES,
00072    MSG_RENAMED, // unused
00073    MSG_RESUME,
00074    MSG_SLAVE_STATUS,
00075    MSG_SLAVE_ACK,
00076    MSG_NET_REQUEST,
00077    MSG_NET_DROP,
00078    MSG_NEED_SUBURL_DATA,
00079    MSG_CANRESUME,
00080    MSG_AUTH_KEY, // deprecated.
00081    MSG_DEL_AUTH_KEY // deprecated.
00082    // add new ones here once a release is done, to avoid breaking binary compatibility
00083  };
00084 
00092 class KIO_EXPORT SlaveInterface : public QObject
00093 {
00094     Q_OBJECT
00095 
00096 public:
00097     SlaveInterface( Connection *connection );
00098     virtual ~SlaveInterface();
00099 
00100     void setConnection( Connection* connection ) { m_pConnection = connection; }
00101     Connection *connection() const { return m_pConnection; }
00102 
00103     void setProgressId( int id ) { m_progressId = id; }
00104     int progressId() const { return m_progressId; }
00105 
00109     void sendResumeAnswer( bool resume );
00110 
00111     void setOffset( KIO::filesize_t offset );
00112     KIO::filesize_t offset() const;
00113 
00114 signals:
00116     // Messages sent by the slave
00118 
00119     void data( const QByteArray & );
00120     void dataReq( );
00121     void error( int , const QString & );
00122     void connected();
00123     void finished();
00124     void slaveStatus(pid_t, const QCString &, const QString &, bool);
00125     void listEntries( const KIO::UDSEntryList& );
00126     void statEntry( const KIO::UDSEntry& );
00127     void needSubURLData();
00128     void needProgressId();
00129 
00130     void canResume( KIO::filesize_t ) ;
00131 
00133     // Info sent by the slave
00135     void metaData( const KIO::MetaData & );
00136     void totalSize( KIO::filesize_t ) ;
00137     void processedSize( KIO::filesize_t ) ;
00138     void redirection( const KURL& ) ;
00139 
00140     void speed( unsigned long ) ;
00141     void errorPage() ;
00142     void mimeType( const QString & ) ;
00143     void warning( const QString & ) ;
00144     void infoMessage( const QString & ) ;
00145     void connectFinished();
00146 
00150     void authorizationKey( const QCString&, const QCString&, bool );
00151 
00155     void delAuthorization( const QCString& grpkey );
00156 
00157 protected:
00159     // Dispatching
00161 
00162     virtual bool dispatch();
00163     virtual bool dispatch( int _cmd, const QByteArray &data );
00164 
00204     void openPassDlg( KIO::AuthInfo& info );
00205 
00209     void openPassDlg( const QString& prompt, const QString& user,
00210                       const QString& caption, const QString& comment,
00211                       const QString& label, bool readOnly ) KDE_DEPRECATED;
00212 
00216     void openPassDlg( const QString& prompt, const QString& user, bool readOnly ) KDE_DEPRECATED;
00217 
00218     void messageBox( int type, const QString &text, const QString &caption,
00219                      const QString &buttonYes, const QString &buttonNo );
00220 
00224     void messageBox( int type, const QString &text, const QString &caption,
00225                      const QString &buttonYes, const QString &buttonNo, const QString &dontAskAgainName );
00226 
00227     // I need to identify the slaves
00228     void requestNetwork( const QString &, const QString &);
00229     void dropNetwork( const QString &, const QString &);
00230 
00235     static void sigpipe_handler(int);
00236 
00237 protected slots:
00238     void calcSpeed();
00239 
00240 protected:
00241     Connection * m_pConnection;
00242 
00243 private:
00244     int m_progressId;
00245 protected:
00246     virtual void virtual_hook( int id, void* data );
00247 private:
00248     SlaveInterfacePrivate *d;
00249 };
00250 
00251 }
00252 
00253 inline QDataStream &operator >>(QDataStream &s, KIO::UDSAtom &a )
00254 {
00255     Q_INT32 l;
00256     s >> a.m_uds;
00257 
00258     if ( a.m_uds & KIO::UDS_LONG ) {
00259         s >> l;
00260         a.m_long = l;
00261         a.m_str = QString::null;
00262     } else if ( a.m_uds & KIO::UDS_STRING ) {
00263         s >> a.m_str;
00264         a.m_long = 0;
00265     } else {} // DIE!
00266     //    assert( 0 );
00267 
00268     return s;
00269 }
00270 
00271 inline QDataStream &operator <<(QDataStream &s, const KIO::UDSAtom &a )
00272 {
00273     s << a.m_uds;
00274 
00275     if ( a.m_uds & KIO::UDS_LONG )
00276         s << (Q_INT32) a.m_long;
00277     else if ( a.m_uds & KIO::UDS_STRING )
00278         s << a.m_str;
00279     else {} // DIE!
00280     //    assert( 0 );
00281 
00282     return s;
00283 }
00284 
00285 KIO_EXPORT QDataStream &operator <<(QDataStream &s, const KIO::UDSEntry &e );
00286 KIO_EXPORT QDataStream &operator >>(QDataStream &s, KIO::UDSEntry &e );
00287 
00288 #endif

kio

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

API Reference

Skip menu "API Reference"
  • dcop
  • DNSSD
  • interfaces
  • Kate
  • kconf_update
  • KDECore
  • KDED
  • kdefx
  • KDEsu
  • kdeui
  • KDocTools
  • KHTML
  • KImgIO
  • KInit
  • kio
  • kioslave
  • KJS
  • KNewStuff
  • KParts
  • KUtils
Generated for API Reference by doxygen 1.5.9
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