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

KIO

  • 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
35namespace 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_PRIVATE_SLOT(d_func(), void slotSubError( KIO::ListJob* job, KIO::ListJob* subJob))
1007 Q_DECLARE_PRIVATE(ListJob)
1008 };
1009
1010 class SpecialJobPrivate;
1022 class KIO_EXPORT SpecialJob : public TransferJob
1023 {
1024 Q_OBJECT
1025 public:
1032 explicit SpecialJob(const KUrl &url, const QByteArray &data = QByteArray());
1033
1038 void setArguments(const QByteArray &data);
1039
1044 QByteArray arguments() const;
1045
1046 public:
1047 ~SpecialJob();
1048
1049 private:
1050 Q_DECLARE_PRIVATE(SpecialJob)
1051 };
1052}
1053
1054#endif
KCompositeJob
KIO::FileCopyJob
The FileCopyJob copies data from one place to another.
Definition: jobclasses.h:856
KIO::FileCopyJob::mimetype
void mimetype(KIO::Job *job, const QString &type)
Mimetype determined during a file copy.
KIO::JobPrivate
Definition: job_p.h:40
KIO::JobUiDelegate
A UI delegate tuned to be used with KIO Jobs.
Definition: jobuidelegate.h:40
KIO::Job
The base class for all jobs.
Definition: jobclasses.h:94
KIO::Job::connected
void connected(KIO::Job *job)
Emitted when the slave successfully connected to the host.
KIO::Job::start
void start()
Definition: jobclasses.h:103
KIO::Job::canceled
void canceled(KJob *job)
KIO::ListJob
A ListJob is allows you to get the get the content of a directory.
Definition: jobclasses.h:936
KIO::ListJob::entries
void entries(KIO::Job *job, const KIO::UDSEntryList &list)
This signal emits the entry found by the job while listing.
KIO::ListJob::redirection
void redirection(KIO::Job *job, const KUrl &url)
Signals a redirection.
KIO::ListJob::subError
void subError(KIO::ListJob *job, KIO::ListJob *subJob)
This signal is emitted when a sub-directory could not be listed.
KIO::ListJob::permanentRedirection
void permanentRedirection(KIO::Job *job, const KUrl &fromUrl, const KUrl &toUrl)
Signals a permanent redirection.
KIO::MetaData
MetaData is a simple map of key/value strings.
Definition: global.h:397
KIO::MimetypeJob
A MimetypeJob is a TransferJob that allows you to get the mime type of an URL.
Definition: jobclasses.h:837
KIO::MultiGetJob
The MultiGetJob is a TransferJob that allows you to get several files from a single server.
Definition: jobclasses.h:778
KIO::MultiGetJob::result
void result(long id)
File transfer completed.
KIO::MultiGetJob::mimetype
void mimetype(long id, const QString &type)
Mimetype determined.
KIO::MultiGetJob::data
void data(long id, const QByteArray &data)
Data from the slave has arrived.
KIO::SimpleJobPrivate
Definition: job_p.h:82
KIO::SimpleJob
A simple job (one url and one command).
Definition: jobclasses.h:322
KIO::SpecialJob
A class that sends a special command to an ioslave.
Definition: jobclasses.h:1023
KIO::StatJob
A KIO job that retrieves information about a file or directory.
Definition: jobclasses.h:440
KIO::StatJob::permanentRedirection
void permanentRedirection(KIO::Job *job, const KUrl &fromUrl, const KUrl &toUrl)
Signals a permanent redirection.
KIO::StatJob::redirection
void redirection(KIO::Job *job, const KUrl &url)
Signals a redirection.
KIO::StatJob::StatSide
StatSide
Definition: jobclasses.h:445
KIO::StatJob::SourceSide
@ SourceSide
Definition: jobclasses.h:446
KIO::StoredTransferJob
StoredTransferJob is a TransferJob (for downloading or uploading data) that also stores a QByteArray ...
Definition: jobclasses.h:743
KIO::TransferJobPrivate
Definition: job_p.h:260
KIO::TransferJob
The transfer job pumps data into and/or out of a Slave.
Definition: jobclasses.h:555
KIO::TransferJob::dataReq
void dataReq(KIO::Job *job, QByteArray &data)
Request for data.
KIO::TransferJob::redirection
void redirection(KIO::Job *job, const KUrl &url)
Signals a redirection.
KIO::TransferJob::data
void data(KIO::Job *job, const QByteArray &data)
Data from the slave has arrived.
KIO::TransferJob::canResume
void canResume(KIO::Job *job, KIO::filesize_t offset)
KIO::TransferJob::permanentRedirection
void permanentRedirection(KIO::Job *job, const KUrl &fromUrl, const KUrl &toUrl)
Signals a permanent redirection.
KIO::TransferJob::mimetype
void mimetype(KIO::Job *job, const QString &type)
Mimetype determined.
KIO::UDSEntry
Universal Directory Service.
Definition: udsentry.h:59
KJob
KUrl
QList< UDSEntry >
QMap
QWidget
global.h
kcompositejob.h
kurl.h
KIO
A namespace for KIO globals.
Definition: kbookmarkmenu.h:55
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::setModificationTime
SimpleJob * setModificationTime(const KUrl &url, const QDateTime &mtime)
Changes the modification time on a file or directory.
Definition: job.cpp:724
KIO::get
TransferJob * get(const KUrl &url, LoadType reload=NoReload, JobFlags flags=DefaultFlags)
Get (a.k.a.
Definition: job.cpp:1369
KIO::mimetype
MimetypeJob * mimetype(const KUrl &url, JobFlags flags=DefaultFlags)
Find mimetype for one file or directory.
Definition: job.cpp:1856
KIO::JobFlag
JobFlag
Flags for the job properties.
Definition: jobclasses.h:42
KIO::Resume
@ Resume
When set, automatically append to the destination file if it exists already.
Definition: jobclasses.h:60
KIO::DefaultFlags
@ DefaultFlags
Show the progress info GUI, no Resume and no Overwrite.
Definition: jobclasses.h:46
KIO::HideProgressInfo
@ HideProgressInfo
Hide progress information dialog, i.e.
Definition: jobclasses.h:51
KIO::Overwrite
@ 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
udsentry.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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.14.38 API Reference

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