• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.10.2 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 
186  void totalSize( KIO::filesize_t _bytes );
192  void processedSize( KIO::filesize_t _bytes );
193 
194  void position( KIO::filesize_t _pos );
195 
196  void written( KIO::filesize_t _bytes );
197 
209  void processedPercent( float percent );
210 
216  void speed( unsigned long _bytes_per_second );
217 
222  void redirection( const KUrl &_url );
223 
229  void errorPage();
230 
235  void mimeType( const QString &_type );
236 
240  void warning( const QString &msg );
241 
246  void infoMessage( const QString &msg );
247 
248  enum MessageBoxType { QuestionYesNo = 1, WarningYesNo = 2, WarningContinueCancel = 3, WarningYesNoCancel = 4, Information = 5, SSLMessageBox = 6 };
249 
263  int messageBox( MessageBoxType type, const QString &text,
264  const QString &caption = QString(),
265  const QString &buttonYes = i18n("&Yes"),
266  const QString &buttonNo = i18n("&No"));
267 
283  int messageBox( const QString &text, MessageBoxType type,
284  const QString &caption = QString(),
285  const QString &buttonYes = i18n("&Yes"),
286  const QString &buttonNo = i18n("&No"),
287  const QString &dontAskAgainName = QString() );
288 
293  void setMetaData(const QString &key, const QString &value);
294 
299  bool hasMetaData(const QString &key) const;
300 
304  QString metaData(const QString &key) const;
305 
306 
311  MetaData allMetaData() const;
312 
320  KConfigGroup* config();
321 
326  KRemoteEncoding* remoteEncoding();
327 
328 
330  // Commands sent by the job, the slave has to
331  // override what it wants to implement
333 
345  virtual void setHost(const QString& host, quint16 port, const QString& user, const QString& pass);
346 
350  virtual void setSubUrl(const KUrl&url);
351 
361  virtual void openConnection();
362 
371  virtual void closeConnection();
372 
392  virtual void get( const KUrl& url );
393 
400  virtual void open( const KUrl &url, QIODevice::OpenMode mode );
401 
402  virtual void read( KIO::filesize_t size );
403  virtual void write( const QByteArray &data );
404  virtual void seek( KIO::filesize_t offset );
405  virtual void close();
406 
422  virtual void put( const KUrl& url, int permissions, JobFlags flags );
423 
439  virtual void stat( const KUrl& url );
440 
453  virtual void mimetype( const KUrl& url );
454 
461  virtual void listDir( const KUrl& url );
462 
470  virtual void mkdir( const KUrl&url, int permissions );
471 
498  virtual void rename( const KUrl& src, const KUrl& dest, JobFlags flags );
499 
507  virtual void symlink( const QString& target, const KUrl& dest, JobFlags flags );
508 
513  virtual void chmod( const KUrl& url, int permissions );
514 
519  virtual void chown( const KUrl& url, const QString& owner, const QString& group );
520 
528  virtual void setModificationTime( const KUrl& url, const QDateTime& mtime );
529 
554  virtual void copy( const KUrl &src, const KUrl &dest, int permissions, JobFlags flags );
555 
566  virtual void del( const KUrl &url, bool isfile);
567 
573  virtual void setLinkDest( const KUrl& url, const QString& target );
574 
583  virtual void special( const QByteArray & data );
584 
592  virtual void multiGet( const QByteArray & data );
593 
598  virtual void slave_status();
599 
604  virtual void reparseConfiguration();
605 
606 
610  int connectTimeout();
611 
615  int proxyConnectTimeout();
616 
621  int responseTimeout();
622 
627  int readTimeout();
628 
642  void setTimeoutSpecialCommand(int timeout, const QByteArray &data=QByteArray());
643 
645  // Dispatching (internal)
647 
651  virtual void dispatch( int command, const QByteArray &data );
652 
656  virtual void dispatchOpenCommand( int command, const QByteArray &data );
657 
666  int readData( QByteArray &buffer );
667 
679  void listEntry( const UDSEntry& _entry, bool ready);
680 
685  void connectSlave(const QString& path);
686  void disconnectSlave();
687 
740  bool openPasswordDialog( KIO::AuthInfo& info, const QString &errorMsg = QString() );
741 
769  bool checkCachedAuthentication( AuthInfo& info );
770 
797  bool cacheAuthentication( const AuthInfo& info );
798 
817  bool requestNetwork(const QString& host = QString());
818 
832  void dropNetwork(const QString& host = QString());
833 
838  int waitForAnswer( int expected1, int expected2, QByteArray & data, int * pCmd = 0 );
839 
852  void sendMetaData();
853 
860  void sendAndKeepMetaData();
861 
867  bool wasKilled() const;
868 
872  void setKillFlag();
873 
877  void lookupHost(const QString& host);
878 
882  int waitForHostInfo(QHostInfo& info);
883 
884 protected:
888  QByteArray mProtocol;
889  //Often used by TcpSlaveBase and unlikely to change
890  MetaData mOutgoingMetaData;
891  MetaData mIncomingMetaData;
892 
893  enum VirtualFunctionId {
894  AppConnectionMade = 0
895  };
896  virtual void virtual_hook( int id, void* data );
897 
898 private:
899 #if 0 // TODO KDE5: enable
900  // This helps catching missing tr() calls in error().
901  void error( int _errid, const QByteArray &_text );
902 #endif
903  void send(int cmd, const QByteArray& arr = QByteArray());
904  SlaveBasePrivate* const d;
905  friend class SlaveBasePrivate;
906 };
907 
908 }
909 
910 #endif
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Sat Apr 20 2013 06:03:12 by doxygen 1.8.3.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.10.2 API Reference

Skip menu "kdelibs-4.10.2 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