kio Library: slavebase.h Source File (kio Library)

| # kio Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# slavebase.h

    00001 /*
    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., 59 Temple Place - Suite 330,
    00017    Boston, MA 02111-1307, USA.
    00018 */
    00019
    00020 #ifndef __slavebase_h
    00021 #define __slavebase_h
    00022
    00023 #include <kurl.h>
    00024 #include <kconfigbase.h>
    00025 #include <kio/global.h>
    00026 #include <kio/authinfo.h>
    00027
    00028 class DCOPClient;
    00029 class KRemoteEncoding;
    00030
    00031 namespace KIO {
    00032
    00033 class Connection;
    00034 class SlaveBasePrivate;
    00035
    00045 class KIO_EXPORT SlaveBase
    00046 {
    00047 public:
    00048     SlaveBase( const QCString &protocol, const QCString &pool_socket, const QCString &app_socket);
    00049     virtual ~SlaveBase();
    00050
    00055     void exit();
    00056
    00060     void dispatchLoop();
    00061
    00065     void setConnection( Connection* connection ) { m_pConnection = connection; }
    00069     Connection *connection() const { return m_pConnection; }
    00070
    00071
    00073     // Message Signals to send to the job
    00075
    00084     void data( const QByteArray &data );
    00085
    00090     void dataReq( );
    00091
    00109     void error( int _errid, const QString &_text );
    00110
    00114     void connected();
    00115
    00120     void finished();
    00121
    00125     void needSubURLData();
    00126
    00133     void slaveStatus(const QString &host, bool connected);
    00134
    00141     void statEntry( const UDSEntry& _entry );
    00142
    00147     void listEntries( const UDSEntryList& _entry );
    00148
    00156     bool canResume( KIO::filesize_t offset );
    00157
    00158     /*
    00159      * Call this at the beginning of get(), if the "resume" metadata was set
    00160      * and resuming is implemented by this protocol.
    00161      */
    00162     void canResume();
    00163
    00165     // Info Signals to send to the job
    00167
    00173     void totalSize( KIO::filesize_t _bytes );
    00179     void processedSize( KIO::filesize_t _bytes );
    00180
    00192     void processedPercent( float percent );
    00193
    00199     void speed( unsigned long _bytes_per_second );
    00200
    00205     void redirection( const KURL &_url );
    00206
    00212     void errorPage();
    00213
    00218     void mimeType( const QString &_type );
    00219
    00223     void warning( const QString &msg );
    00224
    00229     void infoMessage( const QString &msg );
    00230
    00231     enum MessageBoxType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4, Information = 5, SSLMessageBox = 6 };
    00232
    00246     int messageBox( MessageBoxType type, const QString &text,
    00247                     const QString &caption = QString::null,
    00248                     const QString &buttonYes = QString::null,
    00249                     const QString &buttonNo = QString::null );
    00250
    00267     int messageBox( const QString &text, MessageBoxType type,
    00268                     const QString &caption = QString::null,
    00269                     const QString &buttonYes = QString::null,
    00270                     const QString &buttonNo = QString::null,
    00271                     const QString &dontAskAgainName = QString::null );
    00272
    00277     void setMetaData(const QString &key, const QString &value);
    00278
    00284     bool hasMetaData(const QString &key) const;
    00285
    00290     QString metaData(const QString &key) const;
    00291
    00297     bool hasMetaData(const QString &key);
    00298
    00303     QString metaData(const QString &key);
    00304
    00312     KConfigBase* config();
    00313
    00320     KRemoteEncoding* remoteEncoding();
    00321
    00322
    00324     // Commands sent by the job, the slave has to
    00325     // override what it wants to implement
    00327
    00339     virtual void setHost(const QString& host, int port, const QString& user, const QString& pass);
    00340
    00344     virtual void setSubURL(const KURL&url);
    00345
    00355     virtual void openConnection();
    00356
    00365     virtual void closeConnection();
    00366
    00373     virtual void get( const KURL& url );
    00374
    00384     virtual void put( const KURL& url, int permissions, bool overwrite, bool resume );
    00385
    00391     virtual void stat( const KURL& url );
    00392
    00405     virtual void mimetype( const KURL& url );
    00406
    00414     virtual void listDir( const KURL& url );
    00415
    00423     virtual void mkdir( const KURL&url, int permissions );
    00424
    00433     virtual void rename( const KURL& src, const KURL& dest, bool overwrite );
    00434
    00442     virtual void symlink( const QString& target, const KURL& dest, bool overwrite );
    00443
    00448     virtual void chmod( const KURL& url, int permissions );
    00449
    00460     virtual void copy( const KURL &src, const KURL &dest, int permissions, bool overwrite );
    00461
    00468     virtual void del( const KURL &url, bool isfile);
    00469
    00470     // TODO KDE4: add setLinkDest() or something, to modify symlink targets.
    00471     // Will be used for kio_file but also kio_remote (#97129)
    00472
    00481     virtual void special( const QByteArray & data );
    00482
    00490     virtual void multiGet( const QByteArray & data );
    00491
    00496     virtual void slave_status();
    00497
    00502     virtual void reparseConfiguration();
    00503
    00504
    00508     int connectTimeout();
    00509
    00513     int proxyConnectTimeout();
    00514
    00519     int responseTimeout();
    00520
    00525     int readTimeout();
    00526
    00541     void setTimeoutSpecialCommand(int timeout, const QByteArray &data=QByteArray());
    00542
    00546     static void sigsegv_handler(int);
    00550     static void sigpipe_handler(int);
    00551
    00553     // Dispatching (internal)
    00555
    00559     virtual bool dispatch();
    00563     virtual void dispatch( int command, const QByteArray &data );
    00564
    00573     int readData( QByteArray &buffer );
    00574
    00585     void listEntry( const UDSEntry& _entry, bool ready);
    00586
    00591     void connectSlave(const QString& path);
    00592     void disconnectSlave();
    00593
    00643     bool openPassDlg( KIO::AuthInfo& info, const QString &errorMsg );
    00644
    00649     bool openPassDlg( KIO::AuthInfo& info );
    00650
    00678     bool checkCachedAuthentication( AuthInfo& info );
    00679
    00686     bool cacheAuthentication( const AuthInfo& info );
    00687
    00692     bool pingCacheDaemon() const;
    00693
    00700     QString createAuthCacheKey( const KURL& url );
    00701
    00709     void sendAuthenticationKey( const QCString& gKey, const QCString& key, bool keep );
    00710
    00719     void delCachedAuthentication( const QString& key );
    00720
    00725     void setMultipleAuthCaching( bool ) {};
    00726
    00731     bool multipleAuthCaching() const { return false; }
    00732
    00751     bool requestNetwork(const QString& host = QString::null);
    00752
    00766     void dropNetwork(const QString& host = QString::null);
    00767
    00772     DCOPClient *dcopClient();
    00773
    00778     int waitForAnswer( int expected1, int expected2, QByteArray & data, int * pCmd = 0 );
    00779
    00783     void sendMetaData();
    00784
    00788     QCString mProtocol;
    00789
    00790     Connection * m_pConnection;
    00791
    00792     MetaData mOutgoingMetaData;
    00793     MetaData mIncomingMetaData;
    00794
    00801     bool wasKilled() const;
    00802
    00807     void setKillFlag();
    00808
    00809 protected:
    00810     UDSEntryList pendingListEntries;
    00811     uint listEntryCurrentSize;
    00812     long listEntry_sec, listEntry_usec;
    00813     Connection *appconn;
    00814     QString mPoolSocket;
    00815     QString mAppSocket;
    00816     bool mConnectedToApp;
    00817     static long s_seqNr;
    00818     virtual void virtual_hook( int id, void* data );
    00819
    00820 private:
    00821     SlaveBasePrivate *d;
    00822 };
    00823
    00824 }
    00825
    00826 #endif

This file is part of the documentation for kio Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:24:07 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003