This file is indexed.

/usr/include/kio/jobclasses.h is in kdelibs5-dev 4:4.13.0-0ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 244
 245
 246
 247
 248
 249
 250
 251
 252
 253
 254
 255
 256
 257
 258
 259
 260
 261
 262
 263
 264
 265
 266
 267
 268
 269
 270
 271
 272
 273
 274
 275
 276
 277
 278
 279
 280
 281
 282
 283
 284
 285
 286
 287
 288
 289
 290
 291
 292
 293
 294
 295
 296
 297
 298
 299
 300
 301
 302
 303
 304
 305
 306
 307
 308
 309
 310
 311
 312
 313
 314
 315
 316
 317
 318
 319
 320
 321
 322
 323
 324
 325
 326
 327
 328
 329
 330
 331
 332
 333
 334
 335
 336
 337
 338
 339
 340
 341
 342
 343
 344
 345
 346
 347
 348
 349
 350
 351
 352
 353
 354
 355
 356
 357
 358
 359
 360
 361
 362
 363
 364
 365
 366
 367
 368
 369
 370
 371
 372
 373
 374
 375
 376
 377
 378
 379
 380
 381
 382
 383
 384
 385
 386
 387
 388
 389
 390
 391
 392
 393
 394
 395
 396
 397
 398
 399
 400
 401
 402
 403
 404
 405
 406
 407
 408
 409
 410
 411
 412
 413
 414
 415
 416
 417
 418
 419
 420
 421
 422
 423
 424
 425
 426
 427
 428
 429
 430
 431
 432
 433
 434
 435
 436
 437
 438
 439
 440
 441
 442
 443
 444
 445
 446
 447
 448
 449
 450
 451
 452
 453
 454
 455
 456
 457
 458
 459
 460
 461
 462
 463
 464
 465
 466
 467
 468
 469
 470
 471
 472
 473
 474
 475
 476
 477
 478
 479
 480
 481
 482
 483
 484
 485
 486
 487
 488
 489
 490
 491
 492
 493
 494
 495
 496
 497
 498
 499
 500
 501
 502
 503
 504
 505
 506
 507
 508
 509
 510
 511
 512
 513
 514
 515
 516
 517
 518
 519
 520
 521
 522
 523
 524
 525
 526
 527
 528
 529
 530
 531
 532
 533
 534
 535
 536
 537
 538
 539
 540
 541
 542
 543
 544
 545
 546
 547
 548
 549
 550
 551
 552
 553
 554
 555
 556
 557
 558
 559
 560
 561
 562
 563
 564
 565
 566
 567
 568
 569
 570
 571
 572
 573
 574
 575
 576
 577
 578
 579
 580
 581
 582
 583
 584
 585
 586
 587
 588
 589
 590
 591
 592
 593
 594
 595
 596
 597
 598
 599
 600
 601
 602
 603
 604
 605
 606
 607
 608
 609
 610
 611
 612
 613
 614
 615
 616
 617
 618
 619
 620
 621
 622
 623
 624
 625
 626
 627
 628
 629
 630
 631
 632
 633
 634
 635
 636
 637
 638
 639
 640
 641
 642
 643
 644
 645
 646
 647
 648
 649
 650
 651
 652
 653
 654
 655
 656
 657
 658
 659
 660
 661
 662
 663
 664
 665
 666
 667
 668
 669
 670
 671
 672
 673
 674
 675
 676
 677
 678
 679
 680
 681
 682
 683
 684
 685
 686
 687
 688
 689
 690
 691
 692
 693
 694
 695
 696
 697
 698
 699
 700
 701
 702
 703
 704
 705
 706
 707
 708
 709
 710
 711
 712
 713
 714
 715
 716
 717
 718
 719
 720
 721
 722
 723
 724
 725
 726
 727
 728
 729
 730
 731
 732
 733
 734
 735
 736
 737
 738
 739
 740
 741
 742
 743
 744
 745
 746
 747
 748
 749
 750
 751
 752
 753
 754
 755
 756
 757
 758
 759
 760
 761
 762
 763
 764
 765
 766
 767
 768
 769
 770
 771
 772
 773
 774
 775
 776
 777
 778
 779
 780
 781
 782
 783
 784
 785
 786
 787
 788
 789
 790
 791
 792
 793
 794
 795
 796
 797
 798
 799
 800
 801
 802
 803
 804
 805
 806
 807
 808
 809
 810
 811
 812
 813
 814
 815
 816
 817
 818
 819
 820
 821
 822
 823
 824
 825
 826
 827
 828
 829
 830
 831
 832
 833
 834
 835
 836
 837
 838
 839
 840
 841
 842
 843
 844
 845
 846
 847
 848
 849
 850
 851
 852
 853
 854
 855
 856
 857
 858
 859
 860
 861
 862
 863
 864
 865
 866
 867
 868
 869
 870
 871
 872
 873
 874
 875
 876
 877
 878
 879
 880
 881
 882
 883
 884
 885
 886
 887
 888
 889
 890
 891
 892
 893
 894
 895
 896
 897
 898
 899
 900
 901
 902
 903
 904
 905
 906
 907
 908
 909
 910
 911
 912
 913
 914
 915
 916
 917
 918
 919
 920
 921
 922
 923
 924
 925
 926
 927
 928
 929
 930
 931
 932
 933
 934
 935
 936
 937
 938
 939
 940
 941
 942
 943
 944
 945
 946
 947
 948
 949
 950
 951
 952
 953
 954
 955
 956
 957
 958
 959
 960
 961
 962
 963
 964
 965
 966
 967
 968
 969
 970
 971
 972
 973
 974
 975
 976
 977
 978
 979
 980
 981
 982
 983
 984
 985
 986
 987
 988
 989
 990
 991
 992
 993
 994
 995
 996
 997
 998
 999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
// -*- c++ -*-
/* This file is part of the KDE libraries
    Copyright (C) 2000 Stephan Kulow <coolo@kde.org>
                  2000-2009 David Faure <faure@kde.org>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.
*/

#ifndef KIO_JOBCLASSES_H
#define KIO_JOBCLASSES_H

#include <QtCore/QObject>
#include <QtCore/QLinkedList> // KDE5: remove
#include <QtCore/QStringList>

#include <kurl.h>
#include <kio/global.h>
#include <kio/udsentry.h>

#include <kcompositejob.h>

namespace KIO {

    /**
     * Flags for the job properties.
     * Not all flags are supported in all cases. Please see documentation of
     * the calling function!
     */
    enum JobFlag {
      /**
       * Show the progress info GUI, no Resume and no Overwrite
       */
      DefaultFlags = 0,

      /**
       * Hide progress information dialog, i.e. don't show a GUI.
       */
      HideProgressInfo = 1,

      /**
       * When set, automatically append to the destination file if it exists already.
       * WARNING: this is NOT the builtin support for offering the user to resume a previous
       * partial download. The Resume option is much less used, it allows to append
       * to an existing file.
       * This is used by KIO::put(), KIO::file_copy(), KIO::file_move().
       */
      Resume = 2,

      /**
       * When set, automatically overwrite the destination if it exists already.
       * This is used by KIO::rename(), KIO::put(), KIO::file_copy(), KIO::file_move(), KIO::symlink().
       * Otherwise the operation will fail with ERR_FILE_ALREADY_EXIST or ERR_DIR_ALREADY_EXIST.
       */
      Overwrite = 4
    };
    Q_DECLARE_FLAGS(JobFlags, JobFlag)
    Q_DECLARE_OPERATORS_FOR_FLAGS(JobFlags)

    class JobUiDelegate;

    class JobPrivate;
    /**
     * The base class for all jobs.
     * For all jobs created in an application, the code looks like
     *
     * \code
     *   KIO::Job * job = KIO::someoperation( some parameters );
     *   connect( job, SIGNAL( result( KJob * ) ),
     *            this, SLOT( slotResult( KJob * ) ) );
     * \endcode
     *   (other connects, specific to the job)
     *
     * And slotResult is usually at least:
     *
     * \code
     *  if ( job->error() )
     *      job->ui()->showErrorMessage();
     * \endcode
     * @see KIO::Scheduler
     */
    class KIO_EXPORT Job : public KCompositeJob {
        Q_OBJECT

    protected:
        Job();
        Job(JobPrivate &dd);

    public:
        virtual ~Job();
        void start() {} // Since KIO autostarts its jobs

        /**
         * Retrieves the UI delegate of this job.
         *
         * This method is basically a convenience for static_cast<KIO::JobUiDelegate*>(uiDelegate()).
         *
         * @return the delegate used by the job to communicate with the UI
         */
        JobUiDelegate *ui() const;

    protected:
        /**
         * Abort this job.
         * This kills all subjobs and deletes the job.
         *
         */
        virtual bool doKill();

        /**
         * Suspend this job
         * @see resume
         */
        virtual bool doSuspend();

        /**
         * Resume this job
         * @see suspend
         */
        virtual bool doResume();

    public:
        /**
         * Converts an error code and a non-i18n error message into an
         * error message in the current language. The low level (non-i18n)
         * error message (usually a url) is put into the translated error
         * message using %1.
         *
         * Example for errid == ERR_CANNOT_OPEN_FOR_READING:
         * \code
         *   i18n( "Could not read\n%1" ).arg( errortext );
         * \endcode
         * Use this to display the error yourself, but for a dialog box
         * use ui()->showErrorMessage(). Do not call it if error()
         * is not 0.
         * @return the error message and if there is no error, a message
         *         telling the user that the app is broken, so check with
         *         error() whether there is an error
         */
        QString errorString() const;

        /**
         * Converts an error code and a non-i18n error message into i18n
         * strings suitable for presentation in a detailed error message box.
         *
         * @param reqUrl the request URL that generated this error message
         * @param method the method that generated this error message
         * (unimplemented)
         * @return the following strings: caption, error + description,
         *         causes+solutions
         */
        QStringList detailedErrorStrings(const KUrl *reqUrl = 0L,
                                         int method = -1) const;

        /**
         * Display a dialog box to inform the user of the error given by
         * this job.
         * Only call if error is not 0, and only in the slot connected
         * to result.
         * @param parent the parent widget for the dialog box, can be 0 for
         *        top-level
         * @deprecated you should use job->ui()->setWindow(parent)
         *             and job->ui()->showErrorMessage() instead
         */
#ifndef KDE_NO_DEPRECATED
        KDE_DEPRECATED void showErrorDialog( QWidget *parent = 0 );
#endif

        /**
         * Returns whether the user should be asked about things when the job
         * is unsure, like whether to overwrite existing files etc.
         * @return true if user interactions are enabled (true by default),
         *         false if setUiDelegate(0) was called.
         * @see setUiDelegate()
         */
        bool isInteractive() const;

        /**
         * Set the parent Job.
         * One example use of this is when FileCopyJob calls RenameDialog::open,
         * it must pass the correct progress ID of the parent CopyJob
         * (to hide the progress dialog).
         * You can set the parent job only once. By default a job does not
         * have a parent job.
         * @param parentJob the new parent job
         */
        void setParentJob( Job* parentJob );

        /**
         * Returns the parent job, if there is one.
         * @return the parent job, or 0 if there is none
         * @see setParentJob
         */
        Job* parentJob() const;

        /**
         * Set meta data to be sent to the slave, replacing existing
         * meta data.
         * @param metaData the meta data to set
         * @see addMetaData()
         * @see mergeMetaData()
         */
        void setMetaData( const KIO::MetaData &metaData);

        /**
         * Add key/value pair to the meta data that is sent to the slave.
         * @param key the key of the meta data
         * @param value the value of the meta data
         * @see setMetaData()
         * @see mergeMetaData()
         */
        void addMetaData(const QString &key, const QString &value);

        /**
         * Add key/value pairs to the meta data that is sent to the slave.
         * If a certain key already existed, it will be overridden.
         * @param values the meta data to add
         * @see setMetaData()
         * @see mergeMetaData()
         */
        void addMetaData(const QMap<QString,QString> &values);

        /**
         * Add key/value pairs to the meta data that is sent to the slave.
         * If a certain key already existed, it will remain unchanged.
         * @param values the meta data to merge
         * @see setMetaData()
         * @see addMetaData()
         */
        void mergeMetaData(const QMap<QString,QString> &values);

        /**
         * @internal. For the scheduler. Do not use.
         */
        MetaData outgoingMetaData() const;

        /**
         * Get meta data received from the slave.
         * (Valid when first data is received and/or slave is finished)
         * @return the job's meta data
         */
        MetaData metaData() const;

        /**
         * Query meta data received from the slave.
         * (Valid when first data is received and/or slave is finished)
         * @param key the key of the meta data to retrieve
         * @return the value of the meta data, or QString() if the
         *         @p key does not exist
         */
        QString queryMetaData(const QString &key);

    protected:

    Q_SIGNALS:
        /**
         * @deprecated. Don't use !
         * Emitted when the job is canceled.
         * Signal result() is emitted as well, and error() is,
         * in this case, ERR_USER_CANCELED.
         * @param job the job that emitted this signal
         */
        void canceled( KJob *job );

        /**
         * Emitted when the slave successfully connected to the host.
         * There is no guarantee the slave will send this, and this is
         * currently unused (in the applications).
         * @param job the job that emitted this signal
         */
        void connected( KIO::Job *job );

    protected:
        /**
         * Add a job that has to be finished before a result
         * is emitted. This has obviously to be called before
         * the finish signal is emitted by the slave.
         *
         * @param job the subjob to add
         */
        virtual bool addSubjob( KJob *job );

        /**
         * Mark a sub job as being done.
         *
         * KDE4 change: this doesn't terminate the parent job anymore, call emitResult to do that.
         *
         * @param job the subjob to remove
         */
        virtual bool removeSubjob( KJob *job );

    private:
        /**
         * Forward signal from subjob.
         * @param job the subjob
         * @param speed the speed in bytes/s
         * @see speed()
         */
        Q_PRIVATE_SLOT(d_func(), void slotSpeed( KJob *job, unsigned long speed ))
        Q_DECLARE_PRIVATE(Job)
    };

    class SimpleJobPrivate;
    /**
     * A simple job (one url and one command).
     * This is the base class for all jobs that are scheduled.
     * Other jobs are high-level jobs (CopyJob, DeleteJob, FileCopyJob...)
     * that manage subjobs but aren't scheduled directly.
     */
    class KIO_EXPORT SimpleJob : public KIO::Job {
    Q_OBJECT

    public:
        ~SimpleJob();

    protected:
        /**
         * Suspend this job
         * @see resume
         */
        virtual bool doSuspend();

        /**
         * Resume this job
         * @see suspend
         */
        virtual bool doResume();

        /**
         * Abort job.
         * This kills all subjobs and deletes the job.
         */
        virtual bool doKill();

    public:
        /**
         * Returns the SimpleJob's URL
         * @return the url
         */
        const KUrl& url() const;

        /**
         * Abort job.
         * Suspends slave to be reused by another job for the same request.
         */
        virtual void putOnHold();

        /**
         * Discard suspended slave.
         */
        static void removeOnHold();

        /**
         * Returns true when redirections are handled internally, the default.
         *
         * @since 4.4
         */
        bool isRedirectionHandlingEnabled() const;

        /**
         * Set @p handle to false to prevent the internal handling of redirections.
         *
         * When this flag is set, redirection requests are simply forwarded to the
         * caller instead of being handled internally.
         *
         * @since 4.4
         */
        void setRedirectionHandlingEnabled(bool handle);

    public Q_SLOTS:
        /**
         * @internal
         * Called on a slave's error.
         * Made public for the scheduler.
         */
        void slotError( int , const QString & );

    protected Q_SLOTS:
        /**
         * Called when the slave marks the job
         * as finished.
         */
        virtual void slotFinished( );

        /**
         * @internal
         * Called on a slave's warning.
         */
        virtual void slotWarning( const QString & );

        /**
         * MetaData from the slave is received.
         * @param _metaData the meta data
         * @see metaData()
         */
        virtual void slotMetaData( const KIO::MetaData &_metaData);

    protected:
        /*
         * Allow jobs that inherit SimpleJob and are aware
         * of redirections to store the SSL session used.
         * Retrieval is handled by SimpleJob::start
         * @param m_redirectionURL Reference to redirection URL,
         * used instead of m_url if not empty
         */
        void storeSSLSessionFromJob(const KUrl &m_redirectionURL);

        /**
         * Creates a new simple job. You don't need to use this constructor,
         * unless you create a new job that inherits from SimpleJob.
         */
        SimpleJob(SimpleJobPrivate &dd);
    private:
        Q_PRIVATE_SLOT(d_func(), void slotConnected())
        Q_PRIVATE_SLOT(d_func(), void slotProcessedSize( KIO::filesize_t data_size ))
        Q_PRIVATE_SLOT(d_func(), void slotSpeed( unsigned long speed ))
        Q_PRIVATE_SLOT(d_func(), void slotTotalSize( KIO::filesize_t data_size ))
        Q_PRIVATE_SLOT(d_func(), void _k_slotSlaveInfoMessage(const QString&))

        Q_DECLARE_PRIVATE(SimpleJob)
    };

    class StatJobPrivate;
    /**
     * A KIO job that retrieves information about a file or directory.
     * @see KIO::stat()
     */
    class KIO_EXPORT StatJob : public SimpleJob {

    Q_OBJECT

    public:
        enum StatSide {
            SourceSide,
            DestinationSide
        };

        ~StatJob();

        /**
         * A stat() can have two meanings. Either we want to read from this URL,
         * or to check if we can write to it. First case is "source", second is "dest".
         * It is necessary to know what the StatJob is for, to tune the kioslave's behavior
         * (e.g. with FTP).
         * @param side SourceSide or DestinationSide
         */
        void setSide(StatSide side);

        /**
         * A stat() can have two meanings. Either we want to read from this URL,
         * or to check if we can write to it. First case is "source", second is "dest".
         * It is necessary to know what the StatJob is for, to tune the kioslave's behavior
         * (e.g. with FTP).
         * @param source true for "source" mode, false for "dest" mode
         */
#ifndef KDE_NO_DEPRECATED
        KDE_DEPRECATED void setSide( bool source );
#endif

        /**
         * Selects the level of @p details we want.
         * By default this is 2 (all details wanted, including modification time, size, etc.),
         * setDetails(1) is used when deleting: we don't need all the information if it takes
         * too much time, no need to follow symlinks etc.
         * setDetails(0) is used for very simple probing: we'll only get the answer
         * "it's a file or a directory, or it doesn't exist". This is used by KRun.
         * @param details 2 for all details, 1 for simple, 0 for very simple
         */
        void setDetails( short int details );

        /**
         * @brief Result of the stat operation.
         * Call this in the slot connected to result,
         * and only after making sure no error happened.
         * @return the result of the stat
         */
        const UDSEntry & statResult() const;

        /**
         * @brief most local URL
         * Call this in the slot connected to result,
         * and only after making sure no error happened.
         * @return the most local URL for the URL we were stat'ing.
         *
         * Sample usage:
         * <code>
         * KIO::StatJob* job = KIO::mostLocalUrl("desktop:/foo");
         * job->ui()->setWindow(this);
         * connect(job, SIGNAL(result(KJob*)), this, SLOT(slotMostLocalUrlResult(KJob*)));
         * [...]
         * // and in the slot
         * if (job->error()) {
         *    [...] // doesn't exist
         * } else {
         *    const KUrl localUrl = job->mostLocalUrl();
         *    // localUrl = file:///$HOME/Desktop/foo
         *    [...]
         * }
         *
         * \since 4.4
         */
        KUrl mostLocalUrl() const;

    Q_SIGNALS:
        /**
         * Signals a redirection.
         * Use to update the URL shown to the user.
         * The redirection itself is handled internally.
         * @param job the job that is redirected
         * @param url the new url
         */
        void redirection( KIO::Job *job, const KUrl &url );

        /**
         * Signals a permanent redirection.
         * The redirection itself is handled internally.
         * @param job the job that is redirected
         * @param fromUrl the original URL
         * @param toUrl the new URL
         */
        void permanentRedirection( KIO::Job *job, const KUrl &fromUrl, const KUrl &toUrl );

    protected Q_SLOTS:
        virtual void slotFinished();
        virtual void slotMetaData( const KIO::MetaData &_metaData);
    protected:
        StatJob(StatJobPrivate &dd);

    private:
        Q_PRIVATE_SLOT(d_func(), void slotStatEntry( const KIO::UDSEntry & entry ))
        Q_PRIVATE_SLOT(d_func(), void slotRedirection( const KUrl &url))
        Q_DECLARE_PRIVATE(StatJob)
    };

    class FileCopyJobPrivate;
    class TransferJobPrivate;
    /**
     * The transfer job pumps data into and/or out of a Slave.
     * Data is sent to the slave on request of the slave ( dataReq).
     * If data coming from the slave can not be handled, the
     * reading of data from the slave should be suspended.
     */
    class KIO_EXPORT TransferJob : public SimpleJob {
    Q_OBJECT

    public:
        ~TransferJob();

        /**
         * Sets the modification time of the file to be created (by KIO::put)
         * Note that some kioslaves might ignore this.
         */
        void setModificationTime( const QDateTime& mtime );

        /**
         * Checks whether we got an error page. This currently only happens
         * with HTTP urls. Call this from your slot connected to result().
         *
         * @return true if we got an (HTML) error page from the server
         * instead of what we asked for.
         */
        bool isErrorPage() const;

        /**
         * Enable the async data mode.
         * When async data is enabled, data should be provided to the job by
         * calling sendAsyncData() instead of returning data in the
         * dataReq() signal.
         */
        void setAsyncDataEnabled(bool enabled);

        /**
         * Provide data to the job when async data is enabled.
         * Should be called exactly once after receiving a dataReq signal
         * Sending an empty block indicates end of data.
         */
        void sendAsyncData(const QByteArray &data);

        /**
         * When enabled, the job reports the amount of data that has been sent,
         * instead of the amount of data that that has been received.
         * @see slotProcessedSize
         * @see slotSpeed
         * @deprecated not needed, this is false for KIO::get and true for KIO::put,
         *             automatically since KDE-4.2.1
         */
#ifndef KDE_NO_DEPRECATED
        KDE_DEPRECATED void setReportDataSent(bool enabled);
#endif

        /**
         *  Returns whether the job reports the amount of data that has been
         *  sent (true), or whether the job reports the amount of data that
         * has been received (false)
         * @deprecated not needed, this is false for KIO::get and true for KIO::put,
         *             automatically since KDE-4.2.1 (and not useful as public API)
         */
#ifndef KDE_NO_DEPRECATED
        KDE_DEPRECATED bool reportDataSent() const;
#endif

        /**
         * Call this in the slot connected to result,
         * and only after making sure no error happened.
         * @return the mimetype of the URL
         */
        QString mimetype() const;

        /**
         * Set the total size of data that we are going to send
         * in a put job. Helps getting proper progress information.
         * @since 4.2.1
         */
        void setTotalSize(KIO::filesize_t bytes);

    protected:
        /**
         * Called when m_subJob finishes.
         * @param job the job that finished
         */
        virtual void slotResult( KJob *job );

        /**
         * Reimplemented for internal reasons
         */
        virtual bool doResume();

    Q_SIGNALS:
        /**
         * Data from the slave has arrived.
         * @param job the job that emitted this signal
         * @param data data received from the slave.
         *
         * End of data (EOD) has been reached if data.size() == 0, however, you
         * should not be certain of data.size() == 0 ever happening (e.g. in case
         * of an error), so you should rely on result() instead.
         */
        void data( KIO::Job *job, const QByteArray &data );

        /**
         * Request for data.
         * Please note, that you shouldn't put too large chunks
         * of data in it as this requires copies within the frame
         * work, so you should rather split the data you want
         * to pass here in reasonable chunks (about 1MB maximum)
         *
         * @param job the job that emitted this signal
         * @param data buffer to fill with data to send to the
         * slave. An empty buffer indicates end of data. (EOD)
         */
        void dataReq( KIO::Job *job, QByteArray &data );

        /**
         * Signals a redirection.
         * Use to update the URL shown to the user.
         * The redirection itself is handled internally.
         * @param job the job that emitted this signal
         * @param url the new URL
         */
        void redirection( KIO::Job *job, const KUrl &url );

        /**
         * Signals a permanent redirection.
         * The redirection itself is handled internally.
         * @param job the job that emitted this signal
         * @param fromUrl the original URL
         * @param toUrl the new URL
         */
        void permanentRedirection( KIO::Job *job, const KUrl &fromUrl, const KUrl &toUrl );

        /**
         * Mimetype determined.
         * @param job the job that emitted this signal
         * @param type the mime type
         */
        void mimetype( KIO::Job *job, const QString &type );

        /**
         * @internal
         * Emitted if the "put" job found an existing partial file
         * (in which case offset is the size of that file)
         * and emitted by the "get" job if it supports resuming to
         * the given offset - in this case @p offset is unused)
         */
        void canResume( KIO::Job *job, KIO::filesize_t offset );


    protected Q_SLOTS:
        virtual void slotRedirection( const KUrl &url);
        virtual void slotFinished();
        virtual void slotData( const QByteArray &data);
        virtual void slotDataReq();
        virtual void slotMimetype( const QString &mimetype );
        virtual void slotMetaData( const KIO::MetaData &_metaData);

    protected:
        TransferJob(TransferJobPrivate &dd);
    private:
        Q_PRIVATE_SLOT(d_func(), void slotErrorPage())
        Q_PRIVATE_SLOT(d_func(), void slotCanResume( KIO::filesize_t offset ))
        Q_PRIVATE_SLOT(d_func(), void slotPostRedirection())
        Q_PRIVATE_SLOT(d_func(), void slotNeedSubUrlData())
        Q_PRIVATE_SLOT(d_func(), void slotSubUrlData(KIO::Job*, const QByteArray &))
        Q_PRIVATE_SLOT(d_func(), void slotDataReqFromDevice())
        Q_DECLARE_PRIVATE(TransferJob)

        // A FileCopyJob may control one or more TransferJobs
        friend class FileCopyJob;
        friend class FileCopyJobPrivate;
    };

    class StoredTransferJobPrivate;
    /**
     * StoredTransferJob is a TransferJob (for downloading or uploading data) that
     * also stores a QByteArray with the data, making it simpler to use than the
     * standard TransferJob.
     *
     * For KIO::storedGet it puts the data into the member QByteArray, so the user
     * of this class can get hold of the whole data at once by calling data()
     * when the result signal is emitted.
     * You should only use StoredTransferJob to download data if you cannot
     * process the data by chunks while it's being downloaded, since storing
     * everything in a QByteArray can potentially require a lot of memory.
     *
     * For KIO::storedPut the user of this class simply provides the bytearray from
     * the start, and the job takes care of uploading it.
     * You should only use StoredTransferJob to upload data if you cannot
     * provide the in chunks while it's being uploaded, since storing
     * everything in a QByteArray can potentially require a lot of memory.
     */
    class KIO_EXPORT StoredTransferJob : public KIO::TransferJob {
        Q_OBJECT

    public:
        ~StoredTransferJob();

        /**
         * Set data to be uploaded. This is for put jobs.
         * Automatically called by KIO::storedPut(const QByteArray &, ...),
         * do not call this yourself.
         */
        void setData( const QByteArray& arr );

        /**
         * Get hold of the downloaded data. This is for get jobs.
         * You're supposed to call this only from the slot connected to the result() signal.
         */
        QByteArray data() const;

    protected:
        StoredTransferJob(StoredTransferJobPrivate &dd);
    private:
        Q_PRIVATE_SLOT(d_func(), void slotStoredData( KIO::Job *job, const QByteArray &data ))
        Q_PRIVATE_SLOT(d_func(), void slotStoredDataReq( KIO::Job *job, QByteArray &data ))

        Q_DECLARE_PRIVATE(StoredTransferJob)
    };

    class MultiGetJobPrivate;
    /**
     * The MultiGetJob is a TransferJob that allows you to get
     * several files from a single server. Don't create directly,
     * but use KIO::multi_get() instead.
     * @see KIO::multi_get()
     */
    class KIO_EXPORT MultiGetJob : public TransferJob {
    Q_OBJECT

    public:
        virtual ~MultiGetJob();

        /**
         * Get an additional file.
         *
         * @param id the id of the file
         * @param url the url of the file to get
         * @param metaData the meta data for this request
         */
        void get(long id, const KUrl &url, const MetaData &metaData);

    Q_SIGNALS:
        /**
         * Data from the slave has arrived.
         * @param id the id of the request
         * @param data data received from the slave.
         * End of data (EOD) has been reached if data.size() == 0
         */
        void data( long id, const QByteArray &data);

        /**
         * Mimetype determined
         * @param id the id of the request
         * @param type the mime type
         */
        void mimetype( long id, const QString &type );

        /**
         * File transfer completed.
         *
         * When all files have been processed, result(KJob *) gets
         * emitted.
         * @param id the id of the request
         */
        void result( long id);

    protected Q_SLOTS:
        virtual void slotRedirection( const KUrl &url);
        virtual void slotFinished();
        virtual void slotData( const QByteArray &data);
        virtual void slotMimetype( const QString &mimetype );

    protected:
        MultiGetJob(MultiGetJobPrivate &dd);
    private:
        Q_DECLARE_PRIVATE(MultiGetJob)
    };

    class MimetypeJobPrivate;
    /**
     * A MimetypeJob is a TransferJob that  allows you to get
     * the mime type of an URL. Don't create directly,
     * but use KIO::mimetype() instead.
     * @see KIO::mimetype()
     */
    class KIO_EXPORT MimetypeJob : public TransferJob {
    Q_OBJECT

    public:
        ~MimetypeJob();

    protected Q_SLOTS:
        virtual void slotFinished( );
    protected:
        MimetypeJob(MimetypeJobPrivate &dd);
    private:
        Q_DECLARE_PRIVATE(MimetypeJob)
    };

    /**
     * The FileCopyJob copies data from one place to another.
     * @see KIO::file_copy()
     * @see KIO::file_move()
     */
    class KIO_EXPORT FileCopyJob : public Job {
    Q_OBJECT

    public:
        ~FileCopyJob();
        /**
         * If you know the size of the source file, call this method
         * to inform this job. It will be displayed in the "resume" dialog.
         * @param size the size of the source file
         */
        void setSourceSize(KIO::filesize_t size);

        /**
         * Sets the modification time of the file
         *
         * Note that this is ignored if a direct copy (SlaveBase::copy) can be done,
         * in which case the mtime of the source is applied to the destination (if the protocol
         * supports the concept).
         */
        void setModificationTime( const QDateTime& mtime );

        /**
         * Returns the source URL.
         * @return the source URL
         */
        KUrl srcUrl() const;

        /**
         * Returns the destination URL.
         * @return the destination URL
         */
        KUrl destUrl() const;

        bool doSuspend();
        bool doResume();

    Q_SIGNALS:
        /**
         * Mimetype determined during a file copy.
         * This is never emitted during a move, and might not be emitted during
         * a file copy, depending on the slave. But when a get and a put are
         * being used (which is the common case), this signal forwards the
         * mimetype information from the get job.
         *
         * @param job the job that emitted this signal
         * @param type the mime type
         */
        void mimetype( KIO::Job *job, const QString &type );

    protected Q_SLOTS:
        /**
         * Called whenever a subjob finishes.
         * @param job the job that emitted this signal
         */
        virtual void slotResult( KJob *job );

    protected:
        FileCopyJob(FileCopyJobPrivate &dd);

    private:
        Q_PRIVATE_SLOT(d_func(), void slotStart())
        Q_PRIVATE_SLOT(d_func(), void slotData( KIO::Job *, const QByteArray &data))
        Q_PRIVATE_SLOT(d_func(), void slotDataReq( KIO::Job *, QByteArray &data))
        Q_PRIVATE_SLOT(d_func(), void slotMimetype( KIO::Job*, const QString& type ))
        Q_PRIVATE_SLOT(d_func(), void slotProcessedSize( KJob *job, qulonglong size ))
        Q_PRIVATE_SLOT(d_func(), void slotTotalSize( KJob *job, qulonglong size ))
        Q_PRIVATE_SLOT(d_func(), void slotPercent( KJob *job, unsigned long pct ))
        Q_PRIVATE_SLOT(d_func(), void slotCanResume( KIO::Job *job, KIO::filesize_t offset ))

        Q_DECLARE_PRIVATE(FileCopyJob)
    };

    class ListJobPrivate;
    /**
     * A ListJob is allows you to get the get the content of a directory.
     * Don't create the job directly, but use KIO::listRecursive() or
     * KIO::listDir() instead.
     * @see KIO::listRecursive()
     * @see KIO::listDir()
     */
    class KIO_EXPORT ListJob : public SimpleJob {
    Q_OBJECT

    public:
        ~ListJob();

        /**
         * Returns the ListJob's redirection URL. This will be invalid if there
         * was no redirection.
         * @return the redirection url
         */
        const KUrl& redirectionUrl() const;

        /**
         * Do not apply any KIOSK restrictions to this job.
         */
        void setUnrestricted(bool unrestricted);

    Q_SIGNALS:
        /**
         * This signal emits the entry found by the job while listing.
         * The progress signals aren't specific to ListJob. It simply
         * uses SimpleJob's processedSize (number of entries listed) and
         * totalSize (total number of entries, if known),
         * as well as percent.
         * @param job the job that emitted this signal
         * @param list the list of UDSEntries
         */
        void entries( KIO::Job *job, const KIO::UDSEntryList& list); // TODO KDE5: use KIO::ListJob* argument to avoid casting

	/**
	 * This signal is emitted when a sub-directory could not be listed.
	 * The job keeps going, thus doesn't result in an overall error.
	 * @param job the job that emitted the signal
	 * @param subJob the job listing a sub-directory, which failed. Use
	 *		 url(), error() and errorText() on that job to find
	 *		 out more.
	 */
	void subError( KIO::ListJob *job, KIO::ListJob *subJob );

        /**
         * Signals a redirection.
         * Use to update the URL shown to the user.
         * The redirection itself is handled internally.
         * @param job the job that is redirected
         * @param url the new url
         */
        void redirection( KIO::Job *job, const KUrl &url );

        /**
         * Signals a permanent redirection.
         * The redirection itself is handled internally.
         * @param job the job that emitted this signal
         * @param fromUrl the original URL
         * @param toUrl the new URL
         */
        void permanentRedirection( KIO::Job *job, const KUrl &fromUrl, const KUrl &toUrl );

    protected Q_SLOTS:
        virtual void slotFinished( );
        virtual void slotMetaData( const KIO::MetaData &_metaData);
        virtual void slotResult( KJob *job );

    protected:
        ListJob(ListJobPrivate &dd);

    private:
        Q_PRIVATE_SLOT(d_func(), void slotListEntries( const KIO::UDSEntryList& list ))
        Q_PRIVATE_SLOT(d_func(), void slotRedirection( const KUrl &url ))
        Q_PRIVATE_SLOT(d_func(), void gotEntries( KIO::Job * subjob, const KIO::UDSEntryList& list ))
        Q_DECLARE_PRIVATE(ListJob)
    };

    class SpecialJobPrivate;
    /**
     * A class that sends a special command to an ioslave.
     * This allows you to send a binary blob to an ioslave and handle
     * its responses. The ioslave will receive the binary data as an
     * argument to the "special" function (inherited from SlaveBase::special()).
     *
     * Use this only on ioslaves that belong to your application. Sending
     * special commands to other ioslaves may cause unexpected behaviour.
     *
     * @see KIO::special
     */
    class KIO_EXPORT SpecialJob : public TransferJob
    {
        Q_OBJECT
    public:
        /**
         * Creates a KIO::SpecialJob.
         *
         * @param url the URL to be passed to the ioslave
         * @param data the data to be sent to the SlaveBase::special() function.
         */
        explicit SpecialJob(const KUrl &url, const QByteArray &data = QByteArray());

        /**
         * Sets the QByteArray that is passed to SlaveBase::special() on
         * the ioslave.
         */
        void setArguments(const QByteArray &data);

        /**
         * Returns the QByteArray data that will be sent (or has been sent) to the
         * ioslave.
         */
        QByteArray arguments() const;

    public:
        ~SpecialJob();

    private:
        Q_DECLARE_PRIVATE(SpecialJob)
    };
}

#endif