File indexing completed on 2024-06-16 13:00:18

0001 /*
0002     This file is or will be part of KDE desktop environment
0003     SPDX-FileCopyrightText: 1999 Matt Koss <koss@miesto.sk>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 #ifndef _KIOWORKERTEST_H
0009 #define _KIOWORKERTEST_H
0010 
0011 #include <QButtonGroup>
0012 #include <QLabel>
0013 #include <QLineEdit>
0014 #include <QPushButton>
0015 #include <QRadioButton>
0016 #include <QWidget>
0017 
0018 #include <KMainWindow>
0019 
0020 #include "kio/global.h"
0021 #include <kio/simplejob.h>
0022 #include <kio/udsentry.h>
0023 
0024 #include <KStatusBarJobTracker>
0025 
0026 class KioWorkerTest : public KMainWindow
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     KioWorkerTest(QString src, QString dest, uint op, uint pr);
0032 
0033     ~KioWorkerTest() override
0034     {
0035         if (job) {
0036             job->kill(KJob::Quietly); // kill the job quietly
0037         }
0038     }
0039 
0040     enum Operations { List = 0, ListRecursive, Stat, Get, Put, Copy, Move, Delete, Mkdir, Mimetype };
0041 
0042     enum ProgressModes { ProgressNone = 0, ProgressDefault, ProgressStatus };
0043 
0044 protected:
0045     void printUDSEntry(const KIO::UDSEntry &entry);
0046 
0047     // info stuff
0048     QLabel *lb_from;
0049     QLineEdit *le_source;
0050 
0051     QLabel *lb_to;
0052     QLineEdit *le_dest;
0053 
0054     // operation stuff
0055     QButtonGroup *opButtons;
0056 
0057     QRadioButton *rbList;
0058     QRadioButton *rbListRecursive;
0059     QRadioButton *rbStat;
0060     QRadioButton *rbGet;
0061     QRadioButton *rbPut;
0062     QRadioButton *rbCopy;
0063     QRadioButton *rbMove;
0064     QRadioButton *rbDelete;
0065     QRadioButton *rbMkdir;
0066     QRadioButton *rbMimetype;
0067 
0068     // progress stuff
0069     QButtonGroup *progressButtons;
0070 
0071     QRadioButton *rbProgressNone;
0072     QRadioButton *rbProgressDefault;
0073     QRadioButton *rbProgressStatus;
0074 
0075     QPushButton *pbStart;
0076     QPushButton *pbStop;
0077 
0078     QPushButton *close;
0079 
0080 protected Q_SLOTS:
0081     void changeOperation(QAbstractButton *b);
0082     void changeProgressMode(QAbstractButton *b);
0083 
0084     void startJob();
0085     void stopJob();
0086 
0087     void slotResult(KJob *);
0088     void slotEntries(KIO::Job *, const KIO::UDSEntryList &);
0089     void slotData(KIO::Job *, const QByteArray &data);
0090     void slotDataReq(KIO::Job *, QByteArray &data);
0091 
0092     void slotQuit();
0093 
0094 private:
0095     KIO::Job *job;
0096     QWidget *main_widget;
0097 
0098     KStatusBarJobTracker *statusTracker;
0099 
0100     int selectedOperation;
0101     int progressMode;
0102     int putBuffer;
0103 };
0104 
0105 #endif // _KIOWORKERTEST_H