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

KIO

  • sources
  • kde-4.12
  • kdelibs
  • kio
  • kio
jobclasses.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 /* This file is part of the KDE libraries
3  Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
4  2000-2009 David Faure <faure@kde.org>
5 
6  This library is free software; you can redistribute it and/or
7  modify it under the terms of the GNU Library General Public
8  License as published by the Free Software Foundation; either
9  version 2 of the License, or (at your option) any later version.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef KIO_JOBCLASSES_H
23 #define KIO_JOBCLASSES_H
24 
25 #include <QtCore/QObject>
26 #include <QtCore/QLinkedList> // KDE5: remove
27 #include <QtCore/QStringList>
28 
29 #include <kurl.h>
30 #include <kio/global.h>
31 #include <kio/udsentry.h>
32 
33 #include <kcompositejob.h>
34 
35 namespace KIO {
36 
42  enum JobFlag {
46  DefaultFlags = 0,
47 
51  HideProgressInfo = 1,
52 
60  Resume = 2,
61 
67  Overwrite = 4
68  };
69  Q_DECLARE_FLAGS(JobFlags, JobFlag)
70  Q_DECLARE_OPERATORS_FOR_FLAGS(JobFlags)
71 
72  class JobUiDelegate;
73 
74  class JobPrivate;
94  class KIO_EXPORT Job : public KCompositeJob {
95  Q_OBJECT
96 
97  protected:
98  Job();
99  Job(JobPrivate &dd);
100 
101  public:
102  virtual ~Job();
103  void start() {} // Since KIO autostarts its jobs
104 
112  JobUiDelegate *ui() const;
113 
114  protected:
120  virtual bool doKill();
121 
126  virtual bool doSuspend();
127 
132  virtual bool doResume();
133 
134  public:
152  QString errorString() const;
153 
164  QStringList detailedErrorStrings(const KUrl *reqUrl = 0L,
165  int method = -1) const;
166 
177 #ifndef KDE_NO_DEPRECATED
178  KDE_DEPRECATED void showErrorDialog( QWidget *parent = 0 );
179 #endif
180 
188  bool isInteractive() const;
189 
199  void setParentJob( Job* parentJob );
200 
206  Job* parentJob() const;
207 
215  void setMetaData( const KIO::MetaData &metaData);
216 
224  void addMetaData(const QString &key, const QString &value);
225 
233  void addMetaData(const QMap<QString,QString> &values);
234 
242  void mergeMetaData(const QMap<QString,QString> &values);
243 
247  MetaData outgoingMetaData() const;
248 
254  MetaData metaData() const;
255 
263  QString queryMetaData(const QString &key);
264 
265  protected:
266 
267  Q_SIGNALS:
275  void canceled( KJob *job );
276 
283  void connected( KIO::Job *job );
284 
285  protected:
293  virtual bool addSubjob( KJob *job );
294 
302  virtual bool removeSubjob( KJob *job );
303 
304  private:
311  Q_PRIVATE_SLOT(d_func(), void slotSpeed( KJob *job, unsigned long speed ))
312  Q_DECLARE_PRIVATE(Job)
313  };
314 
315  class SimpleJobPrivate;
322  class KIO_EXPORT SimpleJob : public KIO::Job {
323  Q_OBJECT
324 
325  public:
326  ~SimpleJob();
327 
328  protected:
333  virtual bool doSuspend();
334 
339  virtual bool doResume();
340 
345  virtual bool doKill();
346 
347  public:
352  const KUrl& url() const;
353 
358  virtual void putOnHold();
359 
363  static void removeOnHold();
364 
370  bool isRedirectionHandlingEnabled() const;
371 
380  void setRedirectionHandlingEnabled(bool handle);
381 
382  public Q_SLOTS:
388  void slotError( int , const QString & );
389 
390  protected Q_SLOTS:
395  virtual void slotFinished( );
396 
401  virtual void slotWarning( const QString & );
402 
408  virtual void slotMetaData( const KIO::MetaData &_metaData);
409 
410  protected:
411  /*
412  * Allow jobs that inherit SimpleJob and are aware
413  * of redirections to store the SSL session used.
414  * Retrieval is handled by SimpleJob::start
415  * @param m_redirectionURL Reference to redirection URL,
416  * used instead of m_url if not empty
417  */
418  void storeSSLSessionFromJob(const KUrl &m_redirectionURL);
419 
424  SimpleJob(SimpleJobPrivate &dd);
425  private:
426  Q_PRIVATE_SLOT(d_func(), void slotConnected())
427  Q_PRIVATE_SLOT(d_func(), void slotProcessedSize( KIO::filesize_t data_size ))
428  Q_PRIVATE_SLOT(d_func(), void slotSpeed( unsigned long speed ))
429  Q_PRIVATE_SLOT(d_func(), void slotTotalSize( KIO::filesize_t data_size ))
430  Q_PRIVATE_SLOT(d_func(), void _k_slotSlaveInfoMessage(const QString&))
431 
432  Q_DECLARE_PRIVATE(SimpleJob)
433  };
434 
435  class StatJobPrivate;
440  class KIO_EXPORT StatJob : public SimpleJob {
441 
442  Q_OBJECT
443 
444  public:
445  enum StatSide {
446  SourceSide,
447  DestinationSide
448  };
449 
450  ~StatJob();
451 
459  void setSide(StatSide side);
460 
468 #ifndef KDE_NO_DEPRECATED
469  KDE_DEPRECATED void setSide( bool source );
470 #endif
471 
481  void setDetails( short int details );
482 
489  const UDSEntry & statResult() const;
490 
514  KUrl mostLocalUrl() const;
515 
516  Q_SIGNALS:
524  void redirection( KIO::Job *job, const KUrl &url );
525 
533  void permanentRedirection( KIO::Job *job, const KUrl &fromUrl, const KUrl &toUrl );
534 
535  protected Q_SLOTS:
536  virtual void slotFinished();
537  virtual void slotMetaData( const KIO::MetaData &_metaData);
538  protected:
539  StatJob(StatJobPrivate &dd);
540 
541  private:
542  Q_PRIVATE_SLOT(d_func(), void slotStatEntry( const KIO::UDSEntry & entry ))
543  Q_PRIVATE_SLOT(d_func(), void slotRedirection( const KUrl &url))
544  Q_DECLARE_PRIVATE(StatJob)
545  };
546 
547  class FileCopyJobPrivate;
548  class TransferJobPrivate;
555  class KIO_EXPORT TransferJob : public SimpleJob {
556  Q_OBJECT
557 
558  public:
559  ~TransferJob();
560 
565  void setModificationTime( const QDateTime& mtime );
566 
574  bool isErrorPage() const;
575 
582  void setAsyncDataEnabled(bool enabled);
583 
589  void sendAsyncData(const QByteArray &data);
590 
599 #ifndef KDE_NO_DEPRECATED
600  KDE_DEPRECATED void setReportDataSent(bool enabled);
601 #endif
602 
610 #ifndef KDE_NO_DEPRECATED
611  KDE_DEPRECATED bool reportDataSent() const;
612 #endif
613 
619  QString mimetype() const;
620 
626  void setTotalSize(KIO::filesize_t bytes);
627 
628  protected:
633  virtual void slotResult( KJob *job );
634 
638  virtual bool doResume();
639 
640  Q_SIGNALS:
650  void data( KIO::Job *job, const QByteArray &data );
651 
663  void dataReq( KIO::Job *job, QByteArray &data );
664 
672  void redirection( KIO::Job *job, const KUrl &url );
673 
681  void permanentRedirection( KIO::Job *job, const KUrl &fromUrl, const KUrl &toUrl );
682 
688  void mimetype( KIO::Job *job, const QString &type );
689 
697  void canResume( KIO::Job *job, KIO::filesize_t offset );
698 
699 
700  protected Q_SLOTS:
701  virtual void slotRedirection( const KUrl &url);
702  virtual void slotFinished();
703  virtual void slotData( const QByteArray &data);
704  virtual void slotDataReq();
705  virtual void slotMimetype( const QString &mimetype );
706  virtual void slotMetaData( const KIO::MetaData &_metaData);
707 
708  protected:
709  TransferJob(TransferJobPrivate &dd);
710  private:
711  Q_PRIVATE_SLOT(d_func(), void slotErrorPage())
712  Q_PRIVATE_SLOT(d_func(), void slotCanResume( KIO::filesize_t offset ))
713  Q_PRIVATE_SLOT(d_func(), void slotPostRedirection())
714  Q_PRIVATE_SLOT(d_func(), void slotNeedSubUrlData())
715  Q_PRIVATE_SLOT(d_func(), void slotSubUrlData(KIO::Job*, const QByteArray &))
716  Q_PRIVATE_SLOT(d_func(), void slotDataReqFromDevice())
717  Q_DECLARE_PRIVATE(TransferJob)
718 
719  // A FileCopyJob may control one or more TransferJobs
720  friend class FileCopyJob;
721  friend class FileCopyJobPrivate;
722  };
723 
724  class StoredTransferJobPrivate;
743  class KIO_EXPORT StoredTransferJob : public KIO::TransferJob {
744  Q_OBJECT
745 
746  public:
747  ~StoredTransferJob();
748 
754  void setData( const QByteArray& arr );
755 
760  QByteArray data() const;
761 
762  protected:
763  StoredTransferJob(StoredTransferJobPrivate &dd);
764  private:
765  Q_PRIVATE_SLOT(d_func(), void slotStoredData( KIO::Job *job, const QByteArray &data ))
766  Q_PRIVATE_SLOT(d_func(), void slotStoredDataReq( KIO::Job *job, QByteArray &data ))
767 
768  Q_DECLARE_PRIVATE(StoredTransferJob)
769  };
770 
771  class MultiGetJobPrivate;
778  class KIO_EXPORT MultiGetJob : public TransferJob {
779  Q_OBJECT
780 
781  public:
782  virtual ~MultiGetJob();
783 
791  void get(long id, const KUrl &url, const MetaData &metaData);
792 
793  Q_SIGNALS:
800  void data( long id, const QByteArray &data);
801 
807  void mimetype( long id, const QString &type );
808 
816  void result( long id);
817 
818  protected Q_SLOTS:
819  virtual void slotRedirection( const KUrl &url);
820  virtual void slotFinished();
821  virtual void slotData( const QByteArray &data);
822  virtual void slotMimetype( const QString &mimetype );
823 
824  protected:
825  MultiGetJob(MultiGetJobPrivate &dd);
826  private:
827  Q_DECLARE_PRIVATE(MultiGetJob)
828  };
829 
830  class MimetypeJobPrivate;
837  class KIO_EXPORT MimetypeJob : public TransferJob {
838  Q_OBJECT
839 
840  public:
841  ~MimetypeJob();
842 
843  protected Q_SLOTS:
844  virtual void slotFinished( );
845  protected:
846  MimetypeJob(MimetypeJobPrivate &dd);
847  private:
848  Q_DECLARE_PRIVATE(MimetypeJob)
849  };
850 
856  class KIO_EXPORT FileCopyJob : public Job {
857  Q_OBJECT
858 
859  public:
860  ~FileCopyJob();
866  void setSourceSize(KIO::filesize_t size);
867 
875  void setModificationTime( const QDateTime& mtime );
876 
881  KUrl srcUrl() const;
882 
887  KUrl destUrl() const;
888 
889  bool doSuspend();
890  bool doResume();
891 
892  Q_SIGNALS:
903  void mimetype( KIO::Job *job, const QString &type );
904 
905  protected Q_SLOTS:
910  virtual void slotResult( KJob *job );
911 
912  protected:
913  FileCopyJob(FileCopyJobPrivate &dd);
914 
915  private:
916  Q_PRIVATE_SLOT(d_func(), void slotStart())
917  Q_PRIVATE_SLOT(d_func(), void slotData( KIO::Job *, const QByteArray &data))
918  Q_PRIVATE_SLOT(d_func(), void slotDataReq( KIO::Job *, QByteArray &data))
919  Q_PRIVATE_SLOT(d_func(), void slotMimetype( KIO::Job*, const QString& type ))
920  Q_PRIVATE_SLOT(d_func(), void slotProcessedSize( KJob *job, qulonglong size ))
921  Q_PRIVATE_SLOT(d_func(), void slotTotalSize( KJob *job, qulonglong size ))
922  Q_PRIVATE_SLOT(d_func(), void slotPercent( KJob *job, unsigned long pct ))
923  Q_PRIVATE_SLOT(d_func(), void slotCanResume( KIO::Job *job, KIO::filesize_t offset ))
924 
925  Q_DECLARE_PRIVATE(FileCopyJob)
926  };
927 
928  class ListJobPrivate;
936  class KIO_EXPORT ListJob : public SimpleJob {
937  Q_OBJECT
938 
939  public:
940  ~ListJob();
941 
947  const KUrl& redirectionUrl() const;
948 
952  void setUnrestricted(bool unrestricted);
953 
954  Q_SIGNALS:
964  void entries( KIO::Job *job, const KIO::UDSEntryList& list); // TODO KDE5: use KIO::ListJob* argument to avoid casting
965 
974  void subError( KIO::ListJob *job, KIO::ListJob *subJob );
975 
983  void redirection( KIO::Job *job, const KUrl &url );
984 
992  void permanentRedirection( KIO::Job *job, const KUrl &fromUrl, const KUrl &toUrl );
993 
994  protected Q_SLOTS:
995  virtual void slotFinished( );
996  virtual void slotMetaData( const KIO::MetaData &_metaData);
997  virtual void slotResult( KJob *job );
998 
999  protected:
1000  ListJob(ListJobPrivate &dd);
1001 
1002  private:
1003  Q_PRIVATE_SLOT(d_func(), void slotListEntries( const KIO::UDSEntryList& list ))
1004  Q_PRIVATE_SLOT(d_func(), void slotRedirection( const KUrl &url ))
1005  Q_PRIVATE_SLOT(d_func(), void gotEntries( KIO::Job * subjob, const KIO::UDSEntryList& list ))
1006  Q_DECLARE_PRIVATE(ListJob)
1007  };
1008 
1009  class SpecialJobPrivate;
1021  class KIO_EXPORT SpecialJob : public TransferJob
1022  {
1023  Q_OBJECT
1024  public:
1031  explicit SpecialJob(const KUrl &url, const QByteArray &data = QByteArray());
1032 
1037  void setArguments(const QByteArray &data);
1038 
1043  QByteArray arguments() const;
1044 
1045  public:
1046  ~SpecialJob();
1047 
1048  private:
1049  Q_DECLARE_PRIVATE(SpecialJob)
1050  };
1051 }
1052 
1053 #endif
KIO::Overwrite
When set, automatically overwrite the destination if it exists already.
Definition: jobclasses.h:67
KIO::filesize_t
qulonglong filesize_t
64-bit file size
Definition: global.h:57
kurl.h
KIO::UDSEntry
Universal Directory Service.
Definition: udsentry.h:58
KIO::ListJob
A ListJob is allows you to get the get the content of a directory.
Definition: jobclasses.h:936
KIO::mimetype
MimetypeJob * mimetype(const KUrl &url, JobFlags flags=DefaultFlags)
Find mimetype for one file or directory.
Definition: job.cpp:1872
KIO::HideProgressInfo
Hide progress information dialog, i.e.
Definition: jobclasses.h:51
KIO::StoredTransferJob
StoredTransferJob is a TransferJob (for downloading or uploading data) that also stores a QByteArray ...
Definition: jobclasses.h:743
QWidget
KIO::StatJob
A KIO job that retrieves information about a file or directory.
Definition: jobclasses.h:440
QString
KIO::JobFlag
JobFlag
Flags for the job properties.
Definition: jobclasses.h:42
KIO::mostLocalUrl
StatJob * mostLocalUrl(const KUrl &url, JobFlags flags=DefaultFlags)
Tries to map a local URL for the given URL, using a KIO job.
Definition: job.cpp:930
KIO::SpecialJob
A class that sends a special command to an ioslave.
Definition: jobclasses.h:1021
global.h
KIO::SimpleJobPrivate
Definition: job_p.h:79
KIO::MetaData
MetaData is a simple map of key/value strings.
Definition: global.h:396
KUrl
KIO::DefaultFlags
Show the progress info GUI, no Resume and no Overwrite.
Definition: jobclasses.h:46
KIO::Resume
When set, automatically append to the destination file if it exists already.
Definition: jobclasses.h:60
kcompositejob.h
KIO::Job::start
void start()
Definition: jobclasses.h:103
QStringList
KIO::setModificationTime
SimpleJob * setModificationTime(const KUrl &url, const QDateTime &mtime)
Changes the modification time on a file or directory.
Definition: job.cpp:724
QDateTime
KIO::FileCopyJob
The FileCopyJob copies data from one place to another.
Definition: jobclasses.h:856
KIO::TransferJobPrivate
Definition: job_p.h:257
udsentry.h
KIO::Job
The base class for all jobs.
Definition: jobclasses.h:94
KIO::MimetypeJob
A MimetypeJob is a TransferJob that allows you to get the mime type of an URL.
Definition: jobclasses.h:837
KIO::StatJob::StatSide
StatSide
Definition: jobclasses.h:445
KIO::StatJob::SourceSide
Definition: jobclasses.h:446
KIO::TransferJob
The transfer job pumps data into and/or out of a Slave.
Definition: jobclasses.h:555
KIO::MultiGetJob
The MultiGetJob is a TransferJob that allows you to get several files from a single server...
Definition: jobclasses.h:778
KCompositeJob
KJob
QMap< QString, QString >
QList< UDSEntry >
KRecentDirs::list
QStringList list(const QString &fileClass)
Returns a list of directories associated with this file-class.
Definition: krecentdirs.cpp:60
KIO::SimpleJob
A simple job (one url and one command).
Definition: jobclasses.h:322
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:50:02 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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