• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeio/tdeio
 

tdeio/tdeio

slaveinterface.h

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 __tdeio_slaveinterface_h
00021 #define __tdeio_slaveinterface_h
00022 
00023 #include <unistd.h>
00024 #include <sys/types.h>
00025 
00026 #include <tqobject.h>
00027 
00028 #include <kurl.h>
00029 #include <tdeio/global.h>
00030 #include <tdeio/authinfo.h>
00031 #include <kdatastream.h>
00032 
00033 namespace TDEIO {
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    INF_LOCALURL
00059    // add new ones here once a release is done, to avoid breaking binary compatibility
00060  };
00061 
00065  enum Message {
00066    MSG_DATA = 100,
00067    MSG_DATA_REQ,
00068    MSG_ERROR,
00069    MSG_CONNECTED,
00070    MSG_FINISHED,
00071    MSG_STAT_ENTRY,
00072    MSG_LIST_ENTRIES,
00073    MSG_RENAMED, // unused
00074    MSG_RESUME,
00075    MSG_SLAVE_STATUS,
00076    MSG_SLAVE_ACK,
00077    MSG_NET_REQUEST,
00078    MSG_NET_DROP,
00079    MSG_NEED_SUBURL_DATA,
00080    MSG_CANRESUME,
00081    MSG_AUTH_KEY, // deprecated.
00082    MSG_DEL_AUTH_KEY // deprecated.
00083    // add new ones here once a release is done, to avoid breaking binary compatibility
00084  };
00085 
00093 class TDEIO_EXPORT SlaveInterface : public TQObject
00094 {
00095     Q_OBJECT
00096 
00097 public:
00098     SlaveInterface( Connection *connection );
00099     virtual ~SlaveInterface();
00100 
00101     void setConnection( Connection* connection ) { m_pConnection = connection; }
00102     Connection *connection() const { return m_pConnection; }
00103 
00104     void setProgressId( int id ) { m_progressId = id; }
00105     int progressId() const { return m_progressId; }
00106 
00110     void sendResumeAnswer( bool resume );
00111 
00112     void setOffset( TDEIO::filesize_t offset );
00113     TDEIO::filesize_t offset() const;
00114 
00115 signals:
00117     // Messages sent by the slave
00119 
00120     void data( const TQByteArray & );
00121     void dataReq( );
00122     void error( int , const TQString & );
00123     void connected();
00124     void finished();
00125     void slaveStatus(pid_t, const TQCString &, const TQString &, bool);
00126     void listEntries( const TDEIO::UDSEntryList& );
00127     void statEntry( const TDEIO::UDSEntry& );
00128     void needSubURLData();
00129     void needProgressId();
00130 
00131     void canResume( TDEIO::filesize_t ) ;
00132 
00134     // Info sent by the slave
00136     void metaData( const TDEIO::MetaData & );
00137     void totalSize( TDEIO::filesize_t ) ;
00138     void processedSize( TDEIO::filesize_t ) ;
00139     void redirection( const KURL& ) ;
00140     void localURL( const KURL&, bool ) ;
00141 
00142     void speed( unsigned long ) ;
00143     void errorPage() ;
00144     void mimeType( const TQString & ) ;
00145     void warning( const TQString & ) ;
00146     void infoMessage( const TQString & ) ;
00147     void connectFinished();
00148 
00152     void authorizationKey( const TQCString&, const TQCString&, bool );
00153 
00157     void delAuthorization( const TQCString& grpkey );
00158 
00159 protected:
00161     // Dispatching
00163 
00164     virtual bool dispatch();
00165     virtual bool dispatch( int _cmd, const TQByteArray &data );
00166 
00206     void openPassDlg( TDEIO::AuthInfo& info );
00207 
00211     void openPassDlg( const TQString& prompt, const TQString& user,
00212                       const TQString& caption, const TQString& comment,
00213                       const TQString& label, bool readOnly ) KDE_DEPRECATED;
00214 
00218     void openPassDlg( const TQString& prompt, const TQString& user, bool readOnly ) KDE_DEPRECATED;
00219 
00220     void messageBox( int type, const TQString &text, const TQString &caption,
00221                      const TQString &buttonYes, const TQString &buttonNo );
00222 
00226     void messageBox( int type, const TQString &text, const TQString &caption,
00227                      const TQString &buttonYes, const TQString &buttonNo, const TQString &dontAskAgainName );
00228 
00229     // I need to identify the slaves
00230     void requestNetwork( const TQString &, const TQString &);
00231     void dropNetwork( const TQString &, const TQString &);
00232 
00237     static void sigpipe_handler(int);
00238 
00239 protected slots:
00240     void calcSpeed();
00241 
00242 protected:
00243     Connection * m_pConnection;
00244 
00245 private:
00246     int m_progressId;
00247 protected:
00248     virtual void virtual_hook( int id, void* data );
00249 private:
00250     SlaveInterfacePrivate *d;
00251 };
00252 
00253 }
00254 
00255 inline TQDataStream &operator >>(TQDataStream &s, TDEIO::UDSAtom &a )
00256 {
00257     TQ_INT32 l;
00258     s >> a.m_uds;
00259 
00260     if ( a.m_uds & TDEIO::UDS_LONG ) {
00261         s >> l;
00262         a.m_long = l;
00263         a.m_str = TQString::null;
00264     } else if ( a.m_uds & TDEIO::UDS_STRING ) {
00265         s >> a.m_str;
00266         a.m_long = 0;
00267     } else {} // DIE!
00268     //    assert( 0 );
00269 
00270     return s;
00271 }
00272 
00273 inline TQDataStream &operator <<(TQDataStream &s, const TDEIO::UDSAtom &a )
00274 {
00275     s << a.m_uds;
00276 
00277     if ( a.m_uds & TDEIO::UDS_LONG )
00278         s << (TQ_INT32) a.m_long;
00279     else if ( a.m_uds & TDEIO::UDS_STRING )
00280         s << a.m_str;
00281     else {} // DIE!
00282     //    assert( 0 );
00283 
00284     return s;
00285 }
00286 
00287 TDEIO_EXPORT TQDataStream &operator <<(TQDataStream &s, const TDEIO::UDSEntry &e );
00288 TDEIO_EXPORT TQDataStream &operator >>(TQDataStream &s, TDEIO::UDSEntry &e );
00289 
00290 #endif

tdeio/tdeio

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

tdeio/tdeio

Skip menu "tdeio/tdeio"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeio/tdeio by doxygen 1.6.3
This website is maintained by Timothy Pearson.