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

kio

slavebase.h

Go to the documentation of this file.
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., 51 Franklin Street, Fifth Floor,
00017    Boston, MA 02110-1301, 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 
00148     void listEntries( const UDSEntryList& _entry );
00149 
00157     bool canResume( KIO::filesize_t offset );
00158 
00159     /*
00160      * Call this at the beginning of get(), if the "resume" metadata was set
00161      * and resuming is implemented by this protocol.
00162      */
00163     void canResume();
00164 
00166     // Info Signals to send to the job
00168 
00174     void totalSize( KIO::filesize_t _bytes );
00180     void processedSize( KIO::filesize_t _bytes );
00181 
00193     void processedPercent( float percent );
00194 
00200     void speed( unsigned long _bytes_per_second );
00201 
00206     void redirection( const KURL &_url );
00207 
00213     void errorPage();
00214 
00219     void mimeType( const QString &_type );
00220 
00224     void warning( const QString &msg );
00225 
00230     void infoMessage( const QString &msg );
00231 
00232     enum MessageBoxType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4, Information = 5, SSLMessageBox = 6 };
00233 
00247     int messageBox( MessageBoxType type, const QString &text,
00248                     const QString &caption = QString::null,
00249                     const QString &buttonYes = QString::null,
00250                     const QString &buttonNo = QString::null );
00251 
00268     int messageBox( const QString &text, MessageBoxType type,
00269                     const QString &caption = QString::null,
00270                     const QString &buttonYes = QString::null,
00271                     const QString &buttonNo = QString::null,
00272                     const QString &dontAskAgainName = QString::null );
00273 
00278     void setMetaData(const QString &key, const QString &value);
00279 
00285     bool hasMetaData(const QString &key) const;
00286 
00291     QString metaData(const QString &key) const;
00292 
00298     bool hasMetaData(const QString &key);
00299 
00304     QString metaData(const QString &key);
00305 
00311     MetaData allMetaData() const { return mIncomingMetaData; }
00312 
00320     KConfigBase* config();
00321 
00328     KRemoteEncoding* remoteEncoding();
00329 
00330 
00332     // Commands sent by the job, the slave has to
00333     // override what it wants to implement
00335 
00347     virtual void setHost(const QString& host, int port, const QString& user, const QString& pass);
00348 
00352     virtual void setSubURL(const KURL&url);
00353 
00363     virtual void openConnection();
00364 
00373     virtual void closeConnection();
00374 
00381     virtual void get( const KURL& url );
00382 
00398     virtual void put( const KURL& url, int permissions, bool overwrite, bool resume );
00399 
00405     virtual void stat( const KURL& url );
00406 
00419     virtual void mimetype( const KURL& url );
00420 
00428     virtual void listDir( const KURL& url );
00429 
00437     virtual void mkdir( const KURL&url, int permissions );
00438 
00447     virtual void rename( const KURL& src, const KURL& dest, bool overwrite );
00448 
00456     virtual void symlink( const QString& target, const KURL& dest, bool overwrite );
00457 
00462     virtual void chmod( const KURL& url, int permissions );
00463 
00474     virtual void copy( const KURL &src, const KURL &dest, int permissions, bool overwrite );
00475 
00482     virtual void del( const KURL &url, bool isfile);
00483 
00484     // TODO KDE4: add setLinkDest() or something, to modify symlink targets.
00485     // Will be used for kio_file but also kio_remote (#97129)
00486 
00495     virtual void special( const QByteArray & data );
00496 
00504     virtual void multiGet( const QByteArray & data );
00505 
00510     virtual void slave_status();
00511 
00516     virtual void reparseConfiguration();
00517 
00518 
00522     int connectTimeout();
00523 
00527     int proxyConnectTimeout();
00528 
00533     int responseTimeout();
00534 
00539     int readTimeout();
00540 
00555     void setTimeoutSpecialCommand(int timeout, const QByteArray &data=QByteArray());
00556 
00560     static void sigsegv_handler(int);
00564     static void sigpipe_handler(int);
00565 
00567     // Dispatching (internal)
00569 
00573     virtual bool dispatch();
00577     virtual void dispatch( int command, const QByteArray &data );
00578 
00587     int readData( QByteArray &buffer );
00588 
00600     void listEntry( const UDSEntry& _entry, bool ready);
00601 
00606     void connectSlave(const QString& path);
00607     void disconnectSlave();
00608 
00658     bool openPassDlg( KIO::AuthInfo& info, const QString &errorMsg );
00659 
00664     bool openPassDlg( KIO::AuthInfo& info );
00665 
00693     bool checkCachedAuthentication( AuthInfo& info );
00694 
00701     bool cacheAuthentication( const AuthInfo& info );
00702 
00707     bool pingCacheDaemon() const;
00708 
00715     QString createAuthCacheKey( const KURL& url );
00716 
00724     void sendAuthenticationKey( const QCString& gKey, const QCString& key, bool keep );
00725 
00734     void delCachedAuthentication( const QString& key );
00735 
00740     void setMultipleAuthCaching( bool ) {};
00741 
00746     bool multipleAuthCaching() const { return false; }
00747 
00766     bool requestNetwork(const QString& host = QString::null);
00767 
00781     void dropNetwork(const QString& host = QString::null);
00782 
00787     DCOPClient *dcopClient();
00788 
00793     int waitForAnswer( int expected1, int expected2, QByteArray & data, int * pCmd = 0 );
00794 
00798     void sendMetaData();
00799 
00803     QCString mProtocol;
00804 
00805     Connection * m_pConnection;
00806 
00807     MetaData mOutgoingMetaData;
00808     MetaData mIncomingMetaData;
00809 
00816     bool wasKilled() const;
00817 
00822     void setKillFlag();
00823 
00824 protected:
00825     UDSEntryList pendingListEntries;
00826     uint listEntryCurrentSize;
00827     long listEntry_sec, listEntry_usec;
00828     Connection *appconn;
00829     QString mPoolSocket;
00830     QString mAppSocket;
00831     bool mConnectedToApp;
00832     static long s_seqNr;
00833     virtual void virtual_hook( int id, void* data );
00834 
00835 private:
00836     SlaveBasePrivate *d;
00837 };
00838 
00839 }
00840 
00841 #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