• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.8.5 API Reference
  • KDE Home
  • Contact Us
 

KIO

  • kio
  • kio
slavebase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2000 David Faure <faure@kde.org>
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 
20 #ifndef SLAVEBASE_H
21 #define SLAVEBASE_H
22 
23 #include <kio/global.h>
24 #include <kio/udsentry.h>
25 #include <kio/authinfo.h>
26 #include <kio/jobclasses.h> // for KIO::JobFlags
27 #include <klocale.h>
28 
29 #include <QtCore/QByteArray>
30 #include <QtNetwork/QHostInfo>
31 
32 class KConfigGroup;
33 class KRemoteEncoding;
34 class KUrl;
35 
36 namespace KIO {
37 
38 class Connection;
39 class SlaveBasePrivate;
40 
50 class KIO_EXPORT SlaveBase
51 {
52 public:
53  SlaveBase( const QByteArray &protocol, const QByteArray &pool_socket, const QByteArray &app_socket);
54  virtual ~SlaveBase();
55 
60  void exit();
61 
65  void dispatchLoop();
66 
68  // Message Signals to send to the job
70 
79  void data( const QByteArray &data );
80 
85  void dataReq( );
86 
91  void opened();
92 
121  void error( int _errid, const QString &_text );
122 
126  void connected();
127 
133  void finished();
134 
138  void needSubUrlData();
139 
146  void slaveStatus(const QString &host, bool connected);
147 
154  void statEntry( const UDSEntry& _entry );
155 
161  void listEntries( const UDSEntryList& _entry );
162 
170  bool canResume( KIO::filesize_t offset );
171 
176  void canResume();
177 
179  // Info Signals to send to the job
181 
187  void totalSize( KIO::filesize_t _bytes );
193  void processedSize( KIO::filesize_t _bytes );
194 
195  void position( KIO::filesize_t _pos );
196 
197  void written( KIO::filesize_t _bytes );
198 
210  void processedPercent( float percent );
211 
217  void speed( unsigned long _bytes_per_second );
218 
223  void redirection( const KUrl &_url );
224 
230  void errorPage();
231 
236  void mimeType( const QString &_type );
237 
241  void warning( const QString &msg );
242 
247  void infoMessage( const QString &msg );
248 
249  enum MessageBoxType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4, Information = 5, SSLMessageBox = 6 };
250 
264  int messageBox( MessageBoxType type, const QString &text,
265  const QString &caption = QString(),
266  const QString &buttonYes = i18n("&Yes"),
267  const QString &buttonNo = i18n("&No"));
268 
284  int messageBox( const QString &text, MessageBoxType type,
285  const QString &caption = QString(),
286  const QString &buttonYes = i18n("&Yes"),
287  const QString &buttonNo = i18n("&No"),
288  const QString &dontAskAgainName = QString() );
289 
294  void setMetaData(const QString &key, const QString &value);
295 
300  bool hasMetaData(const QString &key) const;
301 
305  QString metaData(const QString &key) const;
306 
307 
312  MetaData allMetaData() const;
313 
321  KConfigGroup* config();
322 
327  KRemoteEncoding* remoteEncoding();
328 
329 
331  // Commands sent by the job, the slave has to
332  // override what it wants to implement
334 
346  virtual void setHost(const QString& host, quint16 port, const QString& user, const QString& pass);
347 
351  virtual void setSubUrl(const KUrl&url);
352 
362  virtual void openConnection();
363 
372  virtual void closeConnection();
373 
393  virtual void get( const KUrl& url );
394 
401  virtual void open( const KUrl &url, QIODevice::OpenMode mode );
402 
403  virtual void read( KIO::filesize_t size );
404  virtual void write( const QByteArray &data );
405  virtual void seek( KIO::filesize_t offset );
406  virtual void close();
407 
423  virtual void put( const KUrl& url, int permissions, JobFlags flags );
424 
440  virtual void stat( const KUrl& url );
441 
454  virtual void mimetype( const KUrl& url );
455 
463  virtual void listDir( const KUrl& url );
464 
472  virtual void mkdir( const KUrl&url, int permissions );
473 
500  virtual void rename( const KUrl& src, const KUrl& dest, JobFlags flags );
501 
509  virtual void symlink( const QString& target, const KUrl& dest, JobFlags flags );
510 
515  virtual void chmod( const KUrl& url, int permissions );
516 
521  virtual void chown( const KUrl& url, const QString& owner, const QString& group );
522 
530  virtual void setModificationTime( const KUrl& url, const QDateTime& mtime );
531 
556  virtual void copy( const KUrl &src, const KUrl &dest, int permissions, JobFlags flags );
557 
568  virtual void del( const KUrl &url, bool isfile);
569 
575  virtual void setLinkDest( const KUrl& url, const QString& target );
576 
585  virtual void special( const QByteArray & data );
586 
594  virtual void multiGet( const QByteArray & data );
595 
600  virtual void slave_status();
601 
606  virtual void reparseConfiguration();
607 
608 
612  int connectTimeout();
613 
617  int proxyConnectTimeout();
618 
623  int responseTimeout();
624 
629  int readTimeout();
630 
644  void setTimeoutSpecialCommand(int timeout, const QByteArray &data=QByteArray());
645 
647  // Dispatching (internal)
649 
653  virtual void dispatch( int command, const QByteArray &data );
654 
658  virtual void dispatchOpenCommand( int command, const QByteArray &data );
659 
668  int readData( QByteArray &buffer );
669 
681  void listEntry( const UDSEntry& _entry, bool ready);
682 
687  void connectSlave(const QString& path);
688  void disconnectSlave();
689 
742  bool openPasswordDialog( KIO::AuthInfo& info, const QString &errorMsg = QString() );
743 
771  bool checkCachedAuthentication( AuthInfo& info );
772 
799  bool cacheAuthentication( const AuthInfo& info );
800 
819  bool requestNetwork(const QString& host = QString());
820 
834  void dropNetwork(const QString& host = QString());
835 
840  int waitForAnswer( int expected1, int expected2, QByteArray & data, int * pCmd = 0 );
841 
854  void sendMetaData();
855 
862  void sendAndKeepMetaData();
863 
869  bool wasKilled() const;
870 
874  void setKillFlag();
875 
879  void lookupHost(const QString& host);
880 
884  int waitForHostInfo(QHostInfo& info);
885 
886 protected:
890  QByteArray mProtocol;
891  //Often used by TcpSlaveBase and unlikely to change
892  MetaData mOutgoingMetaData;
893  MetaData mIncomingMetaData;
894 
895  enum VirtualFunctionId {
896  AppConnectionMade = 0
897  };
898  virtual void virtual_hook( int id, void* data );
899 
900 private:
901 #if 0 // TODO KDE5: enable
902  // This helps catching missing tr() calls in error().
903  void error( int _errid, const QByteArray &_text );
904 #endif
905  void send(int cmd, const QByteArray& arr = QByteArray());
906  SlaveBasePrivate* const d;
907  friend class SlaveBasePrivate;
908 };
909 
910 }
911 
912 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2012 The KDE developers.
Generated on Fri Nov 16 2012 15:10:14 by doxygen 1.8.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KIO

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

kdelibs-4.8.5 API Reference

Skip menu "kdelibs-4.8.5 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal